Exemplo n.º 1
0
def afterinit(win):
    wx.EVT_UPDATE_UI(win, win.IDM_EDIT_CUT, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_EDIT_COPY, win.OnUpdateUI)
    if wx.Platform == '__WXMSW__':
        wx.EVT_UPDATE_UI(win, win.IDM_EDIT_PASTE, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_EDIT_UNDO, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_EDIT_REDO, win.OnUpdateUI)
Exemplo n.º 2
0
    def InstallControls(self,
                        frame,
                        menuBar=None,
                        toolBar=None,
                        statusBar=None,
                        document=None):
        if document and document.GetDocumentTemplate().GetDocumentType(
        ) != TextDocument:
            return
        config = wx.ConfigBase_Get()

        formatMenuIndex = menuBar.FindMenu(_("&Format"))
        if formatMenuIndex > -1:
            formatMenu = menuBar.GetMenu(formatMenuIndex)
        else:
            formatMenu = wx.Menu()
        formatMenu = wx.Menu()
        if not menuBar.FindItemById(TextService.WORD_WRAP_ID):
            formatMenu.AppendCheckItem(
                TextService.WORD_WRAP_ID, _("Word Wrap"),
                _("Wraps text horizontally when checked"))
            formatMenu.Check(TextService.WORD_WRAP_ID,
                             config.ReadInt("TextEditorWordWrap", True))
            wx.EVT_MENU(frame, TextService.WORD_WRAP_ID, frame.ProcessEvent)
            wx.EVT_UPDATE_UI(frame, TextService.WORD_WRAP_ID,
                             frame.ProcessUpdateUIEvent)
        if not menuBar.FindItemById(TextService.CHOOSE_FONT_ID):
            formatMenu.Append(TextService.CHOOSE_FONT_ID, _("Font..."),
                              _("Sets the font to use"))
            wx.EVT_MENU(frame, TextService.CHOOSE_FONT_ID, frame.ProcessEvent)
            wx.EVT_UPDATE_UI(frame, TextService.CHOOSE_FONT_ID,
                             frame.ProcessUpdateUIEvent)
        if formatMenuIndex == -1:
            viewMenuIndex = menuBar.FindMenu(_("&View"))
            menuBar.Insert(viewMenuIndex + 1, formatMenu, _("&Format"))
Exemplo n.º 3
0
    def __init__(self, parent, mainframe, filename, documenttype):
        self.initmixin()

        wx.Panel.__init__(self, parent, -1)
        DocumentBase.DocumentBase.__init__(self, parent, filename,
                                           documenttype)
        self.mainframe = mainframe
        if sys.platform == 'win32':
            self.html = IEHtmlWindow(self, filename)
        else:
            self.html = DefaultHtmlWindow(self, filename)
            self.html.SetRelatedFrame(
                mainframe, mainframe.app.appname + " - Browser [%s]")
            self.html.SetRelatedStatusBar(0)

        self.box = wx.BoxSizer(wx.VERTICAL)

        subbox = wx.BoxSizer(wx.HORIZONTAL)

        self.ID_EDIT = wx.NewId()
        self.btnEdit = wx.Button(self, self.ID_EDIT, tr("Edit"))
        subbox.Add(self.btnEdit, 0, wx.RIGHT, 2)

        self.ID_BACK = wx.NewId()
        self.btnBack = wx.Button(self, self.ID_BACK, "<", size=(22, -1))
        subbox.Add(self.btnBack, 0, wx.RIGHT, 2)

        self.ID_FORWARD = wx.NewId()
        self.btnForward = wx.Button(self, self.ID_FORWARD, ">", size=(22, -1))
        subbox.Add(self.btnForward, 0, wx.RIGHT, 2)

        self.ID_REFRESH = wx.NewId()
        self.btnRefresh = wx.Button(self, self.ID_REFRESH, tr("Refresh"))
        subbox.Add(self.btnRefresh, 0, wx.RIGHT, 2)

        self.box.Add(subbox, 0, wx.GROW)

        self.box.Add(wx.StaticLine(self, -1), 0, wx.EXPAND)

        if sys.platform == 'win32':
            self.box.Add(self.html.ie, 1, wx.GROW)
        else:
            self.box.Add(self.html, 1, wx.GROW)

        self.SetSizer(self.box)
        self.SetAutoLayout(True)

        self.needcheck = False
        self.pageimagename = 'htmlview'

        wx.EVT_BUTTON(self.btnEdit, self.ID_EDIT, self.OnEdit)
        wx.EVT_BUTTON(self.btnBack, self.ID_BACK, self.OnBack)
        wx.EVT_BUTTON(self.btnForward, self.ID_FORWARD, self.OnForward)
        wx.EVT_BUTTON(self.btnRefresh, self.ID_REFRESH, self.OnRefresh)
        wx.EVT_UPDATE_UI(self.btnBack, self.ID_BACK, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.btnForward, self.ID_FORWARD, self.OnUpdateUI)
        if sys.platform == 'win32':
            import wx.lib.iewin as iewin
            iewin.EVT_StatusTextChange(self.html.ie, self.html.ie.GetId(),
                                       self.OnStatusTextChange)
