コード例 #1
0
ファイル: systemTray.py プロジェクト: mush42/Bright
 def __init__(self, parent):
     super(TBIcon, self).__init__()
     icon = wx.Icon(os.path.join(app_path(), "icon.ico"),
                    wx.BITMAP_TYPE_ICO)
     self.SetIcon(icon, "%s" % application.name)
     self.Menu = wx.Menu()
     ExitId = wx.NewId()
     ExitOption = wx.MenuItem(self.Menu, ExitId, "E&xit",
                              "Exit %s" % application.name)
     self.Menu.AppendItem(ExitOption)
     wx.EVT_MENU(self.Menu, ExitId, lambda evt: interface.exit())
     self.Bind(wx.EVT_TASKBAR_RIGHT_DOWN, self.onActivate)
コード例 #2
0
    def AddPage(self, page):
        err_msg = None
        err_det = None

        if not isinstance(page, WizardPage):
            try:
                pagemod = u'wizbin.{}'.format(page)
                page = mimport(pagemod).Page(self)

            except ImportError:
                err_msg = u'module does not exist'
                err_det = traceback.format_exc()

        lyt_main = self.GetSizer()

        if not err_msg:
            # Must already be child
            if not isinstance(page, WizardPage):
                err_msg = u'not WizardPage instance'

            elif page not in self.GetChildren():
                err_msg = u'not child of wizard'

            elif page in lyt_main.GetChildWindows():
                err_msg = u'page is already added to wizard'

        if err_msg:
            err_msg = u'Cannot add page, {}'.format(err_msg)

            if err_det:
                ShowErrorDialog(err_msg, err_det)

            else:
                ShowErrorDialog(err_msg)

            return

        main_window = GetMainWindow()

        lyt_main.Add(page, 1, wx.EXPAND)
        self.Pages.append(page)

        # Add to page menu
        page_menu = GetMenu(menuid.PAGE)

        page_menu.AppendItem(
            wx.MenuItem(page_menu,
                        page.Id,
                        page.GetTitle(),
                        kind=wx.ITEM_RADIO))

        # Bind menu event to ID
        wx.EVT_MENU(main_window, page.Id, main_window.OnMenuChangePage)
コード例 #3
0
    def __init__(self, parent, ID, mainControl):
        EnhancedListControl.__init__(self,
                                     parent,
                                     ID,
                                     style=wx.LC_REPORT | wx.LC_SINGLE_SEL)

        self.mainControl = mainControl

        self.InsertColumn(0, _(u"Page Name"), width=100)
        self.InsertColumn(1, _(u"Visited"), width=100)

        colConfig = self.mainControl.getConfig().get(
            "main", "wikiWideHistory_columnWidths", u"100,100")

        self.setColWidthsByConfigString(colConfig)

        #         self.updatingThreadHolder = Utilities.ThreadHolder()

        self.mainControl.getMiscEvent().addListener(self)

        self.layerVisible = True
        self.sizeVisible = True  # False if this window has a size
        # that it can't be read (one dim. less than 5 pixels)
        self.ignoreOnChange = False

        self.historyOverviewSink = wxKeyFunctionSink(
            (("changed wiki wide history", self.onUpdateNeeded), ))

        self.__sinkApp = wxKeyFunctionSink(
            (("options changed", self.onUpdateNeeded), ),
            wx.GetApp().getMiscEvent(), self)

        if not self.mainControl.isMainWindowConstructed():
            # Install event handler to wait for construction
            self.__sinkMainFrame = wxKeyFunctionSink(
                (("constructed main window", self.onConstructedMainWindow), ),
                self.mainControl.getMiscEvent(), self)
        else:
            self.onConstructedMainWindow(None)

        wx.EVT_CONTEXT_MENU(self, self.OnContextMenu)

        wx.EVT_WINDOW_DESTROY(self, self.OnDestroy)
        #         wx.EVT_LIST_ITEM_SELECTED(self, self.GetId(), self.OnItemSelected)
        wx.EVT_LIST_ITEM_ACTIVATED(self, self.GetId(), self.OnItemActivated)
        wx.EVT_SIZE(self, self.OnSize)
        #         wx.EVT_KEY_DOWN(self, self.OnKeyDown)
        wx.EVT_MIDDLE_DOWN(self, self.OnMiddleButtonDown)

        wx.EVT_MENU(self, GUI_ID.CMD_WIKI_WIDE_HISTORY_DELETE_ALL,
                    self.OnCmdDeleteAll)

        self.onWikiStateChanged(None)
コード例 #4
0
ファイル: main.py プロジェクト: pohmx/osu_kps
 def __init__(self, parent, ID, title, size):
     # <Frame constructor>
     wx.Frame.__init__(self, parent, ID, title, wx.DefaultPosition,
                       wx.Size(size))
     menu = wx.Menu()
     menu.Append(ID_EXIT, "E&xit", "Terminate the program")
     menuBar = wx.MenuBar()
     menuBar.Append(menu, "&File")
     self.SetMenuBar(menuBar)
     wx.EVT_MENU(self, ID_EXIT, self.DoExit)
     # make sure reactor.stop() is used to stop event loop:
     wx.EVT_CLOSE(self, lambda evt: reactor.stop())
