def __init__(self, QWidget_parent=None): QMainWindow.__init__(self, QWidget_parent) self.ui = Ui_MainWindow() self.ui.setupUi(self) self.ui.actionStations.triggered.connect(self.onShowStations) self.checkChoiceStation() self.setWindowTitle(App.settings.value(App.stationName()))
def checkChoiceStation(self): while (True): station = App.settings.value(App.stationName()) if station: break else: QMessageBox.warning(None, 'Предупреждение!', 'Не выбрана станция!\r\n' 'Для корректной работы программы должна быть выбрана станция.', QMessageBox.Ok, QMessageBox.Ok) self.onShowStations()
def readSettings(self): station = App.settings.value(App.stationName()) App.settings.beginGroup('/Settings') App.settings.beginGroup('/' + station) App.settings.beginGroup('/Plotters') App.settings.beginGroup('/BasePlotter') self._colorExt = QColor(App.settings.value('/ColorExt', self._colorExt)) self._colorInside = QColor(App.settings.value('/ColorInside', self._colorInside)) self._colorCurve = QColor(App.settings.value('/ColorCurve', self._colorCurve)) self._fontGrid = QFont(App.settings.value('/FontGrid', self._fontGrid)) self._fontTitle = QFont(App.settings.value('/FontTitle', self._fontTitle)) self._fontLegend = QFont(App.settings.value('/FontLegend', self._fontLegend)) self._fontTitleY = QFont(App.settings.value('/FontTitleY', self._fontTitleY)) self._pixmapSaveWidth = int(App.settings.value('/PixmapSaveWidth', self._pixmapSaveWidth)) self._pixmapSaveHeight = int(App.settings.value('/PixmapSaveHeight', self._pixmapSaveHeight)) App.settings.endGroup() App.settings.endGroup() App.settings.endGroup() App.settings.endGroup()
def onShowStations(self): dlg = StationsDialog(self) dlg.exec() self.setWindowTitle(App.settings.value(App.stationName()))
def onToggledTimer(self, b_check): if self._isWatcher: if b_check: self.timerTick.emit() self._timer.start( App.settings.value('/Settings/{0}/Main/TimeInterval'.format(App.settings.value(App.stationName())), 5000) * 1000) else: self._timer.stop() else: self.noWatching.emit(b_check)
__author__ = 'Алексей Галкин' import sys from Application.App import App from Application.MainWindow import MainWindow app = App(sys.argv) w = MainWindow() w.show() sys.exit(app.exec_())