Exemplo n.º 4
0
    def InstallControls(self,
                        frame,
                        menuBar=None,
                        toolBar=None,
                        statusBar=None,
                        document=None):
        FindService.FindService.InstallControls(self, frame, menuBar, toolBar,
                                                statusBar, document)

        editMenu = menuBar.GetMenu(menuBar.FindMenu(_("&Edit")))
        wx.EVT_MENU(frame, FindInDirService.FINDFILE_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, FindInDirService.FINDFILE_ID,
                         self.ProcessUpdateUIEvent)
        editMenu.Append(
            FindInDirService.FINDFILE_ID, _("Find in File...\tCtrl+Shift+F"),
            _("Searches for the specified text in the current file"))
        wx.EVT_MENU(frame, FindInDirService.FINDALL_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, FindInDirService.FINDALL_ID,
                         self.ProcessUpdateUIEvent)
        editMenu.Append(
            FindInDirService.FINDALL_ID, _("Find in Project...\tCtrl+Shift+P"),
            _("Searches for the specified text in all the files in the project"
              ))
        wx.EVT_MENU(frame, FindInDirService.FINDDIR_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, FindInDirService.FINDDIR_ID,
                         self.ProcessUpdateUIEvent)
        editMenu.Append(
            FindInDirService.FINDDIR_ID,
            _("Find in Directory...\tCtrl+Shift+D"),
            _("Searches for the specified text in all the files in the directory"
              ))
Exemplo n.º 5
0
 def __init__(self, parent, value):
     pre = wx.PreDialog()
     g.frame.res.LoadOnDialog(pre, parent, 'DIALOG_CONTENT_CHECKLIST')
     self.PostCreate(pre)
     self.list = xrc.XRCCTRL(self, 'CHECK_LIST')
     # Set list items
     i = 0
     for v, ch in value:
         self.list.Append(v)
         self.list.Check(i, ch)
         i += 1
     self.SetAutoLayout(True)
     self.GetSizer().Fit(self)
     # Callbacks
     self.ID_BUTTON_APPEND = xrc.XRCID('BUTTON_APPEND')
     self.ID_BUTTON_REMOVE = xrc.XRCID('BUTTON_REMOVE')
     self.ID_BUTTON_UP = xrc.XRCID('BUTTON_UP')
     self.ID_BUTTON_DOWN = xrc.XRCID('BUTTON_DOWN')
     wx.EVT_CHECKLISTBOX(self, self.list.GetId(), self.OnCheck)
     wx.EVT_BUTTON(self, self.ID_BUTTON_UP, self.OnButtonUp)
     wx.EVT_BUTTON(self, self.ID_BUTTON_DOWN, self.OnButtonDown)
     wx.EVT_BUTTON(self, self.ID_BUTTON_APPEND, self.OnButtonAppend)
     wx.EVT_BUTTON(self, self.ID_BUTTON_REMOVE, self.OnButtonRemove)
     wx.EVT_UPDATE_UI(self, self.ID_BUTTON_UP, self.OnUpdateUI)
     wx.EVT_UPDATE_UI(self, self.ID_BUTTON_DOWN, self.OnUpdateUI)
     wx.EVT_UPDATE_UI(self, self.ID_BUTTON_REMOVE, self.OnUpdateUI)
Exemplo n.º 6
0
    def InstallControls(self, frame, menuBar = None, toolBar = None, statusBar = None, document = None):
        if document and document.GetDocumentTemplate().GetDocumentType() != STCTextEditor.TextDocument:
            return
        if not document and wx.GetApp().GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI:
            return

        viewMenu = menuBar.GetMenu(menuBar.FindMenu(_("&View")))
        
        viewMenu.AppendSeparator()
        item = wx.MenuItem(viewMenu,ID_NEXT_POS, _("Next Position"), _("Goto next position in history."))
        forward_image_path = os.path.join(sysutilslib.mainModuleDir, "noval", "tool", "bmp_source", "forward.png")
        item.SetBitmap(wx.BitmapFromImage(wx.Image(forward_image_path,wx.BITMAP_TYPE_ANY)))
        viewMenu.AppendItem(item)
        item = wx.MenuItem(viewMenu,ID_PRE_POS, _("Previous Position"), _("Goto previous position in history."))
        backward_image_path = os.path.join(sysutilslib.mainModuleDir, "noval", "tool", "bmp_source", "backward.png")
        item.SetBitmap(wx.BitmapFromImage(wx.Image(backward_image_path,wx.BITMAP_TYPE_ANY)))
        viewMenu.AppendItem(item)
        wx.EVT_MENU(frame, ID_NEXT_POS, frame.ProcessEvent)
        wx.EVT_MENU(frame, ID_PRE_POS, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, ID_NEXT_POS, frame.ProcessUpdateUIEvent)
        wx.EVT_UPDATE_UI(frame, ID_PRE_POS, frame.ProcessUpdateUIEvent)

        forward_bmp_path = os.path.join(sysutilslib.mainModuleDir, "noval", "tool", "bmp_source", "forward.png")
        forward_bmp = wx.Bitmap(forward_bmp_path, wx.BITMAP_TYPE_PNG)
        backward_bmp_path = os.path.join(sysutilslib.mainModuleDir, "noval", "tool", "bmp_source", "backward.png")
        backward_bmp = wx.Bitmap(backward_bmp_path, wx.BITMAP_TYPE_PNG)
        toolBar.AddTool(ID_PRE_POS, backward_bmp, shortHelpString = _("Previous Position"), longHelpString = _("Goto previous position in history."))
        toolBar.AddTool(ID_NEXT_POS, forward_bmp, shortHelpString = _("Next Position"), longHelpString = _("Goto next position in history."))
Exemplo n.º 7
0
def afterinit(win):
    wx.EVT_UPDATE_UI(win, win.IDM_WINDOW_LEFT, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_WINDOW_BOTTOM, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_WINDOW_SHELL, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_WINDOW_MESSAGE, win.OnUpdateUI)
    win.messagewindow = None
    win.shellwindow = None
