183 def isatty(self): |
183 def isatty(self): |
184 return false |
184 return false |
185 |
185 |
186 [ID_BEREMIZ, ID_BEREMIZMAINSPLITTER, |
186 [ID_BEREMIZ, ID_BEREMIZMAINSPLITTER, |
187 ID_BEREMIZPLCCONFIG, ID_BEREMIZLOGCONSOLE, |
187 ID_BEREMIZPLCCONFIG, ID_BEREMIZLOGCONSOLE, |
188 ] = [wx.NewId() for _init_ctrls in range(4)] |
188 ID_BEREMIZINSPECTOR] = [wx.NewId() for _init_ctrls in range(5)] |
189 |
189 |
190 [ID_BEREMIZFILEMENUITEMS0, ID_BEREMIZFILEMENUITEMS1, |
190 [ID_BEREMIZFILEMENUITEMS0, ID_BEREMIZFILEMENUITEMS1, |
191 ID_BEREMIZFILEMENUITEMS2, ID_BEREMIZFILEMENUITEMS3, |
191 ID_BEREMIZFILEMENUITEMS2, ID_BEREMIZFILEMENUITEMS3, |
192 ID_BEREMIZFILEMENUITEMS5, ID_BEREMIZFILEMENUITEMS7, |
192 ID_BEREMIZFILEMENUITEMS5, ID_BEREMIZFILEMENUITEMS7, |
193 ] = [wx.NewId() for _init_coll_FileMenu_Items in range(6)] |
193 ] = [wx.NewId() for _init_coll_FileMenu_Items in range(6)] |
328 self._init_utils() |
328 self._init_utils() |
329 self.SetClientSize(wx.Size(1000, 600)) |
329 self.SetClientSize(wx.Size(1000, 600)) |
330 self.SetMenuBar(self.menuBar1) |
330 self.SetMenuBar(self.menuBar1) |
331 self.Bind(wx.EVT_ACTIVATE, self.OnFrameActivated) |
331 self.Bind(wx.EVT_ACTIVATE, self.OnFrameActivated) |
332 self.Bind(wx.EVT_CLOSE, self.OnCloseFrame) |
332 self.Bind(wx.EVT_CLOSE, self.OnCloseFrame) |
|
333 |
|
334 self.Bind(wx.EVT_MENU, self.OnOpenWidgetInspector, id=ID_BEREMIZINSPECTOR) |
|
335 accel = wx.AcceleratorTable([wx.AcceleratorEntry(wx.ACCEL_CTRL, wx.WXK_F12, ID_BEREMIZINSPECTOR)]) |
|
336 self.SetAcceleratorTable(accel) |
|
337 |
|
338 |
333 |
339 |
334 if wx.VERSION < (2, 8, 0): |
340 if wx.VERSION < (2, 8, 0): |
335 self.MainSplitter = wx.SplitterWindow(id=ID_BEREMIZMAINSPLITTER, |
341 self.MainSplitter = wx.SplitterWindow(id=ID_BEREMIZMAINSPLITTER, |
336 name='MainSplitter', parent=self, point=wx.Point(0, 0), |
342 name='MainSplitter', parent=self, point=wx.Point(0, 0), |
337 size=wx.Size(0, 0), style=wx.SP_3D) |
343 size=wx.Size(0, 0), style=wx.SP_3D) |
390 self.PluginRoot.LoadProject(projectOpen, self.Log) |
396 self.PluginRoot.LoadProject(projectOpen, self.Log) |
391 self.RefreshPLCParams() |
397 self.RefreshPLCParams() |
392 self.RefreshPluginTree() |
398 self.RefreshPluginTree() |
393 |
399 |
394 self.RefreshMainMenu() |
400 self.RefreshMainMenu() |
|
401 |
|
402 def OnOpenWidgetInspector(self, evt): |
|
403 # Activate the widget inspection tool |
|
404 from wx.lib.inspection import InspectionTool |
|
405 if not InspectionTool().initialized: |
|
406 InspectionTool().Init() |
|
407 |
|
408 # Find a widget to be selected in the tree. Use either the |
|
409 # one under the cursor, if any, or this frame. |
|
410 wnd = wx.FindWindowAtPointer() |
|
411 if not wnd: |
|
412 wnd = self |
|
413 InspectionTool().Show(wnd, True) |
395 |
414 |
396 def OnCloseFrame(self, event): |
415 def OnCloseFrame(self, event): |
397 if self.PluginRoot.HasProjectOpened(): |
416 if self.PluginRoot.HasProjectOpened(): |
398 if self.PluginRoot.runningPLC is not None: |
417 if self.PluginRoot.runningPLC is not None: |
399 wx.MessageBox("Please stop any running PLC before closing") |
418 wx.MessageBox("Please stop any running PLC before closing") |
1182 |
1201 |
1183 def OnSaveLogMenu(self, event): |
1202 def OnSaveLogMenu(self, event): |
1184 event.Skip() |
1203 event.Skip() |
1185 |
1204 |
1186 def OnBeremizMenu(self, event): |
1205 def OnBeremizMenu(self, event): |
1187 if wx.Platform == '__WXMSW__': |
|
1188 readerpath = get_acroversion() |
|
1189 readerexepath = os.path.join(readerpath,"AcroRd32.exe") |
|
1190 if(os.path.isfile(readerexepath)): |
|
1191 os.spawnl(os.P_DETACH, readerexepath, "AcroRd32.exe", '"%s"'%os.path.join(CWD,"doc","manual_beremiz.pdf")) |
|
1192 else: |
|
1193 os.system("xpdf -remote BEREMIZ %s %d &"%(os.path.join(CWD,"doc","manual_beremiz.pdf",16))) |
|
1194 event.Skip() |
1206 event.Skip() |
1195 |
1207 |
1196 def OnAboutMenu(self, event): |
1208 def OnAboutMenu(self, event): |
1197 about_html = objdictedit(self) |
|
1198 about_html.OpenHtmlFrame("About Beremiz", os.path.join(CWD,"doc","about.html"),wx.Size(500,600)) |
|
1199 event.Skip() |
1209 event.Skip() |
1200 |
1210 |
1201 def OnAddButton(self, event): |
1211 def OnAddButton(self, event): |
1202 PluginType = self.PluginChilds.GetStringSelection() |
1212 PluginType = self.PluginChilds.GetStringSelection() |
1203 if PluginType != "": |
1213 if PluginType != "": |