diff --git a/src/View/MainWindow.py b/src/View/MainWindow.py index 946eb54eedbdb94b90d98c6440162cef0ad0d861..4f28cd8fca2eae8d7ed879aaad20173a741acba2 100644 --- a/src/View/MainWindow.py +++ b/src/View/MainWindow.py @@ -496,6 +496,9 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): self.update() def close_model(self): + if not self.dialog_close(cancel=True): + return + self._study = None self.update_enable_action() self.conf.set_close_correctly() @@ -745,15 +748,16 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): ################## def msg_select_reach(self): - self.message_box("Please select a reach", - "Geometry edition need a reach selected " - "into river network window to work on it") + self.message_box( + self._trad["mb_select_reach_title"], + self._trad["mb_select_reach_msg"] + ) def dialog_reopen_study(self): dlg = QMessageBox(self) - dlg.setWindowTitle("Last open study") - dlg.setText("Do you want to open again the last open study?") + dlg.setWindowTitle(self._trad["mb_last_open_title"]) + dlg.setText(self._trad["mb_last_open_msg"]) opt = QMessageBox.Cancel | QMessageBox.Ok # | QMessageBox.Open dlg.setStandardButtons(opt) @@ -793,9 +797,9 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): def dialog_close(self, cancel=True): dlg = QMessageBox(self) - dlg.setWindowTitle("Close PAMHYR without saving study") - dlg.setText("Do you want to save current study before PAMHYR close ?") - opt = QMessageBox.Save | QMessageBox.Ignore + dlg.setWindowTitle(self._trad["mb_close_title"]) + dlg.setText(self._trad["mb_close_msg"]) + opt = QMessageBox.Save | QMessageBox.Close if cancel: opt |= QMessageBox.Cancel @@ -807,7 +811,7 @@ class ApplicationWindow(QMainWindow, ListedSubWindow, WindowToolKit): if res == QMessageBox.Save: self.save_study() return True - elif res == QMessageBox.Ignore: + elif res == QMessageBox.Close: return True elif res == QMessageBox.Cancel: return False diff --git a/src/View/Tools/ASubWindow.py b/src/View/Tools/ASubWindow.py index f483b7b0c6b3d81339c7c8590eef534a9bf7dfaa..01db62f43e56f477bf40139b847971ed928a7240 100644 --- a/src/View/Tools/ASubWindow.py +++ b/src/View/Tools/ASubWindow.py @@ -149,6 +149,9 @@ class WindowToolKit(object): msg.setInformativeText(informative_text) msg.setWindowTitle(window_title) + msg.findChild(QLabel, "qt_msgbox_label")\ + .setFixedWidth(384) + msg.exec_() diff --git a/src/View/Translate.py b/src/View/Translate.py index 90d7b4235edbbef9d8eb5c957d3976e24c63fd01..e41812e98d72ae3dbbad87112b44d58cc10e28f6 100644 --- a/src/View/Translate.py +++ b/src/View/Translate.py @@ -102,3 +102,29 @@ class MainTranslate(UnitTranslate): self._dict["active_window"] = _translate( "MainWindow", "Enable this window" ) + + # Message box + self._dict["mb_select_reach_title"] = _translate( + "MainWindow", "Please select a reach" + ) + self._dict["mb_select_reach_msg"] = _translate( + "MainWindow", + "This edition window need a reach selected " + "into the river network to work on it" + ) + + self._dict["mb_last_open_title"] = _translate( + "MainWindow", "Last open study" + ) + self._dict["mb_last_open_msg"] = _translate( + "MainWindow", + "Do you want to open again the last open study?" + ) + + self._dict["mb_close_title"] = _translate( + "MainWindow", "Close without saving study" + ) + self._dict["mb_close_msg"] = _translate( + "MainWindow", + "Do you want to save current study before closing it?" + ) diff --git a/src/lang/fr.ts b/src/lang/fr.ts index 4bd645dd3287281ec40cd2282eda5ed1314b6b83..3597c8aa7de329533b28fb67d6d89148122dc607 100644 --- a/src/lang/fr.ts +++ b/src/lang/fr.ts @@ -2481,6 +2481,41 @@ <source>Data</source> <translation>Données</translation> </message> + <message> + <location filename="../View/Translate.py" line="107"/> + <source>Please select a reach</source> + <translation>Veuillez sélectionner un bief</translation> + </message> + <message> + <location filename="../View/Translate.py" line="110"/> + <source>Geometry edition need a reach selected into the river network to work on it</source> + <translation type="obsolete">L'édition de la géométrie nécessite un bief sélectionné dans le réseau fluvial pour pouvoir travailler dessus</translation> + </message> + <message> + <location filename="../View/Translate.py" line="116"/> + <source>Last open study</source> + <translation>Dernière étude ouverte</translation> + </message> + <message> + <location filename="../View/Translate.py" line="119"/> + <source>Do you want to open again the last open study?</source> + <translation>Voulez-vous rouvrir la dernière étude ?</translation> + </message> + <message> + <location filename="../View/Translate.py" line="110"/> + <source>This edition window need a reach selected into the river network to work on it</source> + <translation>Cette fenêtre d'édition a besoin d'un bief sélectionné dans le réseau pour travailler dessus</translation> + </message> + <message> + <location filename="../View/Translate.py" line="124"/> + <source>Close without saving study</source> + <translation>Fermer sans sauvegarder l'étude</translation> + </message> + <message> + <location filename="../View/Translate.py" line="127"/> + <source>Do you want to save current study before closing it?</source> + <translation>Souhaitez-vous sauvegarder l'étude en cours avant de la fermer ?</translation> + </message> </context> <context> <name>MainWindow_reach</name>