コード例 #5
0
ファイル: customDialogs.py プロジェクト: gdrealm/caid
 def OnRightMouseClick(self, event):
     ### 2. Launcher creates wxMenu. ###
     menu = wx.Menu()
     for (id, title) in list(self.menu_title_by_id.items()):
         ### 3. Launcher packs menu with Append. ###
         toAppend = True
         menu.Append(id, title)
         ### 4. Launcher registers menu handlers with EVT_MENU, on the menu. ###
         wx.EVT_MENU(menu, id, self.MenuSelectionCb)
     ### 5. Launcher displays menu with call to PopupMenu, invoked on the source component, passing event's GetPoint. ###
     self.PopupMenu(menu)
     menu.Destroy()  # destroy to avoid mem leak
コード例 #6
0
 def _on_context_menu(self, event):
     """
         Default context menu for a plot panel
     """
     id = wx.NewId()
     slicerpop = wx.Menu()
     slicerpop.Append(id, '&Reset 3D View')
     wx.EVT_MENU(self, id, self.resetView)
    
     pos = event.GetPosition()
     #pos = self.ScreenToClient(pos)
     self.PopupMenu(slicerpop, pos)        
コード例 #7
0
ファイル: foreign.py プロジェクト: xiaojay/wxPython-In-Action
    def __init__(self,
                 parent,
                 id,
                 title,
                 pos=wx.DefaultPosition,
                 size=wx.DefaultSize,
                 style=wx.DEFAULT_FRAME_STYLE):
        wx.Frame.__init__(self, parent, id, title, pos, size, style)

        self.CreateMyMenuBar()

        self.CreateStatusBar(1)
        self.SetStatusText("Welcome to Foreign!")

        # insert main window here

        # WDR: handler declarations for MyFrame
        wx.EVT_MENU(self, ID_ABOUT, self.OnAbout)
        wx.EVT_MENU(self, ID_QUIT, self.OnQuit)
        wx.EVT_MENU(self, ID_TEST, self.OnTest)
        wx.EVT_CLOSE(self, self.OnCloseWindow)
コード例 #8
0
 def __init__(self, parent, winId, boxSize=wx.DefaultSize):
     wx.ListCtrl.__init__(self,
                          parent,
                          winId,
                          size=boxSize,
                          style=wx.LC_REPORT)
     self.InsertColumn(0, 'Role')
     self.SetColumnWidth(0, 150)
     self.InsertColumn(1, 'Cost')
     self.SetColumnWidth(1, 300)
     self.theDimMenu = wx.Menu()
     self.theDimMenu.Append(armid.COSTLISTCTRL_MENUADD_ID, 'Add')
     self.theDimMenu.Append(armid.COSTLISTCTRL_MENUDELETE_ID, 'Delete')
     self.theSelectedIdx = -1
     self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
     self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected)
     self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnItemDeselected)
     wx.EVT_MENU(self.theDimMenu, armid.COSTLISTCTRL_MENUADD_ID,
                 self.onAddProperty)
     wx.EVT_MENU(self.theDimMenu, armid.COSTLISTCTRL_MENUDELETE_ID,
                 self.onDeleteProperty)
コード例 #9
0
ファイル: mc2000.py プロジェクト: zacsimile/python-microscopy
    def addMenuItems(self, parentWindow, menu):
        """Add menu items and keyboard accelerators for joystick control
        to the specified menu & parent window"""
        #Create IDs
        self.ID_JOY_ON = wx.NewId()
        self.ID_JOY_OFF = wx.NewId()

        #Add menu items
        menu.AppendSeparator()
        menu.Append(helpString='',
                    id=self.ID_JOY_ON,
                    item='Joystick On',
                    kind=wx.ITEM_NORMAL)
        menu.Append(helpString='',
                    id=self.ID_JOY_OFF,
                    item='Joystick Off',
                    kind=wx.ITEM_NORMAL)

        #Handle clicking on the menu items
        wx.EVT_MENU(parentWindow, self.ID_JOY_ON, self.JoyOn)
        wx.EVT_MENU(parentWindow, self.ID_JOY_OFF, self.JoyOff)
コード例 #10
0
ファイル: CodingTextCtrl.py プロジェクト: ash-ley/CAIRIS
  def __init__(self, parent, winId):
    wx.richtext.RichTextCtrl.__init__(self,parent,winId,style=wx.TE_MULTILINE)
    self.codingMenu = wx.Menu()
    self.ocItem = self.codingMenu.Append(BVNTC_TEXTOPENCODING_ID,'Open Coding')
    self.clItem = self.codingMenu.Append(BVNTC_LISTALPHABET_ID,'Alphabet')
    self.dcItem = self.codingMenu.Append(BVNTC_CMDUNLINKCODES_ID,'Unlink codes')
    self.meItem = self.codingMenu.Append(BVNTC_CMDMEMO_ID,'Memo')

    wx.EVT_MENU(self,BVNTC_TEXTOPENCODING_ID,self.onOpenCoding)
    wx.EVT_MENU(self,BVNTC_LISTALPHABET_ID,self.onListAlphabet)
    wx.EVT_MENU(self,BVNTC_CMDMEMO_ID,self.onMemo)
    self.Bind(wx.EVT_RIGHT_DOWN, self.onRightClick)
    self.Bind(wx.EVT_TEXT_URL,self.onUrl)

    self.theSelectionStart = -1
    self.theSelectionEnd = -1
    self.theSelection = ''
    self.clItem.Enable(False)
    self.dcItem.Enable(False)
    self.theCodes = {}
    self.theMemos = {}
コード例 #11
0
ファイル: gui.py プロジェクト: Acidburn0zzz/mlox
 def right_click_handler(self, e):
     menu = wx.Menu()
     menu_items = [(_["Select All"], self.menu_select_all_handler),
                   (_["Paste"], self.menu_paste_handler),
                   (_["Open File"], self.menu_open_file_handler),
                   (_["Debug"], self.menu_debug_handler)]
     for name, handler in menu_items:
         id = wx.NewId()
         menu.Append(id, name)
         wx.EVT_MENU(menu, id, handler)
     self.frame.PopupMenu(menu)
     menu.Destroy()