Exemplo n.º 8
0
def on_enter(mainframe, document):
    wx.EVT_UPDATE_UI(mainframe, mainframe.IDM_LUA_RUN,
                     mainframe.OnLuaRunUpdateUI)
    wx.EVT_UPDATE_UI(mainframe, mainframe.IDM_LUA_SETARGS,
                     mainframe.OnLuaRunUpdateUI)
    wx.EVT_UPDATE_UI(mainframe, mainframe.IDM_LUA_END,
                     mainframe.OnLuaRunUpdateUI)
Exemplo n.º 9
0
def on_enter(mainframe, document):
    wx.EVT_UPDATE_UI(mainframe, mainframe.IDM_PYTHON_RUN,
                     mainframe.OnPythonRunUpdateUI)
    wx.EVT_UPDATE_UI(mainframe, mainframe.IDM_PYTHON_SETARGS,
                     mainframe.OnPythonRunUpdateUI)
    wx.EVT_UPDATE_UI(mainframe, mainframe.IDM_PYTHON_END,
                     mainframe.OnPythonRunUpdateUI)
Exemplo n.º 10
0
def editor_init(win):
    wx.EVT_UPDATE_UI(win, win.IDPM_CUT, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDPM_COPY, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDPM_PASTE, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDPM_UNDO, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDPM_REDO, win.OnUpdateUI)
    wx.EVT_LEFT_DCLICK(win, win.OnDClick)
Exemplo n.º 11
0
 def CreatePopupMenu(self):
     menu = wx.Menu()   
     menu.Append(wx.ID_UNDO, _("Undo"))
     menu.Append(wx.ID_REDO, _("Redo"))
     menu.AppendSeparator()       
     menu.Append(wx.ID_CUT, _("Cut"))
     menu.Append(wx.ID_COPY, _("Copy\tCtrl+C"))
     menu.Append(wx.ID_PASTE, _("Paste\tCtrl+V"))
     menu.Append(wx.ID_CLEAR, _("Clear"))
     menu.AppendSeparator()
     menu.Append(wx.ID_SELECTALL, _("Select All\tCtrl+A"))
                 
     menu.AppendCheckItem(TextService.WORD_WRAP_ID, _("Word Wrap"))
     wx.EVT_MENU(self, wx.ID_UNDO, self.DSProcessEvent) 
     wx.EVT_UPDATE_UI(self, wx.ID_UNDO, self.DSProcessUpdateUIEvent)
     wx.EVT_MENU(self, wx.ID_REDO, self.DSProcessEvent) 
     wx.EVT_UPDATE_UI(self, wx.ID_REDO, self.DSProcessUpdateUIEvent)
     wx.EVT_MENU(self, wx.ID_CUT, self.DSProcessEvent) 
     wx.EVT_UPDATE_UI(self, wx.ID_CUT, self.DSProcessUpdateUIEvent)
     wx.EVT_MENU(self, wx.ID_COPY, self.DSProcessEvent) 
     wx.EVT_UPDATE_UI(self, wx.ID_COPY, self.DSProcessUpdateUIEvent)
     wx.EVT_MENU(self, wx.ID_PASTE, self.DSProcessEvent) 
     wx.EVT_UPDATE_UI(self, wx.ID_PASTE, self.DSProcessUpdateUIEvent)
     wx.EVT_MENU(self, wx.ID_CLEAR, self.DSProcessEvent) 
     wx.EVT_UPDATE_UI(self, wx.ID_CLEAR, self.DSProcessUpdateUIEvent)
     wx.EVT_MENU(self, wx.ID_SELECTALL, self.DSProcessEvent) 
     wx.EVT_UPDATE_UI(self, wx.ID_SELECTALL, self.DSProcessUpdateUIEvent)
     wx.EVT_MENU(self, TextService.WORD_WRAP_ID, self.DSProcessEvent) 
     wx.EVT_UPDATE_UI(self, TextService.WORD_WRAP_ID, self.DSProcessUpdateUIEvent)
     return menu
Exemplo n.º 12
0
def afterinit(win):
    win.m3u = None
    win.isloop = True
    win.src = None
    win.selectedid = -1
    win.musiclist = None
    win.music = pySonic.World()
    win.flag_pause = False
    win.playing = None
    win.playingid = None

    wx.EVT_UPDATE_UI(win, win.IDM_MUSIC_PLAY, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_MUSIC_STOP, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDM_MUSIC_PAUSE, win.OnUpdateUI)
Exemplo n.º 13
0
    def InstallControls(self, frame, menuBar = None, toolBar = None, statusBar = None, document = None):
        menu = menuBar.GetMenu(menuBar.FindMenu(_("Project")))

        menu.AppendSeparator()

        wx.EVT_MENU(frame, SVNService.SVN_UPDATE_ALL_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, SVNService.SVN_UPDATE_ALL_ID, self.ProcessUpdateUIEvent)
        menu.Append(SVNService.SVN_UPDATE_ALL_ID, _("SVN Update All in Project"), _("Update all files in a project from Subversion"))
        wx.EVT_MENU(frame, SVNService.SVN_CHECKIN_ALL_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, SVNService.SVN_CHECKIN_ALL_ID, self.ProcessUpdateUIEvent)
        menu.Append(SVNService.SVN_CHECKIN_ALL_ID, _("SVN Commit All in Project..."), _("Commit all files changes in a project to Subversion"))
        wx.EVT_MENU(frame, SVNService.SVN_UPDATE_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, SVNService.SVN_UPDATE_ID, self.ProcessUpdateUIEvent)
        menu.Append(SVNService.SVN_UPDATE_ID, _("SVN Update"), _("Update file from Subversion"))
        wx.EVT_MENU(frame, SVNService.SVN_CHECKIN_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, SVNService.SVN_CHECKIN_ID, self.ProcessUpdateUIEvent)
        menu.Append(SVNService.SVN_CHECKIN_ID, _("SVN Commit..."), _("Commit file changes to Subversion"))
        wx.EVT_MENU(frame, SVNService.SVN_CHECKOUT_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, SVNService.SVN_CHECKOUT_ID, self.ProcessUpdateUIEvent)
        menu.Append(SVNService.SVN_CHECKOUT_ID, _("SVN Checkout..."), _("Checkout file from Subversion"))
        wx.EVT_MENU(frame, SVNService.SVN_REVERT_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, SVNService.SVN_REVERT_ID, self.ProcessUpdateUIEvent)
        menu.Append(SVNService.SVN_REVERT_ID, _("SVN Revert"), _("Revert file from Subversion"))

        menu.AppendSeparator()

        wx.EVT_MENU(frame, SVNService.SVN_ADD_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, SVNService.SVN_ADD_ID, self.ProcessUpdateUIEvent)
        menu.Append(SVNService.SVN_ADD_ID, _("SVN Add"), _("Add file to Subversion"))
        wx.EVT_MENU(frame, SVNService.SVN_DELETE_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, SVNService.SVN_DELETE_ID, self.ProcessUpdateUIEvent)
        menu.Append(SVNService.SVN_DELETE_ID, _("SVN Delete"), _("Delete file from Subversion"))
