291 kind=wx.ITEM_NORMAL, text=_(u'New\tCTRL+N')) |
291 kind=wx.ITEM_NORMAL, text=_(u'New\tCTRL+N')) |
292 AppendMenu(parent, help='', id=wx.ID_OPEN, |
292 AppendMenu(parent, help='', id=wx.ID_OPEN, |
293 kind=wx.ITEM_NORMAL, text=_(u'Open\tCTRL+O')) |
293 kind=wx.ITEM_NORMAL, text=_(u'Open\tCTRL+O')) |
294 AppendMenu(parent, help='', id=wx.ID_SAVE, |
294 AppendMenu(parent, help='', id=wx.ID_SAVE, |
295 kind=wx.ITEM_NORMAL, text=_(u'Save\tCTRL+S')) |
295 kind=wx.ITEM_NORMAL, text=_(u'Save\tCTRL+S')) |
|
296 AppendMenu(parent, help='', id=wx.ID_SAVEAS, |
|
297 kind=wx.ITEM_NORMAL, text=_(u'Save as\tCTRL+S')) |
296 AppendMenu(parent, help='', id=wx.ID_CLOSE, |
298 AppendMenu(parent, help='', id=wx.ID_CLOSE, |
297 kind=wx.ITEM_NORMAL, text=_(u'Close Tab\tCTRL+W')) |
299 kind=wx.ITEM_NORMAL, text=_(u'Close Tab\tCTRL+W')) |
298 AppendMenu(parent, help='', id=wx.ID_CLOSE_ALL, |
300 AppendMenu(parent, help='', id=wx.ID_CLOSE_ALL, |
299 kind=wx.ITEM_NORMAL, text=_(u'Close Project')) |
301 kind=wx.ITEM_NORMAL, text=_(u'Close Project')) |
300 parent.AppendSeparator() |
302 parent.AppendSeparator() |
312 kind=wx.ITEM_NORMAL, text=_(u'Quit\tCTRL+Q')) |
314 kind=wx.ITEM_NORMAL, text=_(u'Quit\tCTRL+Q')) |
313 |
315 |
314 self.Bind(wx.EVT_MENU, self.OnNewProjectMenu, id=wx.ID_NEW) |
316 self.Bind(wx.EVT_MENU, self.OnNewProjectMenu, id=wx.ID_NEW) |
315 self.Bind(wx.EVT_MENU, self.OnOpenProjectMenu, id=wx.ID_OPEN) |
317 self.Bind(wx.EVT_MENU, self.OnOpenProjectMenu, id=wx.ID_OPEN) |
316 self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=wx.ID_SAVE) |
318 self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=wx.ID_SAVE) |
|
319 self.Bind(wx.EVT_MENU, self.OnSaveProjectAsMenu, id=wx.ID_SAVEAS) |
317 self.Bind(wx.EVT_MENU, self.OnCloseTabMenu, id=wx.ID_CLOSE) |
320 self.Bind(wx.EVT_MENU, self.OnCloseTabMenu, id=wx.ID_CLOSE) |
318 self.Bind(wx.EVT_MENU, self.OnCloseProjectMenu, id=wx.ID_CLOSE_ALL) |
321 self.Bind(wx.EVT_MENU, self.OnCloseProjectMenu, id=wx.ID_CLOSE_ALL) |
319 self.Bind(wx.EVT_MENU, self.OnPageSetupMenu, id=wx.ID_PAGE_SETUP) |
322 self.Bind(wx.EVT_MENU, self.OnPageSetupMenu, id=wx.ID_PAGE_SETUP) |
320 self.Bind(wx.EVT_MENU, self.OnPreviewMenu, id=wx.ID_PREVIEW) |
323 self.Bind(wx.EVT_MENU, self.OnPreviewMenu, id=wx.ID_PREVIEW) |
321 self.Bind(wx.EVT_MENU, self.OnPrintMenu, id=wx.ID_PRINT) |
324 self.Bind(wx.EVT_MENU, self.OnPrintMenu, id=wx.ID_PRINT) |
541 self.FileMenu.Enable(wx.ID_CLOSE, False) |
544 self.FileMenu.Enable(wx.ID_CLOSE, False) |
542 self.FileMenu.Enable(wx.ID_PREVIEW, False) |
545 self.FileMenu.Enable(wx.ID_PREVIEW, False) |
543 self.FileMenu.Enable(wx.ID_PRINT, False) |
546 self.FileMenu.Enable(wx.ID_PRINT, False) |
544 self.FileMenu.Enable(wx.ID_PAGE_SETUP, True) |
547 self.FileMenu.Enable(wx.ID_PAGE_SETUP, True) |
545 self.FileMenu.Enable(wx.ID_SAVE, True) |
548 self.FileMenu.Enable(wx.ID_SAVE, True) |
|
549 self.FileMenu.Enable(wx.ID_SAVEAS, True) |
546 self.FileMenu.Enable(wx.ID_PROPERTIES, True) |
550 self.FileMenu.Enable(wx.ID_PROPERTIES, True) |
547 self.FileMenu.Enable(wx.ID_CLOSE_ALL, True) |
551 self.FileMenu.Enable(wx.ID_CLOSE_ALL, True) |
548 else: |
552 else: |
549 self.FileMenu.Enable(wx.ID_CLOSE, False) |
553 self.FileMenu.Enable(wx.ID_CLOSE, False) |
550 self.FileMenu.Enable(wx.ID_PAGE_SETUP, False) |
554 self.FileMenu.Enable(wx.ID_PAGE_SETUP, False) |
551 self.FileMenu.Enable(wx.ID_PREVIEW, False) |
555 self.FileMenu.Enable(wx.ID_PREVIEW, False) |
552 self.FileMenu.Enable(wx.ID_PRINT, False) |
556 self.FileMenu.Enable(wx.ID_PRINT, False) |
553 self.FileMenu.Enable(wx.ID_SAVE, False) |
557 self.FileMenu.Enable(wx.ID_SAVE, False) |
|
558 self.FileMenu.Enable(wx.ID_SAVEAS, False) |
554 self.FileMenu.Enable(wx.ID_PROPERTIES, False) |
559 self.FileMenu.Enable(wx.ID_PROPERTIES, False) |
555 self.FileMenu.Enable(wx.ID_CLOSE_ALL, False) |
560 self.FileMenu.Enable(wx.ID_CLOSE_ALL, False) |
556 |
561 |
557 def RefreshScrollBars(self): |
562 def RefreshScrollBars(self): |
558 xstart, ystart = self.PLCConfig.GetViewStart() |
563 xstart, ystart = self.PLCConfig.GetViewStart() |
1368 if self.PluginRoot is not None: |
1373 if self.PluginRoot is not None: |
1369 self.PluginRoot.SaveProject() |
1374 self.PluginRoot.SaveProject() |
1370 self.RefreshAll() |
1375 self.RefreshAll() |
1371 self.RefreshTitle() |
1376 self.RefreshTitle() |
1372 |
1377 |
|
1378 def OnSaveProjectAsMenu(self, event): |
|
1379 if self.PluginRoot is not None: |
|
1380 self.PluginRoot.SaveProjectAs() |
|
1381 self.RefreshAll() |
|
1382 self.RefreshTitle() |
|
1383 event.Skip() |
|
1384 |
1373 def OnPropertiesMenu(self, event): |
1385 def OnPropertiesMenu(self, event): |
1374 self.ShowProperties() |
1386 self.ShowProperties() |
1375 |
1387 |
1376 def OnQuitMenu(self, event): |
1388 def OnQuitMenu(self, event): |
1377 self.Close() |
1389 self.Close() |
1400 wx.CallAfter(self.DeletePlugin, plugin) |
1412 wx.CallAfter(self.DeletePlugin, plugin) |
1401 event.Skip() |
1413 event.Skip() |
1402 return DeleteButtonFunction |
1414 return DeleteButtonFunction |
1403 |
1415 |
1404 def AddPlugin(self, PluginType, plugin): |
1416 def AddPlugin(self, PluginType, plugin): |
1405 dialog = wx.TextEntryDialog(self, _("Please enter a name for plugin:"), _("Add Plugin"), "", wx.OK|wx.CANCEL) |
1417 if self.PluginRoot.CheckProjectPathPerm(): |
1406 if dialog.ShowModal() == wx.ID_OK: |
1418 dialog = wx.TextEntryDialog(self, _("Please enter a name for plugin:"), _("Add Plugin"), "", wx.OK|wx.CANCEL) |
1407 PluginName = dialog.GetValue() |
1419 if dialog.ShowModal() == wx.ID_OK: |
1408 plugin.PlugAddChild(PluginName, PluginType) |
1420 PluginName = dialog.GetValue() |
1409 self.RefreshPluginTree() |
1421 plugin.PlugAddChild(PluginName, PluginType) |
1410 self.PluginRoot.RefreshPluginsBlockLists() |
1422 self.RefreshPluginTree() |
1411 dialog.Destroy() |
1423 self.PluginRoot.RefreshPluginsBlockLists() |
|
1424 dialog.Destroy() |
1412 |
1425 |
1413 def DeletePlugin(self, plugin): |
1426 def DeletePlugin(self, plugin): |
1414 dialog = wx.MessageDialog(self, _("Really delete plugin ?"), _("Remove plugin"), wx.YES_NO|wx.NO_DEFAULT) |
1427 if self.PluginRoot.CheckProjectPathPerm(): |
1415 if dialog.ShowModal() == wx.ID_YES: |
1428 dialog = wx.MessageDialog(self, _("Really delete plugin ?"), _("Remove plugin"), wx.YES_NO|wx.NO_DEFAULT) |
1416 self.PluginInfos.pop(plugin) |
1429 if dialog.ShowModal() == wx.ID_YES: |
1417 plugin.PlugRemove() |
1430 self.PluginInfos.pop(plugin) |
1418 del plugin |
1431 plugin.PlugRemove() |
1419 self.PluginRoot.RefreshPluginsBlockLists() |
1432 del plugin |
1420 self.RefreshPluginTree() |
1433 self.PluginRoot.RefreshPluginsBlockLists() |
1421 dialog.Destroy() |
1434 self.RefreshPluginTree() |
1422 |
1435 dialog.Destroy() |
|
1436 |
1423 #------------------------------------------------------------------------------- |
1437 #------------------------------------------------------------------------------- |
1424 # Exception Handler |
1438 # Exception Handler |
1425 #------------------------------------------------------------------------------- |
1439 #------------------------------------------------------------------------------- |
1426 |
1440 |
1427 Max_Traceback_List_Size = 20 |
1441 Max_Traceback_List_Size = 20 |