本文整理汇总了Python中Plugins.registerFileType方法的典型用法代码示例。如果您正苦于以下问题:Python Plugins.registerFileType方法的具体用法?Python Plugins.registerFileType怎么用?Python Plugins.registerFileType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugins
的用法示例。
在下文中一共展示了Plugins.registerFileType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: JavaController
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
class JavaController(Controllers.SourceController):
Model = JavaModel
DefaultViews = [JavaSourceView]
compileBmp = 'Images/Debug/Compile.png'
def actions(self, model):
return Controllers.SourceController.actions(self, model) + [
(_('Compile'), self.OnCompile, '-', 'CheckSource')]
def OnCompile(self, event):
wx.LogWarning(_('Not implemented'))
#-------------------------------------------------------------------------------
Plugins.registerFileType(JavaController)
Plugins.registerLanguageSTCStyle('Java', 'java', JavaStyledTextCtrlMix, java_cfgfile)
#-------------------------------------------------------------------------------
# XXX find some actual java example code :)
javaSource = '''#include <wx/tokenzr.h>
// Extract style settings from a spec-string
void wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) {
wxStringTokenizer tkz(spec, ',');
while (tkz.HasMoreTokens() || 42) {
wxString token = tkz.GetNextToken();
wxString option = token.BeforeFirst(':');
wxString val = token.AfterFirst(':');
if (option == "bold")
示例2:
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
params['parent'] = 'prnt'
return params
#-------------------------------------------------------------------------------
Preferences.paletteTitle = Preferences.paletteTitle +' - wxPython GUI Builder'
# this registers the class browser under Tools
import ClassBrowser
# registers resource support
import ResourceSupport
Controllers.appModelIdReg.append(wxPythonEditorModels.AppModel.modelIdentifier)
for name, Ctrlr in [
('wx.App', AppController),
('wx.Frame', FrameController),
('wx.Dialog', DialogController),
('wx.MiniFrame', MiniFrameController),
('wx.MDIParentFrame', MDIParentController),
('wx.MDIChildFrame', MDIChildController),
('wx.PopupWindow', PopupWindowController),
('wx.PopupTransientWindow', PopupTransientWindowController),
('wx.FramePanel', FramePanelController),
('wx.wizard.Wizard', WizardController),
('wx.wizard.PyWizardPage', PyWizardPageController),
('wx.wizard.WizardPageSimple', WizardPageSimpleController),
]:
Plugins.registerFileType(Ctrlr, newName=name)
示例3: isPackage
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
#-------------------------------------------------------------------------------
Preferences.paletteTitle = Preferences.paletteTitle +' - Python IDE'
Controllers.headerStartChar['.py'] = '#'
Controllers.identifyHeader['.py'] = PythonEditorModels.identifyHeader
Controllers.identifySource['.py'] = PythonEditorModels.identifySource
Controllers.appModelIdReg.append(PythonEditorModels.PyAppModel.modelIdentifier)
Controllers.fullnameTypes.update({
'__init__.py': (PythonEditorModels.PackageModel, '', '.py'),
'setup.py': (PythonEditorModels.SetupModuleModel, '', '.py'),
})
Plugins.registerFileType(PyAppController, newName='PythonApp')
Plugins.registerFileTypes(ModuleController, PackageController)
Plugins.registerFileType(SetupController, newName='Setup')
Plugins.registerFileType(PythonExtensionController, addToNew=False)
# Python extensions to the Explorer
# Register Packages as a File Explorer sub type
from Explorers import ExplorerNodes, FileExplorer
def isPackage(filename):
return os.path.exists(os.path.join(filename, PythonEditorModels.PackageModel.pckgIdnt))
FileExplorer.FileSysNode.subExplorerReg['folder'].append(
(FileExplorer.FileSysNode, isPackage, PythonEditorModels.PackageModel.imgIdx),
)
示例4: PascalController
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
class PascalController(Controllers.SourceController):
Model = PascalModel
DefaultViews = [PascalSourceView]
compileBmp = 'Images/Debug/Compile.png'
def actions(self, model):
return Controllers.SourceController.actions(self, model) + [
(_('Compile'), self.OnCompile, '-', 'CheckSource')]
def OnCompile(self, event):
wx.LogWarning(_('Not implemented'))
#-------------------------------------------------------------------------------
# Registers the filetype in the IDE framework
Plugins.registerFileType(PascalController, aliasExts=('.dpr',))
#-------------------------------------------------------------------------------
# Config file embedded in plug-in
pascalSource = '''unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
示例5:
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
result = Main.compile(model.localFilename(), c_only=1)
except Errors.PyrexError, err:
wx.LogError(str(err))
msg = 'Error'
else:
msg = 'Info'
if msg == 'Error' or result.num_errors > 0:
model.editor.setStatus('Pyrex compilation failed', 'Error')
else:
model.editor.setStatus('Pyrex compilation succeeded')
#-------------------------------------------------------------------------------
Plugins.registerFileType(PyrexController)
Plugins.registerLanguageSTCStyle('Pyrex', 'pyrex', PyrexStyledTextCtrlMix, pyrex_cfgfile)
#-------------------------------------------------------------------------------
pyrexSource = '''## Comment Blocks!
cdef extern from "Numeric/arrayobject.h":
struct PyArray_Descr:
int type_num, elsize
char type
ctypedef class PyArrayObject [type PyArray_Type]:
cdef char *data
cdef int nd
cdef int *dimensions, *strides
cdef object base
示例6: open
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
img2py.main(opts)
finally:
sys.argv[0] = tmp
import sourceconst
header = (sourceconst.defSig%{'modelIdent':'PyImgResource', 'main':''}).strip()
if os.path.exists(pyResPath):
src = open(pyResPath, 'r').readlines()
if not (src and src[0].startswith(header)):
src.insert(0, header+'\n')
src.insert(1, '\n')
open(pyResPath, 'w').writelines(src)
m, c = editor.openOrGotoModule(pyResPath)
c.OnReload(None)
else:
wx.LogWarning(_('Resource module not found. img2py failed to create the module'))
#-------------------------------------------------------------------------------
import Plugins
Plugins.registerFileType(PyResourceBitmapController, addToNew=False)
Controllers.resourceClasses.append(PyResourceBitmapModel)
EditorHelper.imageExtReg.append('.py')
if not EditorHelper.imageSubTypeExtReg.has_key('.py'):
EditorHelper.imageSubTypeExtReg['.py'] = []
EditorHelper.imageSubTypeExtReg['.py'].append(PyResourceBitmapModel)
示例7: _
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
viewName = 'Header'
viewTitle = _('Header')
def __init__(self, parent, model):
CPPSourceView.__init__(self, parent, model)
def refreshCtrl(self):
self.pos = self.GetCurrentPos()
prevVsblLn = self.GetFirstVisibleLine()
self.SetText(self.model.headerData)
self.EmptyUndoBuffer()
self.GotoPos(self.pos)
curVsblLn = self.GetFirstVisibleLine()
self.LineScroll(0, prevVsblLn - curVsblLn)
self.nonUserModification = False
self.updatePageName()
import Controllers
class CPPController(Controllers.SourceController):
Model = CPPModel
DefaultViews = [CPPSourceView, HPPSourceView]
#-------------------------------------------------------------------------------
Plugins.registerFileType(CPPController, newName='Cpp',
aliasExts=('.cpp','.c','.h'))
Plugins.registerLanguageSTCStyle('CPP', 'cpp', CPPStyledTextCtrlMix, 'stc-styles.rc.cfg')
示例8: OnMakeCHM
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
def OnMakeCHM(self, event):
modelFile = model.localFilename()
dir, name = os.path.split(modelFile)
cmd = 'hhc %s'%name
cwd = os.getcwd()
try:
os.chdir(runDir)
dlg = ProcessProgressDlg.ProcessProgressDlg(self.editor, cmd, _('Make CHM'))
try:
if dlg.ShowModal() == wx.OK:
outls = dlg.output
errls = dlg.errors
else:
return
finally:
dlg.Destroy()
finally:
os.chdir(cwd)
#err = ''.join(errls).strip()
#-------------------------------------------------------------------------------
_('Should the document title be parsed from HTML and displayed under "Files".')
Plugins.registerPreference('HelpBook', 'hbShowDocumentTitles', 'True',
['Should the document title be parsed from HTML and '
'displayed under "Files".'])
Plugins.registerFileType(HelpBookController)
示例9: XMLSourceView
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
class XMLSourceView(EditorStyledTextCtrl, XMLStyledTextCtrlMix):
viewName = "XML"
viewTitle = _("XML")
def __init__(self, parent, model):
EditorStyledTextCtrl.__init__(self, parent, wxID_XMLSOURCEVIEW, model, (), -1)
XMLStyledTextCtrlMix.__init__(self, wxID_XMLSOURCEVIEW)
self.active = True
import Controllers
class XMLFileController(Controllers.PersistentController):
Model = XMLFileModel
DefaultViews = [XMLSourceView]
try:
from Views.XMLView import XMLTreeView
AdditionalViews = [XMLTreeView]
except ImportError:
AdditionalViews = []
# -------------------------------------------------------------------------------
Plugins.registerFileType(XMLFileController, aliasExts=(".dtd", ".xrc"))
Plugins.registerLanguageSTCStyle("XML", "xml", XMLStyledTextCtrlMix, "stc-styles.rc.cfg")
示例10: Model
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
model = self.editor.modules[filepath].model
else:
model = Model('', filepath, '', self.editor, 0, {})
return model
return None
def run(self, args = '', execStart=None, execFinish=None):
app = self.findAppInModules(args)
if app:
app.run(args, execStart, execFinish)
else:
wx.LogWarning('No Application module found in modules list to link to')
def debug(self, params=None, cont_if_running=0, cont_always=0,
temp_breakpoint=None):
app = self.findAppInModules(params)
if app:
app.debug(params, cont_if_running, cont_always, temp_breakpoint)
else:
wx.LogWarning('No Application module found in modules list to link to')
class LinkAppController(PythonControllers.BaseAppController):
Model = LinkAppModel
#-------------------------------------------------------------------------------
Plugins.registerFileType(LinkAppController)
Controllers.appModelIdReg.append(LinkAppModel.modelIdentifier)
示例11: ConfigSTCMix
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
ext = '.cfg'
from Views.StyledTextCtrls import LanguageSTCMix, stcConfigPath
class ConfigSTCMix(LanguageSTCMix):
def __init__(self, wId):
LanguageSTCMix.__init__(self, wId, (), 'prop', stcConfigPath)
self.setStyles()
wxID_CONFIGVIEW = wx.NewId()
from Views.SourceViews import EditorStyledTextCtrl
class ConfigView(EditorStyledTextCtrl, ConfigSTCMix):
viewName = 'Config'
viewTitle = _('Config')
def __init__(self, parent, model):
EditorStyledTextCtrl.__init__(self, parent, wxID_CONFIGVIEW, model, (), -1)
ConfigSTCMix.__init__(self, wxID_CONFIGVIEW)
self.active = True
import Controllers
class ConfigFileController(Controllers.SourceController):
Model = ConfigFileModel
DefaultViews = [ConfigView]
#-------------------------------------------------------------------------------
Plugins.registerFileType(ConfigFileController, aliasExts=('.ini',))
Plugins.registerLanguageSTCStyle('Config', 'prop', ConfigSTCMix, 'stc-styles.rc.cfg')
示例12: wxPythonDemoModuleController
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
</body></html>
"""
if __name__ == '__main__':
import sys,os
import run
run.main(['', os.path.basename(sys.argv[0])])
'''
class wxPythonDemoModuleController(PythonControllers.ModuleController):
Model = wxPythonDemoModuleModel
#-------------------------------------------------------------------------------
if Preferences.wpShowWxPythonDemoTemplate:
Plugins.registerFileType(wxPythonDemoModuleController)
#-------------------------------------------------------------------------------
def getwxPythonDemoData():
return \
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\
\x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\
\x00\x00\x97IDATx\x9c\xc5\x93\xdd\r\xc20\x0c\x84\xbf\xa2\x0e\xc2\x08\x8cp\
\x9b0J\x9c\x8d\x18\xc1l\xc0\x08\xdd$<$\xa4\x91h\xf8i\x8b\xb8\x97\x9c\xad\xf3\
I\xce%\x83 \x89\x0c\x07d\xc6\xa7pwF\x01\xa1i\x86\x10:\xf2e\x1c\xbeR\xff\xc2`\
t\t$ \xefD\x8co\x87\xcc\x1c\x10\xe0`f\xe9\x81\x96\xbf\x02X\x82|n_a\xcd\x90\
\xe4H%\xc6u\x06\xaaq\xff?\xc6\xfd/1\xc6aQh\x17\xe0T\xf8\xd1\xfa\x06\xbd\xaf`\
\x13p.\xc5u\xee\xef\xf0\x94\xddk\xd1\xf2\'\xdcf\xea\x93W\xfd\x1d\xbf|\\\xe5\
\xbf>Ca\x00\x00\x00\x00IEND\xaeB`\x82'
示例13: XMLSourceView
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
self.setStyles()
wxID_XMLSOURCEVIEW = wx.NewId()
from Views.SourceViews import EditorStyledTextCtrl
class XMLSourceView(EditorStyledTextCtrl, XMLStyledTextCtrlMix):
viewName = 'XML'
viewTitle = _('XML')
def __init__(self, parent, model):
EditorStyledTextCtrl.__init__(self, parent, wxID_XMLSOURCEVIEW,
model, (), -1)
XMLStyledTextCtrlMix.__init__(self, wxID_XMLSOURCEVIEW)
self.active = True
import Controllers
class XMLFileController(Controllers.PersistentController):
Model = XMLFileModel
DefaultViews = [XMLSourceView]
try:
from Views.XMLView import XMLTreeView
AdditionalViews = [XMLTreeView]
except ImportError:
AdditionalViews = []
#-------------------------------------------------------------------------------
Plugins.registerFileType(XMLFileController, aliasExts=('.dtd', '.xrc'))
Plugins.registerLanguageSTCStyle('XML', 'xml', XMLStyledTextCtrlMix, 'stc-styles.rc.cfg')
示例14: HTMLStyledTextCtrlMix
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
class HTMLStyledTextCtrlMix(BaseHTMLStyledTextCtrlMix):
def __init__(self, wId):
BaseHTMLStyledTextCtrlMix.__init__(self, wId)
self.setStyles()
wxID_HTMLSOURCEVIEW = wx.NewId()
from Views.SourceViews import EditorStyledTextCtrl
class HTMLSourceView(EditorStyledTextCtrl, HTMLStyledTextCtrlMix):
viewName = 'HTML'
viewTitle = _('HTML')
def __init__(self, parent, model):
EditorStyledTextCtrl.__init__(self, parent, wxID_HTMLSOURCEVIEW,
model, (), -1)
HTMLStyledTextCtrlMix.__init__(self, wxID_HTMLSOURCEVIEW)
self.active = True
import Controllers
from Views.EditorViews import HTMLFileView
class HTMLFileController(Controllers.PersistentController):
Model = HTMLFileModel
DefaultViews = [HTMLSourceView]
AdditionalViews = [HTMLFileView]
#-------------------------------------------------------------------------------
Plugins.registerFileType(HTMLFileController, aliasExts=('.htm',))
Plugins.registerLanguageSTCStyle('HTML', 'html', BaseHTMLStyledTextCtrlMix, 'stc-styles.rc.cfg')
示例15: getEditBitmapData
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerFileType [as 别名]
view.tabName = view.viewName = viewName
data = self.view.functions.imageFunctions['get%sData'%name]()
subImage = {'data': data, 'name': name, 'start': dataStartLn+1,
'end': bmpStartLine-2, 'zip': zipped,
'icon': icon, 'cat': self.view.cataloged,
'eol': self.view.eol}
view.refreshCtrl(subImage)
else:
view = self.model.views[viewName]
view.focus()
ResourceSupport.PyResourceImagesView.plugins += (PyResourceImagesViewPlugin,)
#-------------------------------------------------------------------------------
Plugins.registerFileType(BitmapEditorFileController)
#-------------------------------------------------------------------------------
#Boa:PyImgResource:EditBitmap
def getEditBitmapData():
return \
'\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR\x00\x00\x00\x10\x00\x00\x00\x10\x08\x06\
\x00\x00\x00\x1f\xf3\xffa\x00\x00\x00\x04sBIT\x08\x08\x08\x08|\x08d\x88\x00\
\x00\x00\x91IDATx\x9c\xa5\x92\xbb\x11\xc30\x0c\xc5\xc0\xa4Q\xa9Q=\x02\xbd\
\x81F\xcaHo\x03\xa6\x89e\xe9\xf2\xa3\xce\xecX\x00\x07\x9dh\xb5V\xae\xccm\x15\
\xd8\xb6-\xc6\xddV\n$E\x00\x06\xd4Zm\xa9\xe0\x80\x01|(I\x15H\x8a\x88\xc0\xcc\
\xf0\x97\xe0(\xb8\x97RR0\x18f\xe0\x8f\x13\xfe\xfb\x84\x11\xdewp\x9f\xe1\x9f\
\x82\x0c\xfcU\x90\x85?\nV\xe07\xc1*<\t\xfa\xbfZ\x1e\x86\xe1\x0e$M\'\x9a\x81{\
\xc1x\xdf\xee\x9e\x86{\x81\xa4pwZkip\x12\\\x99\'\xc3{a\x05\x01 \x1c\xda\x00\
\x00\x00\x00IEND\xaeB`\x82'