Exemplo n.º 14
0
    def InstallControls(self,
                        frame,
                        menuBar=None,
                        toolBar=None,
                        statusBar=None,
                        document=None):
        """ Install Find Service Menu Items """
        editMenu = menuBar.GetMenu(menuBar.FindMenu(_("&Edit")))
        editMenu.AppendSeparator()
        editMenu.Append(FindService.FIND_ID, _("&Find...\tCtrl+F"),
                        _("Finds the specified text"))
        wx.EVT_MENU(frame, FindService.FIND_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, FindService.FIND_ID,
                         frame.ProcessUpdateUIEvent)
        editMenu.Append(FindService.FIND_PREVIOUS_ID,
                        _("Find &Previous\tShift+F3"),
                        _("Finds the specified text"))
        wx.EVT_MENU(frame, FindService.FIND_PREVIOUS_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, FindService.FIND_PREVIOUS_ID,
                         frame.ProcessUpdateUIEvent)
        editMenu.Append(FindService.FIND_NEXT_ID, _("Find &Next\tF3"),
                        _("Finds the specified text"))
        wx.EVT_MENU(frame, FindService.FIND_NEXT_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, FindService.FIND_NEXT_ID,
                         frame.ProcessUpdateUIEvent)
        editMenu.Append(FindService.REPLACE_ID, _("R&eplace...\tCtrl+H"),
                        _("Replaces specific text with different text"))
        wx.EVT_MENU(frame, FindService.REPLACE_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, FindService.REPLACE_ID,
                         frame.ProcessUpdateUIEvent)
        editMenu.Append(FindService.GOTO_LINE_ID, _("&Go to Line...\tCtrl+G"),
                        _("Goes to a certain line in the file"))
        wx.EVT_MENU(frame, FindService.GOTO_LINE_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, FindService.GOTO_LINE_ID,
                         frame.ProcessUpdateUIEvent)

        # wxBug: wxToolBar::GetToolPos doesn't exist, need it to find cut tool and then insert find in front of it.
        toolBar.InsertTool(6,
                           FindService.FIND_ID,
                           getFindBitmap(),
                           shortHelpString=_("Find"),
                           longHelpString=_("Finds the specified text"))
        toolBar.InsertSeparator(6)
        toolBar.Realize()

        frame.Bind(wx.EVT_FIND, frame.ProcessEvent)
        frame.Bind(wx.EVT_FIND_NEXT, frame.ProcessEvent)
        frame.Bind(wx.EVT_FIND_REPLACE, frame.ProcessEvent)
        frame.Bind(wx.EVT_FIND_REPLACE_ALL, frame.ProcessEvent)
Exemplo n.º 15
0
    def InstallControls(self,
                        frame,
                        menuBar=None,
                        toolBar=None,
                        statusBar=None,
                        document=None):

        menu = menuBar.GetMenu(menuBar.FindMenu(_("&World")))

        wx.EVT_MENU(frame, ZoneService.TESTLAST_ZONE_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, ZoneService.TESTLAST_ZONE_ID,
                         self.ProcessUpdateUIEvent)
        self.testLastMenuItem = menu.Append(ZoneService.TESTLAST_ZONE_ID,
                                            ("Test Last Zone...\tCtrl+T"),
                                            ("Tests the last zone"))
        self.testLastMenuItem.Enable(False)

        wx.EVT_MENU(frame, ZoneService.TEST_ZONE_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, ZoneService.TEST_ZONE_ID,
                         self.ProcessUpdateUIEvent)
        menu.Append(ZoneService.TEST_ZONE_ID, ("Test Zone"),
                    ("Tests a chosen zone"))

        menu.AppendSeparator()

        wx.EVT_MENU(frame, ZoneService.EDITLAST_ZONE_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, ZoneService.EDITLAST_ZONE_ID,
                         self.ProcessUpdateUIEvent)
        self.editLastMenuItem = menu.Append(ZoneService.EDITLAST_ZONE_ID,
                                            ("Edit Last Zone...\tCtrl+E"),
                                            ("Edits the last zone"))
        self.editLastMenuItem.Enable(False)

        wx.EVT_MENU(frame, ZoneService.EDIT_ZONE_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, ZoneService.EDIT_ZONE_ID,
                         self.ProcessUpdateUIEvent)
        menu.Append(ZoneService.EDIT_ZONE_ID, ("Edit Zone"),
                    ("Edits a chosen zone"))

        menu.AppendSeparator()

        wx.EVT_MENU(frame, ZoneService.NEW_ZONE_ID, self.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, ZoneService.NEW_ZONE_ID,
                         self.ProcessUpdateUIEvent)
        menu.Append(ZoneService.NEW_ZONE_ID, ("New Zone"),
                    ("Create a New Zone"))

        menu.AppendSeparator()