コード例 #12
0
    def add(self, bitmapdef, command=None):
        """Add a new tool.
        """

        bitmap = self._def2bitmap(bitmapdef)
        id = self._id_manager.allocID()
        self._wx.AddSimpleTool(id, bitmap, "Short", "A help string.")

        self._tool_id_lut[id] = command
        wx.EVT_MENU(self._wx, id, self._onToolSelection)

        self._wx.Realize()
コード例 #13
0
    def __init__(self, plots_frame):

        wx.Menu.__init__(self)

        self.plots_frame = plots_frame

        rename = self.Append(wx.ID_ANY, "Rename", "Rename the current tab")
        wx.EVT_MENU(self, rename.GetId(),
                    self.plots_frame.rename_current_figure)
        self.AppendSeparator()

        h_split = self.Append(-1, "Split Horizontal", "Split the current plot "
                              "into a new pane")
        v_split = self.Append(-1, "Split Vertical", "Split the current plot "
                              "into a new pane")
        wx.EVT_MENU(self, h_split.GetId(), self.plots_frame.split_figure_horiz)
        wx.EVT_MENU(self, v_split.GetId(), self.plots_frame.split_figure_vert)

        self.AppendSeparator()
        close_current = self.Append(wx.ID_ANY, "Close",
                                    "Close the current tab")
        wx.EVT_MENU(self, close_current.GetId(), self.close_current)

        close_others = self.Append(wx.ID_ANY, "Close Others",
                                   "Close other tabs")
        wx.EVT_MENU(self, close_others.GetId(), self.close_others)

        close_all = self.Append(wx.ID_ANY, "Close All", "Close all tabs")
        wx.EVT_MENU(self, close_all.GetId(), self.close_all)
コード例 #14
0
    def __init__(self, parent, winId=SECURITYPATTERN_LISTPATTERNSTRUCTURE_ID):
        wx.ListCtrl.__init__(self,
                             parent,
                             winId,
                             size=wx.DefaultSize,
                             style=wx.LC_REPORT)
        b = Borg()
        self.dbProxy = b.dbProxy
        self.InsertColumn(0, 'Head Asset')
        self.SetColumnWidth(0, 100)
        self.InsertColumn(1, 'Type')
        self.SetColumnWidth(1, 75)
        self.InsertColumn(2, 'Nav')
        self.SetColumnWidth(2, 75)
        self.InsertColumn(3, 'Nry')
        self.SetColumnWidth(3, 50)
        self.InsertColumn(4, 'Role')
        self.SetColumnWidth(4, 50)
        self.InsertColumn(5, 'Tail Role')
        self.SetColumnWidth(5, 50)
        self.InsertColumn(6, 'Tail Nry')
        self.SetColumnWidth(6, 50)
        self.InsertColumn(7, 'Tail Nav')
        self.SetColumnWidth(7, 75)
        self.InsertColumn(8, 'Tail Type')
        self.SetColumnWidth(8, 75)
        self.InsertColumn(9, 'Tail Asset')
        self.SetColumnWidth(9, 100)
        self.theSelectedIdx = -1
        self.theDimMenu = wx.Menu()
        self.theDimMenu.Append(AA_MENUADD_ID, 'Add')
        self.theDimMenu.Append(AA_MENUDELETE_ID, 'Delete')
        self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
        wx.EVT_MENU(self.theDimMenu, AA_MENUADD_ID, self.onAddAssociation)
        wx.EVT_MENU(self.theDimMenu, AA_MENUDELETE_ID,
                    self.onDeleteAssociation)

        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected)
        self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnItemDeselected)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onAssetActivated)
コード例 #15
0
    def __init__(self, parent, id, title):
        wx.Frame.__init__(self,
                          parent,
                          wx.ID_ANY,
                          title,
                          size=(600, 300),
                          pos=(100, 100))

        self.txt = wx.TextCtrl(self, 1, style=wx.TE_MULTILINE)
        self.txt.SetEditable(False)
        self.txt.AppendText("Waiting for the RjzServer thread to start...\n\n")
        self.firstpost = True

        self.CreateStatusBar()  # A StatusBar in the bottom of the window

        # Setting up the menu.
        filemenu = wx.Menu()
        filemenu.Append(
            ID_DIR, "&Set scene directory",
            " Set the scene directory where your scenes are stored")
        filemenu.Append(ID_HELP, "&Help", " How to use RjzServer")
        filemenu.Append(ID_ABOUT, "&About", " Information about this program")
        filemenu.AppendSeparator()
        filemenu.Append(ID_EXIT, "E&xit", " Terminate the program")

        # Creating the menubar.
        menuBar = wx.MenuBar()
        menuBar.Append(filemenu,
                       "&File")  # Adding the "filemenu" to the MenuBar
        self.SetMenuBar(menuBar)  # Adding the MenuBar to the Frame content.

        # attach events to each menu item
        wx.EVT_MENU(self, ID_DIR, self.OnSetDir)
        wx.EVT_MENU(self, ID_ABOUT, self.OnAbout)
        wx.EVT_MENU(self, ID_HELP, self.OnHelp)
        wx.EVT_MENU(self, ID_EXIT, self.OnExit)
        # message events from outside the app
        EVT_RESULT(self, self.OnExtMsg)

        self.Show(True)
