added optional cancel button in node creation dialog (Beremiz)
authoretisserant
Wed, 25 Jun 2008 17:02:17 +0200
changeset 486 edf526bd34b5
parent 485 24b506ea314b
child 487 7292e686f1ab
added optional cancel button in node creation dialog (Beremiz)
objdictgen/commondialogs.py
--- a/objdictgen/commondialogs.py	Tue Jun 24 19:05:41 2008 +0200
+++ b/objdictgen/commondialogs.py	Wed Jun 25 17:02:17 2008 +0200
@@ -890,7 +890,7 @@
         
         self.SetSizer(self.flexGridSizer1)
 
-    def _init_ctrls(self, prnt):
+    def _init_ctrls(self, prnt, buttons):
         wx.Dialog.__init__(self, id=ID_CREATENODEDIALOG,
               name='CreateNodeDialog', parent=prnt, pos=wx.Point(376, 223),
               size=wx.Size(450, 350), style=wx.DEFAULT_DIALOG_STYLE,
@@ -994,13 +994,13 @@
               name='Spacer', parent=self, pos=wx.Point(0, 0),
               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
 
-        self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL)
+        self.ButtonSizer = self.CreateButtonSizer(buttons)
         self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
         
         self._init_sizers()
 
-    def __init__(self, parent):
-        self._init_ctrls(parent)
+    def __init__(self, parent,buttons=wx.OK|wx.CANCEL):
+        self._init_ctrls(parent,buttons)
         
         self.staticText3.Hide()
         self.NodeID.Hide()
@@ -1238,7 +1238,12 @@
                 self.EndModal(wx.ID_OK)
 
     def OnImportEDSButton(self, event):
-        dialog = wx.FileDialog(self, "Choose an EDS file", os.getcwd(), "",  "EDS files (*.eds)|*.eds|All files|*.*", wx.OPEN|wx.CHANGE_DIR)
+        dialog = wx.FileDialog(self,
+                               "Choose an EDS file",
+                               os.getcwd(),
+                               "",
+                               "EDS files (*.eds)|*.eds|All files|*.*",
+                               wx.OPEN)
         if dialog.ShowModal() == wx.ID_OK:
             filepath = dialog.GetPath()
             if os.path.isfile(filepath):