Exemplo n.º 16
0
 def BuildSubmenu(self, subMenu):
     subMenuObject = wx.Menu()
     for item in subMenu:
         if not item:  #allow now to add separators
             subMenuObject.AppendSeparator()
             continue
         statustext = ''
         uihandler = None
         if len(item) == 2:
             title, action = item
         elif len(item) == 3:
             if type(item[2]) is str:
                 title, action, statustext = item
             else:
                 title, action, statustext = item
         elif len(item) == 4:
             title, action, statustext, uihandler = item
         else:
             raise AssertionError, \
                 'Item %s should have either 2 to 4 parts' % (item,)
         if type(action) is list:
             _id = wx.NewId()
             subMenuObject.AppendMenu(_id, title, self.BuildSubmenu(action))
         else:
             _id = wx.NewId()
             subMenuObject.Append(_id, title, statustext)
             wx.EVT_MENU(self, _id, action)
         if uihandler:
             wx.EVT_UPDATE_UI(self, _id, uihandler)
     return subMenuObject
Exemplo n.º 17
0
    def InstallControls(self,
                        frame,
                        menuBar=None,
                        toolBar=None,
                        statusBar=None,
                        document=None):
        toolsMenuIndex = menuBar.FindMenu(_("&Tools"))
        if toolsMenuIndex > -1:
            toolsMenu = menuBar.GetMenu(toolsMenuIndex)
        else:
            toolsMenu = wx.Menu()

        if self._extensions:
            if toolsMenu.GetMenuItems():
                toolsMenu.AppendSeparator()
            for ext in self._extensions:
                # Append a tool menu item for each extension
                ext.id = wx.NewId()
                toolsMenu.Append(ext.id, ext.menuItemName)
                wx.EVT_MENU(frame, ext.id, frame.ProcessEvent)
                wx.EVT_UPDATE_UI(frame, ext.id, frame.ProcessUpdateUIEvent)

        if toolsMenuIndex == -1:
            index = menuBar.FindMenu(_("&Run"))
            if index == -1:
                index = menuBar.FindMenu(_("&Project"))
            if index == -1:
                index = menuBar.FindMenu(_("&Format"))
            if index == -1:
                index = menuBar.FindMenu(_("&View"))
            menuBar.Insert(index + 1, toolsMenu, _("&Tools"))
Exemplo n.º 18
0
    def CreatePopupMenu(self):
        TOGGLEBREAKPOINT_ID = wx.NewId()
        TOGGLEMARKER_ID = wx.NewId()
        SYNCTREE_ID = wx.NewId()
        
        menu = wx.Menu()
        
        self.Bind(wx.EVT_MENU, self.OnPopSyncOutline, id=SYNCTREE_ID)
        item = wx.MenuItem(menu, SYNCTREE_ID, _("Find in Outline View"))
        menu.AppendItem(item)
        menu.AppendSeparator()
        self.Bind(wx.EVT_MENU, self.OnPopToggleBP, id=TOGGLEBREAKPOINT_ID)
        item = wx.MenuItem(menu, TOGGLEBREAKPOINT_ID, _("Toggle Breakpoint"))
        menu.AppendItem(item)
        self.Bind(wx.EVT_MENU, self.OnPopToggleMarker, id=TOGGLEMARKER_ID)
        item = wx.MenuItem(menu, TOGGLEMARKER_ID, _("Toggle Bookmark"))
        menu.AppendItem(item)
        menu.AppendSeparator()
                
        itemIDs = [wx.ID_UNDO, wx.ID_REDO, None,
                   wx.ID_CUT, wx.ID_COPY, wx.ID_PASTE, wx.ID_CLEAR, None, wx.ID_SELECTALL]

        menuBar = wx.GetApp().GetTopWindow().GetMenuBar()
        for itemID in itemIDs:
            if not itemID:
                menu.AppendSeparator()
            else:
                item = menuBar.FindItemById(itemID)
                if item:
                    menu.Append(itemID, item.GetLabel())
                    wx.EVT_MENU(self, itemID, self.DSProcessEvent)  # wxHack: for customized right mouse menu doesn't work with new DynamicSashWindow
                    wx.EVT_UPDATE_UI(self, itemID, self.DSProcessUpdateUIEvent)  # wxHack: for customized right mouse menu doesn't work with new DynamicSashWindow
        return menu
Exemplo n.º 19
0
    def InstallControls(self,
                        frame,
                        menuBar=None,
                        toolBar=None,
                        statusBar=None,
                        document=None):
        CodeEditor.CodeService.InstallControls(self, frame, menuBar, toolBar,
                                               statusBar, document)

        if document and document.GetDocumentTemplate().GetDocumentType(
        ) != PythonDocument:
            return
        if not document and wx.GetApp().GetDocumentManager().GetFlags(
        ) & wx.lib.docview.DOC_SDI:
            return

        viewMenu = menuBar.GetMenu(menuBar.FindMenu(_("&View")))

        viewStatusBarItemPos = self.GetMenuItemPos(
            viewMenu, wx.lib.pydocview.VIEW_STATUSBAR_ID)
        viewMenu.InsertCheckItem(
            viewStatusBarItemPos + 1, VIEW_PYTHON_INTERPRETER_ID,
            _("Python &Interpreter"),
            _("Shows or hides the Python interactive window"))
        wx.EVT_MENU(frame, VIEW_PYTHON_INTERPRETER_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, VIEW_PYTHON_INTERPRETER_ID,
                         frame.ProcessUpdateUIEvent)
