本文整理汇总了Python中Plugins.registerLanguageSTCStyle方法的典型用法代码示例。如果您正苦于以下问题:Python Plugins.registerLanguageSTCStyle方法的具体用法?Python Plugins.registerLanguageSTCStyle怎么用?Python Plugins.registerLanguageSTCStyle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Plugins
的用法示例。
在下文中一共展示了Plugins.registerLanguageSTCStyle方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: PascalSourceView
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerLanguageSTCStyle [as 别名]
StyledTextCtrls.LanguageSTCMix.__init__(self, wId,
(0, Preferences.STCLineNumMarginWidth), 'pascal', pascal_cfgfile)
self.setStyles()
wxID_PASSOURCEVIEW = wx.NewId()
class PascalSourceView(SourceViews.EditorStyledTextCtrl, PascalStyledTextCtrlMix):
viewName = 'Source'
viewTitle = _('Source')
def __init__(self, parent, model):
SourceViews.EditorStyledTextCtrl.__init__(self, parent, wxID_PASSOURCEVIEW,
model, (), -1)
PascalStyledTextCtrlMix.__init__(self, wxID_PASSOURCEVIEW)
self.active = True
# Register a Pascal STC style editor under Preferences
Plugins.registerLanguageSTCStyle('Pascal', 'pascal', PascalStyledTextCtrlMix, pascal_cfgfile)
# The compile action is just added as an example of how to add an action to
# a controller and is not implemented
wxID_PASCALCOMPILE = wx.NewId()
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):
示例2: actions
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerLanguageSTCStyle [as 别名]
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")
StyleSetBold(styleNum, True);
示例3:
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerLanguageSTCStyle [as 别名]
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
cdef PyArray_Descr *descr
示例4: PascalSourceView
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerLanguageSTCStyle [as 别名]
wxID_PASSOURCEVIEW = wx.NewId()
class PascalSourceView(SourceViews.EditorStyledTextCtrl, PascalStyledTextCtrlMix):
viewName = "Source"
viewTitle = _("Source")
def __init__(self, parent, model):
SourceViews.EditorStyledTextCtrl.__init__(self, parent, wxID_PASSOURCEVIEW, model, (), -1)
PascalStyledTextCtrlMix.__init__(self, wxID_PASSOURCEVIEW)
self.active = True
# Register a Pascal STC style editor under Preferences
Plugins.registerLanguageSTCStyle("Pascal", "pascal", PascalStyledTextCtrlMix, pascal_cfgfile)
# The compile action is just added as an example of how to add an action to
# a controller and is not implemented
wxID_PASCALCOMPILE = wx.NewId()
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")]
示例5: _
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerLanguageSTCStyle [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')
示例6: XMLSourceView
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerLanguageSTCStyle [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")
示例7: ConfigSTCMix
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerLanguageSTCStyle [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')
示例8: XMLSourceView
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerLanguageSTCStyle [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')
示例9: HTMLStyledTextCtrlMix
# 需要导入模块: import Plugins [as 别名]
# 或者: from Plugins import registerLanguageSTCStyle [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')