Exemplo n.º 1
0
def loadBitmap(name):
    """ Loads bitmap if it exists, else loads default bitmap """
    imgPath = 'Images/Palette/' + name+'.png'
    try:
        return IS.load(imgPath)
    except IS.Error:
        return IS.load('Images/Palette/Component.png')
    def __init__(self, parent, lang=wx.LANGUAGE_DEFAULT, filter='boa', 
              boaLangs=(wx.LANGUAGE_DEFAULT,)):
        self._init_ctrls(parent)

        self.filterMap = {'boa': langlistctrl.LC_ONLY, 
                          'available': langlistctrl.LC_AVAILABLE, 
                          'all': langlistctrl.LC_ALL}
                        
        self.filterIdxMap = {0: 'boa', 
                             1: 'available', 
                             2: 'all'}
        self.boaLangs = boaLangs
        self.langCtrl = langlistctrl.LanguageListCtrl(self.langCtrlContainer, -1, 
              filter=self.filterMap[filter], only=boaLangs, select=lang,
              style=wx.LC_REPORT | wx.LC_NO_HEADER | wx.LC_SINGLE_SEL | wx.SUNKEN_BORDER)
        
        # reset min sizes for all controls except the language selector
        Utils.resetMinSize(self, (self.langCtrlContainer,))
        
        # set language selector size
        self.OnLangCtrlContainerSize()
        
        # now set the sizer properly
        self.SetSizerAndFit(self.mainSizer)
        
        self.SetIcon(IS.load('Images/Icons/LanguageSelect.ico'))
Exemplo n.º 3
0
    def __init__(self, parent, debugger):
        DebuggerListCtrl.__init__(self, parent, wxID_BREAKVIEW)

        self.InsertColumn(0, _("Module"), wx.LIST_FORMAT_LEFT, 90)
        self.InsertColumn(1, _("Line"), wx.LIST_FORMAT_CENTER, 40)
        self.InsertColumn(2, _("Ignore"), wx.LIST_FORMAT_CENTER, 45)
        self.InsertColumn(3, _("Hits"), wx.LIST_FORMAT_CENTER, 45)
        self.InsertColumn(4, _("Condition"), wx.LIST_FORMAT_LEFT, 250)

        self.brkImgLst = wx.ImageList(16, 16)
        self.brkImgLst.Add(IS.load("Images/Debug/Breakpoint-red.png"))
        self.brkImgLst.Add(IS.load("Images/Debug/Breakpoint-yellow.png"))
        self.brkImgLst.Add(IS.load("Images/Debug/Breakpoint-gray.png"))
        self.brkImgLst.Add(IS.load("Images/Debug/Breakpoint-blue.png"))

        self.Bind(wx.EVT_LEFT_DCLICK, self.OnGotoSource)

        self.debugger = debugger

        self.menu = wx.Menu()

        self.menu.Append(wxID_BREAKSOURCE, _("Goto source"))
        self.menu.Append(wxID_BREAKREFRESH, _("Refresh"))
        self.menu.AppendSeparator()
        self.menu.Append(wxID_BREAKIGNORE, _("Edit ignore count"))
        self.menu.Append(wxID_BREAKEDIT, _("Edit condition"))
        self.menu.Append(wxID_BREAKDELETE, _("Delete"))
        self.menu.AppendSeparator()
        self.menu.Append(wxID_BREAKENABLED, _("Enabled"), "", True)

        self.menu.Check(wxID_BREAKENABLED, True)

        self.Bind(wx.EVT_MENU, self.OnGotoSourceRight, id=wxID_BREAKSOURCE)
        self.Bind(wx.EVT_MENU, self.OnRefresh, id=wxID_BREAKREFRESH)
        self.Bind(wx.EVT_MENU, self.OnEditIgnore, id=wxID_BREAKIGNORE)
        self.Bind(wx.EVT_MENU, self.OnEditCondition, id=wxID_BREAKEDIT)
        self.Bind(wx.EVT_MENU, self.OnDelete, id=wxID_BREAKDELETE)
        self.Bind(wx.EVT_MENU, self.OnToggleEnabled, id=wxID_BREAKENABLED)
        self.pos = None

        self.setPopupMenu(self.menu)

        self.AssignImageList(self.brkImgLst, wx.IMAGE_LIST_SMALL)

        self.bps = []
        self.stats_map = {}
Exemplo n.º 4
0
    def _init_coll_toolBar_Tools(self, parent):
        # generated method, don't edit

        parent.AddTool(bitmap=IS.load('Images/Shared/Inspector.png'),
              id=wxID_BOAFRAMETOOLBARTOOLS0, isToggle=False, longHelpString='',
              pushedBitmap=wx.NullBitmap,
              shortHelpString=_('Brings the Inspector to the front'))
        parent.AddTool(bitmap=IS.load('Images/Shared/Editor.png'),
              id=wxID_BOAFRAMETOOLBARTOOLS1, isToggle=False, longHelpString='',
              pushedBitmap=wx.NullBitmap,
              shortHelpString=_('Brings the Editor to the front'))
        self.Bind(wx.EVT_TOOL, self.OnInspectorToolClick,
              id=wxID_BOAFRAMETOOLBARTOOLS0)
        self.Bind(wx.EVT_TOOL, self.OnEditorToolClick,
              id=wxID_BOAFRAMETOOLBARTOOLS1)

        parent.Realize()
