Example #1
0
            elif types.StringType is type(value[0]):
                value = value[0]

            items.append((string.split(name, ':')[1], value))
        return items


class RegCompanion(RegPropReaderMixin, ExplorerNodes.ExplorerCompanion):
    def __init__(self, name, regNode):
        ExplorerNodes.ExplorerCompanion.__init__(self, name)
        self.regNode = regNode

    def getPropertyItems(self):
        res = []
        self.regNode.initHkey()
        for name, val, tpe in self.regNode.enumReg(_winreg.EnumValue,
                                                   self.regNode.hkey):
            res.append((name, val))
        return res

    def SetProp(self, name, value):
        raise 'Property editing not supported yet'


#-------------------------------------------------------------------------------
ExplorerNodes.register(RegItemNode,
                       clipboard=RegExpClipboard,
                       confdef=('explorer', 'reg'),
                       controller=RegController,
                       category=RegCatNode)
Example #2
0
#-------------------------------------------------------------------------------
# maps meta types to ExplorerNodes
zopeClassMap = {
    'Folder': DirNode,
    'Product Help': DirNode,
    'Z Class': ZClassNode,
    'User Folder': UserFolderNode,
    'Control Panel': ControlNode,
    'Z SQL Method': ZSQLNode,
    'DTML Document': DTMLDocNode,
    'DTML Method': DTMLMethodNode,
    'Python Method': PythonNode,
    'External Method': ExtPythonNode,
    'Script (Python)': PythonScriptNode,
    'Image': ZopeImageNode,
    'File': ZopeNode,
    'User': ZopeUserNode,
    'Site Error Log': SiteErrorLogNode,
    'Help Topic': HelpTopicNode,
}

ExplorerNodes.register(ZopeCatNode, controller=ZopeCatController)
ExplorerNodes.register(ZopeItemNode,
                       clipboard='global',
                       confdef=('explorer', 'zope'),
                       controller=ZopeController,
                       category=ZopeCatNode)
ExplorerNodes.uriSplitReg[('zope', 2)] = uriSplitZope
ExplorerNodes.uriSplitReg[('zopedebug', 2)] = uriSplitZopeDebug
ExplorerNodes.transportFindReg['zope'] = findZopeExplorerNode
Example #3
0
    def buildItems(self, items, propList):
        #print propList
        for name, value in propList:
            if not value: value = ''
            elif types.StringType is type(value[0]):
                value = value[0]

            items.append( (string.split(name, ':')[1], value) )
        return items

class RegCompanion(RegPropReaderMixin, ExplorerNodes.ExplorerCompanion):
    def __init__(self, name, regNode):
        ExplorerNodes.ExplorerCompanion.__init__(self, name)
        self.regNode = regNode

    def getPropertyItems(self):
        res = []
        self.regNode.initHkey()
        for name, val, tpe in self.regNode.enumReg(_winreg.EnumValue, self.regNode.hkey):
            res.append( (name, val) )
        return res

    def SetProp(self, name, value):
        raise 'Property editing not supported yet'


#-------------------------------------------------------------------------------
ExplorerNodes.register(RegItemNode, clipboard=RegExpClipboard,
      confdef=('explorer', 'reg'), controller=RegController, category=RegCatNode)
              EditorHelper.imgPathFolder, self, self.bookmarks)

    def refresh(self):
        self.entries = []
        pythonDir = os.path.dirname(sys.executable)
        for pth in sys.path:
            pth = os.path.abspath(pth)
            shortPath = pth
            if pth:
                if pth[0:len(pythonDir)] == pythonDir:
                    shortPath = pth[len(pythonDir):]
                    if not shortPath:
                        shortPath = '<Python root>'
                if (shortPath, pth) not in self.entries and os.path.isdir(pth):
                    self.entries.append( (shortPath, pth) )

    def openList(self):
        self.refresh()
        res = []
        for short, entry in self.entries:
            res.append(self.createChildNode(short, entry))
        return res

if not hasattr(sys, 'frozen'):
    ExplorerNodes.register(SysPathNode, clipboard='file', controller='file', root=True)


# Hook debugger attaching to Tools menu
Plugins.registerTool(
 _('Attach to debugger'), ToolsOnAttachToDebugger, 'Images/Shared/Debugger.png')
        ##
        ##        self.entries = lst
        return self.entries

    def open(self, editor):
        return editor.openOrGotoModule(self.resourcepath)

    def openParent(self, editor):
        tree = editor.explorer.tree
        svnParentItemParent = tree.GetItemParent(
            tree.GetItemParent(tree.GetSelection()))

        svnChd = tree.getChildNamed(svnParentItemParent, '.svn')
        if svnChd.IsOk():
            tree.SelectItem(svnChd)
            return True
        else:
            return False