コード例 #16
0
    def __init__(self, parent, winId, dp, pList, boxSize=wx.DefaultSize):
        wx.ListCtrl.__init__(self,
                             parent,
                             winId,
                             size=boxSize,
                             style=wx.LC_REPORT)
        self.dbProxy = dp
        self.assetPropertyList = pList
        self.theCurrentEnvironment = ''
        self.InsertColumn(0, 'Nav')
        self.SetColumnWidth(0, 50)
        self.InsertColumn(1, 'Type')
        self.SetColumnWidth(1, 75)
        self.InsertColumn(2, 'Nry')
        self.SetColumnWidth(2, 50)
        self.InsertColumn(3, 'Role')
        self.SetColumnWidth(3, 50)
        self.InsertColumn(4, 'Tail Role')
        self.SetColumnWidth(4, 50)
        self.InsertColumn(5, 'Tail Nry')
        self.SetColumnWidth(5, 50)
        self.InsertColumn(6, 'Tail Type')
        self.SetColumnWidth(6, 75)
        self.InsertColumn(7, 'Tail Nav')
        self.SetColumnWidth(7, 50)
        self.InsertColumn(8, 'Tail Asset')
        self.SetColumnWidth(8, 100)
        self.theSelectedIdx = -1
        self.theDimMenu = wx.Menu()
        self.theDimMenu.Append(armid.AA_MENUADD_ID, 'Add')
        self.theDimMenu.Append(armid.AA_MENUDELETE_ID, 'Delete')
        self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
        wx.EVT_MENU(self.theDimMenu, armid.AA_MENUADD_ID,
                    self.onAddAssociation)
        wx.EVT_MENU(self.theDimMenu, armid.AA_MENUDELETE_ID,
                    self.onDeleteAssociation)

        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected)
        self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnItemDeselected)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onAssetActivated)
コード例 #17
0
    def InstallControls(self, frame, menuBar = None, toolBar = None, statusBar = None, document = None):
        
        menu = wx.Menu()
        
        index = menuBar.FindMenu(_("&World"))
        menuBar.Insert(index + 1, menu, _("&MMO"))

        menu = menuBar.GetMenu(menuBar.FindMenu(_("&MMO")))
        
        wx.EVT_MENU(frame, MMOService.RUN_CLIENT_ID, self.ProcessEvent)        
        menu.Append(MMOService.RUN_CLIENT_ID, ("Run MMO Client"), ("Runs the MMO Client"))
        
        menu.AppendSeparator()

        
        wx.EVT_MENU(frame, MMOService.RUN_MASTERSERVER_ID, self.ProcessEvent)        
        menu.Append(MMOService.RUN_MASTERSERVER_ID, ("Run Master Server"), ("Runs the Master Server"))

        wx.EVT_MENU(frame, MMOService.RUN_CHARACTERSERVER_ID, self.ProcessEvent)        
        menu.Append(MMOService.RUN_CHARACTERSERVER_ID, ("Run Character Server"), ("Runs the Character Server"))
        
        wx.EVT_MENU(frame, MMOService.RUN_WORLDDAEMON_ID, self.ProcessEvent)        
        menu.Append(MMOService.RUN_WORLDDAEMON_ID, ("Run World Daemon"), ("Runs the World Daemon"))
        
        menu.AppendSeparator()

        wx.EVT_MENU(frame, MMOService.CREATE_MASTERDB_ID, self.ProcessEvent)        
        menu.Append(MMOService.CREATE_MASTERDB_ID, ("Create Master DB"), ("Creates the Master Server Database"))

        wx.EVT_MENU(frame, MMOService.CREATE_CHARACTERDB_ID, self.ProcessEvent)        
        menu.Append(MMOService.CREATE_CHARACTERDB_ID, ("Create Character DB"), ("Creates the Character Server Database"))
コード例 #18
0
    def __init__(self, ID, size, parent = None, **args):
        """constructor for the base WaxEditFrame class

        **INPUTS**

        *wx.WindowID ID* -- the wx.Windows ID for the frame window

        *wx.Size or (INT, INT) size* -- initial size for the frame

        *wx.Window parent* -- the parent window, if any (usually not for
        single-frame applications)
        """

        self.deep_construct( WaxFrameBase,
                            {'closing': 0,
                             'ID': ID
                            }, args,
                            exclude_bases = {wx.Frame: 1},
                            enforce_value = {'ID': ID}
                           )
        wx.Frame.__init__(self, parent, self.ID, self.app_name, 
            wx.DefaultPosition, size)

        file_menu=wx.Menu()
        ID_OPEN_FILE = wx.NewId()
        ID_SAVE_FILE = wx.NewId()
        ID_SAVE_AS = wx.NewId()
        ID_EXIT = wx.NewId()
        ID_CLOSE_MENU = wx.NewId()
#        print ID_OPEN_FILE
        file_menu.Append(ID_OPEN_FILE,"&Open...","Open a file")
        file_menu.Append(ID_SAVE_FILE,"&Save","Save current file")
        file_menu.Append(ID_SAVE_AS,"Save &As...","Save current file")        
        file_menu.Append(ID_CLOSE_MENU,"&Close","Close window")
        file_menu.Append(ID_EXIT,"E&xit","Terminate")

        ID_CHOOSE_FONT = wx.NewId()
        format_menu = wx.Menu()
        format_menu.Append(ID_CHOOSE_FONT, "&Font...")        

        edit_menu = wx.Menu()

        menuBar=wx.MenuBar()
        wx.EVT_CLOSE(self, self.on_close)        
        menuBar.Append(file_menu,"&File");
        menuBar.Append(edit_menu,"&Edit");
        menuBar.Append(format_menu,"F&ormat");        
