Changeset 3058
- Timestamp:
- 04/13/07 10:00:30 (2 years ago)
- Files:
-
- trunk/dabo/ui/uiwx/dEditor.py (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/dabo/ui/uiwx/dEditor.py
r3054 r3058 61 61 if self.Parent: 62 62 self.Parent.SetLexer(stc.STC_LEX_PYTHON) 63 self.mode = "container" 64 self.Interval = self.styleTimerInterval 65 elif self.mode == "xml": 66 if self.Parent: 67 self.Parent.SetLexer(stc.STC_LEX_XML) 63 68 self.mode = "container" 64 69 self.Interval = self.styleTimerInterval … … 98 103 self._codeCompletion = True 99 104 self._syntaxColoring = True 100 self._language = " Python"105 self._language = "" 101 106 self._keyWordsSet = False 102 107 self._defaultsSet = False … … 105 110 self._useBookmarks = False 106 111 self._selectionBackColor = None 107 self._selectionForeColor = None 112 self._selectionForeColor = None 113 self._title = "" 108 114 109 115 stc.StyledTextCtrl.__init__(self, parent, -1, … … 381 387 if not self._syntaxColoring: 382 388 return 383 self._styleTimer.mode = "python"389 self._styleTimer.mode = self.Language.lower() 384 390 self._styleTimer.start() 385 391 … … 775 781 def setSyntaxColoring(self, color=None): 776 782 """Sets the appropriate lexer for syntax coloring.""" 777 if color:778 lex = self.Language.lower()783 lex = self.Language.lower() 784 if color and lex: 779 785 if lex == "python": 780 786 self.SetLexer(stc.STC_LEX_PYTHON) … … 782 788 self.SetKeyWords(0, " ".join(keyword.kwlist)) 783 789 self._keyWordsSet = True 784 self.Colourise(-1, -1) 790 self.Colourise(-1, -1) 791 elif lex == "xml": 792 self.SetLexer(stc.STC_LEX_XML) 785 793 else: 786 794 self.ClearDocumentStyle() … … 1075 1083 else: 1076 1084 func = dabo.ui.getFile 1077 fname = func("py", " *", message=prompt, defaultPath=drct)1085 fname = func("py", "cdxml", "cnxml", "mnxml", "rfxml", "*", message=prompt, defaultPath=drct) 1078 1086 return fname 1079 1087 … … 1220 1228 return False 1221 1229 self._fileName = fileSpec 1222 self._curdir = os.path.split(fileSpec)[0] 1230 pth, fname = os.path.split(fileSpec) 1231 fext = os.path.splitext(fname)[1] 1232 if fext == ".py": 1233 self.Language = "Python" 1234 elif fext.endswith("xml"): 1235 self.Language = "XML" 1236 self._curdir = pth 1223 1237 self.SetText(text) 1224 1238 self._clearDocument(clearText=False) … … 1692 1706 def _setLanguage(self, val): 1693 1707 if self._constructed(): 1694 if val.lower() == "python": 1695 self._language = val 1696 else: 1697 dabo.errorLog.write(_("Currently only Python language is supported")) 1708 if val != self._language: 1709 if val.lower() in ("python", "xml"): 1710 self._language = val 1711 else: 1712 dabo.errorLog.write(_("Currently only Python and XML are supported")) 1713 # This forces a refresh of the coloring 1714 self.SyntaxColoring = self.SyntaxColoring 1698 1715 else: 1699 1716 self._properties["Language"] = val
