class MainWindow(QMainWindow, Ui_MainWindow): def __init__(self): super(MainWindow, self).__init__() self.flags = Qt.FramelessWindowHint self.setupUi(self) self.show() def setupUi(self, obj): super(MainWindow, self).setupUi(obj) self.btn_quit.clicked.connect(self.go_to_sleep) self.btn_primary.clicked.connect(self.show_primary_dialog) self.btn_secondary.clicked.connect(self.show_secondary_dialog) def go_to_sleep(self): subprocess.call('xset dpms force off'.split()) def _show_ferm_dialog(self, fermentation): if getattr(self, 'ferm_dialog', None) is None: self.ferm_dialog = FermentationDialog() self.ferm_dialog.show(fermentation=fermentation) def show_primary_dialog(self): self._show_ferm_dialog(fermentation='primary') def show_secondary_dialog(self): self._show_ferm_dialog(fermentation='secondary')
def _show_ferm_dialog(self, fermentation): if getattr(self, 'ferm_dialog', None) is None: self.ferm_dialog = FermentationDialog() self.ferm_dialog.show(fermentation=fermentation)