PLCOpenEditor.py
changeset 220 127d1323e5e0
parent 219 ca1f1d3734f9
child 221 25f2b4924347
equal deleted inserted replaced
219:ca1f1d3734f9 220:127d1323e5e0
   199                 event(self, id, function)
   199                 event(self, id, function)
   200             else:
   200             else:
   201                 event(self, function)
   201                 event(self, function)
   202     
   202     
   203     def _init_coll_MenuBar_Menus(self, parent):
   203     def _init_coll_MenuBar_Menus(self, parent):
   204         if self.ModeSolo:
   204         parent.Append(menu=self.FileMenu, title=u'File')
   205             parent.Append(menu=self.FileMenu, title=u'File')
       
   206         parent.Append(menu=self.EditMenu, title=u'Edit')
   205         parent.Append(menu=self.EditMenu, title=u'Edit')
   207         parent.Append(menu=self.HelpMenu, title=u'Help')
   206         parent.Append(menu=self.HelpMenu, title=u'Help')
   208 
   207 
   209     def _init_coll_FileMenu_Items(self, parent):
   208     def _init_coll_FileMenu_Items(self, parent):
   210         AppendMenu(parent, help='', id=wx.ID_NEW,
   209         if self.ModeSolo:
   211               kind=wx.ITEM_NORMAL, text=u'New\tCTRL+N')
   210             AppendMenu(parent, help='', id=wx.ID_NEW,
   212         AppendMenu(parent, help='', id=wx.ID_OPEN,
   211                   kind=wx.ITEM_NORMAL, text=u'New\tCTRL+N')
   213               kind=wx.ITEM_NORMAL, text=u'Open\tCTRL+O')
   212             AppendMenu(parent, help='', id=wx.ID_OPEN,
       
   213                   kind=wx.ITEM_NORMAL, text=u'Open\tCTRL+O')
   214         AppendMenu(parent, help='', id=wx.ID_CLOSE,
   214         AppendMenu(parent, help='', id=wx.ID_CLOSE,
   215               kind=wx.ITEM_NORMAL, text=u'Close Tab\tCTRL+W')
   215               kind=wx.ITEM_NORMAL, text=u'Close Tab\tCTRL+W')
   216         AppendMenu(parent, help='', id=wx.ID_CLOSE_ALL,
   216         if self.ModeSolo:
   217               kind=wx.ITEM_NORMAL, text=u'Close Project')
   217             AppendMenu(parent, help='', id=wx.ID_CLOSE_ALL,
   218         parent.AppendSeparator()
   218                   kind=wx.ITEM_NORMAL, text=u'Close Project')
       
   219             parent.AppendSeparator()
   219         AppendMenu(parent, help='', id=wx.ID_SAVE,
   220         AppendMenu(parent, help='', id=wx.ID_SAVE,
   220               kind=wx.ITEM_NORMAL, text=u'Save\tCTRL+S')
   221               kind=wx.ITEM_NORMAL, text=u'Save\tCTRL+S')
   221         AppendMenu(parent, help='', id=wx.ID_SAVEAS,
   222         if self.ModeSolo:
   222               kind=wx.ITEM_NORMAL, text=u'Save As...\tCTRL+SHIFT+S')
   223             AppendMenu(parent, help='', id=wx.ID_SAVEAS,
   223         AppendMenu(parent, help='', id=ID_PLCOPENEDITORFILEMENUGENERATE,
   224                   kind=wx.ITEM_NORMAL, text=u'Save As...\tCTRL+SHIFT+S')
   224               kind=wx.ITEM_NORMAL, text=u'Generate Program\tCTRL+G')
   225             AppendMenu(parent, help='', id=ID_PLCOPENEDITORFILEMENUGENERATE,
   225         parent.AppendSeparator()
   226                   kind=wx.ITEM_NORMAL, text=u'Generate Program\tCTRL+G')
       
   227             parent.AppendSeparator()
   226         AppendMenu(parent, help='', id=wx.ID_PAGE_SETUP,
   228         AppendMenu(parent, help='', id=wx.ID_PAGE_SETUP,
   227               kind=wx.ITEM_NORMAL, text=u'Page Setup')
   229               kind=wx.ITEM_NORMAL, text=u'Page Setup')
   228         AppendMenu(parent, help='', id=wx.ID_PREVIEW,
   230         AppendMenu(parent, help='', id=wx.ID_PREVIEW,
   229               kind=wx.ITEM_NORMAL, text=u'Preview')
   231               kind=wx.ITEM_NORMAL, text=u'Preview')
   230         AppendMenu(parent, help='', id=wx.ID_PRINT,
   232         AppendMenu(parent, help='', id=wx.ID_PRINT,
   231               kind=wx.ITEM_NORMAL, text=u'Print')
   233               kind=wx.ITEM_NORMAL, text=u'Print')
   232         parent.AppendSeparator()
   234         parent.AppendSeparator()
   233         AppendMenu(parent, help='', id=wx.ID_PROPERTIES,
   235         AppendMenu(parent, help='', id=wx.ID_PROPERTIES,
   234               kind=wx.ITEM_NORMAL, text=u'Properties')
   236               kind=wx.ITEM_NORMAL, text=u'Properties')
   235         parent.AppendSeparator()
   237         if self.ModeSolo:
   236         AppendMenu(parent, help='', id=wx.ID_EXIT,
   238             parent.AppendSeparator()
   237               kind=wx.ITEM_NORMAL, text=u'Quit\tCTRL+Q')
   239             AppendMenu(parent, help='', id=wx.ID_EXIT,
       
   240                   kind=wx.ITEM_NORMAL, text=u'Quit\tCTRL+Q')
       
   241             
   238         self.Bind(wx.EVT_MENU, self.OnNewProjectMenu, id=wx.ID_NEW)
   242         self.Bind(wx.EVT_MENU, self.OnNewProjectMenu, id=wx.ID_NEW)
   239         self.Bind(wx.EVT_MENU, self.OnOpenProjectMenu, id=wx.ID_OPEN)
   243         self.Bind(wx.EVT_MENU, self.OnOpenProjectMenu, id=wx.ID_OPEN)
   240         self.Bind(wx.EVT_MENU, self.OnCloseTabMenu, id=wx.ID_CLOSE)
   244         self.Bind(wx.EVT_MENU, self.OnCloseTabMenu, id=wx.ID_CLOSE)
   241         self.Bind(wx.EVT_MENU, self.OnCloseProjectMenu, id=wx.ID_CLOSE_ALL)
   245         self.Bind(wx.EVT_MENU, self.OnCloseProjectMenu, id=wx.ID_CLOSE_ALL)
   242         self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=wx.ID_SAVE)
   246         self.Bind(wx.EVT_MENU, self.OnSaveProjectMenu, id=wx.ID_SAVE)
   311         self.Bind(wx.EVT_MENU, self.OnAboutMenu, id=wx.ID_ABOUT)
   315         self.Bind(wx.EVT_MENU, self.OnAboutMenu, id=wx.ID_ABOUT)
   312 
   316 
   313     def _init_utils(self):
   317     def _init_utils(self):
   314         self.MenuBar = wx.MenuBar()
   318         self.MenuBar = wx.MenuBar()
   315 
   319 
   316         if self.ModeSolo:
   320         self.FileMenu = wx.Menu(title='')
   317             self.FileMenu = wx.Menu(title='')
       
   318         else:
       
   319             self.FileMenu = None
       
   320         self.EditMenu = wx.Menu(title='')
   321         self.EditMenu = wx.Menu(title='')
   321         self.HelpMenu = wx.Menu(title='')
   322         self.HelpMenu = wx.Menu(title='')
   322         
   323         
   323         self._init_coll_MenuBar_Menus(self.MenuBar)
   324         self._init_coll_MenuBar_Menus(self.MenuBar)
   324         if self.ModeSolo:
   325         self._init_coll_FileMenu_Items(self.FileMenu)
   325             self._init_coll_FileMenu_Items(self.FileMenu)
       
   326         self._init_coll_EditMenu_Items(self.EditMenu)
   326         self._init_coll_EditMenu_Items(self.EditMenu)
   327         self._init_coll_HelpMenu_Items(self.HelpMenu)
   327         self._init_coll_HelpMenu_Items(self.HelpMenu)
   328         
   328         
   329     def _init_ctrls(self, prnt):
   329     def _init_ctrls(self, prnt):
   330         if wx.VERSION >= (2, 8, 0):
   330         if wx.VERSION >= (2, 8, 0):
   860             printout = GraphicPrintout(self.GetPage(selected), page_size, margins, True)
   860             printout = GraphicPrintout(self.GetPage(selected), page_size, margins, True)
   861             printout2 = GraphicPrintout(self.GetPage(selected), page_size, margins, True)
   861             printout2 = GraphicPrintout(self.GetPage(selected), page_size, margins, True)
   862             preview = wx.PrintPreview(printout, printout2, data)
   862             preview = wx.PrintPreview(printout, printout2, data)
   863 
   863 
   864             if preview.Ok():
   864             if preview.Ok():
   865                 preview_frame = wx.PreviewFrame(preview, frame, "Print preview")
   865                 preview_frame = wx.PreviewFrame(preview, self, "Print preview")
   866 
   866 
   867                 preview_frame.Initialize()
   867                 preview_frame.Initialize()
   868                 
   868                 
   869                 preview_frame.Show(True)
   869                 preview_frame.Show(True)
   870         event.Skip()
   870         event.Skip()