Exemplo n.º 20
0
    def CreatePopupMenu(self):
        SYNCTREE_ID = wx.NewId()
        menu = CodeEditor.CodeCtrl.CreatePopupMenu(self)
      #  self.Bind(wx.EVT_MENU, self.OnPopFindDefinition, id=FINDDEF_ID)
       # menu.Insert(1, FINDDEF_ID, _("Find 'def'"))

        #self.Bind(wx.EVT_MENU, self.OnPopFindClass, id=FINDCLASS_ID)
        #menu.Insert(2, FINDCLASS_ID, _("Find 'class'"))
        menu.AppendSeparator()
        self.Bind(wx.EVT_MENU, self.OnPopSyncOutline, id=SYNCTREE_ID)
        item = wx.MenuItem(menu, SYNCTREE_ID, _("Find in Outline View"))
        menu.AppendItem(item)
        
        self.Bind(wx.EVT_MENU, self.OnGotoDefinition, id=CompletionService.CompletionService.GO_TO_DEFINITION)
        item = wx.MenuItem(menu, CompletionService.CompletionService.GO_TO_DEFINITION, \
                            _("Goto Definition\tF12"))
        wx.EVT_UPDATE_UI(self,CompletionService.CompletionService.GO_TO_DEFINITION, self.DSProcessUpdateUIEvent)
        menu.AppendItem(item)

        menu.Append(DebuggerService.DebuggerService.RUN_ID, _("&Run\tF5"))
        wx.EVT_MENU(self, DebuggerService.DebuggerService.RUN_ID, self.RunScript)

        menu.Append(DebuggerService.DebuggerService.DEBUG_ID, _("&Debug\tCtrl+F5"))
        wx.EVT_MENU(self, DebuggerService.DebuggerService.DEBUG_ID, self.DebugRunScript)
        
        return menu
Exemplo n.º 21
0
    def InstallControls(self, frame, menuBar = None, toolBar = None, statusBar = None, document = None):
        viewMenu = menuBar.GetMenu(menuBar.FindMenu(_("&View")))
        menuItemPos = self.GetMenuItemPos(viewMenu, viewMenu.FindItem(_("&Status Bar"))) + 1

        viewMenu.InsertCheckItem(menuItemPos, self.SHOW_WINDOW, self.GetMenuString(), self.GetMenuDescr())
        wx.EVT_MENU(frame, self.SHOW_WINDOW, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, self.SHOW_WINDOW, frame.ProcessUpdateUIEvent)
        return True
Exemplo n.º 22
0
def create_prev(win, toolbar):
    ID_PREV = Id.makeid(win, 'IDM_SEARCH_NAV_PREV')
    btnPrev = FlatButtons.FlatBitmapMenuButton(toolbar, ID_PREV, common.getpngimage('images/nav_left.gif'))
    btnPrev.SetRightClickFunc(win.OnSmartNavPrevFiles)
    btnPrev.SetToolTip(wx.ToolTip(tr('Previous File')))
    wx.EVT_BUTTON(btnPrev, ID_PREV, win.OnSmartNavPrev)
    wx.EVT_UPDATE_UI(win, win.IDM_SEARCH_NAV_PREV, win.OnUpdateUI)

    return btnPrev
Exemplo n.º 23
0
def create_next(win, toolbar):
    ID_NEXT = Id.makeid(win, 'IDM_SEARCH_NAV_NEXT')
    btnNext = FlatButtons.FlatBitmapMenuButton(toolbar, ID_NEXT, common.getpngimage('images/nav_right.gif'))
    btnNext.SetRightClickFunc(win.OnSmartNavNextFiles)
    btnNext.SetToolTip(wx.ToolTip(tr('Next File')))
    wx.EVT_BUTTON(btnNext, ID_NEXT, win.OnSmartNavNext)
    wx.EVT_UPDATE_UI(win, win.IDM_SEARCH_NAV_NEXT, win.OnUpdateUI)

    return btnNext
Exemplo n.º 24
0
def on_enter(mainframe, document):
    wx.EVT_UPDATE_UI(mainframe, mainframe.IDM_RUBY_CLASSBROWSER, mainframe.OnRubyUpdateUI)
    if mainframe.pref.ruby_classbrowser_show and document.init_class_browser == False:
        document.class_browser = not document.class_browser
        document.panel.showWindow('LEFT', document.class_browser)
        if document.panel.LeftIsVisible:
            if document.init_class_browser == False:
                document.init_class_browser = True
                document.outlinebrowser.show()
Exemplo n.º 25
0
    def InstallControls(self,
                        frame,
                        menuBar=None,
                        toolBar=None,
                        statusBar=None,
                        document=None):
        if document and document.GetDocumentTemplate().GetDocumentType(
        ) != STCTextEditor.TextDocument:
            return
        if not document and wx.GetApp().GetDocumentManager().GetFlags(
        ) & wx.lib.docview.DOC_SDI:
            return

        editMenu = menuBar.GetMenu(menuBar.FindMenu(_("&Edit")))
        editMenu.AppendSeparator()
        editMenu.Append(CompletionService.GO_TO_DEFINITION,
                        _("Goto Definition\tF12"),
                        _("Goto Definition of current statement"))
        wx.EVT_MENU(frame, CompletionService.GO_TO_DEFINITION,
                    frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, CompletionService.GO_TO_DEFINITION,
                         frame.ProcessUpdateUIEvent)
        editMenu.Append(CompletionService.COMPLETE_WORD_LIST,
                        _("Completion Word List\tCtrl+Shit+K"),
                        _("List All Completion Word of suggestions"))
        wx.EVT_MENU(frame, CompletionService.COMPLETE_WORD_LIST,
                    frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, CompletionService.COMPLETE_WORD_LIST,
                         frame.ProcessUpdateUIEvent)
        editMenu.Append(
            CompletionService.AUTO_COMPLETE_ID,
            _("&Auto Complete\tCtrl+Shift+Space"),
            _("Provides suggestions on how to complete the current statement"))
        wx.EVT_MENU(frame, CompletionService.AUTO_COMPLETE_ID,
                    frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, CompletionService.AUTO_COMPLETE_ID,
                         frame.ProcessUpdateUIEvent)
        editMenu.Append(CompletionService.LIST_CURRENT_MEMBERS,
                        _("List Members\tCtrl+J"),
                        _("List Members of Current statement"))
        wx.EVT_MENU(frame, CompletionService.LIST_CURRENT_MEMBERS,
                    frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, CompletionService.LIST_CURRENT_MEMBERS,
                         frame.ProcessUpdateUIEvent)