Exemplo n.º 5
0
    def __init__(self, editor, list, inspector, controllers):
        ExplorerNodes.Controller.__init__(self, editor)
        self.list = list
        self.menu = wx.Menu()
        self.svnOptions = '-z7'

        self.svnMenuDef = [
              (wxID_SVNUPDATE, 'Update', self.OnUpdateSVNItems, self.updateBmp),
              (wxID_SVNCOMMIT, 'Commit', self.OnCommitSVNItems, self.commitBmp),
              (wxID_SVNRESOLVED, 'Resolved', self.OnResolvedSVNItems, '-'),
              (-1, '-', None, ''),
              (wxID_SVNADD, 'Add', self.OnAddSVNItems, self.addBmp),
              (wxID_SVNREMOVE, 'Remove', self.OnRemoveSVNItems, self.removeBmp),
              (-1, '-', None, ''),
              (wxID_SVNDIFF, 'Diff', self.OnDiffSVNItems, self.diffBmp),
              (wxID_SVNLOG, 'Log', self.OnLogSVNItems, self.logBmp),
              (wxID_SVNSTATUS, 'Status', self.OnStatusSVNItems, self.statusBmp),
              (wxID_SVNINFO, 'Info', self.OnInfoSVNItems, '-'),
              #(-1, '-', None, ''),
              #(wxID_SVNLOCK, 'Lock', self.OnLockSVNItems, '-'),
              #(wxID_SVNUNLOCK, 'Unlock', self.OnUnlockSVNItems, '-'), 
        ]

        self.setupMenu(self.menu, self.list, self.svnMenuDef)

        self.fileSVNMenuDef = [
              #(wxID_FSSVNIMPORT, 'Import', self.OnImportSVNFSItems, '-'),
              (wxID_FSSVNCHECKOUT, 'Checkout', self.OnCheckoutSVNFSItems, '-'),
        ]

        self.fileSVNMenu = wx.Menu()
        self.setupMenu(self.fileSVNMenu, self.list, self.fileSVNMenuDef, False)


        self.images = wx.ImageList(16, 16)
        for svnImg in ( 'Images/CvsPics/File.png',
                        'Images/CvsPics/BinaryFile.png',
                        'Images/CvsPics/ModifiedFile.png',
                        'Images/CvsPics/ModifiedBinaryFile.png',
                        'Images/CvsPics/MissingFile.png',
                        'Images/CvsPics/ConflictingFile.png',
                        'Images/CvsPics/Dir.png',
                        'Images/Modules/FolderUp.png',
                        'Images/CvsPics/UnknownDir.png',
                        'Images/CvsPics/UnknownFile.png'):
            self.images.Add(IS.load(svnImg))

        self.toolbarMenus = [self.svnMenuDef]

        FSSVNFolderNode.images = self.images
Exemplo n.º 6
0
    def addTools(self, toolbar):
        if self.list.node and self.controllers.has_key(self.list.node.protocol):
            prot = self.list.node.protocol
            tbMenus = []
            for menuLst in self.controllers[prot].toolbarMenus:
                tbMenus.extend(list(menuLst))

            for wID, name, meth, bmp in tbMenus:
                if name == '-' and not bmp:
                    toolbar.AddSeparator()
                elif bmp != '-':
                    if name[0] == '+':
                        # XXX Add toggle button
                        name = name [1:]
                    Utils.AddToolButtonBmpObject(self.editor, toolbar,
                          IS.load(bmp), name, meth)
Exemplo n.º 7
0
 def addViewTools(self, toolbar):
     addedSep = False
     for name, meth, bmp, accls in self.actions:
         if name == '-' and not bmp:
             toolbar.AddSeparator()
             addedSep = True
         elif bmp != '-':
             if name[0] == '+':
                 # XXX Add toggle button
                 name = name [1:]
             if not addedSep:
                 # this is the separator between File and Edit
                 toolbar.AddSeparator()
                 addedSep = True
             Utils.AddToolButtonBmpObject(self.model.editor, toolbar,
                   IS.load(bmp), name, meth)
Exemplo n.º 8
0
    def __init__(self, editor):
        import Utils
        conf = Utils.createAndReadConfig('Explorer')
        self.writeConfig = Utils.writeConfig

        if conf and conf.has_section('debugger.remote'):
            host = conf.get('debugger.remote', 'host')
            port = conf.get('debugger.remote', 'port')
            user = conf.get('debugger.remote', 'user')
            pwd = eval(conf.get('debugger.remote', 'passwd'))
            if pwd is not None:
                from Explorers import scrm
                pwd = scrm.scramble(pwd)
            paths = eval(conf.get('debugger.remote', 'paths'))
        else:
            host, port, user, pwd, paths = self.rem_host, self.rem_port, \
                  self.rem_user, self.rem_pass, self.rem_pths
        self.conf = conf

        self.host = '127.0.0.1'
        if host is not None: self.host = host

        self.port = '26200'
        if port is not None: self.port = port

        self.user = ''
        if user is not None: self.user = user

        self.pwd = ''
        if pwd is not None: self.pwd = pwd

        self.paths = []
        if paths is not None: self.paths[:] = paths

        self._init_ctrls(editor)
        self.editor = editor

        self.pathsPanel.init_paths(self.paths)

        self.Center(wx.BOTH)

        try:
            from Preferences import IS
            self.SetIcon(IS.load('Images/Icons/Debug.ico'))
        except Exception:#ImportError: # for testing standalone
            pass
Exemplo n.º 9
0
    def __init__(self, parent, model):
        id = wx.NewId()
        wx.TreeCtrl.__init__(self, parent, id, style=wx.TR_HAS_BUTTONS | wx.SUNKEN_BORDER)
        EditorView.__init__(self, model,
          ((_('Goto line'), self.OnGoto, self.gotoLineBmp, ''),), 0)

        self.tokenImgLst = wx.ImageList(16, 16)
        for hierImg in ('Images/Views/Hierarchy/inherit.png',
                        'Images/Views/Hierarchy/inherit_base.png',
                        'Images/Views/Hierarchy/inherit_outside.png',
                        'Images/Modules/'+self.model.bitmap):
            self.tokenImgLst.Add(IS.load(hierImg))

        self.SetImageList(self.tokenImgLst)

        self.Bind(wx.EVT_KEY_UP, self.OnKeyPressed)

        self.canExplore = True
        self.active = True
Exemplo n.º 10
0
def evalCtrl(expr, localsDct=None, preserveExc=True):
    """ Function usually used to evaluate source snippets.

    Uses the namespace of this module which contain all the wxPython libs
    and also adds param localDct.
    """
    global _NB
    if not _NB:
        _NB = IS.load('Images/Inspector/wxNullBitmap.png')
    if localsDct is None:
        localsDct = {}
    localsDct['_'] = lambda x: x
    wx.NullBitmap = _NB
    try:
        return eval(expr, globals(), localsDct)
    except Exception, err:
        if preserveExc:
            raise
        else:
            clsName = err.__class__.__name__
            raise DesignTimeExpressionError, clsName+': '+str(err)
