class PyResourceBitmapModel(PythonEditorModels.ModuleModel): modelIdentifier = 'PyImgResource' bitmap = 'PyResBitmap.png' imgIdx = EditorHelper.imgPyResBitmap = EditorHelper.imgIdxRange() def updateData(self, data, subImage): from wx.tools import img2py crunched = StringIO(img2py.crunch_data(data, subImage['zip'])).readlines() if subImage['zip']: crunched[-1].rstrip() crunched[-1] += ' )'+subImage['eol'] srcLines = self.getDataAsLines() srcLines[subImage['start']:subImage['end']] = crunched + [subImage['eol']] self.setDataFromLines(srcLines) self.modified = True subImage['data'] = data
except ValueError: files.append(file.filename) return files def updateFilelists(self): zf = self.ArchiveClass(self.resourcepath, 'r') try: self.compression = zf.compression self.allFiles = zf.infolist() self.allFileNames = [fl.filename for fl in self.allFiles] finally: zf.close() EditorHelper.imgZipFileModel = \ EditorHelper.addPluginImgs('Images/Modules/ZipFile.png') class ZipFileModel(EditorModels.EditorModel): modelIdentifier = 'ZipFile' defaultName = 'zip' bitmap = 'ZipFile.png' imgIdx = EditorHelper.imgZipFileModel ext = '.zip' def uriSplitZip(filename, zipfile, zipentry): return 'zip', zipfile, zipentry, filename def findZipExplorerNode(category, respath, transports):
import os import wx import wx.stc import Preferences, Utils, Plugins from Utils import _ import PaletteStore from Models import Controllers, EditorHelper, EditorModels from Views import SourceViews, StyledTextCtrls # Allocate an image index for Java files EditorHelper.imgJavaModel = EditorHelper.imgIdxRange() Plugins.registerPreference('JavaSupport', 'jsJavaCompilerPath', "''", ['Path to the compiler'], 'type: filepath') class JavaModel(EditorModels.SourceModel): modelIdentifier = 'Java' defaultName = 'java' # default name given to newly created files bitmap = 'Java.png' # this image must exist in Images/Modules ext = '.java' imgIdx = EditorHelper.imgJavaModel # get the style definitions file in either the prefs directory or the Boa root java_cfgfile = os.path.join(Preferences.rcPath, 'stc-java.rc.cfg') #if not os.path.exists(java_cfgfile): # java_cfgfile = Preferences.pyPath +'/Plug-ins/stc-java.rc.cfg'
# Define new zope image and a Model for opening in the Editor from ZopeLib.ZopeEditorModels import addZOAImage, ZOAIcons, ZopeDocumentModel, ZopeController import Models from Models import Controllers, EditorHelper from Models.HTMLSupport import HTMLFileModel, HTMLFileController, HTMLFileView addZOAImage('Page Template', 'Images/ZOA/ZopePageTemplate.png') addZOAImage('Filesystem Page Template', 'Images/ZOA/ZopePageTemplate.png') class ZopePageTemplateModel(ZopeDocumentModel): imgIdx = ZOAIcons['Page Template'] EditorHelper.imgZopePTFSModel = EditorHelper.imgIdxRange() class ZopePageTemplateFSModel(HTMLFileModel): modelIdentifier = 'PageTemplateHTML' defaultName = 'pagetemplate' bitmap = 'ZopePageTemplate_s.png' imgIdx = EditorHelper.imgZopePTFSModel ext = '.pt' EditorHelper.modelReg[ ZopePageTemplateFSModel.modelIdentifier] = ZopePageTemplateFSModel EditorHelper.extMap['.pt'] = ZopePageTemplateFSModel EditorHelper.extMap['.zpt'] = ZopePageTemplateFSModel
import os import wx import wx.stc import Preferences, Utils, Plugins from Utils import _ import PaletteStore from Models import Controllers, EditorHelper, EditorModels from Views import SourceViews, StyledTextCtrls from Explorers import ExplorerNodes # Allocate an image index for Pascal files EditorHelper.imgPascalModel = EditorHelper.imgIdxRange() # Register plug-in preference Plugins.registerPreference('PascalSupport', 'psPascalCompilerPath', "''", ['Path to the compiler'], 'type: filepath') class PascalModel(EditorModels.SourceModel): modelIdentifier = 'Pascal' defaultName = 'pascal' # default name given to newly created files bitmap = 'Pascal.png' # this image must exist in Images/Modules ext = '.pas' imgIdx = EditorHelper.imgPascalModel # get the style definitions file in either the prefs directory or the Boa root pascal_cfgfile = Preferences.rcPath +'/stc-pascal.rc.cfg'
import os import wx import wx.stc import Preferences, Utils, Plugins from Utils import _ import PaletteStore from Models import Controllers, EditorHelper, EditorModels from Views import SourceViews, StyledTextCtrls from Explorers import ExplorerNodes # Allocate an image index for Pascal files EditorHelper.imgPascalModel = EditorHelper.imgIdxRange() # Register plug-in preference Plugins.registerPreference('PascalSupport', 'psPascalCompilerPath', "''", ['Path to the compiler'], 'type: filepath') class PascalModel(EditorModels.SourceModel): modelIdentifier = 'Pascal' defaultName = 'pascal' # default name given to newly created files bitmap = 'Pascal.png' # this image must exist in Images/Modules ext = '.pas' imgIdx = EditorHelper.imgPascalModel # get the style definitions file in either the prefs directory or the Boa root
to run the link app module itself from the IDE! Linked apps can be chained but beware of cycles! ;) Only proxies the run and debug methods to the parent app. """ import wx import Plugins import sourceconst from Models import PythonEditorModels, PythonControllers, EditorHelper, Controllers EditorHelper.imgLinkAppModel = EditorHelper.imgIdxRange() class LinkAppModel(PythonEditorModels.PyAppModel): modelIdentifier = 'LinkApp' defaultName = 'LinkApp' bitmap = 'LinkApp_s.png' imgIdx = EditorHelper.imgLinkAppModel # def getDefaultData(self): # return sourceconst.defSig %{'modelIdent':self.modelIdentifier, 'main': ''} def findAppInModules(self, args): for name, Model in self.moduleModels.items(): if Model.modelIdentifier in Controllers.appModelIdReg: filepath = self.moduleFilename(name)
import wx import wx.stc import Preferences, Utils, Plugins from Utils import _ try: imp.find_module('Pyrex') except ImportError: raise Plugins.SkipPlugin, _('Pyrex is not installed') from Models import Controllers, EditorHelper, EditorModels, PythonEditorModels, PythonControllers from Views import SourceViews, StyledTextCtrls EditorHelper.imgPyrexModel = EditorHelper.imgIdxRange() class PyrexModel(EditorModels.SourceModel): modelIdentifier = 'Pyrex' defaultName = 'pyrex' bitmap = 'Pyrex.png' ext = '.pyx' imgIdx = EditorHelper.imgPyrexModel pyrex_cfgfile = os.path.join(Preferences.rcPath, 'stc-pyrex.rc.cfg') #if not os.path.exists(pyrex_cfgfile): # pyrex_cfgfile = Preferences.pyPath +'/Plug-ins/stc-pyrex.rc.cfg' class PyrexStyledTextCtrlMix(StyledTextCtrls.LanguageSTCMix): def __init__(self, wId): StyledTextCtrls.LanguageSTCMix.__init__(self, wId,
to run the link app module itself from the IDE! Linked apps can be chained but beware of cycles! ;) Only proxies the run and debug methods to the parent app. """ import wx import Plugins import sourceconst from Models import PythonEditorModels, PythonControllers, EditorHelper, Controllers EditorHelper.imgLinkAppModel = EditorHelper.imgIdxRange() class LinkAppModel(PythonEditorModels.PyAppModel): modelIdentifier = 'LinkApp' defaultName = 'LinkApp' bitmap = 'LinkApp_s.png' imgIdx = EditorHelper.imgLinkAppModel # def getDefaultData(self): # return sourceconst.defSig %{'modelIdent':self.modelIdentifier, 'main': ''} def findAppInModules(self, args): for name, Model in self.moduleModels.items(): if Model.modelIdentifier in Controllers.appModelIdReg: filepath = self.moduleFilename(name) if self.editor.modules.has_key(filepath):
#---Model----------------------------------------------------------------------- # Define new zope image and a Model for opening in the Editor from ZopeLib.ZopeEditorModels import addZOAImage, ZOAIcons, ZopeDocumentModel, ZopeController import Models from Models import Controllers, EditorHelper from Models.HTMLSupport import HTMLFileModel, HTMLFileController, HTMLFileView addZOAImage('Page Template', 'Images/ZOA/ZopePageTemplate.png') addZOAImage('Filesystem Page Template', 'Images/ZOA/ZopePageTemplate.png') class ZopePageTemplateModel(ZopeDocumentModel): imgIdx = ZOAIcons['Page Template'] EditorHelper.imgZopePTFSModel = EditorHelper.imgIdxRange() class ZopePageTemplateFSModel(HTMLFileModel): modelIdentifier = 'PageTemplateHTML' defaultName = 'pagetemplate' bitmap = 'ZopePageTemplate_s.png' imgIdx = EditorHelper.imgZopePTFSModel ext = '.pt' EditorHelper.modelReg[ZopePageTemplateFSModel.modelIdentifier] = ZopePageTemplateFSModel EditorHelper.extMap['.pt'] = ZopePageTemplateFSModel EditorHelper.extMap['.zpt'] = ZopePageTemplateFSModel #---Views----------------------------------------------------------------------- from ZopeLib import ZopeViews
try: files.index(file.filename) except ValueError: files.append(file.filename) return files def updateFilelists(self): zf = self.ArchiveClass(self.resourcepath, 'r') try: self.compression = zf.compression self.allFiles = zf.infolist() self.allFileNames = [fl.filename for fl in self.allFiles] finally: zf.close() EditorHelper.imgZipFileModel = \ EditorHelper.addPluginImgs('Images/Modules/ZipFile.png') class ZipFileModel(EditorModels.EditorModel): modelIdentifier = 'ZipFile' defaultName = 'zip' bitmap = 'ZipFile.png' imgIdx = EditorHelper.imgZipFileModel ext = '.zip' def uriSplitZip(filename, zipfile, zipentry): return 'zip', zipfile, zipentry, filename def findZipExplorerNode(category, respath, transports): zf = ZipFileNode(os.path.basename(category), category, None, -1, None, None) zf.openList() return zf.getNodeFromPath(respath)
class PseudoFileOutTC(Utils.PseudoFile): tags = 'stderr' def write(self, s): self.output.AppendText(s) if echo: sys.__stdout__.write(s) class PseudoFileErrTC(Utils.PseudoFile): tags = 'stdout' def write(self, s): self.output.AppendText(s) if echo: sys.__stderr__.write(s) #------------------------------------------------------------------------------- EditorHelper.imgPyCrust = EditorHelper.addPluginImgs('Images\Editor\PyCrust.png') class PyCrustShellEditor(wx.SplitterWindow): def __init__(self, parent, wId): wx.SplitterWindow.__init__(self, parent, wId) from wx.py.crust import Shell, Filling # XXX argh! PyCrust records the About box pseudo file objs from # XXX sys.in/err/out o, i, e = sys.stdout, sys.stdin, sys.stderr sys.stdout, sys.stdin, sys.stderr = \ sys.__stdout__, sys.__stdin__, sys.__stderr__ try: self.shellWin = Shell(self, -1) finally:
os.chdir(cwd) del sys.path[0] except Exception, err: print str(err) return None def getWxPyDemoTree(): Main = importFromWxPyDemo('Main') if Main: return Main._treeList else: return [] EditorHelper.imgWxPythonDemo = EditorHelper.addPluginImgs('Images/wxPythonDemo.png') class SkipViewSignal(Exception): """ Raised when the demo is not docked """ class wxPythonDemoView(wx.Panel, EditorViews.EditorView, EditorViews.CloseableViewMix): viewName = tabName = 'Demo' viewTitle = _('Demo') def __init__(self, parent, model): wx.Panel.__init__(self, parent, -1) EditorViews.CloseableViewMix.__init__(self) EditorViews.EditorView.__init__(self, model, actions=self.closingActionItems) self.demoCtrl = None
import wx import wx.stc import Preferences, Utils, Plugins from Utils import _ try: imp.find_module('Pyrex') except ImportError: raise Plugins.SkipPlugin, _('Pyrex is not installed') from Models import Controllers, EditorHelper, EditorModels, PythonEditorModels, PythonControllers from Views import SourceViews, StyledTextCtrls EditorHelper.imgPyrexModel = EditorHelper.imgIdxRange() class PyrexModel(EditorModels.SourceModel): modelIdentifier = 'Pyrex' defaultName = 'pyrex' bitmap = 'Pyrex.png' ext = '.pyx' imgIdx = EditorHelper.imgPyrexModel pyrex_cfgfile = os.path.join(Preferences.rcPath, 'stc-pyrex.rc.cfg') #if not os.path.exists(pyrex_cfgfile): # pyrex_cfgfile = Preferences.pyPath +'/Plug-ins/stc-pyrex.rc.cfg'
os.chdir(cwd) del sys.path[0] except Exception, err: print str(err) return None def getWxPyDemoTree(): Main = importFromWxPyDemo('Main') if Main: return Main._treeList else: return [] EditorHelper.imgWxPythonDemo = EditorHelper.addPluginImgs( 'Images/wxPythonDemo.png') class SkipViewSignal(Exception): """ Raised when the demo is not docked """ class wxPythonDemoView(wx.Panel, EditorViews.EditorView, EditorViews.CloseableViewMix): viewName = tabName = 'Demo' viewTitle = _('Demo') def __init__(self, parent, model): wx.Panel.__init__(self, parent, -1) EditorViews.CloseableViewMix.__init__(self) EditorViews.EditorView.__init__(self,