Beispiel #1
0
    def __init__(self, parent, title):
        wxFrame.__init__(self,
                         parent,
                         wxID_ANY,
                         title,
                         size=(200, 100),
                         style=wxDEFAULT_FRAME_STYLE
                         | wxNO_FULL_REPAINT_ON_RESIZE)

        filemenu = wxMenu()
        filemenu.AppendSeparator()
        filemenu.Append(ID_EXIT, "E&xit\tCtrl+Q", " Terminate the program")

        helpmenu = wxMenu()
        helpmenu.Append(ID_ABOUT, "&About", " Information about this program")

        menuBar = wxMenuBar()
        menuBar.Append(filemenu, "&File")
        menuBar.Append(helpmenu, "&Help")
        self.SetMenuBar(menuBar)
        self.SetSize((800, 600))
        self.Show(True)
        EVT_MENU(self, ID_EXIT, self.OnExit)
        EVT_MENU(self, ID_ABOUT, self.OnAbout)

        EVT_CLOSE(self, self.OnExit)
Beispiel #2
0
 def __init__ ( self, desc, owner, popup = FALSE, window = None ):
     self.owner = owner
     if window is None:
         window = owner
     self.window   = window
     self.indirect = getattr( owner, 'call_menu', None )
     self.names    = {}
     self.desc     = desc.split( '\n' )
     self.index    = 0
     self.keys     = []
     if popup:
         self.menu = menu = wx.wxMenu()
         self.parse( menu, -1 )
     else:
         self.menu = menu = wx.wxMenuBar()
         self.parse( menu, -1 )
         window.SetMenuBar( menu )
         if len( self.keys ) > 0:
             window.SetAcceleratorTable( wx.wxAcceleratorTable( self.keys ) )
Beispiel #3
0
    def __init__(self,parent,title):
        wxFrame.__init__(self,parent,wxID_ANY, title, size = ( 200,100),
                         style=wxDEFAULT_FRAME_STYLE|wxNO_FULL_REPAINT_ON_RESIZE)

        filemenu= wxMenu()
        filemenu.AppendSeparator()
        filemenu.Append(ID_EXIT,"E&xit\tCtrl+Q"," Terminate the program")

        helpmenu = wxMenu()
        helpmenu.Append(ID_ABOUT, "&About"," Information about this program")

        menuBar = wxMenuBar()
        menuBar.Append(filemenu,"&File")
        menuBar.Append(helpmenu,"&Help")
        self.SetMenuBar(menuBar)
        self.SetSize((800, 600))
        self.Show(True)
        EVT_MENU(self, ID_EXIT, self.OnExit)
        EVT_MENU(self, ID_ABOUT, self.OnAbout)

        EVT_CLOSE(self, self.OnExit)
Beispiel #4
0
 def __init__(self, parent=wx.NULL, id = -1, title = '',
              pos=wx.wxPyDefaultPosition,
              size=default_size,visible=1):
     wx.wxFrame.__init__(self, parent, id, title,pos,size)
     # Now Create the menu bar and items
     self.mainmenu = wx.wxMenuBar()
     menu = wx.wxMenu()
     menu.Append(200, '&Save As...', 'Save plot to image file')
     wx.EVT_MENU(self, 200, self.file_save_as)
     menu.Append(203, '&Print...', 'Print the current plot')
     wx.EVT_MENU(self, 203, self.file_print)
     menu.Append(204, 'Print Pre&view', 'Preview the current plot')
     wx.EVT_MENU(self, 204, self.file_preview)
     menu.Append(205, 'Close', 'Close plot')
     wx.EVT_MENU(self, 205, self.file_close)
     self.mainmenu.Append(menu, '&File')
     menu = wx.wxMenu()
     menu.Append(self.TITLE_TEXT, '&Graph Title', 'Title for plot')
     wx.EVT_MENU(self,self.TITLE_TEXT,self.title)
     menu.Append(self.X_TEXT, '&X Title', 'Title for X axis')
     wx.EVT_MENU(self,self.X_TEXT,self.title)
     menu.Append(self.Y_TEXT, '&Y Title', 'Title for Y axis')
     wx.EVT_MENU(self,self.Y_TEXT,self.title)
     self.mainmenu.Append(menu, '&Titles')
     #menu = wx.wxMenu()
     #menu.Append(300, '&Profile', 'Check the hot spots in the program')
     #wx.EVT_MENU(self,300,self.OnProfile)
     #self.mainmenu.Append(menu, '&Utility')
     self.SetMenuBar(self.mainmenu)
     # A status bar to tell people what's happening
     self.CreateStatusBar(1)
     self.print_data = wx.wxPrintData()
     self.print_data.SetPaperId(wx.wxPAPER_LETTER)
     self.client = plot_canvas(self)
     if visible: self.Show(1)
     self.Raise()
     self.SetFocus()
