~ubuntu-branches/ubuntu/trusty/boa-constructor/trusty

« back to all changes in this revision

Viewing changes to Models/HTMLSupport.py

  • Committer: Bazaar Package Importer
  • Author(s): Luca Falavigna
  • Date: 2008-04-29 16:05:23 UTC
  • mfrom: (3.1.6 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080429160523-24y12jcjem5m8z80
Tags: 0.6.1-4
* Urgency high to fix RC bugs.
* debian/control:
  - Move to XS-Python-Version: >= 2.4 (Closes: #476929, #477145).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#-----------------------------------------------------------------------------
2
 
# Name:        HTMLSupport.py
3
 
# Purpose:
4
 
#
5
 
# Author:      Riaan Booysen
6
 
#
7
 
# Created:     2002
8
 
# RCS-ID:      $Id: HTMLSupport.py,v 1.8 2005/05/18 12:05:11 riaan Exp $
9
 
# Copyright:   (c) 2002 - 2005
10
 
# Licence:     GPL
11
 
#-----------------------------------------------------------------------------
12
 
print 'importing Models.HTMLSupport'
13
 
 
14
 
import wx
15
 
 
16
 
import Preferences, Utils, Plugins
17
 
 
18
 
import EditorHelper
19
 
EditorHelper.imgHTMLFileModel = EditorHelper.imgIdxRange()
20
 
 
21
 
from Models.EditorModels import PersistentModel
22
 
 
23
 
class HTMLFileModel(PersistentModel):
24
 
    modelIdentifier = 'HTML'
25
 
    defaultName = 'html'
26
 
    bitmap = 'WebDocHTML.png'
27
 
    imgIdx = EditorHelper.imgHTMLFileModel
28
 
    ext = '.html'
29
 
 
30
 
 
31
 
from Views.StyledTextCtrls import LanguageSTCMix, stcConfigPath
32
 
class BaseHTMLStyledTextCtrlMix(LanguageSTCMix):
33
 
    def __init__(self, wId):
34
 
        LanguageSTCMix.__init__(self, wId,
35
 
              (0, Preferences.STCLineNumMarginWidth), 'html', stcConfigPath)
36
 
 
37
 
 
38
 
class HTMLStyledTextCtrlMix(BaseHTMLStyledTextCtrlMix):
39
 
    def __init__(self, wId):
40
 
        BaseHTMLStyledTextCtrlMix.__init__(self, wId)
41
 
        self.setStyles()
42
 
 
43
 
 
44
 
wxID_HTMLSOURCEVIEW = wx.NewId()
45
 
from Views.SourceViews import EditorStyledTextCtrl
46
 
class HTMLSourceView(EditorStyledTextCtrl, HTMLStyledTextCtrlMix):
47
 
    viewName = 'HTML'
48
 
    def __init__(self, parent, model):
49
 
        EditorStyledTextCtrl.__init__(self, parent, wxID_HTMLSOURCEVIEW,
50
 
          model, (), -1)
51
 
        HTMLStyledTextCtrlMix.__init__(self, wxID_HTMLSOURCEVIEW)
52
 
        self.active = True
53
 
 
54
 
 
55
 
import Controllers
56
 
from Views.EditorViews import HTMLFileView
57
 
class HTMLFileController(Controllers.PersistentController):
58
 
    Model           = HTMLFileModel
59
 
    DefaultViews    = [HTMLSourceView]
60
 
    AdditionalViews = [HTMLFileView]
61
 
 
62
 
#-------------------------------------------------------------------------------
63
 
 
64
 
Plugins.registerFileType(HTMLFileController, aliasExts=('.htm',))
65
 
Plugins.registerLanguageSTCStyle('HTML', 'html', BaseHTMLStyledTextCtrlMix, 'stc-styles.rc.cfg')
 
1
#-----------------------------------------------------------------------------
 
2
# Name:        HTMLSupport.py
 
3
# Purpose:
 
4
#
 
5
# Author:      Riaan Booysen
 
6
#
 
7
# Created:     2002
 
8
# RCS-ID:      $Id: HTMLSupport.py,v 1.11 2007/07/02 15:01:12 riaan Exp $
 
9
# Copyright:   (c) 2002 - 2007
 
10
# Licence:     GPL
 
11
#-----------------------------------------------------------------------------
 
12
print 'importing Models.HTMLSupport'
 
13
 
 
14
import wx
 
15
 
 
16
import Preferences, Utils, Plugins
 
17
from Utils import _
 
18
 
 
19
import EditorHelper
 
20
EditorHelper.imgHTMLFileModel = EditorHelper.imgIdxRange()
 
21
 
 
22
from Models.EditorModels import PersistentModel
 
23
 
 
24
class HTMLFileModel(PersistentModel):
 
25
    modelIdentifier = 'HTML'
 
26
    defaultName = 'html'
 
27
    bitmap = 'WebDocHTML.png'
 
28
    imgIdx = EditorHelper.imgHTMLFileModel
 
29
    ext = '.html'
 
30
 
 
31
 
 
32
from Views.StyledTextCtrls import LanguageSTCMix, stcConfigPath
 
33
class BaseHTMLStyledTextCtrlMix(LanguageSTCMix):
 
34
    def __init__(self, wId):
 
35
        LanguageSTCMix.__init__(self, wId,
 
36
              (0, Preferences.STCLineNumMarginWidth), 'html', stcConfigPath)
 
37
 
 
38
 
 
39
class HTMLStyledTextCtrlMix(BaseHTMLStyledTextCtrlMix):
 
40
    def __init__(self, wId):
 
41
        BaseHTMLStyledTextCtrlMix.__init__(self, wId)
 
42
        self.setStyles()
 
43
 
 
44
 
 
45
wxID_HTMLSOURCEVIEW = wx.NewId()
 
46
from Views.SourceViews import EditorStyledTextCtrl
 
47
class HTMLSourceView(EditorStyledTextCtrl, HTMLStyledTextCtrlMix):
 
48
    viewName = 'HTML'
 
49
    viewTitle = _('HTML')
 
50
    
 
51
    def __init__(self, parent, model):
 
52
        EditorStyledTextCtrl.__init__(self, parent, wxID_HTMLSOURCEVIEW,
 
53
          model, (), -1)
 
54
        HTMLStyledTextCtrlMix.__init__(self, wxID_HTMLSOURCEVIEW)
 
55
        self.active = True
 
56
 
 
57
 
 
58
import Controllers
 
59
from Views.EditorViews import HTMLFileView
 
60
class HTMLFileController(Controllers.PersistentController):
 
61
    Model           = HTMLFileModel
 
62
    DefaultViews    = [HTMLSourceView]
 
63
    AdditionalViews = [HTMLFileView]
 
64
 
 
65
#-------------------------------------------------------------------------------
 
66
 
 
67
Plugins.registerFileType(HTMLFileController, aliasExts=('.htm',))
 
68
Plugins.registerLanguageSTCStyle('HTML', 'html', BaseHTMLStyledTextCtrlMix, 'stc-styles.rc.cfg')