def closeEvent(self, event): if not self.last_type_selected and self.arret.raisons: if self.arret.raisons[0].type != "Nettoyage" and self.arret.raisons[0].type != "Commentaire": self.can_exit = True if self.can_exit: event.accept() self.on_close(self.arret.start) else: if self.arret.raisons and not self.popup_avertissement: if self.arret.raisons[0].type == "Nettoyage" or self.arret.raisons[0].type == "Commentaire": self.popup_nettoyage = PopupCloseNettoyage(onclose=self.onclose_popup_avertissement) self.popup_nettoyage.POPUP_CLOSE_NETTOYAGE_SIGNAL.connect(self.onselect_popup_avertissement) self.move_popup_on_window(self.popup_nettoyage) else: self.popup_avertissement = PopupCloseAvertissement(onclose=self.onclose_popup_avertissement) self.popup_avertissement.POPUP_CLOSE_AVERTISSEMENT_SIGNAL.connect(self.onselect_popup_avertissement) self.move_popup_on_window(self.popup_avertissement) elif self.popup_avertissement: focus_window(self.popup_avertissement) self.move_popup_on_window(self.popup_avertissement) else: if self.popup_no_raison: focus_window(self.popup_no_raison) self.move_popup_on_window(self.popup_no_raison) else: self.popup_no_raison = PopupCloseNoRaison(onclose=self.onclose_popup_avertissement) self.popup_no_raison.POPUP_CLOSE_NO_RAISON_SIGNAL.connect(self.onselect_popup_avertissement) self.move_popup_on_window(self.popup_no_raison) event.ignore()
def create_tracker_window(self): if self.tracker_window: focus_window(self.tracker_window) else: from production.ui.windows.tracker_window import TrackerWindow self.tracker_window = TrackerWindow(self.on_close_tracker_window) self.tracker_window.setWindowTitle("DUNE Tracker") self.tracker_window.setFixedSize(self.tracker_window.sizeHint()) self.tracker_window.show()
def create_popup_user(self): if self.popup_user: focus_window(self.popup_user) else: self.popup_user = PopupUser(on_close=self.on_close_user_popup) if self.main_window: x = self.main_window.pos().x() + (self.main_window.width() - self.popup_user.width()) / 2 y = self.main_window.pos().y() + 200 self.popup_user.move(x, y)
def create_arret_window(self, start_arret, day_ago): if self.dic_arret_window.get(start_arret): focus_window(self.dic_arret_window[start_arret]) else: object_arret = data_store_manager.get_store_at_day_ago( day_ago).dic_arret[start_arret] from production.ui.windows.arret_window import ArretWindow arret_window = ArretWindow(self.on_close_arret_window, object_arret) self.dic_arret_window[start_arret] = arret_window arret_window.setWindowTitle("Gestion d'un arrêt") x = self.main_window.pos().x() + (self.main_window.width() - arret_window.width()) / 2 y = self.main_window.pos().y() + 50 arret_window.move(x, y) arret_window.show()
def create_main_window(self): if self.main_window: focus_window(self.main_window) else: from production.ui.windows.main_window import MainWindow logger.log("INITIALISATION", "Création de la Window") self.main_window = MainWindow(self.on_close_main_window, self.on_resize_main_window) logger.log("INITIALISATION", "Configuration de la Window") self.main_window.initialisation() self.main_window.setWindowTitle("DUNE Production bobine") self.main_window.resize(window_width, window_height) self.main_window.setMinimumSize(window_width, window_height) logger.log("INITIALISATION", "Affichage de MainWindow") self.main_window.show()