Exemplo n.º 26
0
def editor_init(win):
    wx.EVT_UPDATE_UI(win, win.IDPM_EDIT_CONVERT_REST2HTML, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDPM_EDIT_CONVERT_PY2HTML, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDPM_EDIT_CONVERT_TEXTILE2HTML, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDPM_EDIT_CONVERT_DIRECT, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDPM_EDIT_CONVERT_OUTPUTHTMLWINDOW, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDPM_EDIT_CONVERT_OUTPUTMESSAGEWINDOW, win.OnUpdateUI)
    wx.EVT_UPDATE_UI(win, win.IDPM_EDIT_CONVERT_REPLACEHERE, win.OnUpdateUI)
Exemplo n.º 27
0
    def init(self, mainframe):
        self.mainframe = mainframe
        self.pref = self.mainframe.pref
        self.obj_ID_CLOSE.SetId(wx.ID_CANCEL)

        self.lastindex = self.pref.last_blog_site
        self.categories = {}
        self.load()

        wx.EVT_UPDATE_UI(self.obj_ID_DELETE, self.ID_DELETE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.obj_ID_UPDATE, self.ID_UPDATE, self.OnUpdateUI)
        wx.EVT_UPDATE_UI(self.obj_ID_ADD, self.ID_ADD, self.OnUpdateUI)
        wx.EVT_CLOSE(self, self.OnClose)
        wx.EVT_BUTTON(self.obj_ID_CLOSE, wx.ID_CANCEL, self.OnClose)
        wx.EVT_BUTTON(self.obj_ID_ADD, self.ID_ADD, self.OnAdd)
        wx.EVT_BUTTON(self.obj_ID_UPDATE, self.ID_UPDATE, self.OnUpdate)
        wx.EVT_BUTTON(self.obj_ID_DELETE, self.ID_DELETE, self.OnDelete)
        wx.EVT_BUTTON(self.obj_ID_BROWSE, self.ID_BROWSE, self.OnBrowse)
        wx.EVT_LISTBOX(self.obj_ID_SITE, self.obj_ID_SITE.GetId(), self.OnSiteSelected)
Exemplo n.º 28
0
    def __init__(self, parent, mainframe):
        self.initmixin()
        wx.Panel.__init__(self, parent, -1)
        self.parent = parent
        self.mainframe = mainframe
        self.pref = mainframe.pref
        if not hasattr(self.pref, 'share_nodes'):
            self.pref.share_nodes = []

        self.processors = {}
#        self.callplugin('add_process_class', self, self.processors)

        self.sizer = wx.BoxSizer(wx.VERTICAL)

        self.shareimagelist = imagelist = wx.ImageList(16, 16)

        #add share image list
        self.imagefiles = {}
        self.imageids = {}
        self.callplugin('add_images', self.imagefiles)
        for name, imagefile in self.imagefiles.items():
            self.add_image(name, imagefile)

        self.tree = wx.TreeCtrl(self, -1, style = wx.TR_EDIT_LABELS|wx.TR_SINGLE|wx.TR_TWIST_BUTTONS|wx.TR_HAS_BUTTONS|wx.TR_ROW_LINES|wx.TR_HIDE_ROOT)
        self.tree.SetImageList(self.shareimagelist)

        self.sizer.Add(self.tree, 1, wx.EXPAND)
        self.root = self.tree.AddRoot('Share')

        self.nodes = {}
        self.ID = 1

        self.read()

        wx.EVT_TREE_SEL_CHANGING(self.tree, self.tree.GetId(), self.OnChanging)
        wx.EVT_TREE_SEL_CHANGED(self.tree, self.tree.GetId(), self.OnChanged)
        wx.EVT_TREE_BEGIN_LABEL_EDIT(self.tree, self.tree.GetId(), self.OnBeginChangeLabel)
        wx.EVT_TREE_END_LABEL_EDIT(self.tree, self.tree.GetId(), self.OnChangeLabel)
        wx.EVT_TREE_ITEM_ACTIVATED(self.tree, self.tree.GetId(), self.OnSelected)
        wx.EVT_TREE_ITEM_RIGHT_CLICK(self.tree, self.tree.GetId(), self.OnRClick)
        wx.EVT_RIGHT_UP(self.tree, self.OnRClick)
        wx.EVT_TREE_DELETE_ITEM(self.tree, self.tree.GetId(), self.OnDeleteItem)
        wx.EVT_LEFT_DCLICK(self.tree, self.OnDoubleClick)
        wx.EVT_TREE_ITEM_EXPANDING(self.tree, self.tree.GetId(), self.OnExpanding)

        from modules import Id
        wx.EVT_UPDATE_UI(self, Id.makeid(self, 'IDPM_DEL'), self.OnUpdateUI)

        #add init process
        self.callplugin('init', self)

        self.SetSizer(self.sizer)
        self.SetAutoLayout(True)

        self.popmenus = None
