--- a/Beremiz.py Fri Oct 23 18:45:24 2009 +0200
+++ b/Beremiz.py Mon Oct 26 11:20:16 2009 +0100
@@ -483,29 +483,29 @@
infos = self.PluginRoot.ShowError(self.Log,
(int(first_line), int(first_column)),
(int(last_line), int(last_column)))
+ ## Function displaying an Error dialog in PLCOpenEditor. + # @return False if closing cancelled. + def CheckSaveBeforeClosing(self, title=_("Close Project")): + if self.PluginRoot.ProjectTestModified(): + dialog = wx.MessageDialog(self, + _("There are changes, do you want to save?"), + wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION) + answer = dialog.ShowModal() + if answer == wx.ID_YES: + self.PluginRoot.SaveProject() + elif answer == wx.ID_CANCEL: def OnCloseFrame(self, event):
- if self.PluginRoot is not None:
- if self.PluginRoot.ProjectTestModified():
- dialog = wx.MessageDialog(self,
- _("Close Application"),
- wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION)
- answer = dialog.ShowModal()
- if answer == wx.ID_YES:
- self.PluginRoot.SaveProject()
- elif answer == wx.ID_NO:
- self.KillLocalRuntime()
+ if self.PluginRoot is None or self.CheckSaveBeforeClosing(_("Close Application")): + self.KillLocalRuntime() def OnMoveWindow(self, event):
@@ -1300,6 +1300,9 @@
self.DebugVariablePanel.SetDataProducer(None)
def OnNewProjectMenu(self, event):
+ if self.PluginRoot is not None and not self.CheckSaveBeforeClosing(): if not self.Config.HasEntry("lastopenedfolder"):
defaultpath = os.path.expanduser("~")
@@ -1325,6 +1328,9 @@
self._Refresh(TITLE, TOOLBAR, FILEMENU, EDITMENU)
def OnOpenProjectMenu(self, event):
+ if self.PluginRoot is not None and not self.CheckSaveBeforeClosing(): if not self.Config.HasEntry("lastopenedfolder"):
defaultpath = os.path.expanduser("~")
@@ -1353,21 +1359,12 @@
def OnCloseProjectMenu(self, event):
- if self.PluginRoot is not None:
- if self.PluginRoot.ProjectTestModified():
- dialog = wx.MessageDialog(self,
- _("Close Application"),
- wx.YES_NO|wx.CANCEL|wx.ICON_QUESTION)
- answer = dialog.ShowModal()
- if answer == wx.ID_YES:
- self.PluginRoot.SaveProject()
- elif answer == wx.ID_CANCEL:
- self._Refresh(TITLE, TOOLBAR, FILEMENU, EDITMENU)
+ if self.PluginRoot is not None and not self.CheckSaveBeforeClosing(): + self._Refresh(TITLE, TOOLBAR, FILEMENU, EDITMENU) def OnSaveProjectMenu(self, event):
if self.PluginRoot is not None:
--- a/i18n/Beremiz_fr_FR.po Fri Oct 23 18:45:24 2009 +0200
+++ b/i18n/Beremiz_fr_FR.po Mon Oct 26 11:20:16 2009 +0100
@@ -7,15 +7,15 @@
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-10-23 18:41+0200\n"
-"PO-Revision-Date: 2009-10-23 18:42+0100\n"
+"POT-Creation-Date: 2009-10-26 10:51+0100\n" +"PO-Revision-Date: 2009-10-26 10:51+0100\n" "Language-Team: LANGUAGE <LL@li.org>\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -48,7 +48,7 @@
msgid " generation failed !\n"
msgstr ": la construction a échouée !\n"
msgid "\"%s\" folder is not a valid Beremiz project\n"
msgstr "Le dossier \"%s\" ne contient pas de projet Beremiz valide\n"
@@ -57,13 +57,13 @@
@@ -81,11 +81,11 @@
msgstr "A propos de Beremiz"
msgstr "Ajouter un plugin"
@@ -205,8 +205,8 @@
msgid "Choose a directory to save project"
msgstr "Choisissez un dossier où enregistrer le projet"
msgstr "Choisissez un projet"
@@ -234,12 +234,12 @@
msgid "Cleaning the build directory\n"
msgstr "Répertoire de compilation en cours de nettoyage\n"
msgid "Close Application"
msgstr "Fermer l'application"
msgstr "Fermer le projet"
@@ -393,8 +393,8 @@
msgid "Enter the IP of the interface to bind"
msgstr "Saisissez l'adresse IP de l'interface à lier"
#: ../Beremiz_service.py:268
#: ../Beremiz_service.py:392
@@ -601,7 +601,7 @@
msgid "Please enter a name for plugin:"
msgstr "Saisissez un nom pour le plugin :"
@@ -659,7 +659,7 @@
msgid "Really delete plugin ?"
msgstr "Voulez-vous réellement supprimer le plugin ?"
@@ -675,7 +675,7 @@
msgstr "Actualiser\tCTRL+R"
msgstr "Enlever le plugin"
@@ -695,11 +695,6 @@
msgid "Save as\tCTRL+SHIFT+S"
msgstr "Enregistrer sous...\tCTRL+SHIFT+S"
-msgstr "Enregistrer les changements ?"
msgid "Services available:"
msgstr "Services disponibles:"
@@ -766,6 +761,10 @@
msgstr "Arrêt du débogage en cours\n"
+msgid "There are changes, do you want to save?" +msgstr "Le projet a été modifié, voulez-vous l'enregistrer ?" @@ -875,16 +874,16 @@
msgid "exited with status %s (pid %s)\n"
msgstr "a quitté avec le status %s (pid %s)\n"
@@ -979,6 +978,9 @@
+#~ msgid "Save changes ?" +#~ msgstr "Enregistrer les changements ?" #~ msgid "Conflict type for location \"%s\""
#~ msgstr "Conflit entre types pour l'adresse \"%s\""
--- a/i18n/messages.pot Fri Oct 23 18:45:24 2009 +0200
+++ b/i18n/messages.pot Mon Oct 26 11:20:16 2009 +0100
@@ -8,7 +8,7 @@
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2009-10-23 18:41+0200\n"
+"POT-Creation-Date: 2009-10-26 10:51+0100\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
@@ -16,7 +16,7 @@
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -37,7 +37,7 @@
msgid " generation failed !\n"
msgid "\"%s\" folder is not a valid Beremiz project\n"
@@ -46,11 +46,11 @@
-#: ../Beremiz.py:1448 ../Beremiz.py:1450 ../Beremiz.py:1451
+#: ../Beremiz.py:1445 ../Beremiz.py:1447 ../Beremiz.py:1448
@@ -68,11 +68,11 @@
@@ -191,7 +191,7 @@
msgid "Choose a directory to save project"
-#: ../Beremiz.py:1308 ../Beremiz.py:1333
+#: ../Beremiz.py:1311 ../Beremiz.py:1339 @@ -219,11 +219,11 @@
msgid "Cleaning the build directory\n"
-#: ../Beremiz.py:492 ../Beremiz.py:1360
msgid "Close Application"
+#: ../Beremiz.py:301 ../Beremiz.py:489 @@ -372,7 +372,7 @@
msgid "Enter the IP of the interface to bind"
-#: ../Beremiz.py:1474 ../Beremiz.py:1484 ../plugger.py:873
+#: ../Beremiz.py:1471 ../Beremiz.py:1481 ../plugger.py:873 #: ../Beremiz_service.py:268 ../Beremiz_service.py:392
@@ -573,7 +573,7 @@
msgid "Please enter a name for plugin:"
@@ -630,7 +630,7 @@
msgid "Really delete plugin ?"
@@ -646,7 +646,7 @@
@@ -666,10 +666,6 @@
msgid "Save as\tCTRL+SHIFT+S"
-#: ../Beremiz.py:491 ../Beremiz.py:1359
msgid "Services available:"
@@ -735,6 +731,10 @@
+msgid "There are changes, do you want to save?" @@ -832,15 +832,15 @@
msgid "exited with status %s (pid %s)\n"
-#: ../Beremiz.py:1448 ../Beremiz.py:1450
+#: ../Beremiz.py:1445 ../Beremiz.py:1447