#        menuBar.Append(window_menu, "&Window");

        self.CreateStatusBar()

        self.SetMenuBar(menuBar)
        wx.EVT_MENU(self, ID_EXIT, self.quit_now)
        wx.EVT_MENU(self, ID_CLOSE_MENU, self.close_now)
        wx.EVT_MENU(self, ID_OPEN_FILE, self.on_open_file)
        wx.EVT_MENU(self, ID_SAVE_FILE,self.on_save)
        wx.EVT_MENU(self, ID_SAVE_AS,self.on_save_as)        
        wx.EVT_MENU(self, ID_CHOOSE_FONT, self.choose_font)
        wx.EVT_ACTIVATE(self, self.OnActivate) 
        self.most_recent_focus = None
コード例 #19
0
ファイル: PolyEditor.py プロジェクト: wangdyna/wxPython
    def __init__(self, parent, id, title, position, size):
        wx.Frame.__init__(self, parent, id, title, position, size)

        ## Set up the MenuBar
        MenuBar = wx.MenuBar()

        FileMenu = wx.Menu()
        FileMenu.Append(wx.NewId(), "&Close", "Close Application")
        wx.EVT_MENU(self, FileMenu.FindItem("Close"), self.OnQuit)

        MenuBar.Append(FileMenu, "&File")

        view_menu = wx.Menu()
        view_menu.Append(wx.NewId(), "Zoom to &Fit", "Zoom to fit the window")
        wx.EVT_MENU(self, view_menu.FindItem("Zoom to &Fit"), self.ZoomToFit)
        MenuBar.Append(view_menu, "&View")

        help_menu = wx.Menu()
        help_menu.Append(ID_ABOUT_MENU, "&About",
                         "More information About this program")
        wx.EVT_MENU(self, ID_ABOUT_MENU, self.OnAbout)
        MenuBar.Append(help_menu, "&Help")

        self.SetMenuBar(MenuBar)

        self.CreateStatusBar()
        # Add the Canvas
        self.Canvas = NavCanvas.NavCanvas(
            self, -1, (500, 500), Debug=0,
            BackgroundColor="DARK SLATE BLUE").Canvas

        wx.EVT_CLOSE(self, self.OnCloseWindow)

        FloatCanvas.EVT_MOTION(self.Canvas, self.OnMove)
        FloatCanvas.EVT_LEFT_UP(self.Canvas, self.OnLeftUp)
        FloatCanvas.EVT_LEFT_DOWN(self.Canvas, self.OnLeftClick)

        self.ResetSelections()

        return None
コード例 #20
0
    def __init__(self, parent, name):
        wx.Menu.__init__(self)

        self.parent = parent
        self.name = name

        self.Append(self.ID_EDIT, 'Edit')
        self.Append(self.ID_REMOVE, 'Remove')
        self.Append(self.ID_GRAPH, 'Show graph')

        sub_menu = wx.Menu()
        sub_menu.AppendRadioItem(self.ID_FRIEND, 'Friend')
        sub_menu.AppendRadioItem(self.ID_NEUTRAL, 'Neutral')
        sub_menu.AppendRadioItem(self.ID_BOZO, 'Bozo')
        self.AppendMenu(self.ID_STATUS, 'Status', sub_menu)
        status = playerdb.get_player_status(name)
        if status == PLAYER_STATUS_FRIEND:
            pos = self.ID_FRIEND
        elif status == PLAYER_STATUS_BOZO:
            pos = self.ID_BOZO
        else:
            pos = self.ID_NEUTRAL
        it = sub_menu.FindItemById(pos)
        if it:
            it.Check()

        wx.EVT_MENU(self, self.ID_EDIT, self.OnEdit)
        wx.EVT_MENU(self, self.ID_REMOVE, self.OnRemove)
        wx.EVT_MENU(self, self.ID_GRAPH, self.OnGraph)
        wx.EVT_MENU(self, self.ID_FRIEND, self.OnFriend)
        wx.EVT_MENU(self, self.ID_NEUTRAL, self.OnNeutral)
        wx.EVT_MENU(self, self.ID_BOZO, self.OnBozo)
コード例 #21
0
    def __init__(self, parent, mainControl, id=-1):
        wx.Panel.__init__(self, parent, id, style=wx.WANTS_CHARS)
        BasicDocPagePresenter.__init__(self, mainControl)
        self.SetSizer(LayerSizer())

        res = xrc.XmlResource.Get()
        self.tabContextMenu = res.LoadMenu("MenuDocPagePresenterTabPopup")

        self.mainTreePositionHint = None  # The tree ctrl uses this to remember
        # which element was selected if same page appears multiple
        # times in tree. DocPagePresenter class itself does not modify it.

        self.tabProgressBar = None
        self.tabProgressCount = {}

        wx.GetApp().getMiscEvent().addListener(self)

        wx.EVT_MENU(self, GUI_ID.CMD_PAGE_HISTORY_LIST,
                    lambda evt: self.viewPageHistory())
        wx.EVT_MENU(self, GUI_ID.CMD_PAGE_HISTORY_LIST_UP,
                    lambda evt: self.viewPageHistory(-1))
        wx.EVT_MENU(self, GUI_ID.CMD_PAGE_HISTORY_LIST_DOWN,
                    lambda evt: self.viewPageHistory(1))
        wx.EVT_MENU(self, GUI_ID.CMD_PAGE_HISTORY_GO_BACK,
                    lambda evt: self.pageHistory.goInHistory(-1))
        wx.EVT_MENU(self, GUI_ID.CMD_PAGE_HISTORY_GO_FORWARD,
                    lambda evt: self.pageHistory.goInHistory(1))
        wx.EVT_MENU(self, GUI_ID.CMD_PAGE_GO_UPWARD_FROM_SUBPAGE,
                    lambda evt: self.goUpwardFromSubpage())
