X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/1e4a197e4c60e461b8068b0619692ea083e30b8b..25b3661bd4cb44304418b93c0dee1d0dfb99765c:/wxPython/samples/StyleEditor/STCStyleEditor.py?ds=sidebyside diff --git a/wxPython/samples/StyleEditor/STCStyleEditor.py b/wxPython/samples/StyleEditor/STCStyleEditor.py index 9758734401..61ca5ed0a7 100644 --- a/wxPython/samples/StyleEditor/STCStyleEditor.py +++ b/wxPython/samples/StyleEditor/STCStyleEditor.py @@ -59,8 +59,7 @@ from wxPython.stc import * settingsIdNames = {-1: 'Selection', -2: 'Caret', -3: 'Edge'} -commonPropDefs = {'fore': '#888888', 'size': 8, - 'face': wxSystemSettings_GetSystemFont(wxSYS_DEFAULT_GUI_FONT).GetFaceName()} +commonPropDefs = {} styleCategoryDescriptions = { '----Language----': 'Styles spesific to the language', @@ -370,6 +369,11 @@ class STCStyleEditDlg(wxDialog): pos=wxPoint(88, 0), size=wxSize(16, 16), style=0) def __init__(self, parent, langTitle, lang, configFile, STCsToUpdate=()): + global commonPropDefs + commonPropDefs = {'fore': '#888888', + 'size': 8, + 'face': wxSystemSettings_GetSystemFont(wxSYS_DEFAULT_GUI_FONT).GetFaceName()} + self.stc_title = 'wxStyledTextCtrl Style Editor' self.stc_title = 'wxStyledTextCtrl Style Editor - %s' % langTitle if wxPlatform == '__WXMSW__': @@ -679,7 +683,7 @@ class STCStyleEditDlg(wxDialog): if num == wxSTC_STYLE_DEFAULT: self.elementLb.InsertItems([name, '----Language----'], 0) self.elementLb.Append('----Standard----') - stdStart = stdPos = self.elementLb.Number() + stdStart = stdPos = self.elementLb.GetCount() else: # std styles if num >= 33 and num < 40: @@ -704,7 +708,7 @@ class STCStyleEditDlg(wxDialog): # add definitions self.elementLb.Append('----Common----') - self.commonDefsStartIdx = self.elementLb.Number() + self.commonDefsStartIdx = self.elementLb.GetCount() for common in self.commonDefs.keys(): tpe = type(self.commonDefs[common]) self.elementLb.Append('%('+common+')'+(tpe is type('') and 's' or 'd')) @@ -974,7 +978,7 @@ class STCStyleEditDlg(wxDialog): self.commonDefs[name] = commonPropDefs[prop] self.elementLb.Append('%('+name+')'+\ (type(commonPropDefs[prop]) is type('') and 's' or 'd')) - self.elementLb.SetSelection(self.elementLb.Number()-1, True) + self.elementLb.SetSelection(self.elementLb.GetCount()-1, True) self.populateCombosWithCommonDefs() self.OnElementlbListbox(None) finally: @@ -1004,7 +1008,7 @@ class STCStyleEditDlg(wxDialog): self.populateCombosWithCommonDefs() selIdx = self.elementLb.GetSelection() self.elementLb.Delete(selIdx) - if selIdx == self.elementLb.Number(): + if selIdx == self.elementLb.GetCount(): selIdx = selIdx - 1 self.elementLb.SetSelection(selIdx, True) self.OnElementlbListbox(None) @@ -1315,9 +1319,8 @@ if __name__ == '__main__': provider = wxSimpleHelpProvider() wxHelpProvider_Set(provider) - home = os.environ.get('HOME') - if home: home = os.path.join(home, '.boa') - config = os.path.abspath(os.path.join(home, 'stc-styles.rc.cfg')) + base = os.path.split(__file__)[0] + config = os.path.abspath(os.path.join(base, 'stc-styles.rc.cfg')) if 0: f = wxFrame(None, -1, 'Test frame (double click for editor)') stc = wxStyledTextCtrl(f, -1)