Exemplo n.º 11
0
    def __init__(self, parent, model):
        wx.TreeCtrl.__init__(self, parent, -1, style=wx.TR_HAS_BUTTONS | wx.SUNKEN_BORDER)
        EditorView.__init__(self, model, ((_('Goto line'), self.OnGoto, self.gotoLineBmp, ''),), 0)

        self.tokenImgLst = wx.ImageList(16, 16)
        for exploreImg in ('Images/Views/Explore/class.png',
                           'Images/Views/Explore/method.png',
                           'Images/Views/Explore/event.png',
                           'Images/Views/Explore/function.png',
                           'Images/Views/Explore/attribute.png',
                           'Images/Modules/'+self.model.bitmap,
                           'Images/Views/Explore/global.png',
                           'Images/Views/Explore/dottedline.png',
                           'Images/Views/Explore/import.png',
                           ):
            self.tokenImgLst.Add(IS.load(exploreImg))
        self.SetImageList(self.tokenImgLst)

        self.active = True
        self.canExplore = True

        self._populated_tree = 0

        self.Bind(wx.EVT_KEY_UP, self.OnKeyPressed)
Exemplo n.º 12
0
def AddToolButtonBmpFile(frame, toolbar, filename, hint, triggermeth):
    return AddToolButtonBmpObject(frame, toolbar, IS.load(filename),
      hint, triggermeth)
Exemplo n.º 13
0
    def __init__(self, parent, collEditView, additAdders = (),
          lvStyle = wx.LC_REPORT):
        self.collEditPos = (-1, -1)
        self.collEditPos = getNextDefaultPos()

        self._init_ctrls(parent)

        self.itemList = wx.ListCtrl(size = wx.DefaultSize,
              id = wxID_COLLECTIONEDITORITEMLIST, parent = self,
              name = 'itemList', style = lvStyle | wx.LC_SINGLE_SEL | wx.SUNKEN_BORDER,
              pos = wx.DefaultPosition)
        self.itemList.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnObjectSelect, id=wxID_COLLECTIONEDITORITEMLIST)
        self.itemList.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnObjectDeselect, id=wxID_COLLECTIONEDITORITEMLIST)
        self.itemList.Bind(wx.EVT_LEFT_DCLICK, self.OnObjectDClick)

        self.SetIcon(IS.load('Images/Icons/Collection.ico'))

        self.collEditView = collEditView
        self.selected = -1

        self.additAdders = additAdders #= 0
        self.additIds = {}

        self.toolLst = []

        acclst = []
        wId = Utils.AddToolButtonBmpIS(self, self.toolBar,
              'Images/Shared/NewItem.png', _('New'), self.OnNewClick)
        self.Bind(wx.EVT_MENU, self.OnNewClick, id=wId)
        acclst.append( (keyDefs['Insert'][0], keyDefs['Insert'][1], wId) )
        self.toolLst.append(wId)
        if additAdders:
            wId = Utils.AddToolButtonBmpIS(self, self.toolBar,
                  'Images/Shared/NewItems.png', _('More new ...'), self.OnMoreNewClick)
            self.Bind(wx.EVT_MENU, self.OnMoreNewClick, id=wId)
            self.toolLst.append(wId)

            self.toolBar.AddSeparator()

        wId = Utils.AddToolButtonBmpIS(self, self.toolBar,
              'Images/Shared/DeleteItem.png', _('Delete'), self.OnDeleteClick)
        self.Bind(wx.EVT_MENU, self.OnDeleteClick, id=wId)
        acclst.append( (keyDefs['Delete'][0], keyDefs['Delete'][1], wId) )
        self.toolLst.append(wId)
        self.toolBar.AddSeparator()
        Utils.AddToolButtonBmpIS(self, self.toolBar, 'Images/Shared/up.png',
          _('Up'), self.OnUpClick)
        Utils.AddToolButtonBmpIS(self, self.toolBar, 'Images/Shared/down.png',
          _('Down'), self.OnDownClick)
        self.toolBar.AddSeparator()
        wId = Utils.AddToolButtonBmpIS(self, self.toolBar,
              'Images/Editor/Refresh.png', _('Refresh'), self.OnRefresh)
        self.Bind(wx.EVT_MENU, self.OnRefresh, id=wId)
        acclst.append( (keyDefs['Refresh'][0], keyDefs['Refresh'][1], wId) )
        self.toolLst.append(wId)

        wId = wx.NewId()
        self.Bind(wx.EVT_MENU, self.OnSwitchToInspector, id=wId)
        acclst.append( (keyDefs['Inspector'][0], keyDefs['Inspector'][1], wId) )

        wId = wx.NewId()
        self.Bind(wx.EVT_MENU, self.OnSwitchToDesigner, id=wId)
        acclst.append( (keyDefs['Designer'][0], keyDefs['Designer'][1], wId) )

        self.SetAcceleratorTable(wx.AcceleratorTable(acclst))

        self.toolBar.Realize()

        if lvStyle == wx.LC_REPORT:
            self.itemList.InsertColumn(0, _('Name'), width=180)

        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)

        self.winConfOption = 'collectioneditor'
        self.loadDims()

        # Hack to force a refresh, it's not displayed correctly initialy
        self.SetSize((self.GetSize().x +1, self.GetSize().y))