コード例 #22
0
    def __init__(self,
                 parent,
                 id,
                 title,
                 image=None,
                 scale='log_{10}',
                 size=wx.Size(550, 470)):
        """
        comment
        :Param data: image array got from imread() of matplotlib [narray]
        :param parent: parent panel/container
        """
        # Initialize the Frame object
        PlotFrame.__init__(self,
                           parent,
                           id,
                           title,
                           scale,
                           size,
                           show_menu_icons=False)
        self.parent = parent
        self.data = image
        self.file_name = title

        menu = wx.Menu()
        id = wx.NewId()
        item = wx.MenuItem(menu, id, "&Convert to Data")
        menu.AppendItem(item)
        wx.EVT_MENU(self, id, self.on_set_data)
        self.menu_bar.Append(menu, "&Image")

        menu_help = wx.Menu()
        id = wx.NewId()
        item = wx.MenuItem(menu_help, id, "&HowTo")
        menu_help.AppendItem(item)
        wx.EVT_MENU(self, id, self.on_help)
        self.menu_bar.Append(menu_help, "&Help")

        self.SetMenuBar(self.menu_bar)
        self.im_show(image)
コード例 #23
0
    def makeFilemenu(self):
        #self.menubar = wx.MenuBar()
        #self.PopupMenu(menu)
        #self.SetMenuBar(self.menubar)
        self.filemenu = wx.Menu("&File")
        self.filemenu.Append(wx.ID_NEW, "New\tCtrl-n", "Create a new file",
                             wx.ITEM_NORMAL)
        self.filemenu.Append(wx.ID_OPEN, "Open\tCtrl-o",
                             "Open a file containing a new structure",
                             wx.ITEM_NORMAL)
        self.filemenu.Append(wx.ID_SAVE, "Save\tCtrl-s",
                             "Save the current structure", wx.ITEM_NORMAL)
        self.filemenu.Append(wx.ID_SAVEAS, "Save As",
                             "Save structure under a new filename",
                             wx.ITEM_NORMAL)
        ID_POV = wx.NewId()
        self.filemenu.Append(ID_POV, "EXport Povray\tCtrl-x",
                             "Export and render with POVRay", wx.ITEM_NORMAL)
        self.filemenu.Append(wx.ID_CLOSE, "Close\tCtrl-w",
                             "Close the current structure", wx.ITEM_NORMAL)
        self.filemenu.Append(wx.ID_EXIT, "Exit\tCtrl-q", "Quit the program",
                             wx.ITEM_NORMAL)
        #self.toolbar.AddControl(self.filemenu)

        wx.EVT_MENU(self, wx.ID_NEW, self.new_file)
        wx.EVT_MENU(self, wx.ID_OPEN, self.load_file)
        wx.EVT_MENU(self, wx.ID_SAVE, self.save_as)
        wx.EVT_MENU(self, wx.ID_SAVEAS, self.save_as)
        wx.EVT_MENU(self, ID_POV, self.render_povray)
        wx.EVT_MENU(self, wx.ID_EXIT, self.quit)

        return
コード例 #24
0
ファイル: MusicPlayer.py プロジェクト: deepak12cs46/muzik
 def __init__(self, parent, id):
     wx.Frame.__init__(self,
                       parent,
                       id,
                       'Frame aka window',
                       size=(180, 100))
     panel = wx.Panel(self)
     self.CreateStatusBar()
     #Create Play and Stop Buttons
     buttonStop = wx.Button(panel,
                            label="Stop",
                            pos=(60, 10),
                            size=(60, 40))
     buttonPlay = wx.Button(panel,
                            label="Play",
                            pos=(00, 10),
                            size=(60, 40))
     buttonOpen = wx.Button(panel,
                            label="Open",
                            pos=(120, 10),
                            size=(60, 40))
     #Bind the buttons to their respective event handlers
     self.Bind(wx.EVT_BUTTON, self.playbutton, buttonPlay)
     self.Bind(wx.EVT_BUTTON, self.onStop, buttonStop)
     self.Bind(wx.EVT_BUTTON, self.onOpen, buttonOpen)
     self.Bind(wx.EVT_CLOSE, self.closewindow)
     #Set up the menu
     filemenu = wx.Menu()
     filemenu.Append(ID_OPEN, "&Open", "Open a mp3 file")
     filemenu.AppendSeparator()
     filemenu.Append(ID_EXIT, "E&xit", "Terminate the app")
     #Creating the MenuBar
     menubar = wx.MenuBar()
     menubar.Append(filemenu, "&File")
     self.SetMenuBar(menubar)
     self.Show(True)
     #Setting the menu event handlers
     wx.EVT_MENU(self, ID_OPEN, self.onOpen)
     wx.EVT_MENU(self, ID_EXIT, self.onExit)
     self.the_player = Process(target=self.play_music)
