diff --git a/lib/gui/gui.py b/lib/gui/gui.py index 506f5b91c4a1fba40f4ca96f9e928f89aa2e1c93..29a089fd0b23ddb44399249659fe62ce7279d38d 100644 --- a/lib/gui/gui.py +++ b/lib/gui/gui.py @@ -9,7 +9,7 @@ import re from PyQt5 import QtCore, QtGui, QtWidgets, uic from lib.hardware import Hardware -from lib.version import __version__ +from lib.su import Su class SuGui(QtWidgets.QMainWindow): """ @@ -24,6 +24,7 @@ class SuGui(QtWidgets.QMainWindow): uic.loadUi("lib/gui/su_mainwindow.ui", self) self.show() # setting some defaults + self.setWindowTitle(Su.name_and_version()) self.lineEdit_dump_file.setText(self._get_default_dump_file_path()) self.lineEdit_dump_file.setCursorPosition(0) self.refresh_hw_button() @@ -69,11 +70,10 @@ class SuGui(QtWidgets.QMainWindow): """ Show about widget. """ - QtWidgets.QMessageBox.about(self, \ - "About", \ - "SU - Spectrum Usage v"+ __version__ + "\n\n" \ - "Contact: daniel.meissner@smail.inf.h-brs.de\n" \ - "Source: https://git.fslab.de/dmeiss2s/su") + QtWidgets.QMessageBox.about(self, "About", \ + Su.name_and_version() + "\n\n" \ + "Contact: daniel.meissner@smail.inf.h-brs.de\n" \ + "Source: https://git.fslab.de/dmeiss2s/su") def _get_default_dump_file_path(self): diff --git a/lib/gui/su_mainwindow.ui b/lib/gui/su_mainwindow.ui index 8ad99a5110b25e48e394ae6987592347ce42410c..39d67a64f5f0e2d4bdcbb8a1d240a84e919e8622 100644 --- a/lib/gui/su_mainwindow.ui +++ b/lib/gui/su_mainwindow.ui @@ -11,7 +11,7 @@ </rect> </property> <property name="windowTitle"> - <string>SU - Spectrum Usage</string> + <string/> </property> <widget class="QWidget" name="centralWidget"> <widget class="QPushButton" name="button_start"> diff --git a/lib/su.py b/lib/su.py new file mode 100644 index 0000000000000000000000000000000000000000..1094ee498a2c1d5da0f0a072ee0c033cd0e89deb --- /dev/null +++ b/lib/su.py @@ -0,0 +1,38 @@ +# -*- coding: utf-8 -*- + +from lib.version import __version__ + +class Su(object): + """ + Prgramm class to store some information about the programm. + """ + @staticmethod + def version(): + """ + Get programm version in Semantic Versioning format. + """ + return __version__ + + @staticmethod + def name(): + """ + Programm name. + """ + return "Spectrum Usage" + + @staticmethod + def short_name(): + """ + Short programm name. + """ + return "SU" + + @staticmethod + def name_and_version(): + """ + Return handy string containing short name, name and version. + + Example: + SU - Spectrum Usage v0.0.1 + """ + return Su.short_name() + " - " + Su.name() + " v" + Su.version() diff --git a/su.py b/su.py index 883b4141b54f5f6b4a21b494af9ca0dc9ac8be53..b460ca38e2882960e99c3ed92d645cd89017b467 100755 --- a/su.py +++ b/su.py @@ -10,22 +10,9 @@ from PyQt5 import QtCore, QtGui, QtWidgets import lib.gui.gui as gui -from lib.version import __version__ +from lib.su import Su from lib.dependencies import check_dependencies -class Su(object): - """ - - """ - @staticmethod - def version(): - return __version__ - - @staticmethod - def name(): - return "Spectrum Usage (su)" - - def parse_arguments(): parser = argparse.ArgumentParser() # verbose