Added the new virtual list capabilities to wxListCtrl.
+Added a wxSTC style editor from Riaan Booysen to the sample apps.
include samples/stxview/StructuredText/*.txt
include samples/wxProject/*.txt
include samples/wxProject/*.py
+include samples/StyleEditor/*.py
+include samples/StyleEditor/*.txt
+include samples/StyleEditor/*.cfg
include wxPython/lib/*.py
include wxPython/lib/*.txt
-from wxPython.lib.PyCrust import PyCrustShell, PyCrustEditor, PyCrustVersion
+from wxPython.lib.PyCrust import shell, version
#----------------------------------------------------------------------
-intro = 'Welcome To PyCrust %s - The Flakiest Python Shell' % PyCrustVersion.version
+intro = 'Welcome To PyCrust %s - The Flakiest Python Shell' % version.VERSION
def runTest(frame, nb, log):
- shell = PyCrustShell.Shell(nb, intro)
- return shell.editor
+ win = shell.Shell(nb, -1, introText=intro)
+ return win
#----------------------------------------------------------------------
-overview = PyCrustShell.__doc__
+overview = shell.__doc__
self.SetItemCount(1000000)
+ self.attr1 = wxListItemAttr()
+ self.attr1.SetBackgroundColour("yellow")
+ self.attr2 = wxListItemAttr()
+ self.attr2.SetBackgroundColour("light blue")
def OnGetItemText(self, item, col):
return 0
def OnGetItemAttr(self, item):
- return None
+ if item % 3 == 1:
+ return self.attr1
+ elif item % 3 == 2:
+ return self.attr2
+ else:
+ return None
#----------------------------------------------------------------------
void BeginBatch();
void EndBatch();
int GetBatchCount();
+ void ForceRefresh();
// ------ edit control functions
bool AltDown();
};
+
+class wxGridEditorCreatedEvent : public wxCommandEvent {
+public:
+ wxGridEditorCreatedEvent(int id, wxEventType type, wxObject* obj,
+ int row, int col, wxControl* ctrl);
+
+ int GetRow();
+ int GetCol();
+ wxControl* GetControl();
+ void SetRow(int row);
+ void SetCol(int col);
+ void SetControl(wxControl* ctrl);
+};
+
+
+
enum {
wxEVT_GRID_CELL_LEFT_CLICK,
wxEVT_GRID_CELL_RIGHT_CLICK,
wxEVT_GRID_SELECT_CELL,
wxEVT_GRID_EDITOR_SHOWN,
wxEVT_GRID_EDITOR_HIDDEN,
+ wxEVT_GRID_EDITOR_CREATED,
};
def EVT_GRID_EDITOR_HIDDEN(win, fn):
win.Connect(-1, -1, wxEVT_GRID_EDITOR_HIDDEN, fn)
+def EVT_GRID_EDITOR_CREATED(win, fn):
+ win.Connect(-1, -1, wxEVT_GRID_EDITOR_CREATED, fn)
+
"
//---------------------------------------------------------------------------
EVT_SET_FOCUS(t1, self.OnSetFocus)
EVT_KILL_FOCUS(t1, self.OnKillFocus)
-
l2 = wxStaticText(self, -1, "Passsword")
t2 = wxTextCtrl(self, 20, "", size=(125, -1), style=wxTE_PASSWORD)
EVT_TEXT(self, 20, self.EvtText)
t4.SetStyle(44, 47, wxTextAttr("RED", "YELLOW"))
points = t4.GetFont().GetPointSize() # get the current size
- f = wxFont(points+2, wxROMAN, wxITALIC, wxBOLD, true)
+ f = wxFont(points+3, wxROMAN, wxITALIC, wxBOLD, true)
## print 'a1', sys.getrefcount(f)
## t4.SetStyle(63, 77, wxTextAttr("BLUE", font=f))
t4.SetStyle(63, 77, wxTextAttr("BLUE", wxNullColour, f))
Source: "samples\doodle\*.txt"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
Source: "samples\doodle\sample.ddl"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
Source: "samples\doodle\superdoodle.iss"; DestDir: "{app}\wxPython\samples\doodle"; Components: samples
+
Source: "samples\wxProject\*.txt"; DestDir: "{app}\wxPython\samples\wxProject"; Components: samples
Source: "samples\wxProject\*.py"; DestDir: "{app}\wxPython\samples\wxProject"; Components: samples
Source: "samples\stxview\*.txt"; DestDir: "{app}\wxPython\samples\stxview"; Components: samples
Source: "samples\stxview\StructuredText\*.py"; DestDir: "{app}\wxPython\samples\stxview\StructuredText"; Components: samples
+Source: "samples\StyleEditor\*.txt"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
+Source: "samples\StyleEditor\*.py"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
+Source: "samples\StyleEditor\*.cfg"; DestDir: "{app}\wxPython\samples\StyleEditor"; Components: samples
+
;;------------------------------------------------------------
Type: files; Name: "{app}\wxPython\samples\doodle\*.pyo";
Type: files; Name: "{app}\wxPython\samples\wxProject\*.pyc";
Type: files; Name: "{app}\wxPython\samples\wxProject\*.pyo";
+Type: files; Name: "{app}\wxPython\samples\StyleEditor\*.pyc";
+Type: files; Name: "{app}\wxPython\samples\StyleEditor\*.pyo";
Type: files; Name: "{app}\wxPython\samples\stxview\*.pyc";
Type: files; Name: "{app}\wxPython\samples\stxview\*.pyo";
Type: files; Name: "{app}\wxPython\samples\stxview\StructuredText\*.pyc";
#----------------------------------------------------------------------
+## TODO: For Python 2.2 wxPython should go into
+# os.path.join(sys.prefix, 'Lib', 'site-packages')
+
+
IFS_Template = r"""
program Setup;
var
'Software\Python\PythonCore\%(PYTHONVER)s\InstallPath',
'', PythonDir) then begin
- MsgBox('No installation of Python %(PYTHONVER)s found. Aborting...',
+ MsgBox('No installation of Python %(PYTHONVER)s found.\nBe sure to enter a pathname that places wxPython\non the PYTHONPATH',
mbConfirmation, MB_OK);
- Result := false;
- end else
- Result := true;
- end else
- Result := true;
+ PythonDir := 'C:\Put a directory on PYTHONPATH here\wxPython';
+ end;
+ end;
+ Result := true;
end;
--- /dev/null
+I've written a style editor for the wxStyledTextCrl. It's not depedent
+on Boa at all and could be useful to anyone with a wxSTC app.
+
+The code is a bit rough, freshly written and have not had any
+refactoring, but it works (only tested on windows so far), has some
+comments and even a doc string here and there ;)
+
+Please give it a go and tell me what you think.
+
+--
+Riaan Booysen
+24-August-2001
\ No newline at end of file
--- /dev/null
+#-----------------------------------------------------------------------------
+# Name: STCStyleEditor.py
+# Purpose: Style editor for the wxStyledTextCtrl
+#
+# Author: Riaan Booysen
+#
+# Created: 2001/08/20
+# RCS-ID: $Id$
+# Copyright: (c) 2001 Riaan Booysen
+# Licence: wxWindows license
+#-----------------------------------------------------------------------------
+#Boa:Dialog:STCStyleEditDlg
+
+""" Style editor for the wxStyledTextCtrl.
+
+Reads in property style definitions from a config file.
+Modified styled can be saved (and optionally applied to a given list of STCs)
+
+It can also maintain a Common definition dictionary of font names, colours and
+sizes which can be shared across multiple language style definitions.
+This is also used to store platform spesific settings as fonts and sizes
+vary with platform.
+
+The following items are defined in the stc-styles.rc.cfg file.
+
+common.defs.msw - Common definition dictionary used on wxMSW
+common.defs.gtk - Common definition dictionary used on wxGTK
+common.styleidnames - STC styles shared by all languages
+
+Each supported language defines the following groups:
+[<language>]
+displaysrc - Example source to display in the editor
+braces - Dictionary defining the (line, column) for showing 'good' and 'bad'
+ brace matching (both keys optional)
+keywords - Space separated list of keywords
+lexer - wxSTC constant for the language lexer
+styleidnames - Dictionary of language spesific style numbers and names
+
+[style.<language>] - The users current style values
+[style.<language>.default] - Default style values (can be reverted from)
+
+0 or more predefined style groups or 'themes'
+[style.<language>.<predefined name>]
+
+Currently the following languages are supported:
+ python, html, xml, cpp, text, props
+Other languages can be added by just defining the above settings for them in
+the config file (if wxSTC implements them).
+
+Use the initSTC function to initialise your wxSTC from a config file.
+"""
+
+import os, sys, string, pprint, copy
+
+from wxPython.wx import *
+from wxPython.lib.anchors import LayoutAnchors
+from wxPython.stc import *
+
+settingsIdNames = {-1: 'Selection', -2: 'Caret', -3: 'Edge'}
+
+commonPropDefs = {'fore': '#888888', 'size': 8,
+ 'face': wxSystemSettings_GetSystemFont(wxSYS_DEFAULT_GUI_FONT).GetFaceName()}
+
+styleCategoryDescriptions = {
+'-----Language-----': 'Styles spesific to the language',
+'-----Standard-----': 'Styles shared by all languages',
+'-----Settings-----': 'Properties set by STC methods',
+'-----Common-----': 'User definable values that can be shared between languages'}
+
+[wxID_STCSTYLEEDITDLG, wxID_STCSTYLEEDITDLGADDCOMMONITEMBTN, wxID_STCSTYLEEDITDLGBGCOLBTN, wxID_STCSTYLEEDITDLGBGCOLCB, wxID_STCSTYLEEDITDLGBGCOLDEFCB, wxID_STCSTYLEEDITDLGCANCELBTN, wxID_STCSTYLEEDITDLGCOMMONDEFSBTN, wxID_STCSTYLEEDITDLGELEMENTLB, wxID_STCSTYLEEDITDLGFACECB, wxID_STCSTYLEEDITDLGFACEDEFCB, wxID_STCSTYLEEDITDLGFGCOLBTN, wxID_STCSTYLEEDITDLGFGCOLCB, wxID_STCSTYLEEDITDLGFGCOLDEFCB, wxID_STCSTYLEEDITDLGFIXEDWIDTHCHK, wxID_STCSTYLEEDITDLGOKBTN, wxID_STCSTYLEEDITDLGPANEL1, wxID_STCSTYLEEDITDLGPANEL2, wxID_STCSTYLEEDITDLGREMOVECOMMONITEMBTN, wxID_STCSTYLEEDITDLGSIZECB, wxID_STCSTYLEEDITDLGSPEEDSETTINGCH, wxID_STCSTYLEEDITDLGSTATICBOX1, wxID_STCSTYLEEDITDLGSTATICBOX2, wxID_STCSTYLEEDITDLGSTATICLINE1, wxID_STCSTYLEEDITDLGSTATICTEXT2, wxID_STCSTYLEEDITDLGSTATICTEXT3, wxID_STCSTYLEEDITDLGSTATICTEXT4, wxID_STCSTYLEEDITDLGSTATICTEXT6, wxID_STCSTYLEEDITDLGSTATICTEXT7, wxID_STCSTYLEEDITDLGSTATICTEXT8, wxID_STCSTYLEEDITDLGSTATICTEXT9, wxID_STCSTYLEEDITDLGSTC, wxID_STCSTYLEEDITDLGSTYLEDEFST, wxID_STCSTYLEEDITDLGTABOLDCB, wxID_STCSTYLEEDITDLGTABOLDDEFCB, wxID_STCSTYLEEDITDLGTAEOLFILLEDCB, wxID_STCSTYLEEDITDLGTAEOLFILLEDDEFCB, wxID_STCSTYLEEDITDLGTAITALICCB, wxID_STCSTYLEEDITDLGTAITALICDEFCB, wxID_STCSTYLEEDITDLGTASIZEDEFCB, wxID_STCSTYLEEDITDLGTAUNDERLINEDCB, wxID_STCSTYLEEDITDLGTAUNDERLINEDDEFCB] = map(lambda _init_ctrls: wxNewId(), range(41))
+
+class STCStyleEditDlg(wxDialog):
+ """ Style editor for the wxStyledTextCtrl """
+ _custom_classes = {'wxWindow' : ['wxStyledTextCtrl']}
+ def _init_utils(self):
+ pass
+
+ def _init_ctrls(self, prnt):
+ wxDialog.__init__(self, id = wxID_STCSTYLEEDITDLG, name = 'STCStyleEditDlg', parent = prnt, pos = wxPoint(416, 307), size = wxSize(425, 481), style = wxWANTS_CHARS | wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER, title = self.stc_title)
+ self._init_utils()
+ self.SetClientSize(wxSize(417, 454))
+ self.SetAutoLayout(true)
+ self.SetSizeHints(425, 400, -1, -1)
+ EVT_SIZE(self, self.OnStcstyleeditdlgSize)
+
+ self.staticBox2 = wxStaticBox(id = wxID_STCSTYLEEDITDLGSTATICBOX2, label = 'Text attributes', name = 'staticBox2', parent = self, pos = wxPoint(296, 56), size = wxSize(112, 99), style = 0)
+ self.staticBox2.SetConstraints(LayoutAnchors(self.staticBox2, false, true, true, false))
+
+ self.staticBox1 = wxStaticBox(id = wxID_STCSTYLEEDITDLGSTATICBOX1, label = 'Colour', name = 'staticBox1', parent = self, pos = wxPoint(157, 56), size = wxSize(128, 99), style = 0)
+ self.staticBox1.SetConstraints(LayoutAnchors(self.staticBox1, false, true, true, false))
+
+ self.elementLb = wxListBox(choices = [], id = wxID_STCSTYLEEDITDLGELEMENTLB, name = 'elementLb', parent = self, pos = wxPoint(8, 72), size = wxSize(144, 112), style = 0, validator = wxDefaultValidator)
+ self.elementLb.SetConstraints(LayoutAnchors(self.elementLb, true, true, true, false))
+ EVT_LISTBOX(self.elementLb, wxID_STCSTYLEEDITDLGELEMENTLB, self.OnElementlbListbox)
+
+ self.styleDefST = wxStaticText(id = wxID_STCSTYLEEDITDLGSTYLEDEFST, label = '(nothing selected)', name = 'styleDefST', parent = self, pos = wxPoint(56, 8), size = wxSize(352, 16), style = wxST_NO_AUTORESIZE)
+ self.styleDefST.SetFont(wxFont(8, wxSWISS, wxNORMAL, wxBOLD, false, self.sys_font))
+ self.styleDefST.SetConstraints(LayoutAnchors(self.styleDefST, true, true, true, false))
+
+ self.taEOLfilledCb = wxCheckBox(id = wxID_STCSTYLEEDITDLGTAEOLFILLEDCB, label = 'EOL filled', name = 'taEOLfilledCb', parent = self.staticBox2, pos = wxPoint(8, 75), size = wxSize(72, 16), style = 0)
+ self.taEOLfilledCb.SetValue(false)
+ EVT_CHECKBOX(self.taEOLfilledCb, wxID_STCSTYLEEDITDLGTAEOLFILLEDCB, self.OnTaeoffilledcbCheckbox)
+
+ self.staticText2 = wxStaticText(id = wxID_STCSTYLEEDITDLGSTATICTEXT2, label = 'default', name = 'staticText2', parent = self.staticBox2, pos = wxPoint(72, 11), size = wxSize(32, 16), style = 0)
+
+ self.taItalicCb = wxCheckBox(id = wxID_STCSTYLEEDITDLGTAITALICCB, label = 'Italic', name = 'taItalicCb', parent = self.staticBox2, pos = wxPoint(8, 43), size = wxSize(72, 16), style = 0)
+ EVT_CHECKBOX(self.taItalicCb, wxID_STCSTYLEEDITDLGTAITALICCB, self.OnTaitaliccbCheckbox)
+
+ self.taUnderlinedDefCb = wxCheckBox(id = wxID_STCSTYLEEDITDLGTAUNDERLINEDDEFCB, label = 'checkBox1', name = 'taUnderlinedDefCb', parent = self.staticBox2, pos = wxPoint(88, 59), size = wxSize(16, 16), style = 0)
+
+ self.taBoldDefCb = wxCheckBox(id = wxID_STCSTYLEEDITDLGTABOLDDEFCB, label = 'checkBox1', name = 'taBoldDefCb', parent = self.staticBox2, pos = wxPoint(88, 27), size = wxSize(16, 16), style = 0)
+
+ self.taItalicDefCb = wxCheckBox(id = wxID_STCSTYLEEDITDLGTAITALICDEFCB, label = 'checkBox1', name = 'taItalicDefCb', parent = self.staticBox2, pos = wxPoint(88, 43), size = wxSize(16, 16), style = 0)
+
+ self.taBoldCb = wxCheckBox(id = wxID_STCSTYLEEDITDLGTABOLDCB, label = 'Bold', name = 'taBoldCb', parent = self.staticBox2, pos = wxPoint(8, 27), size = wxSize(72, 16), style = 0)
+ EVT_CHECKBOX(self.taBoldCb, wxID_STCSTYLEEDITDLGTABOLDCB, self.OnTaboldcbCheckbox)
+
+ self.taEOLfilledDefCb = wxCheckBox(id = wxID_STCSTYLEEDITDLGTAEOLFILLEDDEFCB, label = 'checkBox1', name = 'taEOLfilledDefCb', parent = self.staticBox2, pos = wxPoint(88, 75), size = wxSize(16, 16), style = 0)
+
+ self.taUnderlinedCb = wxCheckBox(id = wxID_STCSTYLEEDITDLGTAUNDERLINEDCB, label = 'Underlined', name = 'taUnderlinedCb', parent = self.staticBox2, pos = wxPoint(8, 59), size = wxSize(72, 16), style = 0)
+ EVT_CHECKBOX(self.taUnderlinedCb, wxID_STCSTYLEEDITDLGTAUNDERLINEDCB, self.OnTaunderlinedcbCheckbox)
+
+ self.fgColDefCb = wxCheckBox(id = wxID_STCSTYLEEDITDLGFGCOLDEFCB, label = 'checkBox1', name = 'fgColDefCb', parent = self.staticBox1, pos = wxPoint(104, 31), size = wxSize(16, 16), style = 0)
+
+ self.staticText3 = wxStaticText(id = wxID_STCSTYLEEDITDLGSTATICTEXT3, label = 'default', name = 'staticText3', parent = self.staticBox1, pos = wxPoint(88, 16), size = wxSize(32, 16), style = 0)
+
+ self.bgColDefCb = wxCheckBox(id = wxID_STCSTYLEEDITDLGBGCOLDEFCB, label = 'checkBox1', name = 'bgColDefCb', parent = self.staticBox1, pos = wxPoint(104, 71), size = wxSize(16, 16), style = 0)
+
+ self.fgColBtn = wxButton(id = wxID_STCSTYLEEDITDLGFGCOLBTN, label = 'Foreground', name = 'fgColBtn', parent = self.staticBox1, pos = wxPoint(8, 16), size = wxSize(72, 16), style = 0)
+ EVT_BUTTON(self.fgColBtn, wxID_STCSTYLEEDITDLGFGCOLBTN, self.OnFgcolbtnButton)
+
+ self.bgColBtn = wxButton(id = wxID_STCSTYLEEDITDLGBGCOLBTN, label = 'Background', name = 'bgColBtn', parent = self.staticBox1, pos = wxPoint(8, 56), size = wxSize(72, 16), style = 0)
+ EVT_BUTTON(self.bgColBtn, wxID_STCSTYLEEDITDLGBGCOLBTN, self.OnBgcolbtnButton)
+
+ self.staticLine1 = wxStaticLine(id = wxID_STCSTYLEEDITDLGSTATICLINE1, name = 'staticLine1', parent = self, pos = wxPoint(36, 62), size = wxSize(115, 2), style = wxLI_HORIZONTAL)
+ self.staticLine1.SetConstraints(LayoutAnchors(self.staticLine1, true, true, true, false))
+
+ self.staticText6 = wxStaticText(id = wxID_STCSTYLEEDITDLGSTATICTEXT6, label = 'Style', name = 'staticText6', parent = self, pos = wxPoint(8, 56), size = wxSize(23, 13), style = 0)
+
+ self.okBtn = wxButton(id = wxID_STCSTYLEEDITDLGOKBTN, label = 'OK', name = 'okBtn', parent = self, pos = wxPoint(248, 422), size = wxSize(75, 23), style = 0)
+ self.okBtn.SetConstraints(LayoutAnchors(self.okBtn, false, false, true, true))
+ self.okBtn.SetToolTipString('Save changes to the config file')
+ EVT_BUTTON(self.okBtn, wxID_STCSTYLEEDITDLGOKBTN, self.OnOkbtnButton)
+
+ self.cancelBtn = wxButton(id = wxID_STCSTYLEEDITDLGCANCELBTN, label = 'Cancel', name = 'cancelBtn', parent = self, pos = wxPoint(332, 422), size = wxSize(75, 23), style = 0)
+ self.cancelBtn.SetConstraints(LayoutAnchors(self.cancelBtn, false, false, true, true))
+ self.cancelBtn.SetToolTipString('Close dialog without saving changes')
+ EVT_BUTTON(self.cancelBtn, wxID_STCSTYLEEDITDLGCANCELBTN, self.OnCancelbtnButton)
+
+ self.commonDefsBtn = wxButton(id = wxID_STCSTYLEEDITDLGCOMMONDEFSBTN, label = 'Common definitions', name = 'commonDefsBtn', parent = self, pos = wxPoint(8, 422), size = wxSize(104, 23), style = 0)
+ self.commonDefsBtn.SetConstraints(LayoutAnchors(self.commonDefsBtn, true, false, false, true))
+ self.commonDefsBtn.SetToolTipString('Directly edit the common definitions dictionary')
+ self.commonDefsBtn.Show(false)
+ EVT_BUTTON(self.commonDefsBtn, wxID_STCSTYLEEDITDLGCOMMONDEFSBTN, self.OnCommondefsbtnButton)
+
+ self.staticText8 = wxStaticText(id = wxID_STCSTYLEEDITDLGSTATICTEXT8, label = 'Style def:', name = 'staticText8', parent = self, pos = wxPoint(8, 8), size = wxSize(44, 13), style = 0)
+
+ self.staticText9 = wxStaticText(id = wxID_STCSTYLEEDITDLGSTATICTEXT9, label = 'SpeedSetting:', name = 'staticText9', parent = self, pos = wxPoint(8, 32), size = wxSize(67, 13), style = 0)
+
+ self.speedsettingCh = wxChoice(choices = [], id = wxID_STCSTYLEEDITDLGSPEEDSETTINGCH, name = 'speedsettingCh', parent = self, pos = wxPoint(88, 28), size = wxSize(320, 21), style = 0, validator = wxDefaultValidator)
+ self.speedsettingCh.SetConstraints(LayoutAnchors(self.speedsettingCh, true, true, true, false))
+ EVT_CHOICE(self.speedsettingCh, wxID_STCSTYLEEDITDLGSPEEDSETTINGCH, self.OnSpeedsettingchChoice)
+
+ self.stc = wxStyledTextCtrl(id = wxID_STCSTYLEEDITDLGSTC, name = 'stc', parent = self, pos = wxPoint(8, 208), size = wxSize(401, 206), style = wxSUNKEN_BORDER)
+ self.stc.SetConstraints(LayoutAnchors(self.stc, true, true, true, true))
+ EVT_LEFT_UP(self.stc, self.OnUpdateUI)
+ EVT_KEY_UP(self.stc, self.OnUpdateUI)
+
+ self.panel1 = wxPanel(id = wxID_STCSTYLEEDITDLGPANEL1, name = 'panel1', parent = self, pos = wxPoint(157, 161), size = wxSize(128, 40), style = wxTAB_TRAVERSAL)
+ self.panel1.SetConstraints(LayoutAnchors(self.panel1, false, true, true, false))
+
+ self.staticText4 = wxStaticText(id = wxID_STCSTYLEEDITDLGSTATICTEXT4, label = 'Face:', name = 'staticText4', parent = self.panel1, pos = wxPoint(0, 0), size = wxSize(27, 13), style = 0)
+
+ self.faceDefCb = wxCheckBox(id = wxID_STCSTYLEEDITDLGFACEDEFCB, label = 'checkBox1', name = 'faceDefCb', parent = self.panel1, pos = wxPoint(104, 0), size = wxSize(16, 16), style = 0)
+
+ self.fixedWidthChk = wxCheckBox(id = wxID_STCSTYLEEDITDLGFIXEDWIDTHCHK, label = '', name = 'fixedWidthChk', parent = self.panel1, pos = wxPoint(0, 23), size = wxSize(13, 19), style = 0)
+ self.fixedWidthChk.SetValue(false)
+ self.fixedWidthChk.SetToolTipString('Check this for Fixed Width fonts')
+ EVT_CHECKBOX(self.fixedWidthChk, wxID_STCSTYLEEDITDLGFIXEDWIDTHCHK, self.OnFixedwidthchkCheckbox)
+
+ self.addCommonItemBtn = wxButton(id = wxID_STCSTYLEEDITDLGADDCOMMONITEMBTN, label = 'Add', name = 'addCommonItemBtn', parent = self, pos = wxPoint(8, 184), size = wxSize(72, 16), style = 0)
+ self.addCommonItemBtn.SetToolTipString('Add new Common definition')
+ EVT_BUTTON(self.addCommonItemBtn, wxID_STCSTYLEEDITDLGADDCOMMONITEMBTN, self.OnAddsharebtnButton)
+
+ self.removeCommonItemBtn = wxButton(id = wxID_STCSTYLEEDITDLGREMOVECOMMONITEMBTN, label = 'Remove', name = 'removeCommonItemBtn', parent = self, pos = wxPoint(80, 184), size = wxSize(72, 16), style = 0)
+ self.removeCommonItemBtn.Enable(false)
+ self.removeCommonItemBtn.SetToolTipString('Remove the selected Common definition')
+ EVT_BUTTON(self.removeCommonItemBtn, wxID_STCSTYLEEDITDLGREMOVECOMMONITEMBTN, self.OnRemovesharebtnButton)
+
+ self.panel2 = wxPanel(id = wxID_STCSTYLEEDITDLGPANEL2, name = 'panel2', parent = self, pos = wxPoint(296, 162), size = wxSize(112, 40), style = wxTAB_TRAVERSAL)
+ self.panel2.SetConstraints(LayoutAnchors(self.panel2, false, true, true, false))
+
+ self.staticText7 = wxStaticText(id = wxID_STCSTYLEEDITDLGSTATICTEXT7, label = 'Size:', name = 'staticText7', parent = self.panel2, pos = wxPoint(0, 0), size = wxSize(23, 13), style = 0)
+
+ self.taSizeDefCb = wxCheckBox(id = wxID_STCSTYLEEDITDLGTASIZEDEFCB, label = 'checkBox1', name = 'taSizeDefCb', parent = self.panel2, pos = wxPoint(88, 0), size = wxSize(16, 16), style = 0)
+
+ self.sizeCb = wxComboBox(choices = [], id = wxID_STCSTYLEEDITDLGSIZECB, name = 'sizeCb', parent = self.panel2, pos = wxPoint(0, 17), size = wxSize(112, 21), style = 0, validator = wxDefaultValidator, value = '')
+ self.sizeCb.SetLabel('')
+
+ self.faceCb = wxComboBox(choices = [], id = wxID_STCSTYLEEDITDLGFACECB, name = 'faceCb', parent = self.panel1, pos = wxPoint(17, 18), size = wxSize(111, 21), style = 0, validator = wxDefaultValidator, value = '')
+ self.faceCb.SetLabel('')
+
+ self.fgColCb = wxComboBox(choices = [], id = wxID_STCSTYLEEDITDLGFGCOLCB, name = 'fgColCb', parent = self.staticBox1, pos = wxPoint(8, 32), size = wxSize(91, 21), style = 0, validator = wxDefaultValidator, value = '')
+ self.fgColCb.SetLabel('')
+
+ self.bgColCb = wxComboBox(choices = [], id = wxID_STCSTYLEEDITDLGBGCOLCB, name = 'bgColCb', parent = self.staticBox1, pos = wxPoint(8, 72), size = wxSize(91, 21), style = 0, validator = wxDefaultValidator, value = '')
+ self.bgColCb.SetLabel('')
+
+ def __init__(self, parent, langTitle, lang, configFile, STCsToUpdate=()):
+ self.stc_title = 'wxStyledTextCtrl Style Editor'
+ self.stc_title = 'wxStyledTextCtrl Style Editor - %s' % langTitle
+ self.sys_font = wxSystemSettings_GetSystemFont(wxSYS_DEFAULT_GUI_FONT).GetFaceName()
+ self._init_ctrls(parent)
+
+ self._onUpdateUI = false
+ self.lang = lang
+ self.configFile = configFile
+ self.style = ''
+ self.names = []
+ self.values = {}
+ self.STCsToUpdate = STCsToUpdate
+
+ for combo, evtRet, evtRDC in (
+ (self.fgColCb, self.OnfgColRet, self.OnGotoCommonDef),
+ (self.bgColCb, self.OnbgColRet, self.OnGotoCommonDef),
+ (self.faceCb, self.OnfaceRet, self.OnGotoCommonDef),
+ (self.sizeCb, self.OnsizeRet, self.OnGotoCommonDef)):
+ self.bindComboEvts(combo, evtRet, evtRDC)
+
+ (self.config, self.commonDefs, self.styleIdNames, self.styles,
+ self.styleGroupNames, self.predefStyleGroups,
+ self.otherLangStyleGroupNames, self.otherLangStyleGroups,
+ self.displaySrc, self.lexer, self.keywords, self.braceInfo) = \
+ initFromConfig(configFile, lang)
+
+ self.currSpeedSetting = 'style.%s'%self.lang
+ for grp in [self.currSpeedSetting]+self.styleGroupNames:
+ self.speedsettingCh.Append(grp)
+ self.speedsettingCh.SetSelection(0)
+
+ margin = 0
+ self.stc.SetMarginType(margin, wxSTC_MARGIN_NUMBER)
+ self.stc.SetMarginWidth(margin, 25)
+ self.stc.SetMarginSensitive(margin, true)
+ EVT_STC_MARGINCLICK(self.stc, wxID_STCSTYLEEDITDLGSTC, self.OnMarginClick)
+
+ self.stc.SetUseTabs(false)
+ self.stc.SetTabWidth(4)
+ self.stc.SetIndentationGuides(true)
+ self.stc.SetEdgeMode(wxSTC_EDGE_BACKGROUND)
+ self.stc.SetEdgeColumn(44)
+
+ self.setStyles()
+
+ self.populateStyleSelector()
+
+ self.defNames, self.defValues = parseProp(\
+ self.styleDict.get(wxSTC_STYLE_DEFAULT, ''))
+
+ self.stc.SetText(self.displaySrc)
+ self.stc.EmptyUndoBuffer()
+ self.stc.SetCurrentPos(self.stc.GetTextLength())
+ self.stc.SetAnchor(self.stc.GetTextLength())
+
+ self.populateCombosWithCommonDefs()
+
+ # Logical grouping of controls and the property they edit
+ self.allCtrls = [((self.fgColBtn, self.fgColCb), self.fgColDefCb,
+ 'fore', wxID_STCSTYLEEDITDLGFGCOLDEFCB),
+ ((self.bgColBtn, self.bgColCb), self.bgColDefCb,
+ 'back', wxID_STCSTYLEEDITDLGBGCOLDEFCB),
+ (self.taBoldCb, self.taBoldDefCb,
+ 'bold', wxID_STCSTYLEEDITDLGTABOLDDEFCB),
+ (self.taItalicCb, self.taItalicDefCb,
+ 'italic', wxID_STCSTYLEEDITDLGTAITALICDEFCB),
+ (self.taUnderlinedCb, self.taUnderlinedDefCb,
+ 'underline', wxID_STCSTYLEEDITDLGTAUNDERLINEDDEFCB),
+ (self.taEOLfilledCb, self.taEOLfilledDefCb,
+ 'eolfilled', wxID_STCSTYLEEDITDLGTAEOLFILLEDDEFCB),
+ (self.sizeCb, self.taSizeDefCb,
+ 'size', wxID_STCSTYLEEDITDLGTASIZEDEFCB),
+ ((self.faceCb, self.fixedWidthChk), self.faceDefCb,
+ 'face', wxID_STCSTYLEEDITDLGFACEDEFCB)]
+
+ self.clearCtrls(disableDefs=true)
+ # centralised default checkbox event handler
+ self.chbIdMap = {}
+ for ctrl, chb, prop, wid in self.allCtrls:
+ self.chbIdMap[wid] = ctrl, chb, prop, wid
+ EVT_CHECKBOX(chb, wid, self.OnDefaultCheckBox)
+ chb.SetToolTipString('Toggle defaults')
+
+ self.Center(wxBOTH)
+ self._onUpdateUI = true
+
+#---Property methods------------------------------------------------------------
+ def getCtrlForProp(self, findprop):
+ for ctrl, chb, prop, wid in self.allCtrls:
+ if findprop == prop:
+ return ctrl, chb
+ raise Exception('PropNotFound', findprop)
+
+ def editProp(self, on, prop, val=''):
+ oldstyle = self.rememberStyles()
+ if on:
+ if not self.names.count(prop):
+ self.names.append(prop)
+ self.values[prop] = val
+ else:
+ try: self.names.remove(prop)
+ except ValueError: pass
+ try: del self.values[prop]
+ except KeyError: pass
+
+ try:
+ self.updateStyle()
+ return true
+ except KeyError, errkey:
+ wxLogError('Name not found in Common definition, '\
+ 'please enter valid reference. (%s)'%errkey)
+ self.restoreStyles(oldstyle)
+ return false
+
+#---Control population methods--------------------------------------------------
+ def setStyles(self):
+ self.styles, self.styleDict, self.styleNumIdxMap = \
+ setSTCStyles(self.stc, self.styles, self.styleIdNames,
+ self.commonDefs, self.lang, self.lexer, self.keywords)
+
+ def updateStyle(self):
+ # called after a control edited self.names, self.values
+ # Special case for saving common defs settings
+ if self.styleNum == 'common':
+ strVal = self.style[2] = self.values.values()[0]
+ if self.style[1] == 'size': self.style[2] = int(strVal)
+
+ self.commonDefs[self.style[0]] = self.style[2]
+ self.styleDefST.SetLabel(strVal)
+ else:
+ self.style = writePropVal(self.names, self.values)
+ styleDecl = writeProp(self.styleNum, self.style, self.lang)
+ self.styles[self.styleNumIdxMap[self.styleNum]] = styleDecl
+ self.styleDefST.SetLabel(self.style)
+ self.setStyles()
+
+ def findInStyles(self, txt, styles):
+ for style in styles:
+ if string.find(style, txt) != -1:
+ return true
+ return false
+
+ def rememberStyles(self):
+ return self.names[:], copy.copy(self.values)
+
+ def restoreStyles(self, style):
+ self.names, self.values = style
+ self.updateStyle()
+
+ def clearCtrls(self, isDefault=false, disableDefs=false):
+ for ctrl, chb, prop, wid in self.allCtrls:
+ if prop in ('fore', 'back'):
+ btn, txt = ctrl
+ btn.SetBackgroundColour(\
+ wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNFACE))
+ btn.SetForegroundColour(wxColour(255, 255, 255))
+ btn.Enable(isDefault)
+ txt.SetValue('')
+ txt.Enable(isDefault)
+ elif prop == 'size':
+ ctrl.SetValue('')
+ ctrl.Enable(isDefault)
+ elif prop == 'face':
+ ctrl[0].SetValue('')
+ ctrl[0].Enable(isDefault)
+ ctrl[1].Enable(isDefault)
+ ctrl[1].SetValue(false)
+ elif prop in ('bold', 'italic', 'underline', 'eolfilled'):
+ ctrl.SetValue(false)
+ ctrl.Enable(isDefault)
+
+ chb.Enable(not isDefault and not disableDefs)
+ chb.SetValue(true)
+
+ def populateProp(self, items, default, forceDisable=false):
+ for name, val in items:
+ if name:
+ ctrl, chb = self.getCtrlForProp(name)
+
+ if name in ('fore', 'back'):
+ btn, txt = ctrl
+ repval = val%self.commonDefs
+ btn.SetBackgroundColour(strToCol(repval))
+ btn.SetForegroundColour(wxColour(0, 0, 0))
+ btn.Enable(not forceDisable)
+ txt.SetValue(val)
+ txt.Enable(not forceDisable)
+ chb.SetValue(default)
+ elif name == 'size':
+ ctrl.SetValue(val)
+ ctrl.Enable(not forceDisable)
+ chb.SetValue(default)
+ elif name == 'face':
+ ctrl[0].SetValue(val)
+ ctrl[0].Enable(not forceDisable)
+ ctrl[1].Enable(not forceDisable)
+ chb.SetValue(default)
+ elif name in ('bold', 'italic', 'underline', 'eolfilled'):
+ ctrl.Enable(not forceDisable)
+ ctrl.SetValue(true)
+ chb.SetValue(default)
+
+ def valIsCommonDef(self, val):
+ return len(val) >= 5 and val[:2] == '%('
+
+ def populateCtrls(self):
+ self.clearCtrls(self.styleNum == wxSTC_STYLE_DEFAULT,
+ disableDefs=self.styleNum < 0)
+
+ # handle colour controls for settings
+ if self.styleNum < 0:
+ self.fgColDefCb.Enable(true)
+ if self.styleNum == -1:
+ self.bgColDefCb.Enable(true)
+
+ # populate with default style
+ self.populateProp(self.defValues.items(), true,
+ self.styleNum != wxSTC_STYLE_DEFAULT)
+ # override with current settings
+ self.populateProp(self.values.items(), false)
+
+ def getCommonDefPropType(self, commonDefName):
+ val = self.commonDefs[commonDefName]
+ if type(val) == type(0): return 'size'
+ if len(val) == 7 and val[0] == '#': return 'fore'
+ return 'face'
+
+ def bindComboEvts(self, combo, returnEvtMeth, rdclickEvtMeth):
+ wId = wxNewId()
+ EVT_MENU(self, wId, returnEvtMeth)
+ combo.SetAcceleratorTable(wxAcceleratorTable([(0, WXK_RETURN, wId)]))
+ EVT_RIGHT_DCLICK(combo, rdclickEvtMeth)
+ combo.SetToolTipString('Select or press Enter to change, right double-click \n'\
+ 'the drop down button to select Common definition (if applicable)')
+
+ def populateCombosWithCommonDefs(self, fixedWidthOnly=None):
+ commonDefs = {'fore': [], 'face': [], 'size': []}
+
+ if self.elementLb.GetSelection() < self.commonDefsStartIdx:
+ for common in self.commonDefs.keys():
+ prop = self.getCommonDefPropType(common)
+ commonDefs[prop].append('%%(%s)%s'%(common,
+ prop=='size' and 'd' or 's'))
+
+ # Colours
+ currFg, currBg = self.fgColCb.GetValue(), self.bgColCb.GetValue()
+ self.fgColCb.Clear(); self.bgColCb.Clear()
+ for colCommonDef in commonDefs['fore']:
+ self.fgColCb.Append(colCommonDef)
+ self.bgColCb.Append(colCommonDef)
+ self.fgColCb.SetValue(currFg); self.bgColCb.SetValue(currBg)
+
+ # Font
+ if fixedWidthOnly is None:
+ fixedWidthOnly = self.fixedWidthChk.GetValue()
+ fontEnum = wxFontEnumerator()
+ fontEnum.EnumerateFacenames(fixedWidthOnly=fixedWidthOnly)
+ fontNameList = fontEnum.GetFacenames()
+
+ currFace = self.faceCb.GetValue()
+ self.faceCb.Clear()
+ for colCommonDef in ['']+fontNameList+commonDefs['face']:
+ self.faceCb.Append(colCommonDef)
+ self.faceCb.SetValue(currFace)
+
+ # Size (XXX add std font sizes)
+ currSize = self.sizeCb.GetValue()
+ self.sizeCb.Clear()
+ for colCommonDef in commonDefs['size']:
+ self.sizeCb.Append(colCommonDef)
+ self.sizeCb.SetValue(currSize)
+
+ def populateStyleSelector(self):
+ numStyles = self.styleIdNames.items()
+ numStyles.sort()
+ self.styleNumLookup = {}
+ stdStart = -1
+ stdOffset = 0
+ extrOffset = 0
+ # add styles
+ for num, name in numStyles:
+ if num == wxSTC_STYLE_DEFAULT:
+ self.elementLb.InsertItems([name, '-----Language-----'], 0)
+ self.elementLb.Append('-----Standard-----')
+ stdStart = stdPos = self.elementLb.Number()
+ else:
+ # std styles
+ if num >= 33 and num < 40:
+ self.elementLb.InsertItems([name], stdStart + stdOffset)
+ stdOffset = stdOffset + 1
+ # extra styles
+ elif num >= 40:
+ self.elementLb.InsertItems([name], stdStart + extrOffset -1)
+ extrOffset = extrOffset + 1
+ # normal lang styles
+ else:
+ self.elementLb.Append(name)
+ self.styleNumLookup[name] = num
+
+ # add settings
+ self.elementLb.Append('-----Settings-----')
+ settings = settingsIdNames.items()
+ settings.sort();settings.reverse()
+ for num, name in settings:
+ self.elementLb.Append(name)
+ self.styleNumLookup[name] = num
+
+ # add definitions
+ self.elementLb.Append('-----Common-----')
+ self.commonDefsStartIdx = self.elementLb.Number()
+ for common in self.commonDefs.keys():
+ tpe = type(self.commonDefs[common])
+ self.elementLb.Append('%('+common+')'+(tpe is type('') and 's' or 'd'))
+ self.styleNumLookup[common] = num
+
+#---Colour methods--------------------------------------------------------------
+ def getColourDlg(self, colour, title=''):
+ data = wxColourData()
+ data.SetColour(colour)
+ data.SetChooseFull(true)
+ dlg = wxColourDialog(self, data)
+ try:
+ dlg.SetTitle(title)
+ if dlg.ShowModal() == wxID_OK:
+ data = dlg.GetColourData()
+ return data.GetColour()
+ finally:
+ dlg.Destroy()
+ return None
+
+ colDlgTitles = {'fore': 'Foreground', 'back': 'Background'}
+ def editColProp(self, colBtn, colCb, prop):
+ col = self.getColourDlg(colBtn.GetBackgroundColour(),
+ self.colDlgTitles[prop]+ ' colour')
+ if col:
+ colBtn.SetForegroundColour(wxColour(0, 0, 0))
+ colBtn.SetBackgroundColour(col)
+ colStr = colToStr(col)
+ colCb.SetValue(colStr)
+ self.editProp(true, prop, colStr)
+
+ def OnFgcolbtnButton(self, event):
+ self.editColProp(self.fgColBtn, self.fgColCb, 'fore')
+
+ def OnBgcolbtnButton(self, event):
+ self.editColProp(self.bgColBtn, self.bgColCb, 'back')
+
+ def editColTCProp(self, colCb, colBtn, prop):
+ colStr = colCb.GetValue()
+ if colStr:
+ col = strToCol(colStr%self.commonDefs)
+ if self.editProp(colStr!='', prop, colStr):
+ if colStr:
+ colBtn.SetForegroundColour(wxColour(0, 0, 0))
+ colBtn.SetBackgroundColour(col)
+ else:
+ colBtn.SetForegroundColour(wxColour(255, 255, 255))
+ colBtn.SetBackgroundColour(\
+ wxSystemSettings_GetSystemColour(wxSYS_COLOUR_BTNFACE))
+
+ def OnfgColRet(self, event):
+ try: self.editColTCProp(self.fgColCb, self.fgColBtn, 'fore')
+ except AssertionError: wxLogError('Not a valid colour value')
+
+ def OnbgColRet(self, event):
+ try: self.editColTCProp(self.bgColCb, self.bgColBtn, 'back')
+ except AssertionError: wxLogError('Not a valid colour value')
+
+#---Text attribute events-------------------------------------------------------
+ def OnTaeoffilledcbCheckbox(self, event):
+ self.editProp(event.IsChecked(), 'eolfilled')
+
+ def OnTaitaliccbCheckbox(self, event):
+ self.editProp(event.IsChecked(), 'italic')
+
+ def OnTaboldcbCheckbox(self, event):
+ self.editProp(event.IsChecked(), 'bold')
+
+ def OnTaunderlinedcbCheckbox(self, event):
+ self.editProp(event.IsChecked(), 'underline')
+
+ def OnGotoCommonDef(self, event):
+ val = event.GetEventObject().GetValue()
+ if self.valIsCommonDef(val):
+ idx = self.elementLb.FindString(val)
+ if idx != -1:
+ self.elementLb.SetSelection(idx, true)
+ self.OnElementlbListbox(None)
+
+ def OnfaceRet(self, event):
+ val = self.faceCb.GetValue()
+ try: val%self.commonDefs
+ except KeyError: wxLogError('Invalid common definition')
+ else: self.editProp(val!='', 'face', val)
+
+ def OnsizeRet(self, event):
+ val = self.sizeCb.GetValue()
+ try: int(val%self.commonDefs)
+ except ValueError: wxLogError('Not a valid integer size value')
+ except KeyError: wxLogError('Invalid common definition')
+ else: self.editProp(val!='', 'size', val)
+
+#---Main GUI events-------------------------------------------------------------
+ def OnElementlbListbox(self, event):
+ isCommon = self.elementLb.GetSelection() >= self.commonDefsStartIdx
+ self.removeCommonItemBtn.Enable(isCommon)
+
+ styleIdent = self.elementLb.GetStringSelection()
+ # common definition selected
+ if isCommon:
+ common = styleIdent[2:-2]
+ prop = self.getCommonDefPropType(common)
+ self.clearCtrls(disableDefs=true)
+ if prop == 'fore':
+ self.fgColBtn.Enable(true)
+ self.fgColCb.Enable(true)
+ elif prop == 'face':
+ self.faceCb.Enable(true)
+ self.fixedWidthChk.Enable(true)
+ elif prop == 'size':
+ self.sizeCb.Enable(true)
+
+ commonDefVal = str(self.commonDefs[common])
+ self.styleDefST.SetLabel(commonDefVal)
+ self.populateProp( [(prop, commonDefVal)], true)
+
+ self.styleNum = 'common'
+ self.style = [common, prop, commonDefVal]
+ self.names, self.values = [prop], {prop: commonDefVal}
+
+ # normal style element selected
+ elif len(styleIdent) >=2 and styleIdent[:2] != '--':
+ self.styleNum = self.styleNumLookup[styleIdent]
+ self.style = self.styleDict[self.styleNum]
+ self.names, self.values = parseProp(self.style)
+
+ if self.styleNum == wxSTC_STYLE_DEFAULT:
+ self.defNames, self.defValues = \
+ self.names, self.values
+
+ self.checkBraces(self.styleNum)
+
+ self.styleDefST.SetLabel(self.style)
+
+ self.populateCtrls()
+ # separator selected
+ else:
+ self.clearCtrls(disableDefs=true)
+ if styleIdent:
+ self.styleDefST.SetLabel(styleCategoryDescriptions[styleIdent])
+
+ self.populateCombosWithCommonDefs()
+
+ def OnDefaultCheckBox(self, event):
+ self._onUpdateUI = false
+ try:
+ if self.chbIdMap.has_key(event.GetId()):
+ ctrl, chb, prop, wid = self.chbIdMap[event.GetId()]
+ restore = not event.IsChecked()
+ if prop in ('fore', 'back'):
+ ctrl[0].Enable(restore)
+ ctrl[1].Enable(restore)
+ if restore:
+ # XXX use ctrl[1] !!
+ colStr = ctrl[1].GetValue()
+ #if prop == 'fore': colStr = self.fgColCb.GetValue()
+ #else: colStr = self.bgColCb.GetValue()
+ if colStr: self.editProp(true, prop, colStr)
+ else:
+ self.editProp(false, prop)
+ elif prop == 'size':
+ val = ctrl.GetValue()
+ if val: self.editProp(restore, prop, val)
+ ctrl.Enable(restore)
+ elif prop == 'face':
+ val = ctrl[0].GetStringSelection()
+ if val: self.editProp(restore, prop, val)
+ ctrl[0].Enable(restore)
+ ctrl[1].Enable(restore)
+ elif prop in ('bold', 'italic', 'underline', 'eolfilled'):
+ ctrl.Enable(restore)
+ if ctrl.GetValue(): self.editProp(restore, prop)
+ finally:
+ self._onUpdateUI = true
+
+ def OnOkbtnButton(self, event):
+ # write styles and common defs to the config
+ writeStylesToConfig(self.config, 'style.%s'%self.lang, self.styles)
+ self.config.SetPath('')
+ self.config.Write(commonDefsFile, `self.commonDefs`)
+ self.config.Flush()
+
+ for stc in self.STCsToUpdate:
+ setSTCStyles(stc, self.styles, self.styleIdNames, self.commonDefs,
+ self.lang, self.lexer, self.keywords)
+
+ self.EndModal(wxID_OK)
+
+ def OnCancelbtnButton(self, event):
+ self.EndModal(wxID_CANCEL)
+
+ def OnCommondefsbtnButton(self, event):
+ dlg = wxTextEntryDialog(self, 'Edit common definitions dictionary',
+ 'Common definitions', pprint.pformat(self.commonDefs),
+ style=wxTE_MULTILINE | wxOK | wxCANCEL | wxCENTRE)
+ try:
+ if dlg.ShowModal() == wxID_OK:
+ answer = eval(dlg.GetValue())
+ assert type(answer) is type({}), 'Not a valid dictionary'
+ oldDefs = self.commonDefs
+ self.commonDefs = answer
+ try:
+ self.setStyles()
+ except KeyError, badkey:
+ wxLogError(str(badkey)+' not defined but required, \n'\
+ 'reverting to previous common definition')
+ self.commonDefs = oldDefs
+ self.setStyles()
+ self.populateCombosWithCommonDefs()
+
+ finally:
+ dlg.Destroy()
+
+ def OnSpeedsettingchChoice(self, event):
+ group = event.GetString()
+ if group:
+ userStyles = 'style.%s'%self.lang
+ if self.currSpeedSetting == userStyles:
+ self.predefStyleGroups[userStyles] = self.styles
+ self.styles = self.predefStyleGroups[group]
+ self.setStyles()
+ self.defNames, self.defValues = parseProp(\
+ self.styleDict.get(wxSTC_STYLE_DEFAULT, ''))
+ self.OnElementlbListbox(None)
+ self.currSpeedSetting = group
+
+ def OnFixedwidthchkCheckbox(self, event):
+ self.populateCombosWithCommonDefs(event.Checked())
+
+ def OnAddsharebtnButton(self, event):
+ dlg = CommonDefDlg(self)
+ try:
+ if dlg.ShowModal() == wxID_OK:
+ prop, name = dlg.result
+ if not self.commonDefs.has_key(name):
+ 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.populateCombosWithCommonDefs()
+ self.OnElementlbListbox(None)
+ finally:
+ dlg.Destroy()
+
+ def OnRemovesharebtnButton(self, event):
+ ownGroup = 'style.%s'%self.lang
+ comDef = self.elementLb.GetStringSelection()
+
+ # Search ALL styles before removing
+ srchDct = {ownGroup: self.styles}
+ srchDct.update(self.predefStyleGroups)
+ srchDct.update(self.otherLangStyleGroups)
+
+ matchList = []
+ for grpName, styles in srchDct.items():
+ if self.findInStyles(comDef, styles):
+ matchList.append(grpName)
+
+ if matchList:
+ wxLogError('Aborted: '+comDef+' is still used in the styles of the \n'\
+ 'following groups in the config file (stc-styles.rc.cfg):\n'+ \
+ string.join(matchList, '\n'))
+ else:
+ del self.commonDefs[comDef[2:-2]]
+ self.setStyles()
+ self.populateCombosWithCommonDefs()
+ selIdx = self.elementLb.GetSelection()
+ self.elementLb.Delete(selIdx)
+ if selIdx == self.elementLb.Number():
+ selIdx = selIdx - 1
+ self.elementLb.SetSelection(selIdx, true)
+ self.OnElementlbListbox(None)
+
+#---STC events------------------------------------------------------------------
+ def OnUpdateUI(self, event):
+ if self._onUpdateUI:
+ styleBefore = self.stc.GetStyleAt(self.stc.GetCurrentPos())
+ if self.styleIdNames.has_key(styleBefore):
+ self.elementLb.SetStringSelection(self.styleIdNames[styleBefore],
+ true)
+ else:
+ self.elementLb.SetSelection(0, false)
+ self.styleDefST.SetLabel('Style %d not defined, sorry.'%styleBefore)
+ self.OnElementlbListbox(None)
+ event.Skip()
+
+ def checkBraces(self, style):
+ if style == wxSTC_STYLE_BRACELIGHT and self.braceInfo.has_key('good'):
+ line, col = self.braceInfo['good']
+ pos = self.stc.PositionFromLine(line-1) + col
+ braceOpposite = self.stc.BraceMatch(pos)
+ if braceOpposite != -1:
+ self.stc.BraceHighlight(pos, braceOpposite)
+ elif style == wxSTC_STYLE_BRACEBAD and self.braceInfo.has_key('bad'):
+ line, col = self.braceInfo['bad']
+ pos = self.stc.PositionFromLine(line-1) + col
+ self.stc.BraceBadLight(pos)
+ else:
+ self.stc.BraceBadLight(-1)
+ return
+
+ def OnStcstyleeditdlgSize(self, event):
+ self.Layout()
+ # Without this refresh, resizing leaves artifacts
+ self.Refresh(1)
+ event.Skip()
+
+ def OnMarginClick(self, event):
+ self.elementLb.SetStringSelection('Line numbers', true)
+ self.OnElementlbListbox(None)
+
+
+#---Common definition dialog----------------------------------------------------
+
+[wxID_COMMONDEFDLG, wxID_COMMONDEFDLGCANCELBTN, wxID_COMMONDEFDLGCOMDEFNAMETC, wxID_COMMONDEFDLGOKBTN, wxID_COMMONDEFDLGPROPTYPERBX, wxID_COMMONDEFDLGSTATICBOX1] = map(lambda _init_ctrls: wxNewId(), range(6))
+
+class CommonDefDlg(wxDialog):
+ def _init_ctrls(self, prnt):
+ wxDialog.__init__(self, id = wxID_COMMONDEFDLG, name = 'CommonDefDlg', parent = prnt, pos = wxPoint(398, 249), size = wxSize(192, 220), style = wxDEFAULT_DIALOG_STYLE, title = 'Common definition')
+ self.SetClientSize(wxSize(184, 175))
+
+ self.propTypeRBx = wxRadioBox(choices = ['Colour value', 'Font face', 'Size value'], id = wxID_COMMONDEFDLGPROPTYPERBX, label = 'Common definition property type', majorDimension = 1, name = 'propTypeRBx', parent = self, point = wxPoint(8, 8), size = wxSize(168, 72), style = wxRA_SPECIFY_COLS, validator = wxDefaultValidator)
+ self.propTypeRBx.SetSelection(self._propTypeIdx)
+
+ self.staticBox1 = wxStaticBox(id = wxID_COMMONDEFDLGSTATICBOX1, label = 'Name', name = 'staticBox1', parent = self, pos = wxPoint(8, 88), size = wxSize(168, 46), style = 0)
+
+ self.comDefNameTC = wxTextCtrl(id = wxID_COMMONDEFDLGCOMDEFNAMETC, name = 'comDefNameTC', parent = self, pos = wxPoint(16, 104), size = wxSize(152, 21), style = 0, value = '')
+ self.comDefNameTC.SetLabel(self._comDefName)
+
+ self.okBtn = wxButton(id = wxID_COMMONDEFDLGOKBTN, label = 'OK', name = 'okBtn', parent = self, pos = wxPoint(8, 144), size = wxSize(80, 23), style = 0)
+ EVT_BUTTON(self.okBtn, wxID_COMMONDEFDLGOKBTN, self.OnOkbtnButton)
+
+ self.cancelBtn = wxButton(id = wxID_COMMONDEFDLGCANCELBTN, label = 'Cancel', name = 'cancelBtn', parent = self, pos = wxPoint(96, 144), size = wxSize(80, 23), style = 0)
+ EVT_BUTTON(self.cancelBtn, wxID_COMMONDEFDLGCANCELBTN, self.OnCancelbtnButton)
+
+ def __init__(self, parent, name='', propIdx=0):
+ self._comDefName = ''
+ self._comDefName = name
+ self._propTypeIdx = 0
+ self._propTypeIdx = propIdx
+ self._init_ctrls(parent)
+
+ self.propMap = {0: 'fore', 1: 'face', 2: 'size'}
+ self.result = ( '', '' )
+
+ self.Center(wxBOTH)
+
+ def OnOkbtnButton(self, event):
+ self.result = ( self.propMap[self.propTypeRBx.GetSelection()],
+ self.comDefNameTC.GetValue() )
+ self.EndModal(wxID_OK)
+
+ def OnCancelbtnButton(self, event):
+ self.result = ( '', '' )
+ self.EndModal(wxID_CANCEL)
+
+#---Functions useful outside of the editor----------------------------------
+
+def setSelectionColour(stc, style):
+ names, values = parseProp(style)
+ if 'fore' in names:
+ stc.SetSelForeground(true, strToCol(values['fore']))
+ if 'back' in names:
+ stc.SetSelBackground(true, strToCol(values['back']))
+
+def setCursorColour(stc, style):
+ names, values = parseProp(style)
+ if 'fore' in names:
+ stc.SetCaretForeground(strToCol(values['fore']))
+
+def setEdgeColour(stc, style):
+ names, values = parseProp(style)
+ if 'fore' in names:
+ stc.SetEdgeColour(strToCol(values['fore']))
+
+def strToCol(strCol):
+ assert len(strCol) == 7 and strCol[0] == '#', 'Not a valid colour string'
+ return wxColour(string.atoi('0x'+strCol[1:3], 16),
+ string.atoi('0x'+strCol[3:5], 16),
+ string.atoi('0x'+strCol[5:7], 16))
+def colToStr(col):
+ return '#%s%s%s' % (string.zfill(string.upper(hex(col.Red())[2:]), 2),
+ string.zfill(string.upper(hex(col.Green())[2:]), 2),
+ string.zfill(string.upper(hex(col.Blue())[2:]), 2))
+
+def writeProp(num, style, lang):
+ if num >= 0:
+ return 'style.%s.%s='%(lang, string.zfill(`num`, 3)) + style
+ else:
+ return 'setting.%s.%d='%(lang, num) + style
+
+def writePropVal(names, values):
+ res = []
+ for name in names:
+ if name:
+ res.append(values[name] and name+':'+values[name] or name)
+ return string.join(res, ',')
+
+def parseProp(prop):
+ items = string.split(prop, ',')
+ names = []
+ values = {}
+ for item in items:
+ nameVal = string.split(item, ':')
+ names.append(string.strip(nameVal[0]))
+ if len(nameVal) == 1:
+ values[nameVal[0]] = ''
+ else:
+ values[nameVal[0]] = string.strip(nameVal[1])
+ return names, values
+
+def parsePropLine(prop):
+ name, value = string.split(prop, '=')
+ return int(string.split(name, '.')[-1]), value
+
+def setSTCStyles(stc, styles, styleIdNames, commonDefs, lang, lexer, keywords):
+ styleDict = {}
+ styleNumIdxMap = {}
+
+ # build style dict based on given styles
+ for numStyle in styles:
+ num, style = parsePropLine(numStyle)
+ styleDict[num] = style
+
+ # Add blank style entries for undefined styles
+ newStyles = []
+ styleItems = styleIdNames.items() + settingsIdNames.items()
+ styleItems.sort()
+ idx = 0
+ for num, name in styleItems:
+ styleNumIdxMap[num] = idx
+ if not styleDict.has_key(num):
+ styleDict[num] = ''
+ newStyles.append(writeProp(num, styleDict[num], lang))
+ idx = idx + 1
+
+ # Set the styles on the wxSTC
+ stc.StyleResetDefault()
+ stc.ClearDocumentStyle()
+ stc.SetLexer(lexer)
+ stc.SetKeyWords(0, keywords)
+ stc.StyleSetSpec(wxSTC_STYLE_DEFAULT,
+ styleDict[wxSTC_STYLE_DEFAULT] % commonDefs)
+ stc.StyleClearAll()
+
+ for num, style in styleDict.items():
+ if num >= 0:
+ stc.StyleSetSpec(num, style % commonDefs)
+ elif num == -1:
+ setSelectionColour(stc, style % commonDefs)
+ elif num == -2:
+ setCursorColour(stc, style % commonDefs)
+ elif num == -3:
+ setEdgeColour(stc, style % commonDefs)
+
+ stc.Colourise(0, stc.GetTextLength())
+
+ return newStyles, styleDict, styleNumIdxMap
+
+#---Config reading and writing -------------------------------------------------
+commonDefsFile = 'common.defs.%s'%(wxPlatform == '__WXMSW__' and 'msw' or 'gtk')
+
+def initFromConfig(configFile, lang):
+ cfg = wxFileConfig(localFilename=configFile, style=wxCONFIG_USE_LOCAL_FILE)
+ cfg.SetExpandEnvVars(false)
+
+ # read in all group names for this language
+ groupPrefix = 'style.%s'%lang
+ gpLen = len(groupPrefix)
+ predefStyleGroupNames, otherLangStyleGroupNames = [], []
+ cont, val, idx = cfg.GetFirstGroup()
+ while cont:
+ if val != groupPrefix and len(val) >= 5 and val[:5] == 'style':
+ if len(val) > gpLen and val[:gpLen] == groupPrefix:
+ predefStyleGroupNames.append(val)
+ else:
+ otherLangStyleGroupNames.append(val)
+
+ cont, val, idx = cfg.GetNextGroup(idx)
+
+ # read in common elements
+ commonDefs = eval(cfg.Read(commonDefsFile))
+ assert type(commonDefs) is type({}), \
+ 'Common definitions (%s) not a valid dict'%commonDefsFile
+
+ commonStyleIdNames = eval(cfg.Read('common.styleidnames'))
+ assert type(commonStyleIdNames) is type({}), \
+ 'Common definitions (%s) not a valid dict'%'common.styleidnames'
+
+ # Lang spesific settings
+ cfg.SetPath(lang)
+ styleIdNames = eval(cfg.Read('styleidnames'))
+ assert type(commonStyleIdNames) is type({}), \
+ 'Not a valid dict [%s] styleidnames)'%lang
+ styleIdNames.update(commonStyleIdNames)
+ braceInfo = eval(cfg.Read('braces'))
+ assert type(commonStyleIdNames) is type({}), \
+ 'Not a valid dict [%s] braces)'%lang
+
+ displaySrc = cfg.Read('displaysrc')
+ lexer = eval(cfg.Read('lexer'))
+ keywords = cfg.Read('keywords')
+
+ cfg.SetPath('')
+
+ # read in current styles
+ styles = readStylesFromConfig(cfg, groupPrefix)
+
+ # read in predefined styles
+ predefStyleGroups = {}
+ for group in predefStyleGroupNames:
+ predefStyleGroups[group] = readStylesFromConfig(cfg, group)
+
+ # read in all other style sections
+ otherLangStyleGroups = {}
+ for group in otherLangStyleGroupNames:
+ otherLangStyleGroups[group] = readStylesFromConfig(cfg, group)
+
+ return (cfg, commonDefs, styleIdNames, styles, predefStyleGroupNames,
+ predefStyleGroups, otherLangStyleGroupNames, otherLangStyleGroups,
+ displaySrc, lexer, keywords, braceInfo)
+
+def readStylesFromConfig(config, group):
+ config.SetPath('')
+ config.SetPath(group)
+ styles = []
+ cont, val, idx = config.GetFirstEntry()
+ while cont:
+ styles.append(val+'='+config.Read(val))
+ cont, val, idx = config.GetNextEntry(idx)
+ config.SetPath('')
+
+ return styles
+
+def writeStylesToConfig(config, group, styles):
+ config.SetPath('')
+ config.DeleteGroup(group)
+ config.SetPath(group)
+
+ for style in styles:
+ name, value = string.split(style, '=')
+ config.Write(name, string.strip(value))
+
+ config.SetPath('')
+
+#-------------------------------------------------------------------------------
+def initSTC(stc, config, lang):
+ """ Main module entry point. Initialise a wxSTC from given config file."""
+ (cfg, commonDefs, styleIdNames, styles, predefStyleGroupNames,
+ predefStyleGroups, otherLangStyleGroupNames, otherLangStyleGroups,
+ displaySrc, lexer, keywords, braceInfo) = initFromConfig(config, lang)
+
+ setSTCStyles(stc, styles, styleIdNames, commonDefs, lang, lexer, keywords)
+
+#-------------------------------------------------------------------------------
+if __name__ == '__main__':
+ app = wxPySimpleApp()
+ config = os.path.abspath('stc-styles.rc.cfg')
+
+ if 0:
+ f = wxFrame(None, -1, 'Test frame (double click for editor)')
+ stc = wxStyledTextCtrl(f, -1)
+ def OnDblClick(evt, stc=stc):
+ dlg = STCStyleEditDlg(None, 'Python', 'python', config, (stc,))
+ try: dlg.ShowModal()
+ finally: dlg.Destroy()
+ stc.SetText(open('STCStyleEditor.py').read())
+ EVT_LEFT_DCLICK(stc, OnDblClick)
+ initSTC(stc, config, 'python')
+ f.Show(true)
+ app.MainLoop()
+ else:
+ dlg = STCStyleEditDlg(None,
+ 'Python', 'python',
+ #'HTML', 'html',
+ #'XML', 'xml',
+ #'C++', 'cpp',
+ #'Text', 'text',
+ #'Properties', 'prop',
+ config)
+ try: dlg.ShowModal()
+ finally: dlg.Destroy()
--- /dev/null
+common.defs.msw={'size': 8, 'backcol': '#FFFFFF', 'lnsize': 6, 'mono': 'Courier New', 'helv': 'Lucida Console'}
+common.defs.gtk={ 'mono' : 'Courier New', 'helv' : 'Lucida Console', 'lucd' : 'Lucida Console', 'other' : 'Comic Sans MS', 'size' : 8, 'lnsize': 6, 'backcol': '#FFFFFF'}
+common.styleidnames = {wxSTC_STYLE_DEFAULT: 'Style default', wxSTC_STYLE_LINENUMBER: 'Line numbers', wxSTC_STYLE_BRACELIGHT: 'Matched braces', wxSTC_STYLE_BRACEBAD: 'Unmatched brace', wxSTC_STYLE_CONTROLCHAR: 'Control characters', wxSTC_STYLE_INDENTGUIDE: 'Indent guide'}
+[style.python]
+setting.python.-2=fore:#000000
+setting.python.-1=back:#88C4FF
+style.python.000=fore:#808080
+style.python.001=back:#E8FFE8,italic,fore:#007F00
+style.python.002=fore:#007F7F
+style.python.003=fore:#7F007F
+style.python.004=fore:#7F007F
+style.python.005=fore:#00007F,bold
+style.python.006=fore:#7F0000
+style.python.007=fore:#000033,back:#FFFFE8
+style.python.008=fore:#0000FF,bold
+style.python.009=fore:#007F7F,bold
+style.python.010=bold
+style.python.012=fore:#7F7F7F,italic
+style.python.013=fore:#000000,back:#E0C0E0,eolfilled
+style.python.032=back:%(backcol)s,face:%(mono)s,size:%(size)d
+style.python.033=size:%(lnsize)d,face:%(helv)s,back:#A0A0A0
+style.python.034=fore:#0000FF,back:#FFFF88,bold
+style.python.035=fore:#FF0000,back:#FFFF88,bold
+[style.xml]
+style.xml.001=bold,fore:#0000A0
+style.xml.002=fore:#800000
+style.xml.003=bold
+style.xml.005=fore:#0000FF
+style.xml.006=fore:#800080
+style.xml.007=fore:#800080
+style.xml.009=fore:#008000
+style.xml.010=bold
+style.xml.012=bold
+style.xml.013=bold
+style.xml.014=fore:#8000FF,bold
+style.xml.017=fore:#808000
+style.xml.018=bold
+style.xml.032=face:%(mono)s,size:%(size)d
+style.xml.033=size:%(lnsize)d
+[style.html]
+style.html.001=bold,fore:#0000A0
+style.html.002=fore:#800000
+style.html.003=bold
+style.html.005=fore:#0000FF
+style.html.006=fore:#800080
+style.html.007=fore:#800080
+style.html.009=fore:#008000
+style.html.010=bold
+style.html.012=bold
+style.html.013=bold
+style.html.014=fore:#8000FF,bold
+style.html.017=fore:#808000
+style.html.018=bold
+style.html.032=face:%(mono)s,size:%(size)d
+style.html.033=size:%(lnsize)d
+[style.cpp]
+setting.cpp.-3=fore:#8080FF
+style.cpp.001=fore:#008040,back:#EAFFEA
+style.cpp.002=fore:#008040,back:#EAFFEA,size:8
+style.cpp.004=fore:#0076AE
+style.cpp.005=bold,fore:#004080
+style.cpp.006=fore:#800080
+style.cpp.007=fore:#800040
+style.cpp.009=fore:#808000
+style.cpp.010=bold
+style.cpp.012=back:#FFD5FF
+style.cpp.013=fore:#8000FF
+style.cpp.032=face:%(mono)s
+style.cpp.033=size:%(lnsize)s
+style.cpp.034=fore:#0000FF,back:#FFFFB9,bold
+style.cpp.035=fore:#FF0000,back:#FFFFB9,bold
+[style.prop]
+style.prop.000=fore:#000080
+style.prop.001=fore:#008000,back:#DDFFDD
+style.prop.002=bold
+style.prop.003=bold,fore:#804000
+style.prop.004=fore:#800000
+style.prop.032=size:7
+[style.text]
+style.text.032=size:7
+
+[style.python.default]
+setting.python.-2=fore:#000000
+setting.python.-1=fore:#000000,back:#88C4FF
+style.python.000=fore:#808080
+style.python.001=fore:#007F00,back:#E8FFE8,italic
+style.python.002=fore:#007F7F
+style.python.003=fore:#7F007F
+style.python.004=fore:#7F007F
+style.python.005=fore:#00007F,bold
+style.python.006=fore:#7F0000
+style.python.007=fore:#000033,back:#FFFFE8
+style.python.008=fore:#0000FF,bold
+style.python.009=fore:#007F7F,bold
+style.python.010=bold
+style.python.012=fore:#7F7F7F,italic
+style.python.013=fore:#000000,back:#E0C0E0,eolfilled
+style.python.032=back:%(backcol)s,face:%(mono)s,size:%(size)d
+style.python.033=size:%(lnsize)d,face:%(helv)s,back:#A0A0A0
+style.python.034=fore:#0000FF,back:#FFFF88,bold
+style.python.035=fore:#FF0000,back:#FFFF88,bold
+
+[style.python.classic]
+setting.python.-2=fore:#FFFFFF
+setting.python.-1=fore:#000000,back:#888888
+style.python.000=fore:#808080
+style.python.001=fore:#00FF00,italic
+style.python.002=fore:#00FFFF
+style.python.003=fore:#FF00FF
+style.python.004=fore:#FF00FF
+style.python.005=fore:#FFFFFF,bold
+style.python.006=fore:#FFB7B7
+style.python.007=fore:#D1D1D1
+style.python.008=fore:#79BCFF,bold
+style.python.009=fore:#FFFFB9,bold
+style.python.010=bold,fore:#FFFFFF
+style.python.012=fore:#949494,italic
+style.python.013=fore:#000000,back:#CA8BE4,eolfilled
+style.python.032=back:#000080,face:%(mono)s,size:%(size)d,fore:#FFFF00
+style.python.033=size:%(lnsize)d,face:%(helv)s,back:#A0A0A0,fore:#000000
+style.python.034=fore:#0000FF,back:#FFFF88,bold
+style.python.035=fore:#FF0000,back:#FFFF88,bold
+
+[style.python.twilight]
+setting.python.-2=fore:#FFFFFF
+setting.python.-1=fore:#000000,back:#888888
+style.python.000=fore:#808080
+style.python.001=fore:#A0A0A0,italic
+style.python.002=fore:#FF00FF
+style.python.003=fore:#FFFF00
+style.python.004=fore:#FFFF00
+style.python.005=fore:#80FFFF,bold
+style.python.006=fore:#00C1C1
+style.python.007=fore:#00C1C1
+style.python.008=fore:#FFFF00,bold
+style.python.009=fore:#FFFFFF,bold
+style.python.010=bold,fore:#80FFFF
+style.python.012=fore:#A0A0A0,italic
+style.python.013=fore:#000000,back:#959500,eolfilled
+style.python.032=back:#000000,face:%(mono)s,size:%(size)d,fore:#FFFFFF
+style.python.033=size:%(lnsize)d,face:%(helv)s,back:#A0A0A0,fore:#000000
+style.python.034=fore:#0000FF,back:#80FFFF,bold
+style.python.035=fore:#FF0000,back:#80FFFF,bold
+
+[style.python.idle]
+setting.python.-1=fore:#FFFFFF,back:#0000A0
+style.python.001=fore:#DD0000
+style.python.003=fore:#00AA00
+style.python.004=fore:#00AA00
+style.python.005=fore:#FF7700
+style.python.006=fore:#00AA00
+style.python.007=fore:#00AA00
+style.python.008=fore:#0000FF
+style.python.009=fore:#0000FF
+style.python.012=fore:#DD0000
+style.python.032=face:%(mono)s,size:%(size)d
+style.python.033=size:%(lnsize)d,face:%(helv)s,back:#A0A0A0
+style.python.034=fore:#0000FF,bold
+style.python.035=fore:#DD0000,bold
+
+[style.html.default]
+style.html.001=bold,fore:#0000A0
+style.html.002=fore:#800000
+style.html.003=bold
+style.html.005=fore:#0000FF
+style.html.006=fore:#800080
+style.html.007=fore:#800080
+style.html.009=fore:#008000
+style.html.010=bold
+style.html.012=bold
+style.html.013=bold
+style.html.014=fore:#8000FF,bold
+style.html.017=fore:#808000
+style.html.018=bold
+style.html.032=face:%(mono)s,size:%(size)d
+style.html.033=size:%(lnsize)d
+
+[style.xml.default]
+style.html.001=bold,fore:#0000A0
+style.html.002=fore:#800000
+style.html.003=bold
+style.html.005=fore:#0000FF
+style.html.006=fore:#800080
+style.html.007=fore:#800080
+style.html.009=fore:#008000
+style.html.010=bold
+style.html.012=bold
+style.html.013=bold
+style.html.014=fore:#8000FF,bold
+style.html.017=fore:#808000
+style.html.018=bold
+style.html.032=face:%(mono)s,size:%(size)d
+style.html.033=size:%(lnsize)d
+
+[style.cpp.default]
+style.cpp.001=fore:#008040,back:#EAFFEA
+style.cpp.002=fore:#008040,back:#EAFFEA,size:8
+style.cpp.004=fore:#0076AE
+style.cpp.005=bold,fore:#004080
+style.cpp.006=fore:#800080
+style.cpp.009=fore:#808000
+style.cpp.010=bold
+style.cpp.012=back:#FFD5FF
+style.cpp.032=face:%(mono)s
+style.cpp.033=size:%(lnsize)s
+style.cpp.034=fore:#0000FF,back:#FFFFB9,bold
+style.cpp.035=fore:#FF0000,back:#FFFFB9,bold
+
+[style.prop.default]
+style.prop.000=fore:#000080
+style.prop.001=fore:#008000,back:#DDFFDD
+style.prop.002=bold
+style.prop.003=bold,fore:#804000
+style.prop.004=fore:#800000
+style.prop.032=size:7
+
+[style.text.default]
+
+[python]
+displaysrc=## Comment Blocks!\nclass MyClass(MyParent):\n """ Class example """\n def __init__(self):\n ''' Triple quotes '''\n # Do something silly\n a = ('Py' + "thon") * 100\n b = 'EOL unclosed string\n c = [Matched braces]\n d = {Unmatched brace
+braces={'good': (9, 12), 'bad': (10, 12)}
+styleidnames={wxSTC_P_DEFAULT: 'Default', wxSTC_P_COMMENTLINE: 'Comment', wxSTC_P_NUMBER : 'Number', wxSTC_P_STRING : 'String', wxSTC_P_CHARACTER: 'Single quoted string', wxSTC_P_WORD: 'Keyword', wxSTC_P_TRIPLE:'Triple quotes', wxSTC_P_TRIPLEDOUBLE: 'Triple double quotes', wxSTC_P_CLASSNAME: 'Class definition', wxSTC_P_DEFNAME: 'Function or method', wxSTC_P_OPERATOR: 'Operators', wxSTC_P_IDENTIFIER: 'Identifiers', wxSTC_P_COMMENTBLOCK: 'Comment blocks', wxSTC_P_STRINGEOL: 'EOL unclosed string'}
+lexer=wxSTC_LEX_PYTHON
+keywords=and assert break class continue def del elif else except exec finally for from global if import in is lambda not or pass print raise return try while
+
+[html]
+displaysrc=<?xml version="1.0"?>\n<html><head>\n <title>STC Style Editor</title>\n <script lang='Python'> a=10 </script>\n </head>\n <body bgcolor="#FFFFFF" text=#000000>\n < Text for testing >\n <unknown_tag>\n <!--Comments--><?question?><![CDATA[]]>\n </body>\n</html>
+braces={}
+keywords=a abbr acronym address applet area b base basefont bdo big blockquote body br button caption center cite code col colgroup dd del dfn dir div dl dt em fieldset font form frame frameset h1 h2 h3 h4 h5 h6 head hr html i iframe img input ins isindex kbd label legend li link map menu meta noframes noscript object ol optgroup option p param pre q s samp script select small span strike strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var xmlns abbr accept-charset accept accesskey action align alink alt archive axis background bgcolor border cellpadding cellspacing char charoff charset checked cite class classid clear codebase codetype color cols colspan compact content coords data datafld dataformatas datapagesize datasrc datetime declare defer dir disabled enctype face for frame frameborder headers height href hreflang hspace http-equiv id ismap label lang language link longdesc marginwidth marginheight maxlength media method multiple name nohref noresize noshade nowrap object onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup onreset onselect onsubmit onunload profile prompt readonly rel rev rows rowspan rules scheme scope shape size span src standby start style summary tabindex target text title type usemap valign value valuetype version vlink vspace width text password checkbox radio submit reset file hidden image public !doctype
+lexer=wxSTC_LEX_HTML
+styleidnames={wxSTC_H_DEFAULT: 'Default', wxSTC_H_TAG: 'Tag', wxSTC_H_TAGUNKNOWN: 'Tag unknown', wxSTC_H_ATTRIBUTE: 'Attribute', wxSTC_H_NUMBER: 'Number', wxSTC_H_DOUBLESTRING: 'Double string', wxSTC_H_SINGLESTRING:'Single string', wxSTC_H_OTHER: 'Other', wxSTC_H_COMMENT: 'Comment', wxSTC_H_ENTITY: 'Entity', wxSTC_H_TAGEND: 'Tag end', wxSTC_H_XMLSTART: 'XML start', wxSTC_H_XMLEND: 'XML End', wxSTC_H_SCRIPT: 'Script', wxSTC_H_ASP: 'ASP', wxSTC_H_ASPAT: 'ASPAT', wxSTC_H_CDATA: 'CDATA', wxSTC_H_QUESTION: 'Question', wxSTC_H_VALUE: 'Value', wxSTC_HJ_START: 'JS - Start',wxSTC_HJ_DEFAULT: 'JS - Default',wxSTC_HJ_COMMENT: 'JS - Comment',wxSTC_HJ_COMMENTLINE: 'JS - Comment line',wxSTC_HJ_COMMENTDOC : 'JS - Comment doc',wxSTC_HJ_NUMBER: 'JS - Number',wxSTC_HJ_WORD: 'JS - Word',wxSTC_HJ_KEYWORD: 'JS - Keyword',wxSTC_HJ_DOUBLESTRING: 'JS - String',wxSTC_HJ_SINGLESTRING: 'JS - Single quoted string',wxSTC_HJ_SYMBOLS: 'JS - Symbol',wxSTC_HJ_STRINGEOL: 'JS - EOL unclosed string', wxSTC_HPHP_DEFAULT: 'HP - Default', wxSTC_HPHP_HSTRING: 'HP - String', wxSTC_HPHP_SIMPLESTRING: 'HP - Simple string', wxSTC_HPHP_WORD: 'HP - Word', wxSTC_HPHP_NUMBER: 'HP - Number', wxSTC_HPHP_VARIABLE: 'HP - Variable', wxSTC_HPHP_COMMENT: 'HP - Comment', wxSTC_HPHP_COMMENTLINE: 'HP - Comment line', wxSTC_HPHP_STRINGEOL: 'HP - EOL unclosed string', wxSTC_HP_START: 'Py - Start', wxSTC_HP_DEFAULT: 'Py - Default', wxSTC_HP_COMMENTLINE: 'Py - Comment line', wxSTC_HP_NUMBER: 'Py - Number', wxSTC_HP_STRING: 'Py - String', wxSTC_HP_CHARACTER: 'Py - Single quoted string', wxSTC_HP_WORD: 'Py - Keyword', wxSTC_HP_TRIPLE: 'Py - Triple quotes', wxSTC_HP_TRIPLEDOUBLE: 'Py - Triple double quotes', wxSTC_HP_CLASSNAME: 'Py - Class definition', wxSTC_HP_DEFNAME: 'Py - Function or method', wxSTC_HP_OPERATOR: 'Py - Operator', wxSTC_HP_IDENTIFIER: 'Py - Identifier'}
+
+[xml]
+displaysrc=<?xml version = "1.0"?>\n<!DOCTYPE ADDRBOOK SYSTEM "addr_book.dtd">\n<ADDRBOOK>\n <ENTRY ID="gn">\n <NAME>Gegbefuna Nwannem</NAME>\n <ADDRESS>666 Murtala Mohammed Blvd.</ADDRESS>\n <PHONENUM DESC="Home">999-101-1001</PHONENUM>\n <EMAIL>nwanneg@naija.ng</EMAIL>\n </ENTRY>\n</ADDRBOOK>
+braces={}
+keywords=a abbr acronym address applet area b base basefont bdo big blockquote body br button caption center cite code col colgroup dd del dfn dir div dl dt em fieldset font form frame frameset h1 h2 h3 h4 h5 h6 head hr html i iframe img input ins isindex kbd label legend li link map menu meta noframes noscript object ol optgroup option p param pre q s samp script select small span strike strong style sub sup table tbody td textarea tfoot th thead title tr tt u ul var xmlns abbr accept-charset accept accesskey action align alink alt archive axis background bgcolor border cellpadding cellspacing char charoff charset checked cite class classid clear codebase codetype color cols colspan compact content coords data datafld dataformatas datapagesize datasrc datetime declare defer dir disabled enctype face for frame frameborder headers height href hreflang hspace http-equiv id ismap label lang language link longdesc marginwidth marginheight maxlength media method multiple name nohref noresize noshade nowrap object onblur onchange onclick ondblclick onfocus onkeydown onkeypress onkeyup onload onmousedown onmousemove onmouseover onmouseout onmouseup onreset onselect onsubmit onunload profile prompt readonly rel rev rows rowspan rules scheme scope shape size span src standby start style summary tabindex target text title type usemap valign value valuetype version vlink vspace width text password checkbox radio submit reset file hidden image public !doctype
+lexer=wxSTC_LEX_XML
+styleidnames={wxSTC_H_DEFAULT: 'Default', wxSTC_H_TAG: 'Tag', wxSTC_H_TAGUNKNOWN: 'Tag unknown', wxSTC_H_ATTRIBUTE: 'Attribute', wxSTC_H_NUMBER: 'Number', wxSTC_H_DOUBLESTRING: 'Double quoted string', wxSTC_H_SINGLESTRING:'Single quoted string', wxSTC_H_OTHER: 'Other inside tag', wxSTC_H_COMMENT: 'Comment', wxSTC_H_ENTITY: 'Entity', wxSTC_H_TAGEND: 'Tag end', wxSTC_H_XMLSTART: 'XML start', wxSTC_H_XMLEND: 'XML End'}
+
+[cpp]
+displaysrc=#include <wx/tokenzr.h>\n// Extract style settings from a spec-string\nvoid wxStyledTextCtrl::StyleSetSpec(int styleNum, const wxString& spec) {\n wxStringTokenizer tkz(spec, ',');\n while (tkz.HasMoreTokens() || 42) {\n wxString token = tkz.GetNextToken();\n wxString option = token.BeforeFirst(':');\n wxString val = token.AfterFirst(':');\n if (option == "bold")\n StyleSetBold(styleNum, true);\n/* End of code snippet */ @"Verbatim" " \n
+braces={'good': (5, 10), 'bad': (5, 38)}
+keywords=asm auto bool break case catch char class const const_cast continue default delete do double dynamic_cast else enum explicit export extern false float for friend goto if inline int long mutable namespace new operator private protected public register reinterpret_cast return short signed sizeof static static_cast struct switch template this throw true try typedef typeid typename union unsigned using virtual void volatile wchar_t while
+lexer=wxSTC_LEX_CPP
+styleidnames={wxSTC_C_DEFAULT: 'Default', wxSTC_C_COMMENT: 'Comment',wxSTC_C_COMMENTLINE: 'Comment line',wxSTC_C_COMMENTDOC: 'Comment doc',wxSTC_C_NUMBER: 'Number',wxSTC_C_WORD: 'Keyword',wxSTC_C_STRING: 'String',wxSTC_C_CHARACTER: 'Character',wxSTC_C_UUID: 'UUID',wxSTC_C_PREPROCESSOR: 'Preprocessor',wxSTC_C_OPERATOR: 'Operator', wxSTC_C_IDENTIFIER: 'Identifier', wxSTC_C_STRINGEOL: 'EOL unclosed string', wxSTC_C_VERBATIM: 'Verbatim'}
+
+[prop]
+displaysrc=# The property's properties\n[prop]\ndisplaysrc=# The property's properties ...\nbraces={}\nkeywords=\nlexer=wxSTC_LEX_PROPERTIES\n\n; Section with a default value\n[section]\n@default=42
+braces={}
+keywords=
+lexer=wxSTC_LEX_PROPERTIES
+styleidnames={0: 'Default', 1: 'Comment', 2: 'Section', 3: 'Assignment operator', 4:'Default value'}
+
+[text]
+displaysrc=Text uses the NULL lexer, so there\naren't really language spesific styles to set.\nOnly the default styles makes sense.
+braces={}
+keywords=
+lexer=wxSTC_LEX_NULL
+styleidnames={0: 'Default'}
#----------------------------------------------------------------------
swig_force = force
-swig_args = ['-c++', '-shadow', '-python', '-keyword', '-dnone', #'-dascii',
+swig_args = ['-c++', '-shadow', '-python', '-keyword',
+ '-dnone',
+ #'-dascii',
+ #'-docstring', '-Sbefore',
'-I./src', '-D'+WXPLAT]
swig_deps = ['src/my_typemaps.i']
wxST_NO_AUTORESIZE,
wxBU_AUTODRAW,
wxBU_NOAUTODRAW,
- wxTR_HAS_BUTTONS,
- wxTR_EDIT_LABELS,
- wxTR_LINES_AT_ROOT,
- wxTR_MULTIPLE,
- wxTR_SINGLE,
- wxTR_HAS_VARIABLE_ROW_HEIGHT,
wxSP_VERTICAL,
wxSP_HORIZONTAL,
wxSP_ARROW_KEYS,
wxEVT_COMMAND_TEXT_UPDATED,
wxEVT_COMMAND_TEXT_ENTER,
wxEVT_COMMAND_TEXT_URL,
+ wxEVT_COMMAND_TEXT_MAXLEN,
wxEVT_COMMAND_MENU_SELECTED,
wxEVT_COMMAND_SLIDER_UPDATED,
wxEVT_COMMAND_RADIOBOX_SELECTED,
def EVT_TEXT_URL(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_TEXT_URL, func)
+def EVT_TEXT_MAXLEN(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TEXT_MAXLEN, func)
+
def EVT_MENU(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_MENU_SELECTED, func)
win.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, func)
-# wxTreeCtrl events
-def EVT_TREE_BEGIN_DRAG(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_DRAG, func)
-
-def EVT_TREE_BEGIN_RDRAG(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_RDRAG, func)
-
-def EVT_TREE_END_DRAG(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_END_DRAG, func)
-
-def EVT_TREE_BEGIN_LABEL_EDIT(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, func)
-
-def EVT_TREE_END_LABEL_EDIT(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_END_LABEL_EDIT, func)
-
-def EVT_TREE_GET_INFO(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_GET_INFO, func)
-
-def EVT_TREE_SET_INFO(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_SET_INFO, func)
-
-def EVT_TREE_ITEM_EXPANDED(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDED, func)
-
-def EVT_TREE_ITEM_EXPANDING(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDING, func)
-
-def EVT_TREE_ITEM_COLLAPSED(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSED, func)
-
-def EVT_TREE_ITEM_COLLAPSING(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSING, func)
-
-def EVT_TREE_SEL_CHANGED(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGED, func)
-
-def EVT_TREE_SEL_CHANGING(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGING, func)
-
-def EVT_TREE_KEY_DOWN(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_KEY_DOWN, func)
-
-def EVT_TREE_DELETE_ITEM(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_DELETE_ITEM, func)
-
-def EVT_TREE_ITEM_ACTIVATED(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_ACTIVATED, func)
-
-def EVT_TREE_ITEM_RIGHT_CLICK(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, func)
-
-def EVT_TREE_ITEM_MIDDLE_CLICK(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, func)
-
-
# wxSpinButton
def EVT_SPIN_UP(win, id, func):
win.Connect(id, -1, wxEVT_SCROLL_LINEUP, func)
win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK,func)
-
-
# wxTaskBarIcon
def EVT_TASKBAR_MOVE(win, func):
win.Connect(-1, -1, wxEVT_TASKBAR_MOVE, func)
wxPyDefaultPosition = wxDefaultPosition
wxPyDefaultSize = wxDefaultSize
+
+# wxGTK sets the locale when initialized. Doing this at the Python
+# level should set it up to match what GTK is doing at the C level.
+try:
+ import locale
+ locale.setlocale(locale.LC_ALL, "")
+except:
+ pass
+
+
#----------------------------------------------------------------------
# This helper function will take a wxPython object and convert it to
# another wxPython object type. This will not be able to create objects
bool SetDefaultStyle(const wxTextAttr& style);
const wxTextAttr& GetDefaultStyle() const;
+ void SetMaxLength(unsigned long len);
+
%addmethods {
void write(const wxString& text) {
self->AppendText(text);
//bool GetItemRect(long item, wxRect& rect, int code = wxLIST_RECT_BOUNDS) const ;
//bool GetItemPosition(long item, wxPoint& pos) const ;
+
+ // Gets the item position
%addmethods {
- // Gets the item position
%new wxPoint* GetItemPosition(long item) {
wxPoint* pos = new wxPoint;
self->GetItemPosition(item, *pos);
//----------------------------------------------------------------------
+// wxTreeCtrl flags
+enum {
+ wxTR_NO_BUTTONS,
+ wxTR_HAS_BUTTONS,
+ wxTR_TWIST_BUTTONS,
+ wxTR_NO_LINES,
+ wxTR_MAC_BUTTONS,
+
+ wxTR_SINGLE,
+ wxTR_MULTIPLE,
+ wxTR_EXTENDED,
+
+ wxTR_EDIT_LABELS,
+ wxTR_LINES_AT_ROOT,
+ wxTR_HIDE_ROOT,
+ wxTR_ROW_LINES,
+ wxTR_HAS_VARIABLE_ROW_HEIGHT,
+
+ wxTR_DEFAULT_STYLE,
+};
+
enum wxTreeItemIcon
{
wxTreeItemIcon_Normal, // not selected, not expanded
};
+%pragma(python) code = "
+# wxTreeCtrl events
+def EVT_TREE_BEGIN_DRAG(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_DRAG, func)
+
+def EVT_TREE_BEGIN_RDRAG(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_RDRAG, func)
+
+def EVT_TREE_END_DRAG(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_END_DRAG, func)
+
+def EVT_TREE_BEGIN_LABEL_EDIT(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, func)
+
+def EVT_TREE_END_LABEL_EDIT(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_END_LABEL_EDIT, func)
+
+def EVT_TREE_GET_INFO(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_GET_INFO, func)
+
+def EVT_TREE_SET_INFO(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_SET_INFO, func)
+
+def EVT_TREE_ITEM_EXPANDED(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDED, func)
+
+def EVT_TREE_ITEM_EXPANDING(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDING, func)
+
+def EVT_TREE_ITEM_COLLAPSED(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSED, func)
+
+def EVT_TREE_ITEM_COLLAPSING(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSING, func)
+
+def EVT_TREE_SEL_CHANGED(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGED, func)
+
+def EVT_TREE_SEL_CHANGING(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGING, func)
+
+def EVT_TREE_KEY_DOWN(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_KEY_DOWN, func)
+
+def EVT_TREE_DELETE_ITEM(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_DELETE_ITEM, func)
+
+def EVT_TREE_ITEM_ACTIVATED(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_ACTIVATED, func)
+
+def EVT_TREE_ITEM_RIGHT_CLICK(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, func)
+
+def EVT_TREE_ITEM_MIDDLE_CLICK(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, func)
+"
+
+
+class wxTreeItemAttr
+{
+public:
+ // ctors
+ //wxTreeItemAttr() { }
+ wxTreeItemAttr(const wxColour& colText = wxNullColour,
+ const wxColour& colBack = wxNullColour,
+ const wxFont& font = wxNullFont);
+
+ // setters
+ void SetTextColour(const wxColour& colText);
+ void SetBackgroundColour(const wxColour& colBack);
+ void SetFont(const wxFont& font);
+
+ // accessors
+ bool HasTextColour();
+ bool HasBackgroundColour();
+ bool HasFont();
+
+ const wxColour& GetTextColour();
+ const wxColour& GetBackgroundColour();
+ const wxFont& GetFont();
+};
+
+
class wxTreeItemId {
public:
wxTreeItemId();
class wxTreeEvent : public wxNotifyEvent {
public:
+ wxTreeEvent(wxEventType commandType = wxEVT_NULL, int id = 0);
+
wxTreeItemId GetItem();
wxTreeItemId GetOldItem();
wxPoint GetPoint();
%pragma(python) addtomethod = "__init__:#wx._StdWindowCallbacks(self)"
%pragma(python) addtomethod = "__init__:self._setSelf(self, wxTreeCtrl)"
- void AssignImageList(wxImageList* imageList);
- %pragma(python) addtomethod = "AssignImageList:_args[0].thisown = 0"
size_t GetCount();
unsigned int GetIndent();
void SetIndent(unsigned int indent);
wxImageList *GetStateImageList();
void SetImageList(wxImageList *imageList);
void SetStateImageList(wxImageList *imageList);
+ void AssignImageList(wxImageList* imageList);
+ %pragma(python) addtomethod = "AssignImageList:_args[0].thisown = 0"
+ void AssignStateImageList(wxImageList* imageList);
+ %pragma(python) addtomethod = "AssignStateImageList:_args[0].thisown = 0"
unsigned int GetSpacing();
void SetSpacing(unsigned int spacing);
//---------------------------------------------------------------------------
#define DEC_PYCALLBACK_LISTATTR_LONG(CBNAME) \
- wxListItemAttr* CBNAME(long a); \
+ wxListItemAttr* CBNAME(long a) const; \
wxListItemAttr* base_##CBNAME(long a);
#define IMP_PYCALLBACK_LISTATTR_LONG(CLASS, PCLASS, CBNAME) \
- wxListItemAttr *CLASS::CBNAME(long a) { \
+ wxListItemAttr *CLASS::CBNAME(long a) const { \
wxListItemAttr *rval = NULL; \
bool doSave = wxPyRestoreThread(); \
if (wxPyCBH_findCallback(m_myInst, #CBNAME)) { \
return _resultobj;
}
+#define wxTextCtrl_SetMaxLength(_swigobj,_swigarg0) (_swigobj->SetMaxLength(_swigarg0))
+static PyObject *_wrap_wxTextCtrl_SetMaxLength(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxTextCtrl * _arg0;
+ unsigned long _arg1;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self","len", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"Ol:wxTextCtrl_SetMaxLength",_kwnames,&_argo0,&_arg1))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTextCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTextCtrl_SetMaxLength. Expected _wxTextCtrl_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ wxTextCtrl_SetMaxLength(_arg0,_arg1);
+
+ wxPy_END_ALLOW_THREADS;
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
static void wxTextCtrl_write(wxTextCtrl *self,const wxString & text) {
self->AppendText(text);
}
{ "wxScrollBar_GetRange", (PyCFunction) _wrap_wxScrollBar_GetRange, METH_VARARGS | METH_KEYWORDS },
{ "new_wxScrollBar", (PyCFunction) _wrap_new_wxScrollBar, METH_VARARGS | METH_KEYWORDS },
{ "wxTextCtrl_write", (PyCFunction) _wrap_wxTextCtrl_write, METH_VARARGS | METH_KEYWORDS },
+ { "wxTextCtrl_SetMaxLength", (PyCFunction) _wrap_wxTextCtrl_SetMaxLength, METH_VARARGS | METH_KEYWORDS },
{ "wxTextCtrl_GetDefaultStyle", (PyCFunction) _wrap_wxTextCtrl_GetDefaultStyle, METH_VARARGS | METH_KEYWORDS },
{ "wxTextCtrl_SetDefaultStyle", (PyCFunction) _wrap_wxTextCtrl_SetDefaultStyle, METH_VARARGS | METH_KEYWORDS },
{ "wxTextCtrl_SetStyle", (PyCFunction) _wrap_wxTextCtrl_SetStyle, METH_VARARGS | METH_KEYWORDS },
val = apply(controlsc.wxTextCtrl_GetDefaultStyle,(self,) + _args, _kwargs)
if val: val = wxTextAttrPtr(val)
return val
+ def SetMaxLength(self, *_args, **_kwargs):
+ val = apply(controlsc.wxTextCtrl_SetMaxLength,(self,) + _args, _kwargs)
+ return val
def write(self, *_args, **_kwargs):
val = apply(controlsc.wxTextCtrl_write,(self,) + _args, _kwargs)
return val
return _resultobj;
}
+#define new_wxTreeItemAttr(_swigarg0,_swigarg1,_swigarg2) (new wxTreeItemAttr(_swigarg0,_swigarg1,_swigarg2))
+static PyObject *_wrap_new_wxTreeItemAttr(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxTreeItemAttr * _result;
+ wxColour * _arg0 = (wxColour *) &wxNullColour;
+ wxColour * _arg1 = (wxColour *) &wxNullColour;
+ wxFont * _arg2 = (wxFont *) &wxNullFont;
+ wxColour temp;
+ PyObject * _obj0 = 0;
+ wxColour temp0;
+ PyObject * _obj1 = 0;
+ PyObject * _argo2 = 0;
+ char *_kwnames[] = { "colText","colBack","font", NULL };
+ char _ptemp[128];
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|OOO:new_wxTreeItemAttr",_kwnames,&_obj0,&_obj1,&_argo2))
+ return NULL;
+ if (_obj0)
+{
+ _arg0 = &temp;
+ if (! wxColour_helper(_obj0, &_arg0))
+ return NULL;
+}
+ if (_obj1)
+{
+ _arg1 = &temp0;
+ if (! wxColour_helper(_obj1, &_arg1))
+ return NULL;
+}
+ if (_argo2) {
+ if (_argo2 == Py_None) { _arg2 = NULL; }
+ else if (SWIG_GetPtrObj(_argo2,(void **) &_arg2,"_wxFont_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 3 of new_wxTreeItemAttr. Expected _wxFont_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ _result = (wxTreeItemAttr *)new_wxTreeItemAttr(*_arg0,*_arg1,*_arg2);
+
+ wxPy_END_ALLOW_THREADS;
+ if (PyErr_Occurred()) return NULL;
+} if (_result) {
+ SWIG_MakePtr(_ptemp, (char *) _result,"_wxTreeItemAttr_p");
+ _resultobj = Py_BuildValue("s",_ptemp);
+ } else {
+ Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ }
+ return _resultobj;
+}
+
+#define wxTreeItemAttr_SetTextColour(_swigobj,_swigarg0) (_swigobj->SetTextColour(_swigarg0))
+static PyObject *_wrap_wxTreeItemAttr_SetTextColour(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxTreeItemAttr * _arg0;
+ wxColour * _arg1;
+ PyObject * _argo0 = 0;
+ wxColour temp;
+ PyObject * _obj1 = 0;
+ char *_kwnames[] = { "self","colText", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeItemAttr_SetTextColour",_kwnames,&_argo0,&_obj1))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeItemAttr_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeItemAttr_SetTextColour. Expected _wxTreeItemAttr_p.");
+ return NULL;
+ }
+ }
+{
+ _arg1 = &temp;
+ if (! wxColour_helper(_obj1, &_arg1))
+ return NULL;
+}
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ wxTreeItemAttr_SetTextColour(_arg0,*_arg1);
+
+ wxPy_END_ALLOW_THREADS;
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
+#define wxTreeItemAttr_SetBackgroundColour(_swigobj,_swigarg0) (_swigobj->SetBackgroundColour(_swigarg0))
+static PyObject *_wrap_wxTreeItemAttr_SetBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxTreeItemAttr * _arg0;
+ wxColour * _arg1;
+ PyObject * _argo0 = 0;
+ wxColour temp;
+ PyObject * _obj1 = 0;
+ char *_kwnames[] = { "self","colBack", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeItemAttr_SetBackgroundColour",_kwnames,&_argo0,&_obj1))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeItemAttr_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeItemAttr_SetBackgroundColour. Expected _wxTreeItemAttr_p.");
+ return NULL;
+ }
+ }
+{
+ _arg1 = &temp;
+ if (! wxColour_helper(_obj1, &_arg1))
+ return NULL;
+}
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ wxTreeItemAttr_SetBackgroundColour(_arg0,*_arg1);
+
+ wxPy_END_ALLOW_THREADS;
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
+#define wxTreeItemAttr_SetFont(_swigobj,_swigarg0) (_swigobj->SetFont(_swigarg0))
+static PyObject *_wrap_wxTreeItemAttr_SetFont(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxTreeItemAttr * _arg0;
+ wxFont * _arg1;
+ PyObject * _argo0 = 0;
+ PyObject * _argo1 = 0;
+ char *_kwnames[] = { "self","font", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeItemAttr_SetFont",_kwnames,&_argo0,&_argo1))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeItemAttr_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeItemAttr_SetFont. Expected _wxTreeItemAttr_p.");
+ return NULL;
+ }
+ }
+ if (_argo1) {
+ if (_argo1 == Py_None) { _arg1 = NULL; }
+ else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxFont_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeItemAttr_SetFont. Expected _wxFont_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ wxTreeItemAttr_SetFont(_arg0,*_arg1);
+
+ wxPy_END_ALLOW_THREADS;
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
+#define wxTreeItemAttr_HasTextColour(_swigobj) (_swigobj->HasTextColour())
+static PyObject *_wrap_wxTreeItemAttr_HasTextColour(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ bool _result;
+ wxTreeItemAttr * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeItemAttr_HasTextColour",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeItemAttr_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeItemAttr_HasTextColour. Expected _wxTreeItemAttr_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ _result = (bool )wxTreeItemAttr_HasTextColour(_arg0);
+
+ wxPy_END_ALLOW_THREADS;
+ if (PyErr_Occurred()) return NULL;
+} _resultobj = Py_BuildValue("i",_result);
+ return _resultobj;
+}
+
+#define wxTreeItemAttr_HasBackgroundColour(_swigobj) (_swigobj->HasBackgroundColour())
+static PyObject *_wrap_wxTreeItemAttr_HasBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ bool _result;
+ wxTreeItemAttr * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeItemAttr_HasBackgroundColour",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeItemAttr_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeItemAttr_HasBackgroundColour. Expected _wxTreeItemAttr_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ _result = (bool )wxTreeItemAttr_HasBackgroundColour(_arg0);
+
+ wxPy_END_ALLOW_THREADS;
+ if (PyErr_Occurred()) return NULL;
+} _resultobj = Py_BuildValue("i",_result);
+ return _resultobj;
+}
+
+#define wxTreeItemAttr_HasFont(_swigobj) (_swigobj->HasFont())
+static PyObject *_wrap_wxTreeItemAttr_HasFont(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ bool _result;
+ wxTreeItemAttr * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeItemAttr_HasFont",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeItemAttr_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeItemAttr_HasFont. Expected _wxTreeItemAttr_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ _result = (bool )wxTreeItemAttr_HasFont(_arg0);
+
+ wxPy_END_ALLOW_THREADS;
+ if (PyErr_Occurred()) return NULL;
+} _resultobj = Py_BuildValue("i",_result);
+ return _resultobj;
+}
+
+#define wxTreeItemAttr_GetTextColour(_swigobj) (_swigobj->GetTextColour())
+static PyObject *_wrap_wxTreeItemAttr_GetTextColour(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxColour * _result;
+ wxTreeItemAttr * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+ char _ptemp[128];
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeItemAttr_GetTextColour",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeItemAttr_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeItemAttr_GetTextColour. Expected _wxTreeItemAttr_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ const wxColour & _result_ref = wxTreeItemAttr_GetTextColour(_arg0);
+ _result = (wxColour *) &_result_ref;
+
+ wxPy_END_ALLOW_THREADS;
+ if (PyErr_Occurred()) return NULL;
+} if (_result) {
+ SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p");
+ _resultobj = Py_BuildValue("s",_ptemp);
+ } else {
+ Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ }
+ return _resultobj;
+}
+
+#define wxTreeItemAttr_GetBackgroundColour(_swigobj) (_swigobj->GetBackgroundColour())
+static PyObject *_wrap_wxTreeItemAttr_GetBackgroundColour(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxColour * _result;
+ wxTreeItemAttr * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+ char _ptemp[128];
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeItemAttr_GetBackgroundColour",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeItemAttr_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeItemAttr_GetBackgroundColour. Expected _wxTreeItemAttr_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ const wxColour & _result_ref = wxTreeItemAttr_GetBackgroundColour(_arg0);
+ _result = (wxColour *) &_result_ref;
+
+ wxPy_END_ALLOW_THREADS;
+ if (PyErr_Occurred()) return NULL;
+} if (_result) {
+ SWIG_MakePtr(_ptemp, (char *) _result,"_wxColour_p");
+ _resultobj = Py_BuildValue("s",_ptemp);
+ } else {
+ Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ }
+ return _resultobj;
+}
+
+#define wxTreeItemAttr_GetFont(_swigobj) (_swigobj->GetFont())
+static PyObject *_wrap_wxTreeItemAttr_GetFont(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxFont * _result;
+ wxTreeItemAttr * _arg0;
+ PyObject * _argo0 = 0;
+ char *_kwnames[] = { "self", NULL };
+ char _ptemp[128];
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"O:wxTreeItemAttr_GetFont",_kwnames,&_argo0))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxTreeItemAttr_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeItemAttr_GetFont. Expected _wxTreeItemAttr_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ const wxFont & _result_ref = wxTreeItemAttr_GetFont(_arg0);
+ _result = (wxFont *) &_result_ref;
+
+ wxPy_END_ALLOW_THREADS;
+ if (PyErr_Occurred()) return NULL;
+} if (_result) {
+ SWIG_MakePtr(_ptemp, (char *) _result,"_wxFont_p");
+ _resultobj = Py_BuildValue("s",_ptemp);
+ } else {
+ Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ }
+ return _resultobj;
+}
+
#define new_wxTreeItemId() (new wxTreeItemId())
static PyObject *_wrap_new_wxTreeItemId(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
return (void *) dest;
}
+#define new_wxTreeEvent(_swigarg0,_swigarg1) (new wxTreeEvent(_swigarg0,_swigarg1))
+static PyObject *_wrap_new_wxTreeEvent(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxTreeEvent * _result;
+ wxEventType _arg0 = (wxEventType ) wxEVT_NULL;
+ int _arg1 = (int ) 0;
+ char *_kwnames[] = { "commandType","id", NULL };
+ char _ptemp[128];
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"|ii:new_wxTreeEvent",_kwnames,&_arg0,&_arg1))
+ return NULL;
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ _result = (wxTreeEvent *)new_wxTreeEvent(_arg0,_arg1);
+
+ wxPy_END_ALLOW_THREADS;
+ if (PyErr_Occurred()) return NULL;
+} if (_result) {
+ SWIG_MakePtr(_ptemp, (char *) _result,"_wxTreeEvent_p");
+ _resultobj = Py_BuildValue("s",_ptemp);
+ } else {
+ Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ }
+ return _resultobj;
+}
+
#define wxTreeEvent_GetItem(_swigobj) (_swigobj->GetItem())
static PyObject *_wrap_wxTreeEvent_GetItem(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
wxWindowID _arg1 = (wxWindowID ) -1;
wxPoint * _arg2 = (wxPoint *) &wxDefaultPosition;
wxSize * _arg3 = (wxSize *) &wxDefaultSize;
- long _arg4 = (long ) wxTR_HAS_BUTTONS|wxTR_LINES_AT_ROOT;
+ long _arg4 = (long ) (wxTR_HAS_BUTTONS)|(wxTR_LINES_AT_ROOT);
wxValidator * _arg5 = (wxValidator *) &wxDefaultValidator;
char * _arg6 = (char *) "wxTreeCtrl";
PyObject * _argo0 = 0;
return _resultobj;
}
-#define wxTreeCtrl_AssignImageList(_swigobj,_swigarg0) (_swigobj->AssignImageList(_swigarg0))
-static PyObject *_wrap_wxTreeCtrl_AssignImageList(PyObject *self, PyObject *args, PyObject *kwargs) {
- PyObject * _resultobj;
- wxPyTreeCtrl * _arg0;
- wxImageList * _arg1;
- PyObject * _argo0 = 0;
- PyObject * _argo1 = 0;
- char *_kwnames[] = { "self","imageList", NULL };
-
- self = self;
- if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeCtrl_AssignImageList",_kwnames,&_argo0,&_argo1))
- return NULL;
- if (_argo0) {
- if (_argo0 == Py_None) { _arg0 = NULL; }
- else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeCtrl_p")) {
- PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeCtrl_AssignImageList. Expected _wxPyTreeCtrl_p.");
- return NULL;
- }
- }
- if (_argo1) {
- if (_argo1 == Py_None) { _arg1 = NULL; }
- else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImageList_p")) {
- PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeCtrl_AssignImageList. Expected _wxImageList_p.");
- return NULL;
- }
- }
-{
- wxPy_BEGIN_ALLOW_THREADS;
- wxTreeCtrl_AssignImageList(_arg0,_arg1);
-
- wxPy_END_ALLOW_THREADS;
- if (PyErr_Occurred()) return NULL;
-} Py_INCREF(Py_None);
- _resultobj = Py_None;
- return _resultobj;
-}
-
#define wxTreeCtrl_GetCount(_swigobj) (_swigobj->GetCount())
static PyObject *_wrap_wxTreeCtrl_GetCount(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
return _resultobj;
}
+#define wxTreeCtrl_AssignImageList(_swigobj,_swigarg0) (_swigobj->AssignImageList(_swigarg0))
+static PyObject *_wrap_wxTreeCtrl_AssignImageList(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxPyTreeCtrl * _arg0;
+ wxImageList * _arg1;
+ PyObject * _argo0 = 0;
+ PyObject * _argo1 = 0;
+ char *_kwnames[] = { "self","imageList", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeCtrl_AssignImageList",_kwnames,&_argo0,&_argo1))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeCtrl_AssignImageList. Expected _wxPyTreeCtrl_p.");
+ return NULL;
+ }
+ }
+ if (_argo1) {
+ if (_argo1 == Py_None) { _arg1 = NULL; }
+ else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImageList_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeCtrl_AssignImageList. Expected _wxImageList_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ wxTreeCtrl_AssignImageList(_arg0,_arg1);
+
+ wxPy_END_ALLOW_THREADS;
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
+#define wxTreeCtrl_AssignStateImageList(_swigobj,_swigarg0) (_swigobj->AssignStateImageList(_swigarg0))
+static PyObject *_wrap_wxTreeCtrl_AssignStateImageList(PyObject *self, PyObject *args, PyObject *kwargs) {
+ PyObject * _resultobj;
+ wxPyTreeCtrl * _arg0;
+ wxImageList * _arg1;
+ PyObject * _argo0 = 0;
+ PyObject * _argo1 = 0;
+ char *_kwnames[] = { "self","imageList", NULL };
+
+ self = self;
+ if(!PyArg_ParseTupleAndKeywords(args,kwargs,"OO:wxTreeCtrl_AssignStateImageList",_kwnames,&_argo0,&_argo1))
+ return NULL;
+ if (_argo0) {
+ if (_argo0 == Py_None) { _arg0 = NULL; }
+ else if (SWIG_GetPtrObj(_argo0,(void **) &_arg0,"_wxPyTreeCtrl_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 1 of wxTreeCtrl_AssignStateImageList. Expected _wxPyTreeCtrl_p.");
+ return NULL;
+ }
+ }
+ if (_argo1) {
+ if (_argo1 == Py_None) { _arg1 = NULL; }
+ else if (SWIG_GetPtrObj(_argo1,(void **) &_arg1,"_wxImageList_p")) {
+ PyErr_SetString(PyExc_TypeError,"Type error in argument 2 of wxTreeCtrl_AssignStateImageList. Expected _wxImageList_p.");
+ return NULL;
+ }
+ }
+{
+ wxPy_BEGIN_ALLOW_THREADS;
+ wxTreeCtrl_AssignStateImageList(_arg0,_arg1);
+
+ wxPy_END_ALLOW_THREADS;
+ if (PyErr_Occurred()) return NULL;
+} Py_INCREF(Py_None);
+ _resultobj = Py_None;
+ return _resultobj;
+}
+
#define wxTreeCtrl_GetSpacing(_swigobj) (_swigobj->GetSpacing())
static PyObject *_wrap_wxTreeCtrl_GetSpacing(PyObject *self, PyObject *args, PyObject *kwargs) {
PyObject * _resultobj;
{ "wxTreeCtrl_GetItemText", (PyCFunction) _wrap_wxTreeCtrl_GetItemText, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeCtrl_SetSpacing", (PyCFunction) _wrap_wxTreeCtrl_SetSpacing, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeCtrl_GetSpacing", (PyCFunction) _wrap_wxTreeCtrl_GetSpacing, METH_VARARGS | METH_KEYWORDS },
+ { "wxTreeCtrl_AssignStateImageList", (PyCFunction) _wrap_wxTreeCtrl_AssignStateImageList, METH_VARARGS | METH_KEYWORDS },
+ { "wxTreeCtrl_AssignImageList", (PyCFunction) _wrap_wxTreeCtrl_AssignImageList, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeCtrl_SetStateImageList", (PyCFunction) _wrap_wxTreeCtrl_SetStateImageList, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeCtrl_SetImageList", (PyCFunction) _wrap_wxTreeCtrl_SetImageList, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeCtrl_GetStateImageList", (PyCFunction) _wrap_wxTreeCtrl_GetStateImageList, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeCtrl_SetIndent", (PyCFunction) _wrap_wxTreeCtrl_SetIndent, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeCtrl_GetIndent", (PyCFunction) _wrap_wxTreeCtrl_GetIndent, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeCtrl_GetCount", (PyCFunction) _wrap_wxTreeCtrl_GetCount, METH_VARARGS | METH_KEYWORDS },
- { "wxTreeCtrl_AssignImageList", (PyCFunction) _wrap_wxTreeCtrl_AssignImageList, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeCtrl__setSelf", (PyCFunction) _wrap_wxTreeCtrl__setSelf, METH_VARARGS | METH_KEYWORDS },
{ "new_wxTreeCtrl", (PyCFunction) _wrap_new_wxTreeCtrl, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeEvent_GetLabel", (PyCFunction) _wrap_wxTreeEvent_GetLabel, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeEvent_GetPoint", (PyCFunction) _wrap_wxTreeEvent_GetPoint, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeEvent_GetOldItem", (PyCFunction) _wrap_wxTreeEvent_GetOldItem, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeEvent_GetItem", (PyCFunction) _wrap_wxTreeEvent_GetItem, METH_VARARGS | METH_KEYWORDS },
+ { "new_wxTreeEvent", (PyCFunction) _wrap_new_wxTreeEvent, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeItemData_SetId", (PyCFunction) _wrap_wxTreeItemData_SetId, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeItemData_GetId", (PyCFunction) _wrap_wxTreeItemData_GetId, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeItemData_SetData", (PyCFunction) _wrap_wxTreeItemData_SetData, METH_VARARGS | METH_KEYWORDS },
{ "wxTreeItemId_IsOk", (PyCFunction) _wrap_wxTreeItemId_IsOk, METH_VARARGS | METH_KEYWORDS },
{ "delete_wxTreeItemId", (PyCFunction) _wrap_delete_wxTreeItemId, METH_VARARGS | METH_KEYWORDS },
{ "new_wxTreeItemId", (PyCFunction) _wrap_new_wxTreeItemId, METH_VARARGS | METH_KEYWORDS },
+ { "wxTreeItemAttr_GetFont", (PyCFunction) _wrap_wxTreeItemAttr_GetFont, METH_VARARGS | METH_KEYWORDS },
+ { "wxTreeItemAttr_GetBackgroundColour", (PyCFunction) _wrap_wxTreeItemAttr_GetBackgroundColour, METH_VARARGS | METH_KEYWORDS },
+ { "wxTreeItemAttr_GetTextColour", (PyCFunction) _wrap_wxTreeItemAttr_GetTextColour, METH_VARARGS | METH_KEYWORDS },
+ { "wxTreeItemAttr_HasFont", (PyCFunction) _wrap_wxTreeItemAttr_HasFont, METH_VARARGS | METH_KEYWORDS },
+ { "wxTreeItemAttr_HasBackgroundColour", (PyCFunction) _wrap_wxTreeItemAttr_HasBackgroundColour, METH_VARARGS | METH_KEYWORDS },
+ { "wxTreeItemAttr_HasTextColour", (PyCFunction) _wrap_wxTreeItemAttr_HasTextColour, METH_VARARGS | METH_KEYWORDS },
+ { "wxTreeItemAttr_SetFont", (PyCFunction) _wrap_wxTreeItemAttr_SetFont, METH_VARARGS | METH_KEYWORDS },
+ { "wxTreeItemAttr_SetBackgroundColour", (PyCFunction) _wrap_wxTreeItemAttr_SetBackgroundColour, METH_VARARGS | METH_KEYWORDS },
+ { "wxTreeItemAttr_SetTextColour", (PyCFunction) _wrap_wxTreeItemAttr_SetTextColour, METH_VARARGS | METH_KEYWORDS },
+ { "new_wxTreeItemAttr", (PyCFunction) _wrap_new_wxTreeItemAttr, METH_VARARGS | METH_KEYWORDS },
{ "wxListCtrl_SortItems", (PyCFunction) _wrap_wxListCtrl_SortItems, METH_VARARGS | METH_KEYWORDS },
{ "wxListCtrl_ScrollList", (PyCFunction) _wrap_wxListCtrl_ScrollList, METH_VARARGS | METH_KEYWORDS },
{ "wxListCtrl_SetItemCount", (PyCFunction) _wrap_wxListCtrl_SetItemCount, METH_VARARGS | METH_KEYWORDS },
PyDict_SetItemString(d,"wxLIST_FORMAT_RIGHT", PyInt_FromLong((long) wxLIST_FORMAT_RIGHT));
PyDict_SetItemString(d,"wxLIST_FORMAT_CENTRE", PyInt_FromLong((long) wxLIST_FORMAT_CENTRE));
PyDict_SetItemString(d,"wxLIST_FORMAT_CENTER", PyInt_FromLong((long) wxLIST_FORMAT_CENTER));
+ PyDict_SetItemString(d,"wxTR_NO_BUTTONS", PyInt_FromLong((long) wxTR_NO_BUTTONS));
+ PyDict_SetItemString(d,"wxTR_HAS_BUTTONS", PyInt_FromLong((long) wxTR_HAS_BUTTONS));
+ PyDict_SetItemString(d,"wxTR_TWIST_BUTTONS", PyInt_FromLong((long) wxTR_TWIST_BUTTONS));
+ PyDict_SetItemString(d,"wxTR_NO_LINES", PyInt_FromLong((long) wxTR_NO_LINES));
+ PyDict_SetItemString(d,"wxTR_MAC_BUTTONS", PyInt_FromLong((long) wxTR_MAC_BUTTONS));
+ PyDict_SetItemString(d,"wxTR_SINGLE", PyInt_FromLong((long) wxTR_SINGLE));
+ PyDict_SetItemString(d,"wxTR_MULTIPLE", PyInt_FromLong((long) wxTR_MULTIPLE));
+ PyDict_SetItemString(d,"wxTR_EXTENDED", PyInt_FromLong((long) wxTR_EXTENDED));
+ PyDict_SetItemString(d,"wxTR_EDIT_LABELS", PyInt_FromLong((long) wxTR_EDIT_LABELS));
+ PyDict_SetItemString(d,"wxTR_LINES_AT_ROOT", PyInt_FromLong((long) wxTR_LINES_AT_ROOT));
+ PyDict_SetItemString(d,"wxTR_HIDE_ROOT", PyInt_FromLong((long) wxTR_HIDE_ROOT));
+ PyDict_SetItemString(d,"wxTR_ROW_LINES", PyInt_FromLong((long) wxTR_ROW_LINES));
+ PyDict_SetItemString(d,"wxTR_HAS_VARIABLE_ROW_HEIGHT", PyInt_FromLong((long) wxTR_HAS_VARIABLE_ROW_HEIGHT));
+ PyDict_SetItemString(d,"wxTR_DEFAULT_STYLE", PyInt_FromLong((long) wxTR_DEFAULT_STYLE));
PyDict_SetItemString(d,"wxTreeItemIcon_Normal", PyInt_FromLong((long) wxTreeItemIcon_Normal));
PyDict_SetItemString(d,"wxTreeItemIcon_Selected", PyInt_FromLong((long) wxTreeItemIcon_Selected));
PyDict_SetItemString(d,"wxTreeItemIcon_Expanded", PyInt_FromLong((long) wxTreeItemIcon_Expanded));
def EVT_LIST_CACHE_HINT(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_LIST_CACHE_HINT, func)
+
+# wxTreeCtrl events
+def EVT_TREE_BEGIN_DRAG(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_DRAG, func)
+
+def EVT_TREE_BEGIN_RDRAG(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_RDRAG, func)
+
+def EVT_TREE_END_DRAG(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_END_DRAG, func)
+
+def EVT_TREE_BEGIN_LABEL_EDIT(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, func)
+
+def EVT_TREE_END_LABEL_EDIT(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_END_LABEL_EDIT, func)
+
+def EVT_TREE_GET_INFO(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_GET_INFO, func)
+
+def EVT_TREE_SET_INFO(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_SET_INFO, func)
+
+def EVT_TREE_ITEM_EXPANDED(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDED, func)
+
+def EVT_TREE_ITEM_EXPANDING(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDING, func)
+
+def EVT_TREE_ITEM_COLLAPSED(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSED, func)
+
+def EVT_TREE_ITEM_COLLAPSING(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSING, func)
+
+def EVT_TREE_SEL_CHANGED(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGED, func)
+
+def EVT_TREE_SEL_CHANGING(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGING, func)
+
+def EVT_TREE_KEY_DOWN(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_KEY_DOWN, func)
+
+def EVT_TREE_DELETE_ITEM(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_DELETE_ITEM, func)
+
+def EVT_TREE_ITEM_ACTIVATED(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_ACTIVATED, func)
+
+def EVT_TREE_ITEM_RIGHT_CLICK(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, func)
+
+def EVT_TREE_ITEM_MIDDLE_CLICK(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, func)
+
class wxListItemAttrPtr :
def __init__(self,this):
self.this = this
+class wxTreeItemAttrPtr :
+ def __init__(self,this):
+ self.this = this
+ self.thisown = 0
+ def SetTextColour(self, *_args, **_kwargs):
+ val = apply(controls2c.wxTreeItemAttr_SetTextColour,(self,) + _args, _kwargs)
+ return val
+ def SetBackgroundColour(self, *_args, **_kwargs):
+ val = apply(controls2c.wxTreeItemAttr_SetBackgroundColour,(self,) + _args, _kwargs)
+ return val
+ def SetFont(self, *_args, **_kwargs):
+ val = apply(controls2c.wxTreeItemAttr_SetFont,(self,) + _args, _kwargs)
+ return val
+ def HasTextColour(self, *_args, **_kwargs):
+ val = apply(controls2c.wxTreeItemAttr_HasTextColour,(self,) + _args, _kwargs)
+ return val
+ def HasBackgroundColour(self, *_args, **_kwargs):
+ val = apply(controls2c.wxTreeItemAttr_HasBackgroundColour,(self,) + _args, _kwargs)
+ return val
+ def HasFont(self, *_args, **_kwargs):
+ val = apply(controls2c.wxTreeItemAttr_HasFont,(self,) + _args, _kwargs)
+ return val
+ def GetTextColour(self, *_args, **_kwargs):
+ val = apply(controls2c.wxTreeItemAttr_GetTextColour,(self,) + _args, _kwargs)
+ if val: val = wxColourPtr(val)
+ return val
+ def GetBackgroundColour(self, *_args, **_kwargs):
+ val = apply(controls2c.wxTreeItemAttr_GetBackgroundColour,(self,) + _args, _kwargs)
+ if val: val = wxColourPtr(val)
+ return val
+ def GetFont(self, *_args, **_kwargs):
+ val = apply(controls2c.wxTreeItemAttr_GetFont,(self,) + _args, _kwargs)
+ if val: val = wxFontPtr(val)
+ return val
+ def __repr__(self):
+ return "<C wxTreeItemAttr instance at %s>" % (self.this,)
+class wxTreeItemAttr(wxTreeItemAttrPtr):
+ def __init__(self,*_args,**_kwargs):
+ self.this = apply(controls2c.new_wxTreeItemAttr,_args,_kwargs)
+ self.thisown = 1
+
+
+
+
class wxTreeItemIdPtr :
def __init__(self,this):
self.this = this
def __repr__(self):
return "<C wxTreeEvent instance at %s>" % (self.this,)
class wxTreeEvent(wxTreeEventPtr):
- def __init__(self,this):
- self.this = this
+ def __init__(self,*_args,**_kwargs):
+ self.this = apply(controls2c.new_wxTreeEvent,_args,_kwargs)
+ self.thisown = 1
def _setSelf(self, *_args, **_kwargs):
val = apply(controls2c.wxTreeCtrl__setSelf,(self,) + _args, _kwargs)
return val
- def AssignImageList(self, *_args, **_kwargs):
- val = apply(controls2c.wxTreeCtrl_AssignImageList,(self,) + _args, _kwargs)
- _args[0].thisown = 0
- return val
def GetCount(self, *_args, **_kwargs):
val = apply(controls2c.wxTreeCtrl_GetCount,(self,) + _args, _kwargs)
return val
def SetStateImageList(self, *_args, **_kwargs):
val = apply(controls2c.wxTreeCtrl_SetStateImageList,(self,) + _args, _kwargs)
return val
+ def AssignImageList(self, *_args, **_kwargs):
+ val = apply(controls2c.wxTreeCtrl_AssignImageList,(self,) + _args, _kwargs)
+ _args[0].thisown = 0
+ return val
+ def AssignStateImageList(self, *_args, **_kwargs):
+ val = apply(controls2c.wxTreeCtrl_AssignStateImageList,(self,) + _args, _kwargs)
+ _args[0].thisown = 0
+ return val
def GetSpacing(self, *_args, **_kwargs):
val = apply(controls2c.wxTreeCtrl_GetSpacing,(self,) + _args, _kwargs)
return val
wxLIST_FORMAT_RIGHT = controls2c.wxLIST_FORMAT_RIGHT
wxLIST_FORMAT_CENTRE = controls2c.wxLIST_FORMAT_CENTRE
wxLIST_FORMAT_CENTER = controls2c.wxLIST_FORMAT_CENTER
+wxTR_NO_BUTTONS = controls2c.wxTR_NO_BUTTONS
+wxTR_HAS_BUTTONS = controls2c.wxTR_HAS_BUTTONS
+wxTR_TWIST_BUTTONS = controls2c.wxTR_TWIST_BUTTONS
+wxTR_NO_LINES = controls2c.wxTR_NO_LINES
+wxTR_MAC_BUTTONS = controls2c.wxTR_MAC_BUTTONS
+wxTR_SINGLE = controls2c.wxTR_SINGLE
+wxTR_MULTIPLE = controls2c.wxTR_MULTIPLE
+wxTR_EXTENDED = controls2c.wxTR_EXTENDED
+wxTR_EDIT_LABELS = controls2c.wxTR_EDIT_LABELS
+wxTR_LINES_AT_ROOT = controls2c.wxTR_LINES_AT_ROOT
+wxTR_HIDE_ROOT = controls2c.wxTR_HIDE_ROOT
+wxTR_ROW_LINES = controls2c.wxTR_ROW_LINES
+wxTR_HAS_VARIABLE_ROW_HEIGHT = controls2c.wxTR_HAS_VARIABLE_ROW_HEIGHT
+wxTR_DEFAULT_STYLE = controls2c.wxTR_DEFAULT_STYLE
wxTreeItemIcon_Normal = controls2c.wxTreeItemIcon_Normal
wxTreeItemIcon_Selected = controls2c.wxTreeItemIcon_Selected
wxTreeItemIcon_Expanded = controls2c.wxTreeItemIcon_Expanded
PyDict_SetItemString(d,"wxTE_MULTILINE", PyInt_FromLong((long) wxTE_MULTILINE));
PyDict_SetItemString(d,"wxTE_AUTO_SCROLL", PyInt_FromLong((long) wxTE_AUTO_SCROLL));
PyDict_SetItemString(d,"wxTE_NO_VSCROLL", PyInt_FromLong((long) wxTE_NO_VSCROLL));
+ PyDict_SetItemString(d,"wxTE_AUTO_URL", PyInt_FromLong((long) wxTE_AUTO_URL));
PyDict_SetItemString(d,"wxCB_SIMPLE", PyInt_FromLong((long) wxCB_SIMPLE));
PyDict_SetItemString(d,"wxCB_DROPDOWN", PyInt_FromLong((long) wxCB_DROPDOWN));
PyDict_SetItemString(d,"wxCB_SORT", PyInt_FromLong((long) wxCB_SORT));
PyDict_SetItemString(d,"wxST_NO_AUTORESIZE", PyInt_FromLong((long) wxST_NO_AUTORESIZE));
PyDict_SetItemString(d,"wxBU_AUTODRAW", PyInt_FromLong((long) wxBU_AUTODRAW));
PyDict_SetItemString(d,"wxBU_NOAUTODRAW", PyInt_FromLong((long) wxBU_NOAUTODRAW));
- PyDict_SetItemString(d,"wxTR_HAS_BUTTONS", PyInt_FromLong((long) wxTR_HAS_BUTTONS));
- PyDict_SetItemString(d,"wxTR_EDIT_LABELS", PyInt_FromLong((long) wxTR_EDIT_LABELS));
- PyDict_SetItemString(d,"wxTR_LINES_AT_ROOT", PyInt_FromLong((long) wxTR_LINES_AT_ROOT));
- PyDict_SetItemString(d,"wxTR_MULTIPLE", PyInt_FromLong((long) wxTR_MULTIPLE));
- PyDict_SetItemString(d,"wxTR_SINGLE", PyInt_FromLong((long) wxTR_SINGLE));
- PyDict_SetItemString(d,"wxTR_HAS_VARIABLE_ROW_HEIGHT", PyInt_FromLong((long) wxTR_HAS_VARIABLE_ROW_HEIGHT));
PyDict_SetItemString(d,"wxSP_VERTICAL", PyInt_FromLong((long) wxSP_VERTICAL));
PyDict_SetItemString(d,"wxSP_HORIZONTAL", PyInt_FromLong((long) wxSP_HORIZONTAL));
PyDict_SetItemString(d,"wxSP_ARROW_KEYS", PyInt_FromLong((long) wxSP_ARROW_KEYS));
PyDict_SetItemString(d,"wxEVT_COMMAND_SPINCTRL_UPDATED", PyInt_FromLong((long) wxEVT_COMMAND_SPINCTRL_UPDATED));
PyDict_SetItemString(d,"wxEVT_COMMAND_TEXT_UPDATED", PyInt_FromLong((long) wxEVT_COMMAND_TEXT_UPDATED));
PyDict_SetItemString(d,"wxEVT_COMMAND_TEXT_ENTER", PyInt_FromLong((long) wxEVT_COMMAND_TEXT_ENTER));
+ PyDict_SetItemString(d,"wxEVT_COMMAND_TEXT_URL", PyInt_FromLong((long) wxEVT_COMMAND_TEXT_URL));
+ PyDict_SetItemString(d,"wxEVT_COMMAND_TEXT_MAXLEN", PyInt_FromLong((long) wxEVT_COMMAND_TEXT_MAXLEN));
PyDict_SetItemString(d,"wxEVT_COMMAND_MENU_SELECTED", PyInt_FromLong((long) wxEVT_COMMAND_MENU_SELECTED));
PyDict_SetItemString(d,"wxEVT_COMMAND_SLIDER_UPDATED", PyInt_FromLong((long) wxEVT_COMMAND_SLIDER_UPDATED));
PyDict_SetItemString(d,"wxEVT_COMMAND_RADIOBOX_SELECTED", PyInt_FromLong((long) wxEVT_COMMAND_RADIOBOX_SELECTED));
wxTE_MULTILINE = wxc.wxTE_MULTILINE
wxTE_AUTO_SCROLL = wxc.wxTE_AUTO_SCROLL
wxTE_NO_VSCROLL = wxc.wxTE_NO_VSCROLL
+wxTE_AUTO_URL = wxc.wxTE_AUTO_URL
wxCB_SIMPLE = wxc.wxCB_SIMPLE
wxCB_DROPDOWN = wxc.wxCB_DROPDOWN
wxCB_SORT = wxc.wxCB_SORT
wxST_NO_AUTORESIZE = wxc.wxST_NO_AUTORESIZE
wxBU_AUTODRAW = wxc.wxBU_AUTODRAW
wxBU_NOAUTODRAW = wxc.wxBU_NOAUTODRAW
-wxTR_HAS_BUTTONS = wxc.wxTR_HAS_BUTTONS
-wxTR_EDIT_LABELS = wxc.wxTR_EDIT_LABELS
-wxTR_LINES_AT_ROOT = wxc.wxTR_LINES_AT_ROOT
-wxTR_MULTIPLE = wxc.wxTR_MULTIPLE
-wxTR_SINGLE = wxc.wxTR_SINGLE
-wxTR_HAS_VARIABLE_ROW_HEIGHT = wxc.wxTR_HAS_VARIABLE_ROW_HEIGHT
wxSP_VERTICAL = wxc.wxSP_VERTICAL
wxSP_HORIZONTAL = wxc.wxSP_HORIZONTAL
wxSP_ARROW_KEYS = wxc.wxSP_ARROW_KEYS
wxEVT_COMMAND_SPINCTRL_UPDATED = wxc.wxEVT_COMMAND_SPINCTRL_UPDATED
wxEVT_COMMAND_TEXT_UPDATED = wxc.wxEVT_COMMAND_TEXT_UPDATED
wxEVT_COMMAND_TEXT_ENTER = wxc.wxEVT_COMMAND_TEXT_ENTER
+wxEVT_COMMAND_TEXT_URL = wxc.wxEVT_COMMAND_TEXT_URL
+wxEVT_COMMAND_TEXT_MAXLEN = wxc.wxEVT_COMMAND_TEXT_MAXLEN
wxEVT_COMMAND_MENU_SELECTED = wxc.wxEVT_COMMAND_MENU_SELECTED
wxEVT_COMMAND_SLIDER_UPDATED = wxc.wxEVT_COMMAND_SLIDER_UPDATED
wxEVT_COMMAND_RADIOBOX_SELECTED = wxc.wxEVT_COMMAND_RADIOBOX_SELECTED
def EVT_TEXT_ENTER(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_TEXT_ENTER, func)
+def EVT_TEXT_URL(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TEXT_URL, func)
+
+def EVT_TEXT_MAXLEN(win, id, func):
+ win.Connect(id, -1, wxEVT_COMMAND_TEXT_MAXLEN, func)
+
def EVT_MENU(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_MENU_SELECTED, func)
win.Connect(id, -1, wxEVT_COMMAND_NOTEBOOK_PAGE_CHANGING, func)
-# wxTreeCtrl events
-def EVT_TREE_BEGIN_DRAG(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_DRAG, func)
-
-def EVT_TREE_BEGIN_RDRAG(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_RDRAG, func)
-
-def EVT_TREE_END_DRAG(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_END_DRAG, func)
-
-def EVT_TREE_BEGIN_LABEL_EDIT(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_BEGIN_LABEL_EDIT, func)
-
-def EVT_TREE_END_LABEL_EDIT(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_END_LABEL_EDIT, func)
-
-def EVT_TREE_GET_INFO(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_GET_INFO, func)
-
-def EVT_TREE_SET_INFO(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_SET_INFO, func)
-
-def EVT_TREE_ITEM_EXPANDED(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDED, func)
-
-def EVT_TREE_ITEM_EXPANDING(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_EXPANDING, func)
-
-def EVT_TREE_ITEM_COLLAPSED(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSED, func)
-
-def EVT_TREE_ITEM_COLLAPSING(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_COLLAPSING, func)
-
-def EVT_TREE_SEL_CHANGED(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGED, func)
-
-def EVT_TREE_SEL_CHANGING(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_SEL_CHANGING, func)
-
-def EVT_TREE_KEY_DOWN(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_KEY_DOWN, func)
-
-def EVT_TREE_DELETE_ITEM(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_DELETE_ITEM, func)
-
-def EVT_TREE_ITEM_ACTIVATED(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_ACTIVATED, func)
-
-def EVT_TREE_ITEM_RIGHT_CLICK(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_RIGHT_CLICK, func)
-
-def EVT_TREE_ITEM_MIDDLE_CLICK(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_TREE_ITEM_MIDDLE_CLICK, func)
-
-
# wxSpinButton
def EVT_SPIN_UP(win, id, func):
win.Connect(id, -1, wxEVT_SCROLL_LINEUP, func)
win.Connect(id, -1, wxEVT_SCROLL_THUMBTRACK,func)
-
-
# wxTaskBarIcon
def EVT_TASKBAR_MOVE(win, func):
win.Connect(-1, -1, wxEVT_TASKBAR_MOVE, func)
win.Connect(-1, -1, wxEVT_EVT_CALCULATE_LAYOUT, func)
-# wxListCtrl
-def EVT_LIST_BEGIN_DRAG(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_DRAG, func)
-
-def EVT_LIST_BEGIN_RDRAG(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_RDRAG, func)
-
-def EVT_LIST_BEGIN_LABEL_EDIT(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_BEGIN_LABEL_EDIT, func)
-
-def EVT_LIST_END_LABEL_EDIT(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_END_LABEL_EDIT, func)
-
-def EVT_LIST_DELETE_ITEM(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ITEM, func)
-
-def EVT_LIST_DELETE_ALL_ITEMS(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_DELETE_ALL_ITEMS, func)
-
-def EVT_LIST_GET_INFO(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_GET_INFO, func)
-
-def EVT_LIST_SET_INFO(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_SET_INFO, func)
-
-def EVT_LIST_ITEM_SELECTED(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_SELECTED, func)
-
-def EVT_LIST_ITEM_DESELECTED(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_DESELECTED, func)
-
-def EVT_LIST_KEY_DOWN(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_KEY_DOWN, func)
-
-def EVT_LIST_INSERT_ITEM(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_INSERT_ITEM, func)
-
-def EVT_LIST_COL_CLICK(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_COL_CLICK, func)
-
-def EVT_LIST_ITEM_RIGHT_CLICK(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_RIGHT_CLICK, func)
-
-def EVT_LIST_ITEM_MIDDLE_CLICK(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_MIDDLE_CLICK, func)
-
-def EVT_LIST_ITEM_ACTIVATED(win, id, func):
- win.Connect(id, -1, wxEVT_COMMAND_LIST_ITEM_ACTIVATED, func)
-
-
-
-
#wxSplitterWindow
def EVT_SPLITTER_SASH_POS_CHANGING(win, id, func):
win.Connect(id, -1, wxEVT_COMMAND_SPLITTER_SASH_POS_CHANGING, func)
wxPyDefaultPosition = wxDefaultPosition
wxPyDefaultSize = wxDefaultSize
+
+# wxGTK sets the locale when initialized. Doing this at the Python
+# level should set it up to match what GTK is doing at the C level.
+try:
+ import locale
+ locale.setlocale(locale.LC_ALL, "")
+except:
+ pass
+
+
#----------------------------------------------------------------------
# This helper function will take a wxPython object and convert it to
# another wxPython object type. This will not be able to create objects