Exemplo n.º 14
0
    def __init__(self, parent):
        self._init_ctrls(parent)

        self.winConfOption = 'classbrowser'
        self.loadDims()

        self.SetIcon(IS.load('Images/Icons/ClassBrowser.ico'))

        self.classes = {}
        for module in ('wx', 'wx.html', 'wx.calendar', 'wx.grid', 'wx.stc',
                       'wx.gizmos', 'wx.wizard'):
            self.classes.update(pyclbr.readmodule(module))


        tID =wx.NewId()
        root = self.hierarchy.AddRoot('wx.Object')

        clsDict = {}

        for i in self.classes.keys():
            travTilBase(i, self.classes, clsDict)

        buildTree(self.hierarchy, root, clsDict)
        self.hierarchy.Expand(root)

        tID =wx.NewId()

        root = self.tree.AddRoot(_('Modules'))
        modules = {}
        moduleName = ''
        for className in self.classes.keys():
            moduleName = os.path.basename(self.classes[className].file)
            if not modules.has_key(moduleName):
                modules[moduleName] = {}
            modules[moduleName][className] = {}
            modules[moduleName][className]['Properties'] = {}
            modules[moduleName][className]['Methods'] = {}
            modules[moduleName][className]['Built-in'] = {}
            for method in self.classes[className].methods.keys():
                if (method[:2] == '__'):
                    modules[moduleName][className]['Built-in'][method] = self.classes[className].lineno
                elif (method[:3] == 'Get'):
                    if self.classes[className].methods.has_key('Set'+method[3:]):
                        modules[moduleName][className]['Properties'][method[3:]] = self.classes[className].lineno
                    else:
                        modules[moduleName][className]['Methods'][method] = self.classes[className].lineno
                elif (method[:3] == 'Set'):
                    if self.classes[className].methods.has_key('Get'+method[3:]):
                        modules[moduleName][className]['Properties'][method[3:]] = self.classes[className].lineno
                    else:
                        modules[moduleName][className]['Methods'][method] = self.classes[className].lineno
                else:
                    modules[moduleName][className]['Methods'][method] = self.classes[className].lineno
        moduleLst = modules.keys()
        moduleLst.sort()
        for module in moduleLst:
            roots = self.tree.AppendItem(root, module)
            classLst = modules[module].keys()
            classLst.sort()
            for classes in classLst:
                aClass = self.tree.AppendItem(roots, classes)
                methItem = self.tree.AppendItem(aClass, _('Methods'))
                for methods in modules[module][classes]['Methods'].keys():
                    methodsItem = self.tree.AppendItem(methItem, methods)
                propItem = self.tree.AppendItem(aClass, _('Properties'))
                for properties in modules[module][classes]['Properties'].keys():
                    propertyItem = self.tree.AppendItem(propItem, properties)
                bInItem = self.tree.AppendItem(aClass, _('Built-in'))
                for builtIns in modules[module][classes]['Built-in'].keys():
                    builtInItem = self.tree.AppendItem(bInItem, builtIns)
                suprItem = self.tree.AppendItem(aClass, _('Super'))
                for supers in self.classes[classes].super:
                    try:
                        superItem = self.tree.AppendItem(suprItem, supers.name)
                    except AttributeError:
                        superItem = self.tree.AppendItem(suprItem, supers)

        self.tree.Expand(root)
Exemplo n.º 15
0
    def __init__(self, editor, filename=None, slave_mode=1):
        wx.Frame.__init__(self, editor, -1, _('Debugger'),
         style=wx.DEFAULT_FRAME_STYLE | wx.CLIP_CHILDREN|Preferences.childFrameStyle)

        self.winConfOption = 'debugger'
        self.loadDims()

        self.editor = editor
        self.running = 0
        self.slave_mode = slave_mode
        if filename:
            self.setDebugFile(filename)
        else:
            self.filename = ''

        self.SetIcon(IS.load('Images/Icons/Debug.ico'))

        self.viewsImgLst = wx.ImageList(16, 16)
        self.viewsImgLst.Add(IS.load('Images/Debug/Stack.png'))
        self.viewsImgLst.Add(IS.load('Images/Debug/Breakpoints.png'))
        self.viewsImgLst.Add(IS.load('Images/Debug/Watches.png'))
        self.viewsImgLst.Add(IS.load('Images/Debug/Locals.png'))
        self.viewsImgLst.Add(IS.load('Images/Debug/Globals.png'))
        self.viewsImgLst.Add(IS.load('Images/Debug/Output.png'))

        self.invalidatePanes()

        self.sb = DebugStatusBar(self)
        self.SetStatusBar(self.sb)

        self.toolbar = wx.ToolBar(self, -1,
              style=wx.TB_HORIZONTAL | wx.NO_BORDER|flatTools)
        self.SetToolBar(self.toolbar)

        self.runId = Utils.AddToolButtonBmpIS(self, self.toolbar,
          'Images/Debug/Debug.png', _('Debug/Continue - %s')%keyDefs['Debug'][2],
          self.OnDebug) #, runs in debugger, stops at breaks and exceptions'
        self.runFullSpdId = Utils.AddToolButtonBmpIS(self, self.toolbar,
          'Images/Debug/DebugFullSpeed.png', _('Debug/Continue full speed'),
          self.OnDebugFullSpeed) #'stops only at hard (code) breaks and exceptions'
        self.stepId = Utils.AddToolButtonBmpIS(self, self.toolbar,
          'Images/Debug/Step.png', _('Step - %s')%keyDefs['DebugStep'][2],
          self.OnStep)
        self.overId = Utils.AddToolButtonBmpIS(self, self.toolbar,
          'Images/Debug/Over.png', _('Over - %s')%keyDefs['DebugOver'][2],
          self.OnOver)
        self.outId = Utils.AddToolButtonBmpIS(self, self.toolbar,
          'Images/Debug/Out.png', _('Out - %s')%keyDefs['DebugOut'][2],
          self.OnOut)
        self.jumpId = -1
        if sys.version_info[:2] >= (2, 3):
            self.jumpId = Utils.AddToolButtonBmpIS(self, self.toolbar,
              'Images/Debug/Jump.png', _('Jump to line'), self.OnJump)

        self.pauseId = Utils.AddToolButtonBmpIS(self, self.toolbar,
          'Images/Debug/Pause.png',  _('Pause'), self.OnPause)
        self.stopId = Utils.AddToolButtonBmpIS(self, self.toolbar,
          'Images/Debug/Stop.png',  _('Stop'), self.OnStop)
        self.toolbar.AddSeparator()
        self.sourceTraceId = Utils.AddToolButtonBmpIS(self, self.toolbar,
          'Images/Debug/SourceTrace-Off.png',  _('Trace in source'),
          self.OnSourceTrace, '1')
        self.debugBrowseId = Utils.AddToolButtonBmpIS(self, self.toolbar,
          'Images/Debug/DebugBrowse.png',  _('Debug browsing'),
          self.OnDebugBrowse, '1')
        if Preferences.psPythonShell == 'Shell':
            self.shellNamespaceId = Utils.AddToolButtonBmpIS(self, self.toolbar,
              'Images/Debug/ShellDebug.png',  _('Eval in shell'),
              self.OnDebugNamespace, '1')
        else:
            self.shellNamespaceId = -1
        self.toolbar.AddSeparator()
        self.pathMappingsId = Utils.AddToolButtonBmpIS(self, self.toolbar,
          'Images/Debug/PathMapping.png', _('Edit client/server path mappings...'),
          self.OnPathMappings)
        self.splitOrientId = Utils.AddToolButtonBmpIS(self, self.toolbar,
          'Images/Debug/SplitOrient.png', _('Toggle split orientation'),
          self.OnToggleSplitOrient)

        self.SetAcceleratorTable(wx.AcceleratorTable( [
          (keyDefs['Debug'][0], keyDefs['Debug'][1], self.runId),
          (keyDefs['DebugStep'][0], keyDefs['DebugStep'][1], self.stepId),
          (keyDefs['DebugOver'][0], keyDefs['DebugOver'][1], self.overId),
          (keyDefs['DebugOut'][0], keyDefs['DebugOut'][1], self.outId) ] ))

        self.toolbar.Realize()

        self.toolbar.ToggleTool(self.sourceTraceId, True)
        self.toolbar.ToggleTool(self.debugBrowseId, False)

        self.splitter = wx.SplitterWindow(self, -1,
               style=wx.SP_NOBORDER|Preferences.splitterStyle)

        (stackImgIdx, breaksImgIdx, watchesImgIdx, localsImgIdx,
                  globalsImgIdx) = range(5)

        # Create a Notebook
        self.nbTop = wx.Notebook(self.splitter, wxID_TOPPAGECHANGED)
        self.nbTop.SetImageList(self.viewsImgLst)

        self.stackView = StackViewCtrl(self.nbTop, None, self)
        self.nbTop.AddPage(self.stackView, _('Stack'), imageId=stackImgIdx)

        self.breakpts = BreakViewCtrl(self.nbTop, self)
        self.nbTop.AddPage(self.breakpts, _('Breakpoints'), imageId=breaksImgIdx)

        # Create a Notebook
        self.nbBottom = wx.Notebook(self.splitter, wxID_PAGECHANGED,
              style=wx.CLIP_CHILDREN)
        self.nbBottom.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.OnPageChange, id=wxID_PAGECHANGED)
        self.nbBottom.SetImageList(self.viewsImgLst)

        self.watches = WatchViewCtrl(self.nbBottom, self.viewsImgLst, self)
        self.nbBottom.AddPage(self.watches, _('Watches'), imageId=watchesImgIdx)

        self.locs = NamespaceViewCtrl(self.nbBottom, self, 1, 'local')
        self.nbBottom.AddPage(self.locs, _('Locals'), imageId=localsImgIdx)

        self.globs = NamespaceViewCtrl(
            self.nbBottom, self, 0, 'global')

        self.nbBottom.AddPage(self.globs, _('Globals'), imageId=globalsImgIdx)

        self.splitter.SetMinimumPaneSize(40)

        self.splitter.SplitHorizontally(self.nbTop, self.nbBottom)
        self.splitter.SetSashPosition(175)
        self.splitter.SetSplitMode(wx.SPLIT_HORIZONTAL)

        self.mlc = 0
        self.frame = None

        self.lastStepView = None
        self.lastStepLineno = -1

        self.stepping_enabled = 1

        self.setParams([])

        self.setServerClientPaths([])

        self.Bind(EVT_DEBUGGER_OK, self.OnDebuggerOk, id=self.GetId())
        self.Bind(EVT_DEBUGGER_EXC, self.OnDebuggerException, id=self.GetId())
        self.Bind(EVT_DEBUGGER_STOPPED, self.OnDebuggerStopped, id=self.GetId())

        # used to indicate when the debugger start,
        # would be better if there was a start event in addition to the OK event
        self._pid = None
        self._erroutFrm = self.editor.erroutFrm

        self.stream_timer = wx.PyTimer(self.OnStreamTimer)
        self.stream_timer.Start(100)

        self.Bind(wx.EVT_MENU_HIGHLIGHT_ALL, self.OnToolOver)
        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
