objdictgen/commondialogs.py
changeset 486 edf526bd34b5
parent 452 9b67c71adbb7
child 500 13fcb9328a02
equal deleted inserted replaced
485:24b506ea314b 486:edf526bd34b5
   888         self._init_coll_RightBottomGridSizer_Items(self.RightBottomGridSizer)
   888         self._init_coll_RightBottomGridSizer_Items(self.RightBottomGridSizer)
   889         self._init_coll_RightBottomGridSizer_Growables(self.RightBottomGridSizer)
   889         self._init_coll_RightBottomGridSizer_Growables(self.RightBottomGridSizer)
   890         
   890         
   891         self.SetSizer(self.flexGridSizer1)
   891         self.SetSizer(self.flexGridSizer1)
   892 
   892 
   893     def _init_ctrls(self, prnt):
   893     def _init_ctrls(self, prnt, buttons):
   894         wx.Dialog.__init__(self, id=ID_CREATENODEDIALOG,
   894         wx.Dialog.__init__(self, id=ID_CREATENODEDIALOG,
   895               name='CreateNodeDialog', parent=prnt, pos=wx.Point(376, 223),
   895               name='CreateNodeDialog', parent=prnt, pos=wx.Point(376, 223),
   896               size=wx.Size(450, 350), style=wx.DEFAULT_DIALOG_STYLE,
   896               size=wx.Size(450, 350), style=wx.DEFAULT_DIALOG_STYLE,
   897               title='Create a new Node')
   897               title='Create a new Node')
   898         self.SetClientSize(wx.Size(450, 350))
   898         self.SetClientSize(wx.Size(450, 350))
   992 
   992 
   993         self.Spacer = wx.Panel(id=ID_CREATENODEDIALOGSPACER,
   993         self.Spacer = wx.Panel(id=ID_CREATENODEDIALOGSPACER,
   994               name='Spacer', parent=self, pos=wx.Point(0, 0),
   994               name='Spacer', parent=self, pos=wx.Point(0, 0),
   995               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
   995               size=wx.Size(0, 0), style=wx.TAB_TRAVERSAL)
   996 
   996 
   997         self.ButtonSizer = self.CreateButtonSizer(wx.OK|wx.CANCEL)
   997         self.ButtonSizer = self.CreateButtonSizer(buttons)
   998         self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
   998         self.Bind(wx.EVT_BUTTON, self.OnOK, id=self.ButtonSizer.GetAffirmativeButton().GetId())
   999         
   999         
  1000         self._init_sizers()
  1000         self._init_sizers()
  1001 
  1001 
  1002     def __init__(self, parent):
  1002     def __init__(self, parent,buttons=wx.OK|wx.CANCEL):
  1003         self._init_ctrls(parent)
  1003         self._init_ctrls(parent,buttons)
  1004         
  1004         
  1005         self.staticText3.Hide()
  1005         self.staticText3.Hide()
  1006         self.NodeID.Hide()
  1006         self.NodeID.Hide()
  1007         
  1007         
  1008         self.NodeID.SetValue("0x00")
  1008         self.NodeID.SetValue("0x00")
  1236                 message.Destroy()
  1236                 message.Destroy()
  1237             else:
  1237             else:
  1238                 self.EndModal(wx.ID_OK)
  1238                 self.EndModal(wx.ID_OK)
  1239 
  1239 
  1240     def OnImportEDSButton(self, event):
  1240     def OnImportEDSButton(self, event):
  1241         dialog = wx.FileDialog(self, "Choose an EDS file", os.getcwd(), "",  "EDS files (*.eds)|*.eds|All files|*.*", wx.OPEN|wx.CHANGE_DIR)
  1241         dialog = wx.FileDialog(self,
       
  1242                                "Choose an EDS file",
       
  1243                                os.getcwd(),
       
  1244                                "",
       
  1245                                "EDS files (*.eds)|*.eds|All files|*.*",
       
  1246                                wx.OPEN)
  1242         if dialog.ShowModal() == wx.ID_OK:
  1247         if dialog.ShowModal() == wx.ID_OK:
  1243             filepath = dialog.GetPath()
  1248             filepath = dialog.GetPath()
  1244             if os.path.isfile(filepath):
  1249             if os.path.isfile(filepath):
  1245                 result = self.NodeList.ImportEDSFile(filepath)
  1250                 result = self.NodeList.ImportEDSFile(filepath)
  1246                 if result:
  1251                 if result: