# HG changeset patch # User etisserant # Date 1214406137 -7200 # Node ID edf526bd34b5b421abe287ddaee6588d19e5da70 # Parent 24b506ea314beb66e1e8812e9e32bc5dea712933 added optional cancel button in node creation dialog (Beremiz) diff -r 24b506ea314b -r edf526bd34b5 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):