Exemplo n.º 16
0
    def __init__(self, parent):
        self._init_ctrls(parent)

        self.winConfOption = 'classbrowser'
        self.loadDims()

        self.SetIcon(IS.load('Images/Icons/ClassBrowser.ico'))

        self.classes = {}
        for module in ('wx', 'wx.html', 'wx.calendar', 'wx.grid', 'wx.stc',
                       'wx.gizmos', 'wx.wizard'):
            self.classes.update(pyclbr.readmodule(module))

        tID = wx.NewId()
        root = self.hierarchy.AddRoot('wx.Object')

        clsDict = {}

        for i in self.classes.keys():
            travTilBase(i, self.classes, clsDict)

        buildTree(self.hierarchy, root, clsDict)
        self.hierarchy.Expand(root)

        tID = wx.NewId()

        root = self.tree.AddRoot(_('Modules'))
        modules = {}
        moduleName = ''
        for className in self.classes.keys():
            moduleName = os.path.basename(self.classes[className].file)
            if not modules.has_key(moduleName):
                modules[moduleName] = {}
            modules[moduleName][className] = {}
            modules[moduleName][className]['Properties'] = {}
            modules[moduleName][className]['Methods'] = {}
            modules[moduleName][className]['Built-in'] = {}
            for method in self.classes[className].methods.keys():
                if (method[:2] == '__'):
                    modules[moduleName][className]['Built-in'][
                        method] = self.classes[className].lineno
                elif (method[:3] == 'Get'):
                    if self.classes[className].methods.has_key('Set' +
                                                               method[3:]):
                        modules[moduleName][className]['Properties'][
                            method[3:]] = self.classes[className].lineno
                    else:
                        modules[moduleName][className]['Methods'][
                            method] = self.classes[className].lineno
                elif (method[:3] == 'Set'):
                    if self.classes[className].methods.has_key('Get' +
                                                               method[3:]):
                        modules[moduleName][className]['Properties'][
                            method[3:]] = self.classes[className].lineno
                    else:
                        modules[moduleName][className]['Methods'][
                            method] = self.classes[className].lineno
                else:
                    modules[moduleName][className]['Methods'][
                        method] = self.classes[className].lineno
        moduleLst = modules.keys()
        moduleLst.sort()
        for module in moduleLst:
            roots = self.tree.AppendItem(root, module)
            classLst = modules[module].keys()
            classLst.sort()
            for classes in classLst:
                aClass = self.tree.AppendItem(roots, classes)
                methItem = self.tree.AppendItem(aClass, _('Methods'))
                for methods in modules[module][classes]['Methods'].keys():
                    methodsItem = self.tree.AppendItem(methItem, methods)
                propItem = self.tree.AppendItem(aClass, _('Properties'))
                for properties in modules[module][classes]['Properties'].keys(
                ):
                    propertyItem = self.tree.AppendItem(propItem, properties)
                bInItem = self.tree.AppendItem(aClass, _('Built-in'))
                for builtIns in modules[module][classes]['Built-in'].keys():
                    builtInItem = self.tree.AppendItem(bInItem, builtIns)
                suprItem = self.tree.AppendItem(aClass, _('Super'))
                for supers in self.classes[classes].super:
                    try:
                        superItem = self.tree.AppendItem(suprItem, supers.name)
                    except AttributeError:
                        superItem = self.tree.AppendItem(suprItem, supers)

        self.tree.Expand(root)