Beispiel #5
0
    def setupMenus(self):
        self.newId = wxNewId()
        self.openId = wxNewId()
        self.viewId = wxNewId()
        self.editId = wxNewId()
        self.openWithId = wxNewId()
        self.propertiesId = wxNewId()
        self.deleteId = wxNewId()
        self.exitId = wxNewId()
        self.cutId = wxNewId()
        self.copyId = wxNewId()
        self.pasteId = wxNewId()
        self.pasteLinkId = wxNewId()
        self.moveToDirId = wxNewId()
        self.copyToDirId = wxNewId()
        self.selectAllId = wxNewId()
        self.deselectAllId = wxNewId()
        self.invertSelectionId = wxNewId()
        self.refreshId = wxNewId()
        self.addBookmarkId = wxNewId()
        self.manageBookmarkId = wxNewId()
        self.goUpId = wxNewId()
        self.goBackId = wxNewId()
        self.goForwardId = wxNewId()
        self.goHomeId = wxNewId()
        self.mountId = wxNewId()
        self.umountId = wxNewId()
        self.aboutId = wxNewId()

        filemenu = wxMenu()
        filemenu.Append(self.newId, "&New item\tCtrl-N", " New item")
        filemenu.Append(self.viewId, "&View\tF3", " View selected items")
        filemenu.Append(self.openId, "&Open\tCtrl-O", " Open selected items")
        filemenu.Append(self.editId, "&Edit\tF4", " Edit selected items")
        filemenu.Append(self.openWithId, "Open &with\tCtrl-W", " Open selected items with ...")
        filemenu.AppendSeparator()
        filemenu.Append(self.propertiesId, "P&roperties\tCtrl-P", " Show properties of selected items")
        filemenu.Append(self.deleteId, "&Delete\tDELETE", self.deleteStr)
        filemenu.AppendSeparator()
        filemenu.Append(self.exitId, "E&xit\tCtrl-Q", " Terminate the program")

        editmenu = wxMenu()
        editmenu.Append(self.copyId, "&Copy\tCtrl-C", self.copyStr)
        editmenu.Append(self.cutId, "C&ut\tCtrl-X", self.cutStr)
        editmenu.Append(self.pasteId, "&Paste\tCtrl-V", self.pasteStr)
        editmenu.Append(self.pasteLinkId, "Paste &link\tCtrl-L", " Paste symbolic link")
        editmenu.AppendSeparator()
        editmenu.Append(self.moveToDirId, "&Move to directory\tCtrl-M", " Move to different direcotry")
        editmenu.Append(self.copyToDirId, "Cop&y to directory\tCtrl-N", " Copy to different direcotry")
        editmenu.AppendSeparator()
        editmenu.Append(self.selectAllId, "&Select all\tCtrl-A", " Select all items")
        editmenu.Append(self.deselectAllId, "&Deselect all\tCtrl-Z", " Deselect all items")
        editmenu.Append(self.invertSelectionId, "&Invert selection\tCtrl-I", " Invert selection")

        viewmenu = wxMenu()
        viewmenu.Append(self.refreshId, "&Refresh\tCtrl-R", self.refreshStr)
        viewmenu.AppendSeparator()

        go__menu = wxMenu()
        go__menu.Append(self.goUpId, "&Up", self.goUpStr)
        go__menu.Append(self.goBackId, "&Back\tALT-LEFT", self.goBackStr)
        go__menu.Append(self.goForwardId, "&Forward\tALT-RIGHT", self.goForwardStr)
        go__menu.Append(self.goHomeId, "&Home\tALT-HOME", self.goHomeStr)

        bookmenu = wxMenu()
        bookmenu.Append(self.addBookmarkId, "&Add\tCtrl-D", " Add bookmark")
        bookmenu.Append(self.manageBookmarkId, "&Manage", " Manage bookmarks")

        toolmenu = wxMenu()
        toolmenu.Append(self.mountId, "&Options", " Mount device")

        helpmenu = wxMenu()
        helpmenu.Append(self.aboutId, "&About", " Information about this program")

        # Creating the menubar.
        menuBar = wxMenuBar(wxMB_DOCKABLE)
        menuBar.Append(filemenu, "&File")
        menuBar.Append(editmenu, "&Edit")
        menuBar.Append(viewmenu, "&View")
        menuBar.Append(go__menu, "&Go")
        menuBar.Append(bookmenu, "&Bookmarks")
        menuBar.Append(toolmenu, "&Tools")
        menuBar.Append(helpmenu, "&Help")
        self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content.

        # attach events to menus
        EVT_MENU(self, self.deleteId, lambda e, self=self: self.ntbook.DeleteItems(e))
        EVT_MENU(self, self.propertiesId, lambda e, self=self: self.ntbook.Properties())
        EVT_MENU(self, self.newId, lambda e, self=self: self.ntbook.NewItem())
        EVT_MENU(self, self.goUpId, lambda e, self=self: self.ntbook.HistoryGo(e, 0))
        EVT_MENU(self, self.goBackId, lambda e, self=self: self.ntbook.HistoryGo(e, -1))
        EVT_MENU(self, self.goForwardId, lambda e, self=self: self.ntbook.HistoryGo(e, +1))
        EVT_MENU(self, self.goHomeId, lambda e, self=self: self.ntbook.GoHome())
        EVT_MENU(self, self.refreshId, lambda e, self=self: self.ntbook.Refresh())
        EVT_MENU(self, self.copyId, lambda e, self=self: self.ntbook.CopyCutPaste(0))
        EVT_MENU(self, self.cutId, lambda e, self=self: self.ntbook.CopyCutPaste(1))
        EVT_MENU(self, self.pasteId, lambda e, self=self: self.ntbook.CopyCutPaste(2))
        EVT_MENU(self, self.selectAllId, lambda e, self=self: self.ntbook.SelectItems(1))
        EVT_MENU(self, self.deselectAllId, lambda e, self=self: self.ntbook.SelectItems(0))
        EVT_MENU(self, self.invertSelectionId, lambda e, self=self: self.ntbook.SelectItems(-1))
        EVT_MENU(self, self.aboutId, self.OnAbout)
        EVT_MENU(self, self.exitId, self.OnExit)