Typos fixed, more true/false --> True/False changes, etc

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19549 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-03-11 01:13:20 +00:00
parent 829be437b1
commit 6049fb0a7d
12 changed files with 242 additions and 237 deletions

View File

@@ -3,7 +3,7 @@ wxPython README
Welcome to the wonderful world of wxPython! Welcome to the wonderful world of wxPython!
So where do you go from here? The bes thing to do is to run the demo So where do you go from here? The best thing to do is to run the demo
and use its source code to help you learn how to use wxPython. Most and use its source code to help you learn how to use wxPython. Most
of the classes available are demonstrated there, and you can view the of the classes available are demonstrated there, and you can view the
sources directly in the demo so it is designed to help you learn. If sources directly in the demo so it is designed to help you learn. If

View File

@@ -105,7 +105,7 @@ class MyPanel(wxPanel):
EVT_BUTTON(self, EVT_BUTTON(self,
ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback, ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback,
self.DoDialog) self.DoDialog)
EVT_CLOSE(self,self.OnClose)
IndexFromID = { IndexFromID = {
ID_BUTTON_wxPyFatalErrorDialog: 3, ID_BUTTON_wxPyFatalErrorDialog: 3,
@@ -138,10 +138,11 @@ class MyPanel(wxPanel):
print "%s.DoDialog(): testing %s..." % (self,sys.stderr) print "%s.DoDialog(): testing %s..." % (self,sys.stderr)
this_will_generate_a_NameError_exception this_will_generate_a_NameError_exception
def OnClose(self,evt): def ShutdownDemo(self):
for d in self.dialogs: for d in self.dialogs:
d.Destroy () d.Destroy()
self.Destroy ()
class MyFrame(wxFrame): class MyFrame(wxFrame):
def __init__(self,parent=None): def __init__(self,parent=None):

View File

@@ -27,7 +27,7 @@ class TestTreeCtrlPanel(wxPanel):
EVT_SIZE(self, self.OnSize) EVT_SIZE(self, self.OnSize)
self.log = log self.log = log
tID = NewId() tID = wxNewId()
self.tree = MyTreeCtrl(self, tID, wxDefaultPosition, wxDefaultSize, self.tree = MyTreeCtrl(self, tID, wxDefaultPosition, wxDefaultSize,
wxTR_HAS_BUTTONS wxTR_HAS_BUTTONS
@@ -67,7 +67,7 @@ class TestTreeCtrlPanel(wxPanel):
self.tree.SetPyData(last, None) self.tree.SetPyData(last, None)
self.tree.SetItemImage(last, fldridx, wxTreeItemIcon_Normal) self.tree.SetItemImage(last, fldridx, wxTreeItemIcon_Normal)
self.tree.SetItemImage(last, fldropenidx, wxTreeItemIcon_Expanded) self.tree.SetItemImage(last, fldropenidx, wxTreeItemIcon_Expanded)
for z in range(5): for z in range(500):
item = self.tree.AppendItem(last, "item %d-%s-%d" % (x, chr(ord("a")+y), z)) item = self.tree.AppendItem(last, "item %d-%s-%d" % (x, chr(ord("a")+y), z))
self.tree.SetPyData(item, None) self.tree.SetPyData(item, None)
self.tree.SetItemImage(item, fileidx, wxTreeItemIcon_Normal) self.tree.SetItemImage(item, fileidx, wxTreeItemIcon_Normal)

View File

@@ -1,5 +1,5 @@
This is a copy of the Distutils package from Python (currently version This is a copy of the Distutils package from Python (currently version
2.3a1.) This newer copy of distutils is used for all versions of 2.3a2.) This newer copy of distutils is used for all versions of
Python to avoid some problems in the older versions that show up in Python to avoid some problems in the older versions that show up in
wxPython builds and to avoid having to make some ugly hacks in local wxPython builds and to avoid having to make some ugly hacks in local
modules to work around them. modules to work around them.

View File

@@ -68,30 +68,30 @@ styleCategoryDescriptions = {
'----Settings----': 'Properties set by STC methods', '----Settings----': 'Properties set by STC methods',
'----Common----': 'User definable values that can be shared between languages'} '----Common----': 'User definable values that can be shared between languages'}
[wxID_STCSTYLEEDITDLG, wxID_STCSTYLEEDITDLGADDCOMMONITEMBTN, [wxID_STCSTYLEEDITDLG, wxID_STCSTYLEEDITDLGADDCOMMONITEMBTN,
wxID_STCSTYLEEDITDLGBGCOLBTN, wxID_STCSTYLEEDITDLGBGCOLCB, wxID_STCSTYLEEDITDLGBGCOLBTN, wxID_STCSTYLEEDITDLGBGCOLCB,
wxID_STCSTYLEEDITDLGBGCOLDEFCB, wxID_STCSTYLEEDITDLGBGCOLOKBTN, wxID_STCSTYLEEDITDLGBGCOLDEFCB, wxID_STCSTYLEEDITDLGBGCOLOKBTN,
wxID_STCSTYLEEDITDLGCANCELBTN, wxID_STCSTYLEEDITDLGCONTEXTHELPBUTTON1, wxID_STCSTYLEEDITDLGCANCELBTN, wxID_STCSTYLEEDITDLGCONTEXTHELPBUTTON1,
wxID_STCSTYLEEDITDLGELEMENTLB, wxID_STCSTYLEEDITDLGFACECB, wxID_STCSTYLEEDITDLGELEMENTLB, wxID_STCSTYLEEDITDLGFACECB,
wxID_STCSTYLEEDITDLGFACEDEFCB, wxID_STCSTYLEEDITDLGFACEOKBTN, wxID_STCSTYLEEDITDLGFACEDEFCB, wxID_STCSTYLEEDITDLGFACEOKBTN,
wxID_STCSTYLEEDITDLGFGCOLBTN, wxID_STCSTYLEEDITDLGFGCOLCB, wxID_STCSTYLEEDITDLGFGCOLBTN, wxID_STCSTYLEEDITDLGFGCOLCB,
wxID_STCSTYLEEDITDLGFGCOLDEFCB, wxID_STCSTYLEEDITDLGFGCOLOKBTN, wxID_STCSTYLEEDITDLGFGCOLDEFCB, wxID_STCSTYLEEDITDLGFGCOLOKBTN,
wxID_STCSTYLEEDITDLGFIXEDWIDTHCHK, wxID_STCSTYLEEDITDLGOKBTN, wxID_STCSTYLEEDITDLGFIXEDWIDTHCHK, wxID_STCSTYLEEDITDLGOKBTN,
wxID_STCSTYLEEDITDLGPANEL1, wxID_STCSTYLEEDITDLGPANEL2, wxID_STCSTYLEEDITDLGPANEL1, wxID_STCSTYLEEDITDLGPANEL2,
wxID_STCSTYLEEDITDLGPANEL3, wxID_STCSTYLEEDITDLGPANEL4, wxID_STCSTYLEEDITDLGPANEL3, wxID_STCSTYLEEDITDLGPANEL4,
wxID_STCSTYLEEDITDLGREMOVECOMMONITEMBTN, wxID_STCSTYLEEDITDLGSIZECB, wxID_STCSTYLEEDITDLGREMOVECOMMONITEMBTN, wxID_STCSTYLEEDITDLGSIZECB,
wxID_STCSTYLEEDITDLGSIZEOKBTN, wxID_STCSTYLEEDITDLGSPEEDSETTINGCH, wxID_STCSTYLEEDITDLGSIZEOKBTN, wxID_STCSTYLEEDITDLGSPEEDSETTINGCH,
wxID_STCSTYLEEDITDLGSTATICBOX1, wxID_STCSTYLEEDITDLGSTATICBOX2, wxID_STCSTYLEEDITDLGSTATICBOX1, wxID_STCSTYLEEDITDLGSTATICBOX2,
wxID_STCSTYLEEDITDLGSTATICLINE1, wxID_STCSTYLEEDITDLGSTATICTEXT2, wxID_STCSTYLEEDITDLGSTATICLINE1, wxID_STCSTYLEEDITDLGSTATICTEXT2,
wxID_STCSTYLEEDITDLGSTATICTEXT3, wxID_STCSTYLEEDITDLGSTATICTEXT4, wxID_STCSTYLEEDITDLGSTATICTEXT3, wxID_STCSTYLEEDITDLGSTATICTEXT4,
wxID_STCSTYLEEDITDLGSTATICTEXT6, wxID_STCSTYLEEDITDLGSTATICTEXT7, wxID_STCSTYLEEDITDLGSTATICTEXT6, wxID_STCSTYLEEDITDLGSTATICTEXT7,
wxID_STCSTYLEEDITDLGSTATICTEXT8, wxID_STCSTYLEEDITDLGSTATICTEXT9, wxID_STCSTYLEEDITDLGSTATICTEXT8, wxID_STCSTYLEEDITDLGSTATICTEXT9,
wxID_STCSTYLEEDITDLGSTC, wxID_STCSTYLEEDITDLGSTYLEDEFST, wxID_STCSTYLEEDITDLGSTC, wxID_STCSTYLEEDITDLGSTYLEDEFST,
wxID_STCSTYLEEDITDLGTABOLDCB, wxID_STCSTYLEEDITDLGTABOLDDEFCB, wxID_STCSTYLEEDITDLGTABOLDCB, wxID_STCSTYLEEDITDLGTABOLDDEFCB,
wxID_STCSTYLEEDITDLGTAEOLFILLEDCB, wxID_STCSTYLEEDITDLGTAEOLFILLEDDEFCB, wxID_STCSTYLEEDITDLGTAEOLFILLEDCB, wxID_STCSTYLEEDITDLGTAEOLFILLEDDEFCB,
wxID_STCSTYLEEDITDLGTAITALICCB, wxID_STCSTYLEEDITDLGTAITALICDEFCB, wxID_STCSTYLEEDITDLGTAITALICCB, wxID_STCSTYLEEDITDLGTAITALICDEFCB,
wxID_STCSTYLEEDITDLGTASIZEDEFCB, wxID_STCSTYLEEDITDLGTAUNDERLINEDCB, wxID_STCSTYLEEDITDLGTASIZEDEFCB, wxID_STCSTYLEEDITDLGTAUNDERLINEDCB,
wxID_STCSTYLEEDITDLGTAUNDERLINEDDEFCB, wxID_STCSTYLEEDITDLGTAUNDERLINEDDEFCB,
] = map(lambda _init_ctrls: wxNewId(), range(47)) ] = map(lambda _init_ctrls: wxNewId(), range(47))
class STCStyleEditDlg(wxDialog): class STCStyleEditDlg(wxDialog):
@@ -109,7 +109,7 @@ class STCStyleEditDlg(wxDialog):
title=self.stc_title) title=self.stc_title)
self._init_utils() self._init_utils()
self.SetClientSize(wxSize(451, 455)) self.SetClientSize(wxSize(451, 455))
self.SetAutoLayout(true) self.SetAutoLayout(True)
self.SetSizeHints(425, 400, -1, -1) self.SetSizeHints(425, 400, -1, -1)
self.Center(wxBOTH) self.Center(wxBOTH)
EVT_SIZE(self, self.OnStcstyleeditdlgSize) EVT_SIZE(self, self.OnStcstyleeditdlgSize)
@@ -119,7 +119,7 @@ class STCStyleEditDlg(wxDialog):
parent=self, pos=wxPoint(96, 28), size=wxSize(346, 21), style=0, parent=self, pos=wxPoint(96, 28), size=wxSize(346, 21), style=0,
validator=wxDefaultValidator) validator=wxDefaultValidator)
self.speedsettingCh.SetConstraints(LayoutAnchors(self.speedsettingCh, self.speedsettingCh.SetConstraints(LayoutAnchors(self.speedsettingCh,
true, true, true, false)) True, True, True, False))
self.speedsettingCh.SetHelpText('The speed setting allows you to revert to one of the predefined style sets. This will overwrite your current settings when tha dialog is posted.') self.speedsettingCh.SetHelpText('The speed setting allows you to revert to one of the predefined style sets. This will overwrite your current settings when tha dialog is posted.')
EVT_CHOICE(self.speedsettingCh, wxID_STCSTYLEEDITDLGSPEEDSETTINGCH, EVT_CHOICE(self.speedsettingCh, wxID_STCSTYLEEDITDLGSPEEDSETTINGCH,
self.OnSpeedsettingchChoice) self.OnSpeedsettingchChoice)
@@ -127,8 +127,8 @@ class STCStyleEditDlg(wxDialog):
self.elementLb = wxListBox(choices=[], id=wxID_STCSTYLEEDITDLGELEMENTLB, self.elementLb = wxListBox(choices=[], id=wxID_STCSTYLEEDITDLGELEMENTLB,
name='elementLb', parent=self, pos=wxPoint(8, 72), name='elementLb', parent=self, pos=wxPoint(8, 72),
size=wxSize(160, 112), style=0, validator=wxDefaultValidator) size=wxSize(160, 112), style=0, validator=wxDefaultValidator)
self.elementLb.SetConstraints(LayoutAnchors(self.elementLb, true, true, self.elementLb.SetConstraints(LayoutAnchors(self.elementLb, True, True,
true, false)) True, False))
self.elementLb.SetHelpText('Select a style here to edit it. Common definitions can be added and maintained here. A common definition is a property that can be shared between styles and special cased per platform.') self.elementLb.SetHelpText('Select a style here to edit it. Common definitions can be added and maintained here. A common definition is a property that can be shared between styles and special cased per platform.')
EVT_LISTBOX(self.elementLb, wxID_STCSTYLEEDITDLGELEMENTLB, EVT_LISTBOX(self.elementLb, wxID_STCSTYLEEDITDLGELEMENTLB,
self.OnElementlbListbox) self.OnElementlbListbox)
@@ -153,15 +153,15 @@ class STCStyleEditDlg(wxDialog):
pos=wxPoint(96, 8), size=wxSize(366, 16), pos=wxPoint(96, 8), size=wxSize(366, 16),
style=wxST_NO_AUTORESIZE) style=wxST_NO_AUTORESIZE)
self.styleDefST.SetFont(wxFont(self.style_font_size, wxSWISS, wxNORMAL, self.styleDefST.SetFont(wxFont(self.style_font_size, wxSWISS, wxNORMAL,
wxBOLD, false, '')) wxBOLD, False, ''))
self.styleDefST.SetConstraints(LayoutAnchors(self.styleDefST, true, self.styleDefST.SetConstraints(LayoutAnchors(self.styleDefST, True,
true, true, false)) True, True, False))
self.staticLine1 = wxStaticLine(id=wxID_STCSTYLEEDITDLGSTATICLINE1, self.staticLine1 = wxStaticLine(id=wxID_STCSTYLEEDITDLGSTATICLINE1,
name='staticLine1', parent=self, pos=wxPoint(48, 62), name='staticLine1', parent=self, pos=wxPoint(48, 62),
size=wxSize(120, 2), style=wxLI_HORIZONTAL) size=wxSize(120, 2), style=wxLI_HORIZONTAL)
self.staticLine1.SetConstraints(LayoutAnchors(self.staticLine1, true, self.staticLine1.SetConstraints(LayoutAnchors(self.staticLine1, True,
true, true, false)) True, True, False))
self.staticText6 = wxStaticText(id=wxID_STCSTYLEEDITDLGSTATICTEXT6, self.staticText6 = wxStaticText(id=wxID_STCSTYLEEDITDLGSTATICTEXT6,
label='Style', name='staticText6', parent=self, pos=wxPoint(8, label='Style', name='staticText6', parent=self, pos=wxPoint(8,
@@ -178,31 +178,31 @@ class STCStyleEditDlg(wxDialog):
self.panel3 = wxPanel(id=wxID_STCSTYLEEDITDLGPANEL3, name='panel3', self.panel3 = wxPanel(id=wxID_STCSTYLEEDITDLGPANEL3, name='panel3',
parent=self, pos=wxPoint(176, 56), size=wxSize(146, 104), parent=self, pos=wxPoint(176, 56), size=wxSize(146, 104),
style=wxTAB_TRAVERSAL) style=wxTAB_TRAVERSAL)
self.panel3.SetConstraints(LayoutAnchors(self.panel3, false, true, true, self.panel3.SetConstraints(LayoutAnchors(self.panel3, False, True, True,
false)) False))
self.panel4 = wxPanel(id=wxID_STCSTYLEEDITDLGPANEL4, name='panel4', self.panel4 = wxPanel(id=wxID_STCSTYLEEDITDLGPANEL4, name='panel4',
parent=self, pos=wxPoint(330, 56), size=wxSize(114, 104), parent=self, pos=wxPoint(330, 56), size=wxSize(114, 104),
style=wxTAB_TRAVERSAL) style=wxTAB_TRAVERSAL)
self.panel4.SetConstraints(LayoutAnchors(self.panel4, false, true, true, self.panel4.SetConstraints(LayoutAnchors(self.panel4, False, True, True,
false)) False))
self.panel1 = wxPanel(id=wxID_STCSTYLEEDITDLGPANEL1, name='panel1', self.panel1 = wxPanel(id=wxID_STCSTYLEEDITDLGPANEL1, name='panel1',
parent=self, pos=wxPoint(176, 161), size=wxSize(143, 40), parent=self, pos=wxPoint(176, 161), size=wxSize(143, 40),
style=wxTAB_TRAVERSAL) style=wxTAB_TRAVERSAL)
self.panel1.SetConstraints(LayoutAnchors(self.panel1, false, true, true, self.panel1.SetConstraints(LayoutAnchors(self.panel1, False, True, True,
false)) False))
self.panel2 = wxPanel(id=wxID_STCSTYLEEDITDLGPANEL2, name='panel2', self.panel2 = wxPanel(id=wxID_STCSTYLEEDITDLGPANEL2, name='panel2',
parent=self, pos=wxPoint(330, 162), size=wxSize(112, 40), parent=self, pos=wxPoint(330, 162), size=wxSize(112, 40),
style=wxTAB_TRAVERSAL) style=wxTAB_TRAVERSAL)
self.panel2.SetConstraints(LayoutAnchors(self.panel2, false, true, true, self.panel2.SetConstraints(LayoutAnchors(self.panel2, False, True, True,
false)) False))
self.stc = wxStyledTextCtrl(id=wxID_STCSTYLEEDITDLGSTC, name='stc', self.stc = wxStyledTextCtrl(id=wxID_STCSTYLEEDITDLGSTC, name='stc',
parent=self, pos=wxPoint(8, 208), size=wxSize(435, 207), parent=self, pos=wxPoint(8, 208), size=wxSize(435, 207),
style=wxSUNKEN_BORDER) style=wxSUNKEN_BORDER)
self.stc.SetConstraints(LayoutAnchors(self.stc, true, true, true, true)) self.stc.SetConstraints(LayoutAnchors(self.stc, True, True, True, True))
self.stc.SetHelpText('The style preview window. Click or move the cursor over a spesific style to select the style for editing in the editors above.') self.stc.SetHelpText('The style preview window. Click or move the cursor over a spesific style to select the style for editing in the editors above.')
EVT_LEFT_UP(self.stc, self.OnUpdateUI) EVT_LEFT_UP(self.stc, self.OnUpdateUI)
EVT_KEY_UP(self.stc, self.OnUpdateUI) EVT_KEY_UP(self.stc, self.OnUpdateUI)
@@ -210,21 +210,21 @@ class STCStyleEditDlg(wxDialog):
self.contextHelpButton1 = wxContextHelpButton(parent=self, self.contextHelpButton1 = wxContextHelpButton(parent=self,
pos=wxPoint(8, 423), size=wxSize(24, 24), style=wxBU_AUTODRAW) pos=wxPoint(8, 423), size=wxSize(24, 24), style=wxBU_AUTODRAW)
self.contextHelpButton1.SetConstraints(LayoutAnchors(self.contextHelpButton1, self.contextHelpButton1.SetConstraints(LayoutAnchors(self.contextHelpButton1,
true, false, false, true)) True, False, False, True))
self.okBtn = wxButton(id=wxID_STCSTYLEEDITDLGOKBTN, label='OK', self.okBtn = wxButton(id=wxID_STCSTYLEEDITDLGOKBTN, label='OK',
name='okBtn', parent=self, pos=wxPoint(282, 423), size=wxSize(75, name='okBtn', parent=self, pos=wxPoint(282, 423), size=wxSize(75,
23), style=0) 23), style=0)
self.okBtn.SetConstraints(LayoutAnchors(self.okBtn, false, false, true, self.okBtn.SetConstraints(LayoutAnchors(self.okBtn, False, False, True,
true)) True))
self.okBtn.SetToolTipString('Save changes to the config file') self.okBtn.SetToolTipString('Save changes to the config file')
EVT_BUTTON(self.okBtn, wxID_STCSTYLEEDITDLGOKBTN, self.OnOkbtnButton) EVT_BUTTON(self.okBtn, wxID_STCSTYLEEDITDLGOKBTN, self.OnOkbtnButton)
self.cancelBtn = wxButton(id=wxID_STCSTYLEEDITDLGCANCELBTN, self.cancelBtn = wxButton(id=wxID_STCSTYLEEDITDLGCANCELBTN,
label='Cancel', name='cancelBtn', parent=self, pos=wxPoint(366, label='Cancel', name='cancelBtn', parent=self, pos=wxPoint(366,
423), size=wxSize(75, 23), style=0) 423), size=wxSize(75, 23), style=0)
self.cancelBtn.SetConstraints(LayoutAnchors(self.cancelBtn, false, self.cancelBtn.SetConstraints(LayoutAnchors(self.cancelBtn, False,
false, true, true)) False, True, True))
self.cancelBtn.SetToolTipString('Close dialog without saving changes') self.cancelBtn.SetToolTipString('Close dialog without saving changes')
EVT_BUTTON(self.cancelBtn, wxID_STCSTYLEEDITDLGCANCELBTN, EVT_BUTTON(self.cancelBtn, wxID_STCSTYLEEDITDLGCANCELBTN,
self.OnCancelbtnButton) self.OnCancelbtnButton)
@@ -303,8 +303,8 @@ class STCStyleEditDlg(wxDialog):
self.staticBox2 = wxStaticBox(id=wxID_STCSTYLEEDITDLGSTATICBOX2, self.staticBox2 = wxStaticBox(id=wxID_STCSTYLEEDITDLGSTATICBOX2,
label='Text attributes', name='staticBox2', parent=self.panel4, label='Text attributes', name='staticBox2', parent=self.panel4,
pos=wxPoint(0, 0), size=wxSize(112, 99), style=0) pos=wxPoint(0, 0), size=wxSize(112, 99), style=0)
self.staticBox2.SetConstraints(LayoutAnchors(self.staticBox2, false, self.staticBox2.SetConstraints(LayoutAnchors(self.staticBox2, False,
true, true, false)) True, True, False))
self.staticBox2.SetHelpText('Text attribute flags.') self.staticBox2.SetHelpText('Text attribute flags.')
self.staticText2 = wxStaticText(id=wxID_STCSTYLEEDITDLGSTATICTEXT2, self.staticText2 = wxStaticText(id=wxID_STCSTYLEEDITDLGSTATICTEXT2,
@@ -358,8 +358,8 @@ class STCStyleEditDlg(wxDialog):
self.staticBox1 = wxStaticBox(id=wxID_STCSTYLEEDITDLGSTATICBOX1, self.staticBox1 = wxStaticBox(id=wxID_STCSTYLEEDITDLGSTATICBOX1,
label='Colour', name='staticBox1', parent=self.panel3, label='Colour', name='staticBox1', parent=self.panel3,
pos=wxPoint(0, 0), size=wxSize(142, 99), style=0) pos=wxPoint(0, 0), size=wxSize(142, 99), style=0)
self.staticBox1.SetConstraints(LayoutAnchors(self.staticBox1, false, self.staticBox1.SetConstraints(LayoutAnchors(self.staticBox1, False,
true, true, false)) True, True, False))
self.faceDefCb = wxCheckBox(id=wxID_STCSTYLEEDITDLGFACEDEFCB, self.faceDefCb = wxCheckBox(id=wxID_STCSTYLEEDITDLGFACEDEFCB,
label='checkBox1', name='faceDefCb', parent=self.panel1, label='checkBox1', name='faceDefCb', parent=self.panel1,
@@ -384,7 +384,7 @@ class STCStyleEditDlg(wxDialog):
self.names = [] self.names = []
self.values = {} self.values = {}
self.STCsToUpdate = STCsToUpdate self.STCsToUpdate = STCsToUpdate
self._blockUpdate = false self._blockUpdate = False
for combo, okBtn, evtRet, evtCB, evtRDC in ( for combo, okBtn, evtRet, evtCB, evtRDC in (
@@ -408,12 +408,12 @@ class STCStyleEditDlg(wxDialog):
margin = 0 margin = 0
self.stc.SetMarginType(margin, wxSTC_MARGIN_NUMBER) self.stc.SetMarginType(margin, wxSTC_MARGIN_NUMBER)
self.stc.SetMarginWidth(margin, 25) self.stc.SetMarginWidth(margin, 25)
self.stc.SetMarginSensitive(margin, true) self.stc.SetMarginSensitive(margin, True)
EVT_STC_MARGINCLICK(self.stc, wxID_STCSTYLEEDITDLGSTC, self.OnMarginClick) EVT_STC_MARGINCLICK(self.stc, wxID_STCSTYLEEDITDLGSTC, self.OnMarginClick)
self.stc.SetUseTabs(false) self.stc.SetUseTabs(False)
self.stc.SetTabWidth(4) self.stc.SetTabWidth(4)
self.stc.SetIndentationGuides(true) self.stc.SetIndentationGuides(True)
self.stc.SetEdgeMode(wxSTC_EDGE_BACKGROUND) self.stc.SetEdgeMode(wxSTC_EDGE_BACKGROUND)
self.stc.SetEdgeColumn(44) self.stc.SetEdgeColumn(44)
@@ -448,7 +448,7 @@ class STCStyleEditDlg(wxDialog):
((self.faceCb, self.faceOkBtn, self.fixedWidthChk), self.faceDefCb, ((self.faceCb, self.faceOkBtn, self.fixedWidthChk), self.faceDefCb,
'face', wxID_STCSTYLEEDITDLGFACEDEFCB)] 'face', wxID_STCSTYLEEDITDLGFACEDEFCB)]
self.clearCtrls(disableDefs=true) self.clearCtrls(disableDefs=True)
# centralised default checkbox event handler # centralised default checkbox event handler
self.chbIdMap = {} self.chbIdMap = {}
for ctrl, chb, prop, wid in self.allCtrls: for ctrl, chb, prop, wid in self.allCtrls:
@@ -479,12 +479,12 @@ class STCStyleEditDlg(wxDialog):
try: try:
self.updateStyle() self.updateStyle()
return true return True
except KeyError, errkey: except KeyError, errkey:
wxLogError('Name not found in Common definition, '\ wxLogError('Name not found in Common definition, '\
'please enter valid reference. (%s)'%errkey) 'please enter valid reference. (%s)'%errkey)
self.restoreStyles(oldstyle) self.restoreStyles(oldstyle)
return false return False
#---Control population methods-------------------------------------------------- #---Control population methods--------------------------------------------------
def setStyles(self): def setStyles(self):
@@ -512,8 +512,8 @@ class STCStyleEditDlg(wxDialog):
def findInStyles(self, txt, styles): def findInStyles(self, txt, styles):
for style in styles: for style in styles:
if string.find(style, txt) != -1: if string.find(style, txt) != -1:
return true return True
return false return False
def rememberStyles(self): def rememberStyles(self):
return self.names[:], copy.copy(self.values) return self.names[:], copy.copy(self.values)
@@ -522,8 +522,8 @@ class STCStyleEditDlg(wxDialog):
self.names, self.values = style self.names, self.values = style
self.updateStyle() self.updateStyle()
def clearCtrls(self, isDefault=false, disableDefs=false): def clearCtrls(self, isDefault=False, disableDefs=False):
self._blockUpdate = true self._blockUpdate = True
try: try:
for ctrl, chb, prop, wid in self.allCtrls: for ctrl, chb, prop, wid in self.allCtrls:
if prop in ('fore', 'back'): if prop in ('fore', 'back'):
@@ -546,18 +546,18 @@ class STCStyleEditDlg(wxDialog):
cmb.Enable(isDefault) cmb.Enable(isDefault)
btn.Enable(isDefault) btn.Enable(isDefault)
chk.Enable(isDefault) chk.Enable(isDefault)
chk.SetValue(false) chk.SetValue(False)
elif prop in ('bold', 'italic', 'underline', 'eolfilled'): elif prop in ('bold', 'italic', 'underline', 'eolfilled'):
ctrl.SetValue(false) ctrl.SetValue(False)
ctrl.Enable(isDefault) ctrl.Enable(isDefault)
chb.Enable(not isDefault and not disableDefs) chb.Enable(not isDefault and not disableDefs)
chb.SetValue(true) chb.SetValue(True)
finally: finally:
self._blockUpdate = false self._blockUpdate = False
def populateProp(self, items, default, forceDisable=false): def populateProp(self, items, default, forceDisable=False):
self._blockUpdate = true self._blockUpdate = True
try: try:
for name, val in items: for name, val in items:
if name: if name:
@@ -588,10 +588,10 @@ class STCStyleEditDlg(wxDialog):
chb.SetValue(default) chb.SetValue(default)
elif name in ('bold', 'italic', 'underline', 'eolfilled'): elif name in ('bold', 'italic', 'underline', 'eolfilled'):
ctrl.Enable(not forceDisable) ctrl.Enable(not forceDisable)
ctrl.SetValue(true) ctrl.SetValue(True)
chb.SetValue(default) chb.SetValue(default)
finally: finally:
self._blockUpdate = false self._blockUpdate = False
def valIsCommonDef(self, val): def valIsCommonDef(self, val):
return len(val) >= 5 and val[:2] == '%(' return len(val) >= 5 and val[:2] == '%('
@@ -602,15 +602,15 @@ class STCStyleEditDlg(wxDialog):
# handle colour controls for settings # handle colour controls for settings
if self.styleNum < 0: if self.styleNum < 0:
self.fgColDefCb.Enable(true) self.fgColDefCb.Enable(True)
if self.styleNum == -1: if self.styleNum == -1:
self.bgColDefCb.Enable(true) self.bgColDefCb.Enable(True)
# populate with default style # populate with default style
self.populateProp(self.defValues.items(), true, self.populateProp(self.defValues.items(), True,
self.styleNum != wxSTC_STYLE_DEFAULT) self.styleNum != wxSTC_STYLE_DEFAULT)
# override with current settings # override with current settings
self.populateProp(self.values.items(), false) self.populateProp(self.values.items(), False)
def getCommonDefPropType(self, commonDefName): def getCommonDefPropType(self, commonDefName):
val = self.commonDefs[commonDefName] val = self.commonDefs[commonDefName]
@@ -627,7 +627,7 @@ class STCStyleEditDlg(wxDialog):
btn.SetToolTipString('Accept value') btn.SetToolTipString('Accept value')
def populateCombosWithCommonDefs(self, fixedWidthOnly=None): def populateCombosWithCommonDefs(self, fixedWidthOnly=None):
self._blockUpdate = true self._blockUpdate = True
try: try:
commonDefs = {'fore': [], 'face': [], 'size': []} commonDefs = {'fore': [], 'face': [], 'size': []}
@@ -665,7 +665,7 @@ class STCStyleEditDlg(wxDialog):
self.sizeCb.Append(colCommonDef) self.sizeCb.Append(colCommonDef)
self.sizeCb.SetValue(currSize) self.sizeCb.SetValue(currSize)
finally: finally:
self._blockUpdate = false self._blockUpdate = False
def populateStyleSelector(self): def populateStyleSelector(self):
numStyles = self.styleIdNames.items() numStyles = self.styleIdNames.items()
@@ -714,7 +714,7 @@ class STCStyleEditDlg(wxDialog):
def getColourDlg(self, colour, title=''): def getColourDlg(self, colour, title=''):
data = wxColourData() data = wxColourData()
data.SetColour(colour) data.SetColour(colour)
data.SetChooseFull(true) data.SetChooseFull(True)
dlg = wxColourDialog(self, data) dlg = wxColourDialog(self, data)
try: try:
dlg.SetTitle(title) dlg.SetTitle(title)
@@ -734,7 +734,7 @@ class STCStyleEditDlg(wxDialog):
colBtn.SetBackgroundColour(col) colBtn.SetBackgroundColour(col)
colStr = colToStr(col) colStr = colToStr(col)
colCb.SetValue(colStr) colCb.SetValue(colStr)
self.editProp(true, prop, colStr) self.editProp(True, prop, colStr)
def OnFgcolbtnButton(self, event): def OnFgcolbtnButton(self, event):
self.editColProp(self.fgColBtn, self.fgColCb, 'fore') self.editColProp(self.fgColBtn, self.fgColCb, 'fore')
@@ -794,7 +794,7 @@ class STCStyleEditDlg(wxDialog):
if self.valIsCommonDef(val): if self.valIsCommonDef(val):
idx = self.elementLb.FindString(val) idx = self.elementLb.FindString(val)
if idx != -1: if idx != -1:
self.elementLb.SetSelection(idx, true) self.elementLb.SetSelection(idx, True)
self.OnElementlbListbox(None) self.OnElementlbListbox(None)
def OnfaceRet(self, event): def OnfaceRet(self, event):
@@ -832,22 +832,22 @@ class STCStyleEditDlg(wxDialog):
if isCommon: if isCommon:
common = styleIdent[2:-2] common = styleIdent[2:-2]
prop = self.getCommonDefPropType(common) prop = self.getCommonDefPropType(common)
self.clearCtrls(disableDefs=true) self.clearCtrls(disableDefs=True)
if prop == 'fore': if prop == 'fore':
self.fgColBtn.Enable(true) self.fgColBtn.Enable(True)
self.fgColCb.Enable(true) self.fgColCb.Enable(True)
self.fgColOkBtn.Enable(true) self.fgColOkBtn.Enable(True)
elif prop == 'face': elif prop == 'face':
self.faceCb.Enable(true) self.faceCb.Enable(True)
self.fixedWidthChk.Enable(true) self.fixedWidthChk.Enable(True)
self.faceOkBtn.Enable(true) self.faceOkBtn.Enable(True)
elif prop == 'size': elif prop == 'size':
self.sizeCb.Enable(true) self.sizeCb.Enable(True)
self.sizeOkBtn.Enable(true) self.sizeOkBtn.Enable(True)
commonDefVal = str(self.commonDefs[common]) commonDefVal = str(self.commonDefs[common])
self.styleDefST.SetLabel(commonDefVal) self.styleDefST.SetLabel(commonDefVal)
self.populateProp( [(prop, commonDefVal)], true) self.populateProp( [(prop, commonDefVal)], True)
self.styleNum = 'common' self.styleNum = 'common'
self.style = [common, prop, commonDefVal] self.style = [common, prop, commonDefVal]
@@ -869,7 +869,7 @@ class STCStyleEditDlg(wxDialog):
self.populateCtrls() self.populateCtrls()
# separator selected # separator selected
else: else:
self.clearCtrls(disableDefs=true) self.clearCtrls(disableDefs=True)
if styleIdent: if styleIdent:
self.styleDefST.SetLabel(styleCategoryDescriptions[styleIdent]) self.styleDefST.SetLabel(styleCategoryDescriptions[styleIdent])
@@ -888,9 +888,9 @@ class STCStyleEditDlg(wxDialog):
colStr = cmb.GetValue() colStr = cmb.GetValue()
#if prop == 'fore': colStr = self.fgColCb.GetValue() #if prop == 'fore': colStr = self.fgColCb.GetValue()
#else: colStr = self.bgColCb.GetValue() #else: colStr = self.bgColCb.GetValue()
if colStr: self.editProp(true, prop, colStr) if colStr: self.editProp(True, prop, colStr)
else: else:
self.editProp(false, prop) self.editProp(False, prop)
elif prop == 'size': elif prop == 'size':
cmb, btn = ctrl cmb, btn = ctrl
val = cmb.GetValue() val = cmb.GetValue()
@@ -974,7 +974,7 @@ class STCStyleEditDlg(wxDialog):
self.commonDefs[name] = commonPropDefs[prop] self.commonDefs[name] = commonPropDefs[prop]
self.elementLb.Append('%('+name+')'+\ self.elementLb.Append('%('+name+')'+\
(type(commonPropDefs[prop]) is type('') and 's' or 'd')) (type(commonPropDefs[prop]) is type('') and 's' or 'd'))
self.elementLb.SetSelection(self.elementLb.Number()-1, true) self.elementLb.SetSelection(self.elementLb.Number()-1, True)
self.populateCombosWithCommonDefs() self.populateCombosWithCommonDefs()
self.OnElementlbListbox(None) self.OnElementlbListbox(None)
finally: finally:
@@ -1006,7 +1006,7 @@ class STCStyleEditDlg(wxDialog):
self.elementLb.Delete(selIdx) self.elementLb.Delete(selIdx)
if selIdx == self.elementLb.Number(): if selIdx == self.elementLb.Number():
selIdx = selIdx - 1 selIdx = selIdx - 1
self.elementLb.SetSelection(selIdx, true) self.elementLb.SetSelection(selIdx, True)
self.OnElementlbListbox(None) self.OnElementlbListbox(None)
#---STC events------------------------------------------------------------------ #---STC events------------------------------------------------------------------
@@ -1014,9 +1014,9 @@ class STCStyleEditDlg(wxDialog):
styleBefore = self.stc.GetStyleAt(self.stc.GetCurrentPos()) styleBefore = self.stc.GetStyleAt(self.stc.GetCurrentPos())
if self.styleIdNames.has_key(styleBefore): if self.styleIdNames.has_key(styleBefore):
self.elementLb.SetStringSelection(self.styleIdNames[styleBefore], self.elementLb.SetStringSelection(self.styleIdNames[styleBefore],
true) True)
else: else:
self.elementLb.SetSelection(0, false) self.elementLb.SetSelection(0, False)
self.styleDefST.SetLabel('Style %d not defined, sorry.'%styleBefore) self.styleDefST.SetLabel('Style %d not defined, sorry.'%styleBefore)
self.OnElementlbListbox(None) self.OnElementlbListbox(None)
event.Skip() event.Skip()
@@ -1043,7 +1043,7 @@ class STCStyleEditDlg(wxDialog):
event.Skip() event.Skip()
def OnMarginClick(self, event): def OnMarginClick(self, event):
self.elementLb.SetStringSelection('Line numbers', true) self.elementLb.SetStringSelection('Line numbers', True)
self.OnElementlbListbox(None) self.OnElementlbListbox(None)
@@ -1096,9 +1096,9 @@ class CommonDefDlg(wxDialog):
def setSelectionColour(stc, style): def setSelectionColour(stc, style):
names, values = parseProp(style) names, values = parseProp(style)
if 'fore' in names: if 'fore' in names:
stc.SetSelForeground(true, strToCol(values['fore'])) stc.SetSelForeground(True, strToCol(values['fore']))
if 'back' in names: if 'back' in names:
stc.SetSelBackground(true, strToCol(values['back'])) stc.SetSelBackground(True, strToCol(values['back']))
def setCursorColour(stc, style): def setCursorColour(stc, style):
names, values = parseProp(style) names, values = parseProp(style)
@@ -1184,7 +1184,7 @@ def setSTCStyles(stc, styles, styleIdNames, commonDefs, lang, lexer, keywords):
stc.SetBackgroundColour(bkCol) stc.SetBackgroundColour(bkCol)
# Set the styles on the wxSTC # Set the styles on the wxSTC
# stc.Show(false) # stc.Show(False)
stc.StyleResetDefault() stc.StyleResetDefault()
stc.ClearDocumentStyle() stc.ClearDocumentStyle()
stc.SetLexer(lexer) stc.SetLexer(lexer)
@@ -1204,7 +1204,7 @@ def setSTCStyles(stc, styles, styleIdNames, commonDefs, lang, lexer, keywords):
setEdgeColour(stc, style % commonDefs) setEdgeColour(stc, style % commonDefs)
stc.Colourise(0, stc.GetTextLength()) stc.Colourise(0, stc.GetTextLength())
# stc.Show(true) # stc.Show(True)
return newStyles, styleDict, styleNumIdxMap return newStyles, styleDict, styleNumIdxMap
@@ -1216,7 +1216,7 @@ def readPyValFromConfig(conf, name):
def initFromConfig(configFile, lang): def initFromConfig(configFile, lang):
cfg = wxFileConfig(localFilename=configFile, style=wxCONFIG_USE_LOCAL_FILE) cfg = wxFileConfig(localFilename=configFile, style=wxCONFIG_USE_LOCAL_FILE)
cfg.SetExpandEnvVars(false) cfg.SetExpandEnvVars(False)
# read in all group names for this language # read in all group names for this language
groupPrefix = 'style.%s'%lang groupPrefix = 'style.%s'%lang
@@ -1328,7 +1328,7 @@ if __name__ == '__main__':
stc.SetText(open('STCStyleEditor.py').read()) stc.SetText(open('STCStyleEditor.py').read())
EVT_LEFT_DCLICK(stc, OnDblClick) EVT_LEFT_DCLICK(stc, OnDblClick)
initSTC(stc, config, 'python') initSTC(stc, config, 'python')
f.Show(true) f.Show(True)
app.MainLoop() app.MainLoop()
else: else:
dlg = STCStyleEditDlg(None, dlg = STCStyleEditDlg(None,

View File

@@ -74,7 +74,7 @@ class DoodleWindow(wxWindow):
dc.SetBackground(wxBrush(self.GetBackgroundColour())) dc.SetBackground(wxBrush(self.GetBackgroundColour()))
dc.Clear() dc.Clear()
self.DrawLines(dc) self.DrawLines(dc)
self.reInitBuffer = false self.reInitBuffer = False
def SetColour(self, colour): def SetColour(self, colour):
@@ -125,14 +125,14 @@ class DoodleWindow(wxWindow):
def OnCheckMenuColours(self, event): def OnCheckMenuColours(self, event):
text = self.menuColours[event.GetId()] text = self.menuColours[event.GetId()]
if text == self.colour: if text == self.colour:
event.Check(true) event.Check(True)
else: else:
event.Check(false) event.Check(False)
def OnCheckMenuThickness(self, event): def OnCheckMenuThickness(self, event):
if event.GetId() == self.thickness: if event.GetId() == self.thickness:
event.Check(true) event.Check(True)
else: else:
event.Check(false) event.Check(False)
def OnLeftDown(self, event): def OnLeftDown(self, event):
@@ -180,7 +180,7 @@ class DoodleWindow(wxWindow):
Called when the window is resized. We set a flag so the idle Called when the window is resized. We set a flag so the idle
handler will resize the buffer. handler will resize the buffer.
""" """
self.reInitBuffer = true self.reInitBuffer = True
def OnIdle(self, event): def OnIdle(self, event):
@@ -192,7 +192,7 @@ class DoodleWindow(wxWindow):
""" """
if self.reInitBuffer: if self.reInitBuffer:
self.InitBuffer() self.InitBuffer()
self.Refresh(FALSE) self.Refresh(False)
def OnPaint(self, event): def OnPaint(self, event):
@@ -251,6 +251,6 @@ class DoodleFrame(wxFrame):
if __name__ == '__main__': if __name__ == '__main__':
app = wxPySimpleApp() app = wxPySimpleApp()
frame = DoodleFrame(None) frame = DoodleFrame(None)
frame.Show(true) frame.Show(True)
app.MainLoop() app.MainLoop()

View File

@@ -53,7 +53,7 @@ class DoodleFrame(wxFrame):
# Tell the frame that it should layout itself in response to # Tell the frame that it should layout itself in response to
# size events. # size events.
self.SetAutoLayout(true) self.SetAutoLayout(True)
self.SetSizer(box) self.SetSizer(box)
@@ -213,7 +213,7 @@ class ControlPanel(wxPanel):
box.Add(tGrid, 0, wxALL, spacing) box.Add(tGrid, 0, wxALL, spacing)
box.Add(ci, 0, wxEXPAND|wxALL, spacing) box.Add(ci, 0, wxEXPAND|wxALL, spacing)
self.SetSizer(box) self.SetSizer(box)
self.SetAutoLayout(true) self.SetAutoLayout(True)
# Resize this window so it is just large enough for the # Resize this window so it is just large enough for the
# minimum requirements of the sizer. # minimum requirements of the sizer.
@@ -348,7 +348,7 @@ instructions: </p>
lc.height.AsIs() lc.height.AsIs()
button.SetConstraints(lc) button.SetConstraints(lc)
self.SetAutoLayout(true) self.SetAutoLayout(True)
self.Layout() self.Layout()
self.CentreOnParent(wxBOTH) self.CentreOnParent(wxBOTH)
@@ -358,9 +358,9 @@ instructions: </p>
class DoodleApp(wxApp): class DoodleApp(wxApp):
def OnInit(self): def OnInit(self):
frame = DoodleFrame(None) frame = DoodleFrame(None)
frame.Show(true) frame.Show(True)
self.SetTopWindow(frame) self.SetTopWindow(frame)
return true return True
#---------------------------------------------------------------------- #----------------------------------------------------------------------

View File

@@ -12,8 +12,6 @@ from wxPython.wx import *
from StatusBar import * from StatusBar import *
from FrogEditor import FrogEditor from FrogEditor import FrogEditor
TRUE = 1
FALSE = 0
ABOUT_TEXT = """FrogEdit : Copyright 2001 Adam Feuer and Steve Howell ABOUT_TEXT = """FrogEdit : Copyright 2001 Adam Feuer and Steve Howell
wxEditor component : Copyright 1999 - 2001 Dirk Holtwic, Robin Dunn, Adam Feuer, Steve Howell wxEditor component : Copyright 1999 - 2001 Dirk Holtwic, Robin Dunn, Adam Feuer, Steve Howell
@@ -95,7 +93,7 @@ class FrogEditFrame(wxFrame):
def SetUpSplitter(self, splitter, win, log): def SetUpSplitter(self, splitter, win, log):
splitter.SplitHorizontally(win, log) splitter.SplitHorizontally(win, log)
splitter.SetSashPosition(360, true) splitter.SetSashPosition(360, True)
splitter.SetMinimumPaneSize(40) splitter.SetMinimumPaneSize(40)
def MakeToolbar(self, win): def MakeToolbar(self, win):
@@ -109,7 +107,7 @@ class FrogEditFrame(wxFrame):
borderWidth = 5 borderWidth = 5
mainBox.Add(self.edl, 1, wxALL|wxGROW, borderWidth) mainBox.Add(self.edl, 1, wxALL|wxGROW, borderWidth)
win.SetSizer(mainBox) win.SetSizer(mainBox)
win.SetAutoLayout(true) win.SetAutoLayout(True)
##-------------- Init Menus ##-------------- Init Menus
@@ -180,9 +178,9 @@ class FrogEditFrame(wxFrame):
result = dialog.ShowModal() result = dialog.ShowModal()
dialog.Destroy() dialog.Destroy()
if result == wxID_OK: if result == wxID_OK:
return TRUE return True
else: else:
return FALSE return False
def SelectFileDialog(self, defaultDir=None, defaultFile=None, wildCard=None): def SelectFileDialog(self, defaultDir=None, defaultFile=None, wildCard=None):
if defaultDir == None: if defaultDir == None:
@@ -247,9 +245,9 @@ class FrogEditFrame(wxFrame):
f.close() f.close()
self.edl.UnTouchBuffer() self.edl.UnTouchBuffer()
self.sb.setFileName(fileName) self.sb.setFileName(fileName)
return TRUE return True
except: except:
return FALSE return False
def OpenFile(self, fileName): def OpenFile(self, fileName):
try: try:
@@ -262,9 +260,9 @@ class FrogEditFrame(wxFrame):
self.edl.SetText(contents) self.edl.SetText(contents)
self.fileName = fileName self.fileName = fileName
self.sb.setFileName(fileName) self.sb.setFileName(fileName)
return TRUE return True
except: except:
return FALSE return False
@@ -288,7 +286,7 @@ class FrogEditFrame(wxFrame):
return return
fileName = self.SelectFileDialog(self.GetCurrentDir()) fileName = self.SelectFileDialog(self.GetCurrentDir())
if fileName is not None: if fileName is not None:
if self.OpenFile(fileName) is FALSE: if self.OpenFile(fileName) is False:
self.OpenFileError(fileName) self.OpenFileError(fileName)
self.edl.SetFocus() self.edl.SetFocus()
@@ -296,7 +294,7 @@ class FrogEditFrame(wxFrame):
if self.fileName is None: if self.fileName is None:
return self.OnSaveFileAs(event) return self.OnSaveFileAs(event)
wxLogMessage("Saving %s..." % self.fileName) wxLogMessage("Saving %s..." % self.fileName)
if self.SaveFile(self.fileName) is not TRUE: if self.SaveFile(self.fileName) is not True:
self.SaveFileError(self.fileName) self.SaveFileError(self.fileName)
self.edl.SetFocus() self.edl.SetFocus()
@@ -305,7 +303,7 @@ class FrogEditFrame(wxFrame):
if fileName is not None: if fileName is not None:
self.fileName = fileName self.fileName = fileName
wxLogMessage("Saving %s..." % self.fileName) wxLogMessage("Saving %s..." % self.fileName)
if self.SaveFile(self.fileName) is not TRUE: if self.SaveFile(self.fileName) is not True:
self.SaveFileError(self.fileName) self.SaveFileError(self.fileName)
self.edl.SetFocus() self.edl.SetFocus()
@@ -331,7 +329,7 @@ class FrogEditFrame(wxFrame):
def LoadInitialFile(self, fileName): def LoadInitialFile(self, fileName):
if fileName is not None: if fileName is not None:
if self.OpenFile(fileName) is FALSE: if self.OpenFile(fileName) is False:
self.OpenFileError(fileName) self.OpenFileError(fileName)
@@ -354,7 +352,7 @@ class FrogEditLauncher:
def Main(self): def Main(self):
app = wxPySimpleApp() app = wxPySimpleApp()
win = self.MakeAppFrame() win = self.MakeAppFrame()
win.Show(true) win.Show(True)
win.LoadInitialFile(self.GetArgvFilename()) win.LoadInitialFile(self.GetArgvFilename())
app.MainLoop() app.MainLoop()

View File

@@ -354,7 +354,7 @@ class DrawingFrame(wxFrame):
style=wxSUNKEN_BORDER) style=wxSUNKEN_BORDER)
self.drawPanel.SetBackgroundColour(wxWHITE) self.drawPanel.SetBackgroundColour(wxWHITE)
self.drawPanel.EnableScrolling(true, true) self.drawPanel.EnableScrolling(True, True)
self.drawPanel.SetScrollbars(20, 20, PAGE_WIDTH / 20, PAGE_HEIGHT / 20) self.drawPanel.SetScrollbars(20, 20, PAGE_WIDTH / 20, PAGE_HEIGHT / 20)
EVT_LEFT_DOWN(self.drawPanel, self.onMouseEvent) EVT_LEFT_DOWN(self.drawPanel, self.onMouseEvent)
@@ -370,7 +370,7 @@ class DrawingFrame(wxFrame):
topSizer.Add(self.toolPalette, 0) topSizer.Add(self.toolPalette, 0)
topSizer.Add(self.drawPanel, 1, wxEXPAND) topSizer.Add(self.drawPanel, 1, wxEXPAND)
self.topPanel.SetAutoLayout(true) self.topPanel.SetAutoLayout(True)
self.topPanel.SetSizer(topSizer) self.topPanel.SetSizer(topSizer)
self.SetSizeHints(minW=250, minH=200) self.SetSizeHints(minW=250, minH=200)
@@ -383,7 +383,7 @@ class DrawingFrame(wxFrame):
# Setup our frame to hold the contents of a sketch document. # Setup our frame to hold the contents of a sketch document.
self.dirty = false self.dirty = False
self.fileName = fileName self.fileName = fileName
self.contents = [] # front-to-back ordered list of DrawingObjects. self.contents = [] # front-to-back ordered list of DrawingObjects.
self.selection = [] # List of selected DrawingObjects. self.selection = [] # List of selected DrawingObjects.
@@ -492,32 +492,32 @@ class DrawingFrame(wxFrame):
feedbackType = feedback_RECT feedbackType = feedback_RECT
action = self.selectByRectangle action = self.selectByRectangle
actionParam = param_RECT actionParam = param_RECT
selecting = true selecting = True
dashedLine = true dashedLine = True
elif self.curTool == self.lineIcon: elif self.curTool == self.lineIcon:
feedbackType = feedback_LINE feedbackType = feedback_LINE
action = self.createLine action = self.createLine
actionParam = param_LINE actionParam = param_LINE
selecting = false selecting = False
dashedLine = false dashedLine = False
elif self.curTool == self.rectIcon: elif self.curTool == self.rectIcon:
feedbackType = feedback_RECT feedbackType = feedback_RECT
action = self.createRect action = self.createRect
actionParam = param_RECT actionParam = param_RECT
selecting = false selecting = False
dashedLine = false dashedLine = False
elif self.curTool == self.ellipseIcon: elif self.curTool == self.ellipseIcon:
feedbackType = feedback_ELLIPSE feedbackType = feedback_ELLIPSE
action = self.createEllipse action = self.createEllipse
actionParam = param_RECT actionParam = param_RECT
selecting = false selecting = False
dashedLine = false dashedLine = False
elif self.curTool == self.textIcon: elif self.curTool == self.textIcon:
feedbackType = feedback_RECT feedbackType = feedback_RECT
action = self.createText action = self.createText
actionParam = param_RECT actionParam = param_RECT
selecting = false selecting = False
dashedLine = true dashedLine = True
else: else:
wxBell() wxBell()
return return
@@ -576,7 +576,7 @@ class DrawingFrame(wxFrame):
endPt = wxPoint(self.curPt.x + self.resizeOffsetX, endPt = wxPoint(self.curPt.x + self.resizeOffsetX,
self.curPt.y + self.resizeOffsetY) self.curPt.y + self.resizeOffsetY)
self._drawVisualFeedback(self.resizeAnchor, endPt, self._drawVisualFeedback(self.resizeAnchor, endPt,
self.resizeFeedback, false) self.resizeFeedback, False)
elif selecting and (self._getObjectAt(mousePt) != None): elif selecting and (self._getObjectAt(mousePt) != None):
@@ -615,13 +615,13 @@ class DrawingFrame(wxFrame):
endPt = wxPoint(self.curPt.x + self.resizeOffsetX, endPt = wxPoint(self.curPt.x + self.resizeOffsetX,
self.curPt.y + self.resizeOffsetY) self.curPt.y + self.resizeOffsetY)
self._drawVisualFeedback(self.resizeAnchor, endPt, self._drawVisualFeedback(self.resizeAnchor, endPt,
self.resizeFeedback, false) self.resizeFeedback, False)
self.curPt = mousePt self.curPt = mousePt
# Draw new visual feedback. # Draw new visual feedback.
endPt = wxPoint(self.curPt.x + self.resizeOffsetX, endPt = wxPoint(self.curPt.x + self.resizeOffsetX,
self.curPt.y + self.resizeOffsetY) self.curPt.y + self.resizeOffsetY)
self._drawVisualFeedback(self.resizeAnchor, endPt, self._drawVisualFeedback(self.resizeAnchor, endPt,
self.resizeFeedback, false) self.resizeFeedback, False)
elif self.dragMode == drag_MOVE: elif self.dragMode == drag_MOVE:
@@ -664,7 +664,7 @@ class DrawingFrame(wxFrame):
endPt = wxPoint(self.curPt.x + self.resizeOffsetX, endPt = wxPoint(self.curPt.x + self.resizeOffsetX,
self.curPt.y + self.resizeOffsetY) self.curPt.y + self.resizeOffsetY)
self._drawVisualFeedback(self.resizeAnchor, endPt, self._drawVisualFeedback(self.resizeAnchor, endPt,
self.resizeFeedback, false) self.resizeFeedback, False)
resizePt = wxPoint(mousePt.x + self.resizeOffsetX, resizePt = wxPoint(mousePt.x + self.resizeOffsetX,
mousePt.y + self.resizeOffsetY) mousePt.y + self.resizeOffsetY)
@@ -748,7 +748,7 @@ class DrawingFrame(wxFrame):
editor.dialogToObject(obj) editor.dialogToObject(obj)
editor.Destroy() editor.Destroy()
self.dirty = true self.dirty = True
self.drawPanel.Refresh() self.drawPanel.Refresh()
self._adjustMenus() self._adjustMenus()
else: else:
@@ -815,9 +815,9 @@ class DrawingFrame(wxFrame):
for i in range(len(self.contents)-1, -1, -1): for i in range(len(self.contents)-1, -1, -1):
obj = self.contents[i] obj = self.contents[i]
if obj in self.selection: if obj in self.selection:
obj.draw(dc, true) obj.draw(dc, True)
else: else:
obj.draw(dc, false) obj.draw(dc, False)
dc.EndDrawing() dc.EndDrawing()
@@ -830,7 +830,7 @@ class DrawingFrame(wxFrame):
""" """
global _docList global _docList
newFrame = DrawingFrame(None, -1, "Untitled") newFrame = DrawingFrame(None, -1, "Untitled")
newFrame.Show(TRUE) newFrame.Show(True)
_docList.append(newFrame) _docList.append(newFrame)
@@ -857,7 +857,7 @@ class DrawingFrame(wxFrame):
# Open a new frame for this document. # Open a new frame for this document.
newFrame = DrawingFrame(None, -1, os.path.basename(fileName), newFrame = DrawingFrame(None, -1, os.path.basename(fileName),
fileName=fileName) fileName=fileName)
newFrame.Show(true) newFrame.Show(True)
_docList.append(newFrame) _docList.append(newFrame)
@@ -949,7 +949,7 @@ class DrawingFrame(wxFrame):
for i in undoData["selection"]: for i in undoData["selection"]:
self.selection.append(self.contents[i]) self.selection.append(self.contents[i])
self.dirty = true self.dirty = True
self.drawPanel.Refresh() self.drawPanel.Refresh()
self._adjustMenus() self._adjustMenus()
@@ -998,7 +998,7 @@ class DrawingFrame(wxFrame):
editor.dialogToObject(obj) editor.dialogToObject(obj)
editor.Destroy() editor.Destroy()
self.dirty = true self.dirty = True
self.drawPanel.Refresh() self.drawPanel.Refresh()
self._adjustMenus() self._adjustMenus()
@@ -1184,14 +1184,14 @@ class DrawingFrame(wxFrame):
panelSizer.Add(10, 10) # Spacer. panelSizer.Add(10, 10) # Spacer.
panelSizer.Add(btnOK, 0, wxALL | wxALIGN_CENTRE, 5) panelSizer.Add(btnOK, 0, wxALL | wxALIGN_CENTRE, 5)
panel.SetAutoLayout(true) panel.SetAutoLayout(True)
panel.SetSizer(panelSizer) panel.SetSizer(panelSizer)
panelSizer.Fit(panel) panelSizer.Fit(panel)
topSizer = wxBoxSizer(wxHORIZONTAL) topSizer = wxBoxSizer(wxHORIZONTAL)
topSizer.Add(panel, 0, wxALL, 10) topSizer.Add(panel, 0, wxALL, 10)
dialog.SetAutoLayout(true) dialog.SetAutoLayout(True)
dialog.SetSizer(topSizer) dialog.SetSizer(topSizer)
topSizer.Fit(dialog) topSizer.Fit(dialog)
@@ -1223,7 +1223,7 @@ class DrawingFrame(wxFrame):
startPt = wxPoint(x1 - topLeftX, y1 - topLeftY), startPt = wxPoint(x1 - topLeftX, y1 - topLeftY),
endPt = wxPoint(x2 - topLeftX, y2 - topLeftY)) endPt = wxPoint(x2 - topLeftX, y2 - topLeftY))
self.contents.insert(0, obj) self.contents.insert(0, obj)
self.dirty = true self.dirty = True
self.doChooseSelectTool() self.doChooseSelectTool()
self.select(obj) self.select(obj)
@@ -1239,7 +1239,7 @@ class DrawingFrame(wxFrame):
fillColour=self.fillColour, fillColour=self.fillColour,
lineSize=self.lineSize) lineSize=self.lineSize)
self.contents.insert(0, obj) self.contents.insert(0, obj)
self.dirty = true self.dirty = True
self.doChooseSelectTool() self.doChooseSelectTool()
self.select(obj) self.select(obj)
@@ -1255,7 +1255,7 @@ class DrawingFrame(wxFrame):
fillColour=self.fillColour, fillColour=self.fillColour,
lineSize=self.lineSize) lineSize=self.lineSize)
self.contents.insert(0, obj) self.contents.insert(0, obj)
self.dirty = true self.dirty = True
self.doChooseSelectTool() self.doChooseSelectTool()
self.select(obj) self.select(obj)
@@ -1276,7 +1276,7 @@ class DrawingFrame(wxFrame):
editor.Destroy() editor.Destroy()
self.contents.insert(0, obj) self.contents.insert(0, obj)
self.dirty = true self.dirty = True
self.doChooseSelectTool() self.doChooseSelectTool()
self.select(obj) self.select(obj)
@@ -1344,7 +1344,7 @@ class DrawingFrame(wxFrame):
obj.setData(data) obj.setData(data)
self.contents.append(obj) self.contents.append(obj)
self.dirty = false self.dirty = False
self.selection = [] self.selection = []
self.undoInfo = None self.undoInfo = None
@@ -1363,7 +1363,7 @@ class DrawingFrame(wxFrame):
cPickle.dump(objData, f) cPickle.dump(objData, f)
f.close() f.close()
self.dirty = false self.dirty = False
def askIfUserWantsToSave(self, action): def askIfUserWantsToSave(self, action):
@@ -1371,9 +1371,9 @@ class DrawingFrame(wxFrame):
'action' is a string describing the action about to be taken. If 'action' is a string describing the action about to be taken. If
the user wants to save the document, it is saved immediately. If the user wants to save the document, it is saved immediately. If
the user cancels, we return false. the user cancels, we return False.
""" """
if not self.dirty: return true # Nothing to do. if not self.dirty: return True # Nothing to do.
response = wxMessageBox("Save changes before " + action + "?", response = wxMessageBox("Save changes before " + action + "?",
"Confirm", wxYES_NO | wxCANCEL, self) "Confirm", wxYES_NO | wxCANCEL, self)
@@ -1384,15 +1384,15 @@ class DrawingFrame(wxFrame):
default_extension="psk", default_extension="psk",
wildcard="*.psk", wildcard="*.psk",
flags = wxSAVE | wxOVERWRITE_PROMPT) flags = wxSAVE | wxOVERWRITE_PROMPT)
if fileName == "": return false # User cancelled. if fileName == "": return False # User cancelled.
self.fileName = fileName self.fileName = fileName
self.saveContents() self.saveContents()
return true return True
elif response == wxNO: elif response == wxNO:
return true # User doesn't want changes saved. return True # User doesn't want changes saved.
elif response == wxCANCEL: elif response == wxCANCEL:
return false # User cancelled. return False # User cancelled.
# ===================== # =====================
# == Private Methods == # == Private Methods ==
@@ -1434,8 +1434,8 @@ class DrawingFrame(wxFrame):
# Enable/disable our toolbar icons. # Enable/disable our toolbar icons.
self.toolbar.EnableTool(wxID_NEW, true) self.toolbar.EnableTool(wxID_NEW, True)
self.toolbar.EnableTool(wxID_OPEN, true) self.toolbar.EnableTool(wxID_OPEN, True)
self.toolbar.EnableTool(wxID_SAVE, canSave) self.toolbar.EnableTool(wxID_SAVE, canSave)
self.toolbar.EnableTool(menu_UNDO, canUndo) self.toolbar.EnableTool(menu_UNDO, canUndo)
self.toolbar.EnableTool(menu_DUPLICATE, selection) self.toolbar.EnableTool(menu_DUPLICATE, selection)
@@ -1602,12 +1602,12 @@ class DrawingFrame(wxFrame):
menu.Append(id_LINESIZE_4, "4-pixel line", kind=wxITEM_CHECK) menu.Append(id_LINESIZE_4, "4-pixel line", kind=wxITEM_CHECK)
menu.Append(id_LINESIZE_5, "5-pixel line", kind=wxITEM_CHECK) menu.Append(id_LINESIZE_5, "5-pixel line", kind=wxITEM_CHECK)
if lineSize == 0: menu.Check(id_LINESIZE_0, true) if lineSize == 0: menu.Check(id_LINESIZE_0, True)
elif lineSize == 1: menu.Check(id_LINESIZE_1, true) elif lineSize == 1: menu.Check(id_LINESIZE_1, True)
elif lineSize == 2: menu.Check(id_LINESIZE_2, true) elif lineSize == 2: menu.Check(id_LINESIZE_2, True)
elif lineSize == 3: menu.Check(id_LINESIZE_3, true) elif lineSize == 3: menu.Check(id_LINESIZE_3, True)
elif lineSize == 4: menu.Check(id_LINESIZE_4, true) elif lineSize == 4: menu.Check(id_LINESIZE_4, True)
elif lineSize == 5: menu.Check(id_LINESIZE_5, true) elif lineSize == 5: menu.Check(id_LINESIZE_5, True)
EVT_MENU(self, id_LINESIZE_0, self._lineSizePopupSelected) EVT_MENU(self, id_LINESIZE_0, self._lineSizePopupSelected)
EVT_MENU(self, id_LINESIZE_1, self._lineSizePopupSelected) EVT_MENU(self, id_LINESIZE_1, self._lineSizePopupSelected)
@@ -1714,7 +1714,7 @@ class DrawingFrame(wxFrame):
feedback_LINE -> draw line feedback. feedback_LINE -> draw line feedback.
feedback_ELLIPSE -> draw elliptical feedback. feedback_ELLIPSE -> draw elliptical feedback.
if 'dashedLine' is true, the feedback is drawn as a dashed rather if 'dashedLine' is True, the feedback is drawn as a dashed rather
than a solid line. than a solid line.
Note that the feedback is drawn by *inverting* the window's Note that the feedback is drawn by *inverting* the window's
@@ -1765,10 +1765,10 @@ class DrawingObject:
'text' The object's text (obj_TEXT objects only). 'text' The object's text (obj_TEXT objects only).
'textFont' The text object's font name. 'textFont' The text object's font name.
'textSize' The text object's point size. 'textSize' The text object's point size.
'textBoldface' If true, this text object will be drawn in 'textBoldface' If True, this text object will be drawn in
boldface. boldface.
'textItalic' If true, this text object will be drawn in italic. 'textItalic' If True, this text object will be drawn in italic.
'textUnderline' If true, this text object will be drawn underlined. 'textUnderline' If True, this text object will be drawn underlined.
""" """
# ================== # ==================
@@ -1803,9 +1803,9 @@ class DrawingObject:
self.textFont = wxSystemSettings_GetSystemFont( self.textFont = wxSystemSettings_GetSystemFont(
wxSYS_DEFAULT_GUI_FONT).GetFaceName() wxSYS_DEFAULT_GUI_FONT).GetFaceName()
self.textSize = 12 self.textSize = 12
self.textBoldface = false self.textBoldface = False
self.textItalic = false self.textItalic = False
self.textUnderline = false self.textUnderline = False
# ============================= # =============================
# == Object Property Methods == # == Object Property Methods ==
@@ -2033,7 +2033,7 @@ class DrawingObject:
""" Draw this DrawingObject into our window. """ Draw this DrawingObject into our window.
'dc' is the device context to use for drawing. If 'selected' is 'dc' is the device context to use for drawing. If 'selected' is
true, the object is currently selected and should be drawn as such. True, the object is currently selected and should be drawn as such.
""" """
if self.type != obj_TEXT: if self.type != obj_TEXT:
if self.lineSize == 0: if self.lineSize == 0:
@@ -2052,21 +2052,21 @@ class DrawingObject:
# ======================= # =======================
def objectContainsPoint(self, x, y): def objectContainsPoint(self, x, y):
""" Returns true iff this object contains the given point. """ Returns True iff this object contains the given point.
This is used to determine if the user clicked on the object. This is used to determine if the user clicked on the object.
""" """
# Firstly, ignore any points outside of the object's bounds. # Firstly, ignore any points outside of the object's bounds.
if x < self.position.x: return false if x < self.position.x: return False
if x > self.position.x + self.size.x: return false if x > self.position.x + self.size.x: return False
if y < self.position.y: return false if y < self.position.y: return False
if y > self.position.y + self.size.y: return false if y > self.position.y + self.size.y: return False
if self.type in [obj_RECT, obj_TEXT]: if self.type in [obj_RECT, obj_TEXT]:
# Rectangles and text are easy -- they're always selected if the # Rectangles and text are easy -- they're always selected if the
# point is within their bounds. # point is within their bounds.
return true return True
# Now things get tricky. There's no straightforward way of knowing # Now things get tricky. There's no straightforward way of knowing
# whether the point is within the object's bounds...to get around this, # whether the point is within the object's bounds...to get around this,
@@ -2082,13 +2082,13 @@ class DrawingObject:
dc.Clear() dc.Clear()
dc.SetPen(wxPen(wxBLACK, self.lineSize + 5, wxSOLID)) dc.SetPen(wxPen(wxBLACK, self.lineSize + 5, wxSOLID))
dc.SetBrush(wxBLACK_BRUSH) dc.SetBrush(wxBLACK_BRUSH)
self._privateDraw(dc, wxPoint(5, 5), true) self._privateDraw(dc, wxPoint(5, 5), True)
dc.EndDrawing() dc.EndDrawing()
pixel = dc.GetPixel(x - self.position.x + 5, y - self.position.y + 5) pixel = dc.GetPixel(x - self.position.x + 5, y - self.position.y + 5)
if (pixel.Red() == 0) and (pixel.Green() == 0) and (pixel.Blue() == 0): if (pixel.Red() == 0) and (pixel.Green() == 0) and (pixel.Blue() == 0):
return true return True
else: else:
return false return False
def getSelectionHandleContainingPoint(self, x, y): def getSelectionHandleContainingPoint(self, x, y):
@@ -2124,13 +2124,13 @@ class DrawingObject:
def objectWithinRect(self, x, y, width, height): def objectWithinRect(self, x, y, width, height):
""" Return true iff this object falls completely within the given rect. """ Return True iff this object falls completely within the given rect.
""" """
if x > self.position.x: return false if x > self.position.x: return False
if x + width < self.position.x + self.size.width: return false if x + width < self.position.x + self.size.width: return False
if y > self.position.y: return false if y > self.position.y: return False
if y + height < self.position.y + self.size.height: return false if y + height < self.position.y + self.size.height: return False
return true return True
# ===================== # =====================
# == Utility Methods == # == Utility Methods ==
@@ -2163,7 +2163,7 @@ class DrawingObject:
""" Private routine to draw this DrawingObject. """ Private routine to draw this DrawingObject.
'dc' is the device context to use for drawing, while 'position' is 'dc' is the device context to use for drawing, while 'position' is
the position in which to draw the object. If 'selected' is true, the position in which to draw the object. If 'selected' is True,
the object is drawn with selection handles. This private drawing the object is drawn with selection handles. This private drawing
routine assumes that the pen and brush have already been set by the routine assumes that the pen and brush have already been set by the
caller. caller.
@@ -2221,13 +2221,13 @@ class DrawingObject:
def _pointInSelRect(self, x, y, rX, rY): def _pointInSelRect(self, x, y, rX, rY):
""" Return true iff (x, y) is within the selection handle at (rX, ry). """ Return True iff (x, y) is within the selection handle at (rX, ry).
""" """
if x < rX - 3: return false if x < rX - 3: return False
elif x > rX + 3: return false elif x > rX + 3: return False
elif y < rY - 3: return false elif y < rY - 3: return False
elif y > rY + 3: return false elif y > rY + 3: return False
else: return true else: return True
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
@@ -2256,7 +2256,7 @@ class ToolPaletteIcon(wxStaticBitmap):
self.iconID = iconID self.iconID = iconID
self.iconName = iconName self.iconName = iconName
self.isSelected = false self.isSelected = False
def select(self): def select(self):
@@ -2269,7 +2269,7 @@ class ToolPaletteIcon(wxStaticBitmap):
bmp = wxBitmap("images/" + self.iconName + "IconSel.bmp", bmp = wxBitmap("images/" + self.iconName + "IconSel.bmp",
wxBITMAP_TYPE_BMP) wxBITMAP_TYPE_BMP)
self.SetBitmap(bmp) self.SetBitmap(bmp)
self.isSelected = true self.isSelected = True
def deselect(self): def deselect(self):
@@ -2282,7 +2282,7 @@ class ToolPaletteIcon(wxStaticBitmap):
bmp = wxBitmap("images/" + self.iconName + "Icon.bmp", bmp = wxBitmap("images/" + self.iconName + "Icon.bmp",
wxBITMAP_TYPE_BMP) wxBITMAP_TYPE_BMP)
self.SetBitmap(bmp) self.SetBitmap(bmp)
self.isSelected = false self.isSelected = False
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
@@ -2399,7 +2399,7 @@ class EditTextObjectDialog(wxDialog):
self._setFontOptions(self.boldCheckbox, weight=wxBOLD) self._setFontOptions(self.boldCheckbox, weight=wxBOLD)
self._setFontOptions(self.italicCheckbox, style=wxITALIC) self._setFontOptions(self.italicCheckbox, style=wxITALIC)
self._setFontOptions(self.underlineCheckbox, underline=true) self._setFontOptions(self.underlineCheckbox, underline=True)
styleSizer = wxBoxSizer(wxHORIZONTAL) styleSizer = wxBoxSizer(wxHORIZONTAL)
styleSizer.Add(self.boldCheckbox, 0, gap, 5) styleSizer.Add(self.boldCheckbox, 0, gap, 5)
@@ -2421,7 +2421,7 @@ class EditTextObjectDialog(wxDialog):
sizer.Add(10, 10) # Spacer. sizer.Add(10, 10) # Spacer.
sizer.Add(btnSizer, 0, gap | wxALIGN_CENTRE, 5) sizer.Add(btnSizer, 0, gap | wxALIGN_CENTRE, 5)
self.SetAutoLayout(true) self.SetAutoLayout(True)
self.SetSizer(sizer) self.SetSizer(sizer)
sizer.Fit(self) sizer.Fit(self)
@@ -2466,7 +2466,7 @@ class EditTextObjectDialog(wxDialog):
def _setFontOptions(self, ctrl, family=None, pointSize=-1, def _setFontOptions(self, ctrl, family=None, pointSize=-1,
style=wxNORMAL, weight=wxNORMAL, style=wxNORMAL, weight=wxNORMAL,
underline=false): underline=False):
""" Change the font settings for the given control. """ Change the font settings for the given control.
The meaning of the 'family', 'pointSize', 'style', 'weight' and The meaning of the 'family', 'pointSize', 'style', 'weight' and
@@ -2486,7 +2486,7 @@ class EditTextObjectDialog(wxDialog):
We simulate clicking on the "OK" button. We simulate clicking on the "OK" button.
""" """
if self.Validate(): self.Show(false) if self.Validate(): self.Show(False)
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
@@ -2516,27 +2516,27 @@ class TextObjectValidator(wxPyValidator):
if len(text) == 0: if len(text) == 0:
wxMessageBox("A text object must contain some text!", "Error") wxMessageBox("A text object must contain some text!", "Error")
return false return False
else: else:
return true return True
def TransferToWindow(self): def TransferToWindow(self):
""" Transfer data from validator to window. """ Transfer data from validator to window.
The default implementation returns false, indicating that an error The default implementation returns False, indicating that an error
occurred. We simply return true, as we don't do any data transfer. occurred. We simply return True, as we don't do any data transfer.
""" """
return true # Prevent wxDialog from complaining. return True # Prevent wxDialog from complaining.
def TransferFromWindow(self): def TransferFromWindow(self):
""" Transfer data from window to validator. """ Transfer data from window to validator.
The default implementation returns false, indicating that an error The default implementation returns False, indicating that an error
occurred. We simply return true, as we don't do any data transfer. occurred. We simply return True, as we don't do any data transfer.
""" """
return true # Prevent wxDialog from complaining. return True # Prevent wxDialog from complaining.
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------
@@ -2601,7 +2601,7 @@ class SketchApp(wxApp):
# blank document. # blank document.
frame = DrawingFrame(None, -1, "Untitled") frame = DrawingFrame(None, -1, "Untitled")
frame.Centre() frame.Centre()
frame.Show(TRUE) frame.Show(True)
_docList.append(frame) _docList.append(frame)
else: else:
# Load the file(s) specified on the command line. # Load the file(s) specified on the command line.
@@ -2611,10 +2611,10 @@ class SketchApp(wxApp):
frame = DrawingFrame(None, -1, frame = DrawingFrame(None, -1,
os.path.basename(fileName), os.path.basename(fileName),
fileName=fileName) fileName=fileName)
frame.Show(TRUE) frame.Show(True)
_docList.append(frame) _docList.append(frame)
return TRUE return True
#---------------------------------------------------------------------------- #----------------------------------------------------------------------------