Exemplo n.º 17
0
 def addTool(self, filename, text, help, func, toggle = False):
     mID = wx.NewId()
     self.toolBar.AddTool(mID, IS.load(filename+'.png'),
       shortHelpString = text, isToggle = toggle)
     self.Bind(wx.EVT_TOOL, func, id=mID)
     return mID
Exemplo n.º 18
0
    def __init__(self, editor, list, inspector, controllers):
        ExplorerNodes.Controller.__init__(self, editor)
        self.list = list
        self.menu = wx.Menu()
        self.cvsOptions = '-z7'

        self.cvsMenuDef = [
            (wxID_CVSUPDATE, 'Update', self.OnUpdateCVSItems, self.updateBmp),
            (wxID_CVSCOMMIT, 'Commit', self.OnCommitCVSItems, self.commitBmp),
            (-1, '-', None, ''),
            (wxID_CVSADD, 'Add', self.OnAddCVSItems, self.addBmp),
            (wxID_CVSADDBINARY, 'Add binary', self.OnAddBinaryCVSItems,
             self.addBinBmp),
            (wxID_CVSREMOVE, 'Remove', self.OnRemoveCVSItems, self.removeBmp),
            (-1, '-', None, ''),
            (wxID_CVSDIFF, 'Diff', self.OnDiffCVSItems, self.diffBmp),
            (wxID_CVSLOG, 'Log', self.OnLogCVSItems, self.logBmp),
            (wxID_CVSSTATUS, 'Status', self.OnStatusCVSItems, self.statusBmp),
            #              (wxID_CVSTEST, 'TEST', self.OnTest),
            (-1, '-', None, ''),
            (wxID_CVSTAG, 'Tag', self.OnTagCVSItems, self.tagBmp),
            (wxID_CVSBRANCH, 'Branch', self.OnBranchCVSItems, self.branchBmp),
            (wxID_CVSLOCK, 'Lock', self.OnLockCVSItems, '-'),
            (wxID_CVSUNLOCK, 'Unlock', self.OnUnlockCVSItems, '-')
        ]

        self.setupMenu(self.menu, self.list, self.cvsMenuDef)

        self.fileCVSMenuDef = [
            (wxID_FSCVSIMPORT, 'Import', self.OnImportCVSFSItems, '-'),
            (wxID_FSCVSCHECKOUT, 'Checkout', self.OnCheckoutCVSFSItems, '-'),
            (-1, '-', None, ''),
            (wxID_FSCVSLOGIN, 'Login', self.OnLoginCVS, '-'),
            (wxID_FSCVSLOGIN, 'SF Login', self.OnSFLoginCVS, '-'),
            (wxID_FSCVSLOGOUT, 'Logout', self.OnLogoutCVS, '-'),
        ]

        self.fileCVSMenu = wx.Menu()
        self.setupMenu(self.fileCVSMenu, self.list, self.fileCVSMenuDef, False)

        ##        self.cvsEnvMenu = wx.Menu()
        ##        menus = []
        ##        for env, id in map(lambda x, v = cvs_environ_vars, i = cvs_environ_ids: \
        ##            (v[x], i[x]), range(len(cvs_environ_vars))):
        ##            menus.append( (id, env, self.OnEditEnv, '-') )
        ##        self.setupMenu(self.cvsEnvMenu, self.list, menus)
        ##
        ##        self.fileCVSMenu.AppendMenu(wxID_FSCVSENV, 'CVS shell environment vars', self.cvsEnvMenu)

        self.images = wx.ImageList(16, 16)
        for cvsImg in ('Images/CvsPics/File.png',
                       'Images/CvsPics/BinaryFile.png',
                       'Images/CvsPics/ModifiedFile.png',
                       'Images/CvsPics/ModifiedBinaryFile.png',
                       'Images/CvsPics/MissingFile.png',
                       'Images/CvsPics/ConflictingFile.png',
                       'Images/CvsPics/Dir.png', 'Images/Modules/FolderUp.png',
                       'Images/CvsPics/UnknownDir.png',
                       'Images/CvsPics/UnknownFile.png'):
            self.images.Add(IS.load(cvsImg))

        self.toolbarMenus = [self.cvsMenuDef]

        FSCVSFolderNode.images = self.images