Exemplo n.º 29
0
    def InstallControls(self, frame, menuBar = None, toolBar = None, statusBar = None, document = None):
        """ Install Find Service Menu Items """
        editMenu = menuBar.GetMenu(menuBar.FindMenu(_("&Edit")))
        editMenu.AppendSeparator()
        item = wx.MenuItem(editMenu,FindService.FIND_ID, _("&Find...\tCtrl+F"), _("Finds the specified text"))
        item.SetBitmap(getFindBitmap())
        editMenu.AppendItem(item)
        
        wx.EVT_MENU(frame, FindService.FIND_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, FindService.FIND_ID, frame.ProcessUpdateUIEvent)
        item = wx.MenuItem(editMenu,FindService.FIND_PREVIOUS_ID, _("Find &Previous\tShift+F3"), _("Finds the previous specified text"))
        previous_image_path = os.path.join(sysutilslib.mainModuleDir, "noval", "tool", "bmp_source", "previous.png")
        item.SetBitmap(wx.BitmapFromImage(wx.Image(previous_image_path,wx.BITMAP_TYPE_ANY)))
        editMenu.AppendItem(item)
        wx.EVT_MENU(frame, FindService.FIND_PREVIOUS_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, FindService.FIND_PREVIOUS_ID, frame.ProcessUpdateUIEvent)
        item = wx.MenuItem(editMenu,FindService.FIND_NEXT_ID, _("Find &Next\tF3"), _("Finds the next specified text"))
        next_image_path = os.path.join(sysutilslib.mainModuleDir, "noval", "tool", "bmp_source", "next.png")
        item.SetBitmap(wx.BitmapFromImage(wx.Image(next_image_path,wx.BITMAP_TYPE_ANY)))
        editMenu.AppendItem(item)
        wx.EVT_MENU(frame, FindService.FIND_NEXT_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, FindService.FIND_NEXT_ID, frame.ProcessUpdateUIEvent)
        editMenu.Append(FindService.REPLACE_ID, _("R&eplace...\tCtrl+H"), _("Replaces specific text with different text"))
        wx.EVT_MENU(frame, FindService.REPLACE_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, FindService.REPLACE_ID, frame.ProcessUpdateUIEvent)
        item = wx.MenuItem(editMenu,FindService.GOTO_LINE_ID, _("&Go to Line...\tCtrl+G"), _("Goes to a certain line in the file"))
        goto_image_path = os.path.join(sysutilslib.mainModuleDir, "noval", "tool", "bmp_source", "goto.png")
        item.SetBitmap(wx.BitmapFromImage(wx.Image(goto_image_path,wx.BITMAP_TYPE_ANY)))
        editMenu.AppendItem(item)
        
        wx.EVT_MENU(frame, FindService.GOTO_LINE_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, FindService.GOTO_LINE_ID, frame.ProcessUpdateUIEvent)

        # wxBug: wxToolBar::GetToolPos doesn't exist, need it to find cut tool and then insert find in front of it.
        toolBar.InsertTool(6, FindService.FIND_ID, getFindBitmap(), shortHelpString = _("Find"), longHelpString = _("Finds the specified text"))
        toolBar.InsertSeparator(6)
        toolBar.Realize()

        frame.Bind(wx.EVT_FIND, frame.ProcessEvent)
        frame.Bind(wx.EVT_FIND_NEXT, frame.ProcessEvent)
        frame.Bind(wx.EVT_FIND_REPLACE, frame.ProcessEvent)
        frame.Bind(wx.EVT_FIND_REPLACE_ALL, frame.ProcessEvent)
Exemplo n.º 30
0
    def InstallControls(self, frame, menuBar = None, toolBar = None, statusBar = None, document = None):
        if document and document.GetDocumentTemplate().GetDocumentType() != STCTextEditor.TextDocument:
            return
        if not document and wx.GetApp().GetDocumentManager().GetFlags() & wx.lib.docview.DOC_SDI:
            return

        editMenu = menuBar.GetMenu(menuBar.FindMenu(_("&Edit")))
        editMenu.AppendSeparator()
        editMenu.Append(MarkerService.MARKERTOGGLE_ID, _("Toggle &Bookmark\tCtrl+M"), _("Toggles a bookmark at text line"))
        wx.EVT_MENU(frame, MarkerService.MARKERTOGGLE_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, MarkerService.MARKERTOGGLE_ID, frame.ProcessUpdateUIEvent)
        editMenu.Append(MarkerService.MARKERDELALL_ID, _("Clear Bookmarks"), _("Removes all jump bookmarks from selected file"))
        wx.EVT_MENU(frame, MarkerService.MARKERDELALL_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, MarkerService.MARKERDELALL_ID, frame.ProcessUpdateUIEvent)
        editMenu.Append(MarkerService.MARKERNEXT_ID, _("Bookmark Next\tF4"), _("Moves to next bookmark in selected file"))
        wx.EVT_MENU(frame, MarkerService.MARKERNEXT_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, MarkerService.MARKERNEXT_ID, frame.ProcessUpdateUIEvent)
        editMenu.Append(MarkerService.MARKERPREV_ID, _("Bookmark Previous\tShift+F4"), _("Moves to previous bookmark in selected file"))
        wx.EVT_MENU(frame, MarkerService.MARKERPREV_ID, frame.ProcessEvent)
        wx.EVT_UPDATE_UI(frame, MarkerService.MARKERPREV_ID, frame.ProcessUpdateUIEvent)