View File

@@ -640,6 +640,9 @@ class _DeprecatedNonBool:
import warnings import warnings
warnings.warn("Use Python's %s instead" % self.__txt, DeprecationWarning, 3) warnings.warn("Use Python's %s instead" % self.__txt, DeprecationWarning, 3)
return self.__val return self.__val
def __nonzero__(self):
return self.__int__()
TRUE = true = _DeprecatedNonBool(True, 'True') TRUE = true = _DeprecatedNonBool(True, 'True')
FALSE = false = _DeprecatedNonBool(False, 'False') FALSE = false = _DeprecatedNonBool(False, 'False')

View File

@@ -1603,6 +1603,9 @@ class _DeprecatedNonBool:
import warnings import warnings
warnings.warn("Use Python's %s instead" % self.__txt, DeprecationWarning, 3) warnings.warn("Use Python's %s instead" % self.__txt, DeprecationWarning, 3)
return self.__val return self.__val
def __nonzero__(self):
return self.__int__()
TRUE = true = _DeprecatedNonBool(True, 'True') TRUE = true = _DeprecatedNonBool(True, 'True')
FALSE = false = _DeprecatedNonBool(False, 'False') FALSE = false = _DeprecatedNonBool(False, 'False')

View File

@@ -144,7 +144,7 @@ class ImageDialog(wxDialog):
self.y_pos = self.y_pos + self.delta self.y_pos = self.y_pos + self.delta
mID = NewId() mID = wxNewId()
wxButton(self, mID, ' Set Directory ', wxPoint(self.x_pos, self.y_pos), size).SetDefault() wxButton(self, mID, ' Set Directory ', wxPoint(self.x_pos, self.y_pos), size).SetDefault()
EVT_BUTTON(self, mID, self.SetDirect) EVT_BUTTON(self, mID, self.SetDirect)
@@ -158,7 +158,7 @@ class ImageDialog(wxDialog):
self.list_height = 150 self.list_height = 150
# List of Labels # List of Labels
mID = NewId() mID = wxNewId()
self.tb = tb = wxListBox(self, mID, wxPoint(self.x_pos, self.y_pos), wxSize(160, self.list_height), self.fl_list, wxLB_SINGLE) self.tb = tb = wxListBox(self, mID, wxPoint(self.x_pos, self.y_pos), wxSize(160, self.list_height), self.fl_list, wxLB_SINGLE)
EVT_LISTBOX(self, mID, self.OnListClick) EVT_LISTBOX(self, mID, self.OnListClick)
EVT_LISTBOX_DCLICK(self, mID, self.OnListDClick) EVT_LISTBOX_DCLICK(self, mID, self.OnListDClick)
@@ -176,7 +176,7 @@ class ImageDialog(wxDialog):
self.set_type = self.fl_types[0] # initial file filter setting self.set_type = self.fl_types[0] # initial file filter setting
self.fl_ext = self.fl_ext_types[self.set_type] self.fl_ext = self.fl_ext_types[self.set_type]
mID = NewId() mID = wxNewId()
self.sel_type = wxComboBox(self, mID, self.set_type, wxPoint(image_posx , self.type_posy), wxSize(150, -1), self.fl_types, wxCB_DROPDOWN) self.sel_type = wxComboBox(self, mID, self.set_type, wxPoint(image_posx , self.type_posy), wxSize(150, -1), self.fl_types, wxCB_DROPDOWN)
EVT_COMBOBOX(self, mID, self.OnSetType) EVT_COMBOBOX(self, mID, self.OnSetType)
@@ -184,7 +184,7 @@ class ImageDialog(wxDialog):
self.y_pos = self.y_pos + height + 20 self.y_pos = self.y_pos + height + 20
mID = NewId() mID = wxNewId()
wxButton(self, mID, ' Select ', wxPoint(100, self.y_pos), size).SetDefault() wxButton(self, mID, ' Select ', wxPoint(100, self.y_pos), size).SetDefault()
EVT_BUTTON(self, mID, self.OnOk) EVT_BUTTON(self, mID, self.OnOk)