コード例 #25
0
    def CreateMenuBar(self):
        """Create our menu-bar for triggering operations"""
        menubar = wx.MenuBar()
        menu = wx.Menu()
        menu.Append(ID_OPEN, _('&Open'), _('Open a new profile file'))
        menu.AppendSeparator()
        menu.Append(ID_EXIT, _('&Close'), _('Close this RunSnakeRun window'))
        menubar.Append(menu, _('&File'))
        menu = wx.Menu()
        self.packageMenuItem = menu.AppendCheckItem(
            ID_PACKAGE_VIEW, _('&File View'),
            _('View time spent by package/module'))
        self.percentageMenuItem = menu.AppendCheckItem(
            ID_PERCENTAGE_VIEW, _('&Percentage View'),
            _('View time spent as percent of overall time'))
        self.rootViewItem = menu.Append(ID_ROOT_VIEW, _('&Root View (Home)'),
                                        _('View the root of the tree'))
        self.backViewItem = menu.Append(ID_BACK_VIEW, _('&Back'),
                                        _('Go back in your viewing history'))
        self.upViewItem = menu.Append(
            ID_UP_VIEW, _('&Up'),
            _('Go "up" to the parent of this node with the largest cummulative total'
              ))

        # This stuff isn't really all that useful for profiling,
        # it's more about how to generate graphics to describe profiling...
        #        self.deeperViewItem = menu.Append(
        #            ID_DEEPER_VIEW, _('&Deeper'), _('View deeper squaremap views')
        #        )
        #        self.shallowerViewItem = menu.Append(
        #            ID_SHALLOWER_VIEW, _('&Shallower'), _('View shallower squaremap views')
        #        )
        #        wx.ToolTip.Enable(True)
        menubar.Append(menu, _('&View'))
        self.SetMenuBar(menubar)

        wx.EVT_MENU(self, ID_EXIT, lambda evt: self.Close(True))
        wx.EVT_MENU(self, ID_OPEN, self.OnOpenFile)
        wx.EVT_MENU(self, ID_PACKAGE_VIEW, self.OnPackageView)
        wx.EVT_MENU(self, ID_PERCENTAGE_VIEW, self.OnPercentageView)
        wx.EVT_MENU(self, ID_UP_VIEW, self.OnUpView)
        wx.EVT_MENU(self, ID_DEEPER_VIEW, self.OnDeeperView)
        wx.EVT_MENU(self, ID_SHALLOWER_VIEW, self.OnShallowerView)
        wx.EVT_MENU(self, ID_ROOT_VIEW, self.OnRootView)
        wx.EVT_MENU(self, ID_BACK_VIEW, self.OnBackView)
コード例 #26
0
    def __init__(self, parent, id, title, objects):
        wx.Frame.__init__(self, parent, id, title, wx.PyDefaultPosition,
                          wx.Size(400, 400))

        # Now Create the menu bar and items
        self.mainmenu = wx.MenuBar()

        menu = wx.Menu()
        menu.Append(200, '&Print...', 'Print the current plot')
        wx.EVT_MENU(self, 200, self.OnFilePrint)
        menu.Append(209, 'E&xit', 'Enough of this already!')
        wx.EVT_MENU(self, 209, self.OnFileExit)
        self.mainmenu.Append(menu, '&File')

        menu = wx.Menu()
        menu.Append(210, '&Draw', 'Draw plots')
        wx.EVT_MENU(self, 210, self.OnPlotDraw)
        menu.Append(211, '&Redraw', 'Redraw plots')
        wx.EVT_MENU(self, 211, self.OnPlotRedraw)
        menu.Append(212, '&Clear', 'Clear canvas')
        wx.EVT_MENU(self, 212, self.OnPlotClear)
        self.mainmenu.Append(menu, '&Plot')

        menu = wx.Menu()
        menu.Append(220, '&About', 'About this thing...')
        wx.EVT_MENU(self, 220, self.OnHelpAbout)
        self.mainmenu.Append(menu, '&Help')

        self.SetMenuBar(self.mainmenu)

        # A status bar to tell people what's happening
        self.CreateStatusBar(1)
コード例 #27
0
    def __init__(self,
                 parent,
                 winId,
                 dp,
                 goalList=False,
                 boxSize=wx.DefaultSize):
        wx.ListCtrl.__init__(self,
                             parent,
                             winId,
                             size=boxSize,
                             style=wx.LC_REPORT)
        self.dbProxy = dp
        self.goalList = goalList
        self.theCurrentEnvironment = ''
        if (self.goalList == True):
            self.InsertColumn(0, 'Goal')
        else:
            self.InsertColumn(0, 'Sub-Goal')

        self.SetColumnWidth(0, 200)
        self.InsertColumn(1, 'Type')
        self.SetColumnWidth(1, 100)
        self.InsertColumn(2, 'Refinement')
        self.SetColumnWidth(2, 100)
        self.InsertColumn(3, 'Alternative')
        self.SetColumnWidth(3, 50)
        self.InsertColumn(4, 'Rationale')
        self.SetColumnWidth(4, 200)
        self.theSelectedIdx = -1
        self.theDimMenu = wx.Menu()
        self.theDimMenu.Append(SGA_MENUADD_ID, 'Add')
        self.theDimMenu.Append(SGA_MENUDELETE_ID, 'Delete')
        self.Bind(wx.EVT_RIGHT_DOWN, self.OnRightDown)
        wx.EVT_MENU(self.theDimMenu, SGA_MENUADD_ID, self.onAddAssociation)
        wx.EVT_MENU(self.theDimMenu, SGA_MENUDELETE_ID,
                    self.onDeleteAssociation)

        self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnItemSelected)
        self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnItemDeselected)
        self.Bind(wx.EVT_LIST_ITEM_ACTIVATED, self.onGoalActivated)
