1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
|
#-----------------------------------------------------------------------------
# Name: XMLSupport.py
# Purpose:
#
# Author: Riaan Booysen
#
# Created: 2002
# RCS-ID: $Id: XMLSupport.py,v 1.7 2005/05/13 21:06:20 riaan Exp $
# Copyright: (c) 2002 - 2005
# Licence: GPL
#-----------------------------------------------------------------------------
print 'importing Models.XMLSupport'
import wx
import Preferences, Utils, Plugins
import EditorHelper
EditorHelper.imgXMLFileModel = EditorHelper.imgIdxRange()
from Models.EditorModels import PersistentModel
class XMLFileModel(PersistentModel):
modelIdentifier = 'XML'
defaultName = 'xml'
bitmap = 'WebDocXML.png'
imgIdx = EditorHelper.imgXMLFileModel
ext = '.xml'
from Views.StyledTextCtrls import LanguageSTCMix, stcConfigPath
class XMLStyledTextCtrlMix(LanguageSTCMix):
def __init__(self, wId):
LanguageSTCMix.__init__(self, wId,
(0, Preferences.STCLineNumMarginWidth), 'xml', stcConfigPath)
self.setStyles()
wxID_XMLSOURCEVIEW = wx.NewId()
from Views.SourceViews import EditorStyledTextCtrl
class XMLSourceView(EditorStyledTextCtrl, XMLStyledTextCtrlMix):
viewName = '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')
|