Exemplo n.º 19
0
    def __init__(self,
                 parent,
                 collEditView,
                 additAdders=(),
                 lvStyle=wx.LC_REPORT):
        self.collEditPos = (-1, -1)
        self.collEditPos = getNextDefaultPos()

        self._init_ctrls(parent)

        self.itemList = wx.ListCtrl(size=wx.DefaultSize,
                                    id=wxID_COLLECTIONEDITORITEMLIST,
                                    parent=self,
                                    name='itemList',
                                    style=lvStyle | wx.LC_SINGLE_SEL
                                    | wx.SUNKEN_BORDER,
                                    pos=wx.DefaultPosition)
        self.itemList.Bind(wx.EVT_LIST_ITEM_SELECTED,
                           self.OnObjectSelect,
                           id=wxID_COLLECTIONEDITORITEMLIST)
        self.itemList.Bind(wx.EVT_LIST_ITEM_DESELECTED,
                           self.OnObjectDeselect,
                           id=wxID_COLLECTIONEDITORITEMLIST)
        self.itemList.Bind(wx.EVT_LEFT_DCLICK, self.OnObjectDClick)

        self.SetIcon(IS.load('Images/Icons/Collection.ico'))

        self.collEditView = collEditView
        self.selected = -1

        self.additAdders = additAdders  #= 0
        self.additIds = {}

        self.toolLst = []

        acclst = []
        wId = Utils.AddToolButtonBmpIS(self, self.toolBar,
                                       'Images/Shared/NewItem.png', _('New'),
                                       self.OnNewClick)
        self.Bind(wx.EVT_MENU, self.OnNewClick, id=wId)
        acclst.append((keyDefs['Insert'][0], keyDefs['Insert'][1], wId))
        self.toolLst.append(wId)
        if additAdders:
            wId = Utils.AddToolButtonBmpIS(self, self.toolBar,
                                           'Images/Shared/NewItems.png',
                                           _('More new ...'),
                                           self.OnMoreNewClick)
            self.Bind(wx.EVT_MENU, self.OnMoreNewClick, id=wId)
            self.toolLst.append(wId)

            self.toolBar.AddSeparator()

        wId = Utils.AddToolButtonBmpIS(self, self.toolBar,
                                       'Images/Shared/DeleteItem.png',
                                       _('Delete'), self.OnDeleteClick)
        self.Bind(wx.EVT_MENU, self.OnDeleteClick, id=wId)
        acclst.append((keyDefs['Delete'][0], keyDefs['Delete'][1], wId))
        self.toolLst.append(wId)
        self.toolBar.AddSeparator()
        Utils.AddToolButtonBmpIS(self, self.toolBar, 'Images/Shared/up.png',
                                 _('Up'), self.OnUpClick)
        Utils.AddToolButtonBmpIS(self, self.toolBar, 'Images/Shared/down.png',
                                 _('Down'), self.OnDownClick)
        self.toolBar.AddSeparator()
        wId = Utils.AddToolButtonBmpIS(self, self.toolBar,
                                       'Images/Editor/Refresh.png',
                                       _('Refresh'), self.OnRefresh)
        self.Bind(wx.EVT_MENU, self.OnRefresh, id=wId)
        acclst.append((keyDefs['Refresh'][0], keyDefs['Refresh'][1], wId))
        self.toolLst.append(wId)

        wId = wx.NewId()
        self.Bind(wx.EVT_MENU, self.OnSwitchToInspector, id=wId)
        acclst.append((keyDefs['Inspector'][0], keyDefs['Inspector'][1], wId))

        wId = wx.NewId()
        self.Bind(wx.EVT_MENU, self.OnSwitchToDesigner, id=wId)
        acclst.append((keyDefs['Designer'][0], keyDefs['Designer'][1], wId))

        self.SetAcceleratorTable(wx.AcceleratorTable(acclst))

        self.toolBar.Realize()

        if lvStyle == wx.LC_REPORT:
            self.itemList.InsertColumn(0, _('Name'), width=180)

        self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)

        self.winConfOption = 'collectioneditor'
        self.loadDims()

        # Hack to force a refresh, it's not displayed correctly initialy
        self.SetSize((self.GetSize().x + 1, self.GetSize().y))
Exemplo n.º 20
0
    def __init__(self, editor, list, inspector, controllers):
        ExplorerNodes.Controller.__init__(self, editor)
        self.list = list
        self.menu = wx.Menu()
        self.cvsOptions = '-z7'

        self.cvsMenuDef = [
              (wxID_CVSUPDATE, 'Update', self.OnUpdateCVSItems, self.updateBmp),
              (wxID_CVSCOMMIT, 'Commit', self.OnCommitCVSItems, self.commitBmp),
              (-1, '-', None, ''),
              (wxID_CVSADD, 'Add', self.OnAddCVSItems, self.addBmp),
              (wxID_CVSADDBINARY, 'Add binary', self.OnAddBinaryCVSItems, self.addBinBmp),
              (wxID_CVSREMOVE, 'Remove', self.OnRemoveCVSItems, self.removeBmp),
              (-1, '-', None, ''),
              (wxID_CVSDIFF, 'Diff', self.OnDiffCVSItems, self.diffBmp),
              (wxID_CVSLOG, 'Log', self.OnLogCVSItems, self.logBmp),
              (wxID_CVSSTATUS, 'Status', self.OnStatusCVSItems, self.statusBmp),
#              (wxID_CVSTEST, 'TEST', self.OnTest),
              (-1, '-', None, ''),
              (wxID_CVSTAG, 'Tag', self.OnTagCVSItems, self.tagBmp),
              (wxID_CVSBRANCH, 'Branch', self.OnBranchCVSItems, self.branchBmp),
              (wxID_CVSLOCK, 'Lock', self.OnLockCVSItems, '-'),
              (wxID_CVSUNLOCK, 'Unlock', self.OnUnlockCVSItems, '-') ]

        self.setupMenu(self.menu, self.list, self.cvsMenuDef)

        self.fileCVSMenuDef = [
              (wxID_FSCVSIMPORT, 'Import', self.OnImportCVSFSItems, '-'),
              (wxID_FSCVSCHECKOUT, 'Checkout', self.OnCheckoutCVSFSItems, '-'),
              (-1, '-', None, ''),
              (wxID_FSCVSLOGIN, 'Login', self.OnLoginCVS, '-'),
              (wxID_FSCVSLOGIN, 'SF Login', self.OnSFLoginCVS, '-'),
              (wxID_FSCVSLOGOUT, 'Logout', self.OnLogoutCVS, '-'),
        ]

        self.fileCVSMenu = wx.Menu()
        self.setupMenu(self.fileCVSMenu, self.list, self.fileCVSMenuDef, False)

##        self.cvsEnvMenu = wx.Menu()
##        menus = []
##        for env, id in map(lambda x, v = cvs_environ_vars, i = cvs_environ_ids: \
##            (v[x], i[x]), range(len(cvs_environ_vars))):
##            menus.append( (id, env, self.OnEditEnv, '-') )
##        self.setupMenu(self.cvsEnvMenu, self.list, menus)
##
##        self.fileCVSMenu.AppendMenu(wxID_FSCVSENV, 'CVS shell environment vars', self.cvsEnvMenu)

        self.images = wx.ImageList(16, 16)
        for cvsImg in ( 'Images/CvsPics/File.png',
                        'Images/CvsPics/BinaryFile.png',
                        'Images/CvsPics/ModifiedFile.png',
                        'Images/CvsPics/ModifiedBinaryFile.png',
                        'Images/CvsPics/MissingFile.png',
                        'Images/CvsPics/ConflictingFile.png',
                        'Images/CvsPics/Dir.png',
                        'Images/Modules/FolderUp.png',
                        'Images/CvsPics/UnknownDir.png',
                        'Images/CvsPics/UnknownFile.png'):
            self.images.Add(IS.load(cvsImg))

        self.toolbarMenus = [self.cvsMenuDef]

        FSCVSFolderNode.images = self.images