コード例 #28
0
    def __do_events(self):
        wx.EVT_BUTTON(self.parent_window, self.tab_send.GetId(),
                      self.OnSendMessage)
        wx.EVT_BUTTON(self.parent_window, self.tab_clear.GetId(),
                      self.OnClearMessage)

        wx.EVT_TEXT_ENTER(self.tab_panel, self.tab_chatBox.GetId(),
                          self.OnSendMessage)

        wx.EVT_KEY_DOWN(self.parent_window, self.OnKeyDown)

        wx.EVT_LIST_ITEM_RIGHT_CLICK(self.tab_panel,
                                     self.tab_listPeople.GetId(),
                                     self.OnRightClick_People)

        wx.EVT_RIGHT_DOWN(self.tab_chatArea, self.OnRightClick_ChatArea)
        #wx.EVT_RIGHT_DOWN(self.tab_panel, self.tab_chatArea.GetId(), self.OnRightClick_ChatArea)

        wx.EVT_MENU(self.tab_panel, ID_POPUP_USERS_PRIVATEMSG,
                    self.OnPrivateMessage)
        wx.EVT_MENU(self.tab_panel, ID_POPUP_USERS_SETAWAY, self.OnSetAway)
        wx.EVT_MENU(self.tab_panel, ID_POPUP_USERS_GETINFO, self.OnGetUserInfo)

        wx.EVT_MENU(self.tab_panel, ID_POPUP_CHANNEL_LOGGING, self.OnLogging)
        wx.EVT_MENU(self.tab_panel, ID_POPUP_CHANNEL_TIMESTAMP,
                    self.OnTimeStamps)
        wx.EVT_MENU(self.tab_panel, ID_POPUP_CHANNEL_CLOSE, self.OnCloseTab)
コード例 #29
0
    def MakeMenu(self):
        # create the file menu
        menu1 = wx.Menu()

        # Using the "\tKeyName" syntax automatically creates a
        # wx.AcceleratorTable for this frame and binds the keys to
        # the menu items.
        menu1.Append(idOPEN, "&Open\tCtrl-O", "Open a doodle file")
        menu1.Append(idSAVE, "&Save\tCtrl-S", "Save the doodle")
        menu1.Append(idSAVEAS, "Save &As", "Save the doodle in a new file")
        menu1.AppendSeparator()
        menu1.Append(idCLEAR, "&Clear", "Clear the current doodle")
        menu1.AppendSeparator()
        menu1.Append(idEXIT, "E&xit", "Terminate the application")

        # and the help menu
        menu2 = wx.Menu()
        menu2.Append(idABOUT, "&About\tCtrl-H",
                     "Display the gratuitous 'about this app' thingamajig")

        # and add them to a menubar
        menuBar = wx.MenuBar()
        menuBar.Append(menu1, "&File")
        menuBar.Append(menu2, "&Help")
        self.SetMenuBar(menuBar)

        wx.EVT_MENU(self, idOPEN, self.OnMenuOpen)
        wx.EVT_MENU(self, idSAVE, self.OnMenuSave)
        wx.EVT_MENU(self, idSAVEAS, self.OnMenuSaveAs)
        wx.EVT_MENU(self, idCLEAR, self.OnMenuClear)
        wx.EVT_MENU(self, idEXIT, self.OnMenuExit)
        wx.EVT_MENU(self, idABOUT, self.OnMenuAbout)
コード例 #30
0
ファイル: configruation.py プロジェクト: ver007/NovalIDE
    def OnContextMenu(self, event):
        menu = wx.Menu()
        x, y = event.GetPosition().x, event.GetPosition().y
        menu.Append(ID_COPY_INTERPRETER_NAME, _("Copy Name"))
        wx.EVT_MENU(self, ID_COPY_INTERPRETER_NAME, self.ProcessEvent)
        wx.EVT_UPDATE_UI(self, ID_COPY_INTERPRETER_NAME,
                         self.ProcessUpdateUIEvent)

        menu.Append(ID_COPY_INTERPRETER_VERSION, _("Copy Version"))
        wx.EVT_MENU(self, ID_COPY_INTERPRETER_VERSION, self.ProcessEvent)
        wx.EVT_UPDATE_UI(self, ID_COPY_INTERPRETER_VERSION,
                         self.ProcessUpdateUIEvent)

        menu.Append(ID_COPY_INTERPRETER_PATH, _("Copy Path"))
        wx.EVT_MENU(self, ID_COPY_INTERPRETER_PATH, self.ProcessEvent)
        wx.EVT_UPDATE_UI(self, ID_COPY_INTERPRETER_PATH,
                         self.ProcessUpdateUIEvent)

        menu.Append(ID_MODIFY_INTERPRETER_NAME, _("Modify Name"))
        wx.EVT_MENU(self, ID_MODIFY_INTERPRETER_NAME, self.ProcessEvent)
        wx.EVT_UPDATE_UI(self, ID_MODIFY_INTERPRETER_NAME,
                         self.ProcessUpdateUIEvent)

        menu.Append(ID_REMOVE_INTERPRETER, _("Remove"))
        wx.EVT_MENU(self, ID_REMOVE_INTERPRETER, self.ProcessEvent)
        wx.EVT_UPDATE_UI(self, ID_REMOVE_INTERPRETER,
                         self.ProcessUpdateUIEvent)

        menu.Append(ID_NEW_INTERPRETER_VIRTUALENV, _("New VirtualEnv"))
        wx.EVT_MENU(self, ID_NEW_INTERPRETER_VIRTUALENV, self.ProcessEvent)
        wx.EVT_UPDATE_UI(self, ID_NEW_INTERPRETER_VIRTUALENV,
                         self.ProcessUpdateUIEvent)

        self.dvlc.PopupMenu(menu, wx.Point(x, y))
        menu.Destroy()