Add build identifier and initial version bump
This commit is contained in:
parent
1e46161c6a
commit
ecac90373c
2
.gitignore
vendored
2
.gitignore
vendored
@ -2,6 +2,8 @@
|
||||
*.py[oc]
|
||||
*.swp
|
||||
|
||||
_buildid.py
|
||||
|
||||
build/
|
||||
dist/
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
</sizepolicy>
|
||||
</property>
|
||||
<property name="windowTitle">
|
||||
<string>Luftdaten.info Flashing Tool</string>
|
||||
<string>Luftdaten.info Flashing Tool (v{version})</string>
|
||||
</property>
|
||||
<property name="windowIcon">
|
||||
<iconset>
|
||||
@ -279,6 +279,19 @@
|
||||
<property name="spacing">
|
||||
<number>12</number>
|
||||
</property>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="buildLabel">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>50</weight>
|
||||
<bold>false</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string><b>Luftdaten.info Flashing Tool</b><br/>Build {build_id}</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="0">
|
||||
<widget class="QLabel" name="label_6">
|
||||
<property name="maximumSize">
|
||||
@ -298,19 +311,6 @@
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="1" column="1">
|
||||
<widget class="QLabel" name="label_7">
|
||||
<property name="font">
|
||||
<font>
|
||||
<weight>75</weight>
|
||||
<bold>true</bold>
|
||||
</font>
|
||||
</property>
|
||||
<property name="text">
|
||||
<string>Luftdaten.info Flashing Tool</string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item row="2" column="0" colspan="2">
|
||||
<widget class="QLabel" name="label_8">
|
||||
<property name="text">
|
||||
|
@ -11,6 +11,7 @@ import logging
|
||||
import requests
|
||||
from esptool import ESPLoader
|
||||
|
||||
import luftdatentool
|
||||
from luftdatentool.qtvariant import QtGui, QtCore, QtWidgets
|
||||
from luftdatentool.utils import QuickThread
|
||||
from luftdatentool.workers import PortDetectThread, FirmwareListThread, \
|
||||
@ -87,6 +88,21 @@ class MainWindow(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
def on_work_error(self, message):
|
||||
self.statusbar.showMessage(message)
|
||||
|
||||
@property
|
||||
def version(self):
|
||||
return luftdatentool.__version__
|
||||
|
||||
@property
|
||||
def build_id(self):
|
||||
try:
|
||||
from luftdatentool._buildid import commit, builddate
|
||||
except ImportError:
|
||||
import datetime
|
||||
commit = 'devel'
|
||||
builddate = datetime.datetime.now().strftime('%Y%m%d')
|
||||
|
||||
return '{}-{}/{}'.format(self.version, commit, builddate)
|
||||
|
||||
def i18n_init(self, locale):
|
||||
"""Initializes i18n to specified QLocale"""
|
||||
|
||||
@ -97,6 +113,13 @@ class MainWindow(QtWidgets.QMainWindow, mainwindow.Ui_MainWindow):
|
||||
self.app.installTranslator(self.translator)
|
||||
self.retranslateUi(self)
|
||||
|
||||
def retranslateUi(self, win):
|
||||
super(MainWindow, self).retranslateUi(win)
|
||||
|
||||
win.setWindowTitle(win.windowTitle().format(
|
||||
version=self.version))
|
||||
win.buildLabel.setText(win.buildLabel.text().format(
|
||||
build_id=self.build_id))
|
||||
def populate_versions(self, files):
|
||||
"""Loads available firmware versions into versionbox widget"""
|
||||
|
||||
|
@ -2,6 +2,16 @@
|
||||
|
||||
block_cipher = None
|
||||
|
||||
import subprocess
|
||||
import datetime
|
||||
|
||||
commit = subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).strip().decode('utf-8')
|
||||
builddate = datetime.datetime.now().strftime('%Y%m%d')
|
||||
|
||||
with open('luftdatentool/_buildid.py', 'w') as fd:
|
||||
fd.write('''# This file is autogenerated in luftdaten-tool.spec file
|
||||
commit = "{commit}"
|
||||
builddate = "{builddate}"'''.format(commit=commit, builddate=builddate))
|
||||
|
||||
a = Analysis(['luftdaten-tool.py'],
|
||||
pathex=['.'],
|
||||
|
@ -0,0 +1 @@
|
||||
__version__ = '0.2'
|
Loading…
x
Reference in New Issue
Block a user