#---------------------------------------------------------------------------
# Register svn dirs as a subtype of file explorers
from Explorers import FileExplorer
FileExplorer.FileSysNode.subExplorerReg['folder'].append(
    (FSSVNFolderNode, isSVN, EditorHelper.imgCVSFolder))

ExplorerNodes.register(FSSVNFolderNode,
                       clipboard=None,
                       confdef=('', ''),
                       controller=SVNController)
                    return itm.getNodeFromPath('/'+respath, metatype)
    raise ExplorerNodes.TransportError(
          'Zope transport could not be found: %s || %s'%(category, respath))

#-------------------------------------------------------------------------------
# maps meta types to ExplorerNodes
zopeClassMap = { 'Folder': DirNode,
        'Product Help': DirNode,
        'Z Class': ZClassNode,
        'User Folder': UserFolderNode,
        'Control Panel': ControlNode,
        'Z SQL Method': ZSQLNode,
        'DTML Document': DTMLDocNode,
        'DTML Method': DTMLMethodNode,
        'Python Method': PythonNode,
        'External Method': ExtPythonNode,
        'Script (Python)': PythonScriptNode,
        'Image': ZopeImageNode,
        'File': ZopeNode,
        'User': ZopeUserNode,
        'Site Error Log': SiteErrorLogNode,
        'Help Topic': HelpTopicNode,
       }

ExplorerNodes.register(ZopeCatNode, controller=ZopeCatController)
ExplorerNodes.register(ZopeItemNode, clipboard='global',
  confdef=('explorer', 'zope'), controller=ZopeController, category=ZopeCatNode)
ExplorerNodes.uriSplitReg[('zope', 2)] = uriSplitZope
ExplorerNodes.uriSplitReg[('zopedebug', 2)] = uriSplitZopeDebug
ExplorerNodes.transportFindReg['zope'] = findZopeExplorerNode
Example #7
0
        self.treeList = getWxPyDemoTree()
        
    def isFolderish(self):
        return true

    def createChildNode(self, section, items):
        return wxPythonDemoSectionNode(section, items, self.clipboard,
              self.bookmarks)

    def openList(self):
        return [self.createChildNode(name, items) 
                for name, items in self.treeList]


#-------------------------------------------------------------------------------
ExplorerNodes.register(wxPythonDemoDirNode, root=True)

#-------------------------------------------------------------------------------

import PaletteStore
from Models import PythonEditorModels, PythonControllers

class wxPythonDemoModuleModel(PythonEditorModels.ModuleModel):
    modelIdentifier = 'wxPythonDemoModule'
    defaultName = 'wxpythondemomodule'
    
    def getDefaultData(self):
        return '''import wx
    
#-------------------------------------------------------------------------------
##
##        for missing in missingEntries:
##            lst.append(missing)
##
##        self.entries = lst
        return self.entries 

    def open(self, editor):
        return editor.openOrGotoModule(self.resourcepath)

    def openParent(self, editor):
        tree = editor.explorer.tree
        svnParentItemParent = tree.GetItemParent(tree.GetItemParent(tree.GetSelection()))

        svnChd = tree.getChildNamed(svnParentItemParent, '.svn')
        if svnChd.IsOk():
            tree.SelectItem(svnChd)
            return True
        else:
            return False

#---------------------------------------------------------------------------
# Register svn dirs as a subtype of file explorers
from Explorers import FileExplorer
FileExplorer.FileSysNode.subExplorerReg['folder'].append(
      (FSSVNFolderNode, isSVN, EditorHelper.imgCVSFolder)
)

ExplorerNodes.register(FSSVNFolderNode, clipboard=None, confdef=('', ''),
                       controller=SVNController)
Example #9
0
    def isFolderish(self):
        return true

    def createChildNode(self, section, items):
        return wxPythonDemoSectionNode(section, items, self.clipboard,
                                       self.bookmarks)

    def openList(self):
        return [
            self.createChildNode(name, items) for name, items in self.treeList
        ]


#-------------------------------------------------------------------------------
ExplorerNodes.register(wxPythonDemoDirNode, root=True)

#-------------------------------------------------------------------------------

import PaletteStore
from Models import PythonEditorModels, PythonControllers


class wxPythonDemoModuleModel(PythonEditorModels.ModuleModel):
    modelIdentifier = 'wxPythonDemoModule'
    defaultName = 'wxpythondemomodule'

    def getDefaultData(self):
        return '''import wx
    
#-------------------------------------------------------------------------------