323 def isatty(self): |
323 def isatty(self): |
324 return false |
324 return false |
325 |
325 |
326 [ID_BEREMIZ, ID_BEREMIZMAINSPLITTER, |
326 [ID_BEREMIZ, ID_BEREMIZMAINSPLITTER, |
327 ID_BEREMIZPLCCONFIG, ID_BEREMIZLOGCONSOLE, |
327 ID_BEREMIZPLCCONFIG, ID_BEREMIZLOGCONSOLE, |
328 ID_BEREMIZINSPECTOR, ID_BUILD] = [wx.NewId() for _init_ctrls in range(6)] |
328 ID_BEREMIZINSPECTOR] = [wx.NewId() for _init_ctrls in range(5)] |
329 |
|
330 [ID_BEREMIZRUNMENUBUILD, ID_BEREMIZRUNMENUSIMULATE, |
|
331 ID_BEREMIZRUNMENURUN, ID_BEREMIZRUNMENUSAVELOG, |
|
332 ] = [wx.NewId() for _init_coll_EditMenu_Items in range(4)] |
|
333 |
329 |
334 class Beremiz(IDEFrame): |
330 class Beremiz(IDEFrame): |
335 |
331 |
336 def _init_coll_FileMenu_Items(self, parent): |
332 def _init_coll_FileMenu_Items(self, parent): |
337 AppendMenu(parent, help='', id=wx.ID_NEW, |
333 AppendMenu(parent, help='', id=wx.ID_NEW, |
406 |
402 |
407 def _init_ctrls(self, prnt): |
403 def _init_ctrls(self, prnt): |
408 IDEFrame._init_ctrls(self, prnt) |
404 IDEFrame._init_ctrls(self, prnt) |
409 |
405 |
410 self.Bind(wx.EVT_MENU, self.OnOpenWidgetInspector, id=ID_BEREMIZINSPECTOR) |
406 self.Bind(wx.EVT_MENU, self.OnOpenWidgetInspector, id=ID_BEREMIZINSPECTOR) |
411 self.Bind(wx.EVT_MENU, self.OnBuildProject, id=ID_BUILD) |
407 accels = [wx.AcceleratorEntry(wx.ACCEL_CTRL|wx.ACCEL_ALT, ord('I'), ID_BEREMIZINSPECTOR)] |
412 accel = wx.AcceleratorTable([wx.AcceleratorEntry(wx.ACCEL_CTRL|wx.ACCEL_ALT, ord('I'), ID_BEREMIZINSPECTOR), |
408 for method,shortcut in [("Stop", wx.WXK_F4), |
413 wx.AcceleratorEntry(wx.ACCEL_NORMAL, wx.WXK_F11, ID_BUILD)]) |
409 ("Run", wx.WXK_F5), |
414 self.SetAcceleratorTable(accel) |
410 ("Transfer", wx.WXK_F6), |
|
411 ("Connect", wx.WXK_F7), |
|
412 ("Build", wx.WXK_F11)]: |
|
413 def OnMethodGen(obj,meth): |
|
414 def OnMethod(evt): |
|
415 if obj.PluginRoot is not None: |
|
416 obj.PluginRoot.CallMethod('_'+meth) |
|
417 wx.CallAfter(self.RefreshAll) |
|
418 return OnMethod |
|
419 newid = wx.NewId() |
|
420 self.Bind(wx.EVT_MENU, OnMethodGen(self,method), id=newid) |
|
421 accels += [wx.AcceleratorEntry(wx.ACCEL_NORMAL, shortcut,newid)] |
|
422 |
|
423 self.SetAcceleratorTable(wx.AcceleratorTable(accels)) |
415 |
424 |
416 self.PLCConfig = wx.ScrolledWindow(id=ID_BEREMIZPLCCONFIG, |
425 self.PLCConfig = wx.ScrolledWindow(id=ID_BEREMIZPLCCONFIG, |
417 name='PLCConfig', parent=self.LeftNoteBook, pos=wx.Point(0, 0), |
426 name='PLCConfig', parent=self.LeftNoteBook, pos=wx.Point(0, 0), |
418 size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER|wx.HSCROLL|wx.VSCROLL) |
427 size=wx.Size(-1, -1), style=wx.TAB_TRAVERSAL|wx.SUNKEN_BORDER|wx.HSCROLL|wx.VSCROLL) |
419 self.PLCConfig.SetBackgroundColour(wx.WHITE) |
428 self.PLCConfig.SetBackgroundColour(wx.WHITE) |
522 # one under the cursor, if any, or this frame. |
531 # one under the cursor, if any, or this frame. |
523 wnd = wx.FindWindowAtPointer() |
532 wnd = wx.FindWindowAtPointer() |
524 if not wnd: |
533 if not wnd: |
525 wnd = self |
534 wnd = self |
526 InspectionTool().Show(wnd, True) |
535 InspectionTool().Show(wnd, True) |
527 |
|
528 def OnBuildProject(self, evt): |
|
529 if self.PluginRoot is not None: |
|
530 self.PluginRoot._build() |
|
531 |
536 |
532 def OnLogConsoleDClick(self, event): |
537 def OnLogConsoleDClick(self, event): |
533 wx.CallAfter(self.SearchLineForError) |
538 wx.CallAfter(self.SearchLineForError) |
534 event.Skip() |
539 event.Skip() |
535 |
540 |