Exemplo n.º 21
0
 def getButtonBmp(self, name, wxClass):
     return IS.load('%s%s.png' %(self.bitmapPath, name))
Exemplo n.º 22
0
 def getButtonBmp(self, name, wxClass):
     try:
         return IS.load('%s%s.png' %(self.bitmapPath, name))
     except IS.Error:
         return IS.load('Images/Palette/Component.png')
Exemplo n.º 23
0
    def __init__(self, parent, id, app):
        self.frameTitle = 'Boa Constructor - Python IDE & wxPython GUI Builder'
        self.frameTitle = Preferences.paletteTitle

        self._init_ctrls(parent)

        self.winConfOption = 'palette'
        self.loadDims()

        self.paletteStyle = Preferences.paletteStyle
        if self.paletteStyle == 'menu':
            self.menuBar = wx.MenuBar()
            self.SetMenuBar(self.menuBar)
            self.palette.Show(False)

        self.app = app
        self.destroying = False

        self.widgetSet = {}
        self.SetIcon(IS.load(self.paletteIcon))

        self.browser = None

        self.toolBar.AddSeparator()

        self.componentSB = ComponentSelection(self)

        if Preferences.showFrameTestButton:
            self.toolBar.AddSeparator()
            self.addTool('Images/Shared/CustomHelp', 'Test', 'Test',
                         self.OnTest)

        # Add main helpbuttons defined in the config file
        conf = Utils.createAndReadConfig('Explorer')
        self.paletteHelpItems = eval(conf.get('help', 'palettehelp'), {})

        self.toolBar.AddSeparator()
        self.addTool('Images/Shared/Help', _('Boa or selected component help'),
                     _('Show help'), self.OnHelpToolClick)
        self.addTool('Images/Shared/wxWinHelp', _('wxPython help'),
                     _('Show help'), self.OnWxWinHelpToolClick)
        self.addTool('Images/Shared/PythonHelp', _('Python help'),
                     _('Show help'), self.OnPythonHelpToolClick)

        # Add additional helpbuttons if defined in the config file
        customHelpItems = eval(conf.get('help', 'customhelp'), {})
        self.customHelpItems = {}
        for caption, helpFile in customHelpItems.items():
            mID = wx.NewId()
            self.toolBar.AddTool(mID,
                                 IS.load('Images/Shared/CustomHelp.png'),
                                 shortHelpString=caption)
            self.Bind(wx.EVT_TOOL, self.OnCustomHelpToolClick, id=mID)
            self.customHelpItems[mID] = (caption, helpFile)

        if wx.Platform == '__WXGTK__':
            self.toolBar.AddSeparator()
            self.addTool('Images/Shared/CloseWindow', 'Exit', '',
                         self.OnCloseClick)
        self.toolBar.Realize()

        self.palettePages = []

        self.SetBackgroundColour(
            wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))
Exemplo n.º 24
0
def AddToolButtonBmpIS(frame, toolbar, name, hint, triggermeth, toggleBmp = ''):
    if toggleBmp:
        return AddToggleToolButtonBmpObject(frame, toolbar, IS.load(name), hint[:85], triggermeth)
    else:
        return AddToolButtonBmpObject(frame, toolbar, IS.load(name), hint[:85], triggermeth)
Exemplo n.º 25
0
    def __init__(self, parent, id, app):
        self.frameTitle = 'Boa Constructor - Python IDE & wxPython GUI Builder'
        self.frameTitle = Preferences.paletteTitle

        self._init_ctrls(parent)

        self.winConfOption = 'palette'
        self.loadDims()

        self.paletteStyle = Preferences.paletteStyle
        if self.paletteStyle == 'menu':
            self.menuBar = wx.MenuBar()
            self.SetMenuBar(self.menuBar)
            self.palette.Show(False)

        self.app = app
        self.destroying = False

        self.widgetSet = {}
        self.SetIcon(IS.load(self.paletteIcon))

        self.browser = None

        self.toolBar.AddSeparator()

        self.componentSB = ComponentSelection(self)

        if Preferences.showFrameTestButton:
            self.toolBar.AddSeparator()
            self.addTool('Images/Shared/CustomHelp', 'Test', 'Test', self.OnTest)

        # Add main helpbuttons defined in the config file
        conf = Utils.createAndReadConfig('Explorer')
        self.paletteHelpItems = eval(conf.get('help', 'palettehelp'), {})

        self.toolBar.AddSeparator()
        self.addTool('Images/Shared/Help', _('Boa or selected component help'),
              _('Show help'), self.OnHelpToolClick)
        self.addTool('Images/Shared/wxWinHelp', _('wxPython help'),
              _('Show help'), self.OnWxWinHelpToolClick)
        self.addTool('Images/Shared/PythonHelp', _('Python help'),
              _('Show help'), self.OnPythonHelpToolClick)

        # Add additional helpbuttons if defined in the config file
        customHelpItems = eval(conf.get('help', 'customhelp'), {})
        self.customHelpItems = {}
        for caption, helpFile in customHelpItems.items():
            mID = wx.NewId()
            self.toolBar.AddTool(mID, IS.load('Images/Shared/CustomHelp.png'),
              shortHelpString = caption)
            self.Bind(wx.EVT_TOOL, self.OnCustomHelpToolClick, id=mID)
            self.customHelpItems[mID] = (caption, helpFile)

        if wx.Platform == '__WXGTK__':
            self.toolBar.AddSeparator()
            self.addTool('Images/Shared/CloseWindow', 'Exit', '', self.OnCloseClick)
        self.toolBar.Realize()

        self.palettePages = []

        self.SetBackgroundColour(wx.SystemSettings.GetColour(wx.SYS_COLOUR_BTNFACE))
Exemplo n.º 26
0
 def getButtonBmp(self, name, wxClass):
     try:
         return IS.load('%s%s.png' % (self.bitmapPath, name))
     except IS.Error:
         return IS.load('Images/Palette/Component.png')