diff --git a/wxPython/README.txt b/wxPython/README.txt index bd808ce033..5e3c5b2f0a 100644 --- a/wxPython/README.txt +++ b/wxPython/README.txt @@ -3,7 +3,7 @@ wxPython README 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 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 diff --git a/wxPython/demo/ErrorDialogs.py b/wxPython/demo/ErrorDialogs.py index c94639ff8c..db24853b82 100644 --- a/wxPython/demo/ErrorDialogs.py +++ b/wxPython/demo/ErrorDialogs.py @@ -105,7 +105,7 @@ class MyPanel(wxPanel): EVT_BUTTON(self, ID_BUTTON_wxPyNonFatalErrorDialogWithTraceback, self.DoDialog) - EVT_CLOSE(self,self.OnClose) + IndexFromID = { ID_BUTTON_wxPyFatalErrorDialog: 3, @@ -138,10 +138,11 @@ class MyPanel(wxPanel): print "%s.DoDialog(): testing %s..." % (self,sys.stderr) this_will_generate_a_NameError_exception - def OnClose(self,evt): + def ShutdownDemo(self): for d in self.dialogs: - d.Destroy () - self.Destroy () + d.Destroy() + + class MyFrame(wxFrame): def __init__(self,parent=None): diff --git a/wxPython/demo/wxTreeCtrl.py b/wxPython/demo/wxTreeCtrl.py index e766cd8c2d..288f83c010 100644 --- a/wxPython/demo/wxTreeCtrl.py +++ b/wxPython/demo/wxTreeCtrl.py @@ -27,7 +27,7 @@ class TestTreeCtrlPanel(wxPanel): EVT_SIZE(self, self.OnSize) self.log = log - tID = NewId() + tID = wxNewId() self.tree = MyTreeCtrl(self, tID, wxDefaultPosition, wxDefaultSize, wxTR_HAS_BUTTONS @@ -67,7 +67,7 @@ class TestTreeCtrlPanel(wxPanel): self.tree.SetPyData(last, None) self.tree.SetItemImage(last, fldridx, wxTreeItemIcon_Normal) 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)) self.tree.SetPyData(item, None) self.tree.SetItemImage(item, fileidx, wxTreeItemIcon_Normal) diff --git a/wxPython/distutils/README_1st.txt b/wxPython/distutils/README_1st.txt index 4105b996b7..5a06b95c56 100644 --- a/wxPython/distutils/README_1st.txt +++ b/wxPython/distutils/README_1st.txt @@ -1,5 +1,5 @@ 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 wxPython builds and to avoid having to make some ugly hacks in local modules to work around them. diff --git a/wxPython/samples/StyleEditor/STCStyleEditor.py b/wxPython/samples/StyleEditor/STCStyleEditor.py index ab0020b292..9758734401 100644 --- a/wxPython/samples/StyleEditor/STCStyleEditor.py +++ b/wxPython/samples/StyleEditor/STCStyleEditor.py @@ -68,30 +68,30 @@ styleCategoryDescriptions = { '----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_STCSTYLEEDITDLGBGCOLOKBTN, - wxID_STCSTYLEEDITDLGCANCELBTN, wxID_STCSTYLEEDITDLGCONTEXTHELPBUTTON1, - wxID_STCSTYLEEDITDLGELEMENTLB, wxID_STCSTYLEEDITDLGFACECB, - wxID_STCSTYLEEDITDLGFACEDEFCB, wxID_STCSTYLEEDITDLGFACEOKBTN, - wxID_STCSTYLEEDITDLGFGCOLBTN, wxID_STCSTYLEEDITDLGFGCOLCB, - wxID_STCSTYLEEDITDLGFGCOLDEFCB, wxID_STCSTYLEEDITDLGFGCOLOKBTN, - wxID_STCSTYLEEDITDLGFIXEDWIDTHCHK, wxID_STCSTYLEEDITDLGOKBTN, - wxID_STCSTYLEEDITDLGPANEL1, wxID_STCSTYLEEDITDLGPANEL2, - wxID_STCSTYLEEDITDLGPANEL3, wxID_STCSTYLEEDITDLGPANEL4, - wxID_STCSTYLEEDITDLGREMOVECOMMONITEMBTN, wxID_STCSTYLEEDITDLGSIZECB, - wxID_STCSTYLEEDITDLGSIZEOKBTN, 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, +[wxID_STCSTYLEEDITDLG, wxID_STCSTYLEEDITDLGADDCOMMONITEMBTN, + wxID_STCSTYLEEDITDLGBGCOLBTN, wxID_STCSTYLEEDITDLGBGCOLCB, + wxID_STCSTYLEEDITDLGBGCOLDEFCB, wxID_STCSTYLEEDITDLGBGCOLOKBTN, + wxID_STCSTYLEEDITDLGCANCELBTN, wxID_STCSTYLEEDITDLGCONTEXTHELPBUTTON1, + wxID_STCSTYLEEDITDLGELEMENTLB, wxID_STCSTYLEEDITDLGFACECB, + wxID_STCSTYLEEDITDLGFACEDEFCB, wxID_STCSTYLEEDITDLGFACEOKBTN, + wxID_STCSTYLEEDITDLGFGCOLBTN, wxID_STCSTYLEEDITDLGFGCOLCB, + wxID_STCSTYLEEDITDLGFGCOLDEFCB, wxID_STCSTYLEEDITDLGFGCOLOKBTN, + wxID_STCSTYLEEDITDLGFIXEDWIDTHCHK, wxID_STCSTYLEEDITDLGOKBTN, + wxID_STCSTYLEEDITDLGPANEL1, wxID_STCSTYLEEDITDLGPANEL2, + wxID_STCSTYLEEDITDLGPANEL3, wxID_STCSTYLEEDITDLGPANEL4, + wxID_STCSTYLEEDITDLGREMOVECOMMONITEMBTN, wxID_STCSTYLEEDITDLGSIZECB, + wxID_STCSTYLEEDITDLGSIZEOKBTN, 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(47)) class STCStyleEditDlg(wxDialog): @@ -109,7 +109,7 @@ class STCStyleEditDlg(wxDialog): title=self.stc_title) self._init_utils() self.SetClientSize(wxSize(451, 455)) - self.SetAutoLayout(true) + self.SetAutoLayout(True) self.SetSizeHints(425, 400, -1, -1) self.Center(wxBOTH) EVT_SIZE(self, self.OnStcstyleeditdlgSize) @@ -119,7 +119,7 @@ class STCStyleEditDlg(wxDialog): parent=self, pos=wxPoint(96, 28), size=wxSize(346, 21), style=0, validator=wxDefaultValidator) 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.') EVT_CHOICE(self.speedsettingCh, wxID_STCSTYLEEDITDLGSPEEDSETTINGCH, self.OnSpeedsettingchChoice) @@ -127,8 +127,8 @@ class STCStyleEditDlg(wxDialog): self.elementLb = wxListBox(choices=[], id=wxID_STCSTYLEEDITDLGELEMENTLB, name='elementLb', parent=self, pos=wxPoint(8, 72), size=wxSize(160, 112), style=0, validator=wxDefaultValidator) - self.elementLb.SetConstraints(LayoutAnchors(self.elementLb, true, true, - true, false)) + self.elementLb.SetConstraints(LayoutAnchors(self.elementLb, True, True, + 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.') EVT_LISTBOX(self.elementLb, wxID_STCSTYLEEDITDLGELEMENTLB, self.OnElementlbListbox) @@ -153,15 +153,15 @@ class STCStyleEditDlg(wxDialog): pos=wxPoint(96, 8), size=wxSize(366, 16), style=wxST_NO_AUTORESIZE) self.styleDefST.SetFont(wxFont(self.style_font_size, wxSWISS, wxNORMAL, - wxBOLD, false, '')) - self.styleDefST.SetConstraints(LayoutAnchors(self.styleDefST, true, - true, true, false)) + wxBOLD, False, '')) + self.styleDefST.SetConstraints(LayoutAnchors(self.styleDefST, True, + True, True, False)) self.staticLine1 = wxStaticLine(id=wxID_STCSTYLEEDITDLGSTATICLINE1, name='staticLine1', parent=self, pos=wxPoint(48, 62), size=wxSize(120, 2), style=wxLI_HORIZONTAL) - self.staticLine1.SetConstraints(LayoutAnchors(self.staticLine1, true, - true, true, false)) + 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, @@ -178,31 +178,31 @@ class STCStyleEditDlg(wxDialog): self.panel3 = wxPanel(id=wxID_STCSTYLEEDITDLGPANEL3, name='panel3', parent=self, pos=wxPoint(176, 56), size=wxSize(146, 104), style=wxTAB_TRAVERSAL) - self.panel3.SetConstraints(LayoutAnchors(self.panel3, false, true, true, - false)) + self.panel3.SetConstraints(LayoutAnchors(self.panel3, False, True, True, + False)) self.panel4 = wxPanel(id=wxID_STCSTYLEEDITDLGPANEL4, name='panel4', parent=self, pos=wxPoint(330, 56), size=wxSize(114, 104), style=wxTAB_TRAVERSAL) - self.panel4.SetConstraints(LayoutAnchors(self.panel4, false, true, true, - false)) + self.panel4.SetConstraints(LayoutAnchors(self.panel4, False, True, True, + False)) self.panel1 = wxPanel(id=wxID_STCSTYLEEDITDLGPANEL1, name='panel1', parent=self, pos=wxPoint(176, 161), size=wxSize(143, 40), style=wxTAB_TRAVERSAL) - self.panel1.SetConstraints(LayoutAnchors(self.panel1, false, true, true, - false)) + self.panel1.SetConstraints(LayoutAnchors(self.panel1, False, True, True, + False)) self.panel2 = wxPanel(id=wxID_STCSTYLEEDITDLGPANEL2, name='panel2', parent=self, pos=wxPoint(330, 162), size=wxSize(112, 40), style=wxTAB_TRAVERSAL) - self.panel2.SetConstraints(LayoutAnchors(self.panel2, false, true, true, - false)) + self.panel2.SetConstraints(LayoutAnchors(self.panel2, False, True, True, + False)) self.stc = wxStyledTextCtrl(id=wxID_STCSTYLEEDITDLGSTC, name='stc', parent=self, pos=wxPoint(8, 208), size=wxSize(435, 207), 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.') EVT_LEFT_UP(self.stc, self.OnUpdateUI) EVT_KEY_UP(self.stc, self.OnUpdateUI) @@ -210,21 +210,21 @@ class STCStyleEditDlg(wxDialog): self.contextHelpButton1 = wxContextHelpButton(parent=self, pos=wxPoint(8, 423), size=wxSize(24, 24), style=wxBU_AUTODRAW) self.contextHelpButton1.SetConstraints(LayoutAnchors(self.contextHelpButton1, - true, false, false, true)) + True, False, False, True)) self.okBtn = wxButton(id=wxID_STCSTYLEEDITDLGOKBTN, label='OK', name='okBtn', parent=self, pos=wxPoint(282, 423), size=wxSize(75, 23), style=0) - self.okBtn.SetConstraints(LayoutAnchors(self.okBtn, false, false, true, - true)) + 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(366, 423), size=wxSize(75, 23), style=0) - self.cancelBtn.SetConstraints(LayoutAnchors(self.cancelBtn, false, - false, true, true)) + 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) @@ -303,8 +303,8 @@ class STCStyleEditDlg(wxDialog): self.staticBox2 = wxStaticBox(id=wxID_STCSTYLEEDITDLGSTATICBOX2, label='Text attributes', name='staticBox2', parent=self.panel4, pos=wxPoint(0, 0), size=wxSize(112, 99), style=0) - self.staticBox2.SetConstraints(LayoutAnchors(self.staticBox2, false, - true, true, false)) + self.staticBox2.SetConstraints(LayoutAnchors(self.staticBox2, False, + True, True, False)) self.staticBox2.SetHelpText('Text attribute flags.') self.staticText2 = wxStaticText(id=wxID_STCSTYLEEDITDLGSTATICTEXT2, @@ -358,8 +358,8 @@ class STCStyleEditDlg(wxDialog): self.staticBox1 = wxStaticBox(id=wxID_STCSTYLEEDITDLGSTATICBOX1, label='Colour', name='staticBox1', parent=self.panel3, pos=wxPoint(0, 0), size=wxSize(142, 99), style=0) - self.staticBox1.SetConstraints(LayoutAnchors(self.staticBox1, false, - true, true, false)) + self.staticBox1.SetConstraints(LayoutAnchors(self.staticBox1, False, + True, True, False)) self.faceDefCb = wxCheckBox(id=wxID_STCSTYLEEDITDLGFACEDEFCB, label='checkBox1', name='faceDefCb', parent=self.panel1, @@ -384,7 +384,7 @@ class STCStyleEditDlg(wxDialog): self.names = [] self.values = {} self.STCsToUpdate = STCsToUpdate - self._blockUpdate = false + self._blockUpdate = False for combo, okBtn, evtRet, evtCB, evtRDC in ( @@ -408,12 +408,12 @@ class STCStyleEditDlg(wxDialog): margin = 0 self.stc.SetMarginType(margin, wxSTC_MARGIN_NUMBER) self.stc.SetMarginWidth(margin, 25) - self.stc.SetMarginSensitive(margin, true) + self.stc.SetMarginSensitive(margin, True) EVT_STC_MARGINCLICK(self.stc, wxID_STCSTYLEEDITDLGSTC, self.OnMarginClick) - self.stc.SetUseTabs(false) + self.stc.SetUseTabs(False) self.stc.SetTabWidth(4) - self.stc.SetIndentationGuides(true) + self.stc.SetIndentationGuides(True) self.stc.SetEdgeMode(wxSTC_EDGE_BACKGROUND) self.stc.SetEdgeColumn(44) @@ -448,7 +448,7 @@ class STCStyleEditDlg(wxDialog): ((self.faceCb, self.faceOkBtn, self.fixedWidthChk), self.faceDefCb, 'face', wxID_STCSTYLEEDITDLGFACEDEFCB)] - self.clearCtrls(disableDefs=true) + self.clearCtrls(disableDefs=True) # centralised default checkbox event handler self.chbIdMap = {} for ctrl, chb, prop, wid in self.allCtrls: @@ -479,12 +479,12 @@ class STCStyleEditDlg(wxDialog): try: self.updateStyle() - return true + return True except KeyError, errkey: wxLogError('Name not found in Common definition, '\ 'please enter valid reference. (%s)'%errkey) self.restoreStyles(oldstyle) - return false + return False #---Control population methods-------------------------------------------------- def setStyles(self): @@ -512,8 +512,8 @@ class STCStyleEditDlg(wxDialog): def findInStyles(self, txt, styles): for style in styles: if string.find(style, txt) != -1: - return true - return false + return True + return False def rememberStyles(self): return self.names[:], copy.copy(self.values) @@ -522,8 +522,8 @@ class STCStyleEditDlg(wxDialog): self.names, self.values = style self.updateStyle() - def clearCtrls(self, isDefault=false, disableDefs=false): - self._blockUpdate = true + def clearCtrls(self, isDefault=False, disableDefs=False): + self._blockUpdate = True try: for ctrl, chb, prop, wid in self.allCtrls: if prop in ('fore', 'back'): @@ -546,18 +546,18 @@ class STCStyleEditDlg(wxDialog): cmb.Enable(isDefault) btn.Enable(isDefault) chk.Enable(isDefault) - chk.SetValue(false) + chk.SetValue(False) elif prop in ('bold', 'italic', 'underline', 'eolfilled'): - ctrl.SetValue(false) + ctrl.SetValue(False) ctrl.Enable(isDefault) chb.Enable(not isDefault and not disableDefs) - chb.SetValue(true) + chb.SetValue(True) finally: - self._blockUpdate = false + self._blockUpdate = False - def populateProp(self, items, default, forceDisable=false): - self._blockUpdate = true + def populateProp(self, items, default, forceDisable=False): + self._blockUpdate = True try: for name, val in items: if name: @@ -588,10 +588,10 @@ class STCStyleEditDlg(wxDialog): chb.SetValue(default) elif name in ('bold', 'italic', 'underline', 'eolfilled'): ctrl.Enable(not forceDisable) - ctrl.SetValue(true) + ctrl.SetValue(True) chb.SetValue(default) finally: - self._blockUpdate = false + self._blockUpdate = False def valIsCommonDef(self, val): return len(val) >= 5 and val[:2] == '%(' @@ -602,15 +602,15 @@ class STCStyleEditDlg(wxDialog): # handle colour controls for settings if self.styleNum < 0: - self.fgColDefCb.Enable(true) + self.fgColDefCb.Enable(True) if self.styleNum == -1: - self.bgColDefCb.Enable(true) + self.bgColDefCb.Enable(True) # populate with default style - self.populateProp(self.defValues.items(), true, + self.populateProp(self.defValues.items(), True, self.styleNum != wxSTC_STYLE_DEFAULT) # override with current settings - self.populateProp(self.values.items(), false) + self.populateProp(self.values.items(), False) def getCommonDefPropType(self, commonDefName): val = self.commonDefs[commonDefName] @@ -627,7 +627,7 @@ class STCStyleEditDlg(wxDialog): btn.SetToolTipString('Accept value') def populateCombosWithCommonDefs(self, fixedWidthOnly=None): - self._blockUpdate = true + self._blockUpdate = True try: commonDefs = {'fore': [], 'face': [], 'size': []} @@ -665,7 +665,7 @@ class STCStyleEditDlg(wxDialog): self.sizeCb.Append(colCommonDef) self.sizeCb.SetValue(currSize) finally: - self._blockUpdate = false + self._blockUpdate = False def populateStyleSelector(self): numStyles = self.styleIdNames.items() @@ -714,7 +714,7 @@ class STCStyleEditDlg(wxDialog): def getColourDlg(self, colour, title=''): data = wxColourData() data.SetColour(colour) - data.SetChooseFull(true) + data.SetChooseFull(True) dlg = wxColourDialog(self, data) try: dlg.SetTitle(title) @@ -734,7 +734,7 @@ class STCStyleEditDlg(wxDialog): colBtn.SetBackgroundColour(col) colStr = colToStr(col) colCb.SetValue(colStr) - self.editProp(true, prop, colStr) + self.editProp(True, prop, colStr) def OnFgcolbtnButton(self, event): self.editColProp(self.fgColBtn, self.fgColCb, 'fore') @@ -794,7 +794,7 @@ class STCStyleEditDlg(wxDialog): if self.valIsCommonDef(val): idx = self.elementLb.FindString(val) if idx != -1: - self.elementLb.SetSelection(idx, true) + self.elementLb.SetSelection(idx, True) self.OnElementlbListbox(None) def OnfaceRet(self, event): @@ -832,22 +832,22 @@ class STCStyleEditDlg(wxDialog): if isCommon: common = styleIdent[2:-2] prop = self.getCommonDefPropType(common) - self.clearCtrls(disableDefs=true) + self.clearCtrls(disableDefs=True) if prop == 'fore': - self.fgColBtn.Enable(true) - self.fgColCb.Enable(true) - self.fgColOkBtn.Enable(true) + self.fgColBtn.Enable(True) + self.fgColCb.Enable(True) + self.fgColOkBtn.Enable(True) elif prop == 'face': - self.faceCb.Enable(true) - self.fixedWidthChk.Enable(true) - self.faceOkBtn.Enable(true) + self.faceCb.Enable(True) + self.fixedWidthChk.Enable(True) + self.faceOkBtn.Enable(True) elif prop == 'size': - self.sizeCb.Enable(true) - self.sizeOkBtn.Enable(true) + self.sizeCb.Enable(True) + self.sizeOkBtn.Enable(True) commonDefVal = str(self.commonDefs[common]) self.styleDefST.SetLabel(commonDefVal) - self.populateProp( [(prop, commonDefVal)], true) + self.populateProp( [(prop, commonDefVal)], True) self.styleNum = 'common' self.style = [common, prop, commonDefVal] @@ -869,7 +869,7 @@ class STCStyleEditDlg(wxDialog): self.populateCtrls() # separator selected else: - self.clearCtrls(disableDefs=true) + self.clearCtrls(disableDefs=True) if styleIdent: self.styleDefST.SetLabel(styleCategoryDescriptions[styleIdent]) @@ -888,9 +888,9 @@ class STCStyleEditDlg(wxDialog): colStr = cmb.GetValue() #if prop == 'fore': colStr = self.fgColCb.GetValue() #else: colStr = self.bgColCb.GetValue() - if colStr: self.editProp(true, prop, colStr) + if colStr: self.editProp(True, prop, colStr) else: - self.editProp(false, prop) + self.editProp(False, prop) elif prop == 'size': cmb, btn = ctrl val = cmb.GetValue() @@ -974,7 +974,7 @@ class STCStyleEditDlg(wxDialog): self.commonDefs[name] = commonPropDefs[prop] self.elementLb.Append('%('+name+')'+\ (type(commonPropDefs[prop]) is type('') and 's' or 'd')) - self.elementLb.SetSelection(self.elementLb.Number()-1, true) + self.elementLb.SetSelection(self.elementLb.Number()-1, True) self.populateCombosWithCommonDefs() self.OnElementlbListbox(None) finally: @@ -1006,7 +1006,7 @@ class STCStyleEditDlg(wxDialog): self.elementLb.Delete(selIdx) if selIdx == self.elementLb.Number(): selIdx = selIdx - 1 - self.elementLb.SetSelection(selIdx, true) + self.elementLb.SetSelection(selIdx, True) self.OnElementlbListbox(None) #---STC events------------------------------------------------------------------ @@ -1014,9 +1014,9 @@ class STCStyleEditDlg(wxDialog): styleBefore = self.stc.GetStyleAt(self.stc.GetCurrentPos()) if self.styleIdNames.has_key(styleBefore): self.elementLb.SetStringSelection(self.styleIdNames[styleBefore], - true) + True) else: - self.elementLb.SetSelection(0, false) + self.elementLb.SetSelection(0, False) self.styleDefST.SetLabel('Style %d not defined, sorry.'%styleBefore) self.OnElementlbListbox(None) event.Skip() @@ -1043,7 +1043,7 @@ class STCStyleEditDlg(wxDialog): event.Skip() def OnMarginClick(self, event): - self.elementLb.SetStringSelection('Line numbers', true) + self.elementLb.SetStringSelection('Line numbers', True) self.OnElementlbListbox(None) @@ -1096,9 +1096,9 @@ class CommonDefDlg(wxDialog): def setSelectionColour(stc, style): names, values = parseProp(style) if 'fore' in names: - stc.SetSelForeground(true, strToCol(values['fore'])) + stc.SetSelForeground(True, strToCol(values['fore'])) if 'back' in names: - stc.SetSelBackground(true, strToCol(values['back'])) + stc.SetSelBackground(True, strToCol(values['back'])) def setCursorColour(stc, style): names, values = parseProp(style) @@ -1184,7 +1184,7 @@ def setSTCStyles(stc, styles, styleIdNames, commonDefs, lang, lexer, keywords): stc.SetBackgroundColour(bkCol) # Set the styles on the wxSTC -# stc.Show(false) +# stc.Show(False) stc.StyleResetDefault() stc.ClearDocumentStyle() stc.SetLexer(lexer) @@ -1204,7 +1204,7 @@ def setSTCStyles(stc, styles, styleIdNames, commonDefs, lang, lexer, keywords): setEdgeColour(stc, style % commonDefs) stc.Colourise(0, stc.GetTextLength()) -# stc.Show(true) +# stc.Show(True) return newStyles, styleDict, styleNumIdxMap @@ -1216,7 +1216,7 @@ def readPyValFromConfig(conf, name): def initFromConfig(configFile, lang): cfg = wxFileConfig(localFilename=configFile, style=wxCONFIG_USE_LOCAL_FILE) - cfg.SetExpandEnvVars(false) + cfg.SetExpandEnvVars(False) # read in all group names for this language groupPrefix = 'style.%s'%lang @@ -1328,7 +1328,7 @@ if __name__ == '__main__': stc.SetText(open('STCStyleEditor.py').read()) EVT_LEFT_DCLICK(stc, OnDblClick) initSTC(stc, config, 'python') - f.Show(true) + f.Show(True) app.MainLoop() else: dlg = STCStyleEditDlg(None, diff --git a/wxPython/samples/doodle/doodle.py b/wxPython/samples/doodle/doodle.py index 8fefcd0416..4895026e74 100644 --- a/wxPython/samples/doodle/doodle.py +++ b/wxPython/samples/doodle/doodle.py @@ -74,7 +74,7 @@ class DoodleWindow(wxWindow): dc.SetBackground(wxBrush(self.GetBackgroundColour())) dc.Clear() self.DrawLines(dc) - self.reInitBuffer = false + self.reInitBuffer = False def SetColour(self, colour): @@ -125,14 +125,14 @@ class DoodleWindow(wxWindow): def OnCheckMenuColours(self, event): text = self.menuColours[event.GetId()] if text == self.colour: - event.Check(true) + event.Check(True) else: - event.Check(false) + event.Check(False) def OnCheckMenuThickness(self, event): if event.GetId() == self.thickness: - event.Check(true) + event.Check(True) else: - event.Check(false) + event.Check(False) def OnLeftDown(self, event): @@ -180,7 +180,7 @@ class DoodleWindow(wxWindow): Called when the window is resized. We set a flag so the idle handler will resize the buffer. """ - self.reInitBuffer = true + self.reInitBuffer = True def OnIdle(self, event): @@ -192,7 +192,7 @@ class DoodleWindow(wxWindow): """ if self.reInitBuffer: self.InitBuffer() - self.Refresh(FALSE) + self.Refresh(False) def OnPaint(self, event): @@ -251,6 +251,6 @@ class DoodleFrame(wxFrame): if __name__ == '__main__': app = wxPySimpleApp() frame = DoodleFrame(None) - frame.Show(true) + frame.Show(True) app.MainLoop() diff --git a/wxPython/samples/doodle/superdoodle.py b/wxPython/samples/doodle/superdoodle.py index 1923d13654..08ee49339e 100644 --- a/wxPython/samples/doodle/superdoodle.py +++ b/wxPython/samples/doodle/superdoodle.py @@ -53,7 +53,7 @@ class DoodleFrame(wxFrame): # Tell the frame that it should layout itself in response to # size events. - self.SetAutoLayout(true) + self.SetAutoLayout(True) self.SetSizer(box) @@ -213,7 +213,7 @@ class ControlPanel(wxPanel): box.Add(tGrid, 0, wxALL, spacing) box.Add(ci, 0, wxEXPAND|wxALL, spacing) self.SetSizer(box) - self.SetAutoLayout(true) + self.SetAutoLayout(True) # Resize this window so it is just large enough for the # minimum requirements of the sizer. @@ -348,7 +348,7 @@ instructions:

lc.height.AsIs() button.SetConstraints(lc) - self.SetAutoLayout(true) + self.SetAutoLayout(True) self.Layout() self.CentreOnParent(wxBOTH) @@ -358,9 +358,9 @@ instructions:

class DoodleApp(wxApp): def OnInit(self): frame = DoodleFrame(None) - frame.Show(true) + frame.Show(True) self.SetTopWindow(frame) - return true + return True #---------------------------------------------------------------------- diff --git a/wxPython/samples/frogedit/FrogEdit.py b/wxPython/samples/frogedit/FrogEdit.py index ee46be3474..157b0e043e 100644 --- a/wxPython/samples/frogedit/FrogEdit.py +++ b/wxPython/samples/frogedit/FrogEdit.py @@ -12,8 +12,6 @@ from wxPython.wx import * from StatusBar import * from FrogEditor import FrogEditor -TRUE = 1 -FALSE = 0 ABOUT_TEXT = """FrogEdit : Copyright 2001 Adam Feuer and 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): splitter.SplitHorizontally(win, log) - splitter.SetSashPosition(360, true) + splitter.SetSashPosition(360, True) splitter.SetMinimumPaneSize(40) def MakeToolbar(self, win): @@ -109,7 +107,7 @@ class FrogEditFrame(wxFrame): borderWidth = 5 mainBox.Add(self.edl, 1, wxALL|wxGROW, borderWidth) win.SetSizer(mainBox) - win.SetAutoLayout(true) + win.SetAutoLayout(True) ##-------------- Init Menus @@ -180,9 +178,9 @@ class FrogEditFrame(wxFrame): result = dialog.ShowModal() dialog.Destroy() if result == wxID_OK: - return TRUE + return True else: - return FALSE + return False def SelectFileDialog(self, defaultDir=None, defaultFile=None, wildCard=None): if defaultDir == None: @@ -247,9 +245,9 @@ class FrogEditFrame(wxFrame): f.close() self.edl.UnTouchBuffer() self.sb.setFileName(fileName) - return TRUE + return True except: - return FALSE + return False def OpenFile(self, fileName): try: @@ -262,9 +260,9 @@ class FrogEditFrame(wxFrame): self.edl.SetText(contents) self.fileName = fileName self.sb.setFileName(fileName) - return TRUE + return True except: - return FALSE + return False @@ -288,7 +286,7 @@ class FrogEditFrame(wxFrame): return fileName = self.SelectFileDialog(self.GetCurrentDir()) if fileName is not None: - if self.OpenFile(fileName) is FALSE: + if self.OpenFile(fileName) is False: self.OpenFileError(fileName) self.edl.SetFocus() @@ -296,7 +294,7 @@ class FrogEditFrame(wxFrame): if self.fileName is None: return self.OnSaveFileAs(event) 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.edl.SetFocus() @@ -305,7 +303,7 @@ class FrogEditFrame(wxFrame): if fileName is not None: self.fileName = 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.edl.SetFocus() @@ -331,7 +329,7 @@ class FrogEditFrame(wxFrame): def LoadInitialFile(self, fileName): if fileName is not None: - if self.OpenFile(fileName) is FALSE: + if self.OpenFile(fileName) is False: self.OpenFileError(fileName) @@ -354,7 +352,7 @@ class FrogEditLauncher: def Main(self): app = wxPySimpleApp() win = self.MakeAppFrame() - win.Show(true) + win.Show(True) win.LoadInitialFile(self.GetArgvFilename()) app.MainLoop() diff --git a/wxPython/samples/pySketch/pySketch.py b/wxPython/samples/pySketch/pySketch.py index 1a02372fdf..2340d45e8a 100644 --- a/wxPython/samples/pySketch/pySketch.py +++ b/wxPython/samples/pySketch/pySketch.py @@ -354,7 +354,7 @@ class DrawingFrame(wxFrame): style=wxSUNKEN_BORDER) 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) EVT_LEFT_DOWN(self.drawPanel, self.onMouseEvent) @@ -370,7 +370,7 @@ class DrawingFrame(wxFrame): topSizer.Add(self.toolPalette, 0) topSizer.Add(self.drawPanel, 1, wxEXPAND) - self.topPanel.SetAutoLayout(true) + self.topPanel.SetAutoLayout(True) self.topPanel.SetSizer(topSizer) self.SetSizeHints(minW=250, minH=200) @@ -383,7 +383,7 @@ class DrawingFrame(wxFrame): # Setup our frame to hold the contents of a sketch document. - self.dirty = false + self.dirty = False self.fileName = fileName self.contents = [] # front-to-back ordered list of DrawingObjects. self.selection = [] # List of selected DrawingObjects. @@ -492,32 +492,32 @@ class DrawingFrame(wxFrame): feedbackType = feedback_RECT action = self.selectByRectangle actionParam = param_RECT - selecting = true - dashedLine = true + selecting = True + dashedLine = True elif self.curTool == self.lineIcon: feedbackType = feedback_LINE action = self.createLine actionParam = param_LINE - selecting = false - dashedLine = false + selecting = False + dashedLine = False elif self.curTool == self.rectIcon: feedbackType = feedback_RECT action = self.createRect actionParam = param_RECT - selecting = false - dashedLine = false + selecting = False + dashedLine = False elif self.curTool == self.ellipseIcon: feedbackType = feedback_ELLIPSE action = self.createEllipse actionParam = param_RECT - selecting = false - dashedLine = false + selecting = False + dashedLine = False elif self.curTool == self.textIcon: feedbackType = feedback_RECT action = self.createText actionParam = param_RECT - selecting = false - dashedLine = true + selecting = False + dashedLine = True else: wxBell() return @@ -576,7 +576,7 @@ class DrawingFrame(wxFrame): endPt = wxPoint(self.curPt.x + self.resizeOffsetX, self.curPt.y + self.resizeOffsetY) self._drawVisualFeedback(self.resizeAnchor, endPt, - self.resizeFeedback, false) + self.resizeFeedback, False) elif selecting and (self._getObjectAt(mousePt) != None): @@ -615,13 +615,13 @@ class DrawingFrame(wxFrame): endPt = wxPoint(self.curPt.x + self.resizeOffsetX, self.curPt.y + self.resizeOffsetY) self._drawVisualFeedback(self.resizeAnchor, endPt, - self.resizeFeedback, false) + self.resizeFeedback, False) self.curPt = mousePt # Draw new visual feedback. endPt = wxPoint(self.curPt.x + self.resizeOffsetX, self.curPt.y + self.resizeOffsetY) self._drawVisualFeedback(self.resizeAnchor, endPt, - self.resizeFeedback, false) + self.resizeFeedback, False) elif self.dragMode == drag_MOVE: @@ -664,7 +664,7 @@ class DrawingFrame(wxFrame): endPt = wxPoint(self.curPt.x + self.resizeOffsetX, self.curPt.y + self.resizeOffsetY) self._drawVisualFeedback(self.resizeAnchor, endPt, - self.resizeFeedback, false) + self.resizeFeedback, False) resizePt = wxPoint(mousePt.x + self.resizeOffsetX, mousePt.y + self.resizeOffsetY) @@ -748,7 +748,7 @@ class DrawingFrame(wxFrame): editor.dialogToObject(obj) editor.Destroy() - self.dirty = true + self.dirty = True self.drawPanel.Refresh() self._adjustMenus() else: @@ -815,9 +815,9 @@ class DrawingFrame(wxFrame): for i in range(len(self.contents)-1, -1, -1): obj = self.contents[i] if obj in self.selection: - obj.draw(dc, true) + obj.draw(dc, True) else: - obj.draw(dc, false) + obj.draw(dc, False) dc.EndDrawing() @@ -830,7 +830,7 @@ class DrawingFrame(wxFrame): """ global _docList newFrame = DrawingFrame(None, -1, "Untitled") - newFrame.Show(TRUE) + newFrame.Show(True) _docList.append(newFrame) @@ -857,7 +857,7 @@ class DrawingFrame(wxFrame): # Open a new frame for this document. newFrame = DrawingFrame(None, -1, os.path.basename(fileName), fileName=fileName) - newFrame.Show(true) + newFrame.Show(True) _docList.append(newFrame) @@ -949,7 +949,7 @@ class DrawingFrame(wxFrame): for i in undoData["selection"]: self.selection.append(self.contents[i]) - self.dirty = true + self.dirty = True self.drawPanel.Refresh() self._adjustMenus() @@ -998,7 +998,7 @@ class DrawingFrame(wxFrame): editor.dialogToObject(obj) editor.Destroy() - self.dirty = true + self.dirty = True self.drawPanel.Refresh() self._adjustMenus() @@ -1184,14 +1184,14 @@ class DrawingFrame(wxFrame): panelSizer.Add(10, 10) # Spacer. panelSizer.Add(btnOK, 0, wxALL | wxALIGN_CENTRE, 5) - panel.SetAutoLayout(true) + panel.SetAutoLayout(True) panel.SetSizer(panelSizer) panelSizer.Fit(panel) topSizer = wxBoxSizer(wxHORIZONTAL) topSizer.Add(panel, 0, wxALL, 10) - dialog.SetAutoLayout(true) + dialog.SetAutoLayout(True) dialog.SetSizer(topSizer) topSizer.Fit(dialog) @@ -1223,7 +1223,7 @@ class DrawingFrame(wxFrame): startPt = wxPoint(x1 - topLeftX, y1 - topLeftY), endPt = wxPoint(x2 - topLeftX, y2 - topLeftY)) self.contents.insert(0, obj) - self.dirty = true + self.dirty = True self.doChooseSelectTool() self.select(obj) @@ -1239,7 +1239,7 @@ class DrawingFrame(wxFrame): fillColour=self.fillColour, lineSize=self.lineSize) self.contents.insert(0, obj) - self.dirty = true + self.dirty = True self.doChooseSelectTool() self.select(obj) @@ -1255,7 +1255,7 @@ class DrawingFrame(wxFrame): fillColour=self.fillColour, lineSize=self.lineSize) self.contents.insert(0, obj) - self.dirty = true + self.dirty = True self.doChooseSelectTool() self.select(obj) @@ -1276,7 +1276,7 @@ class DrawingFrame(wxFrame): editor.Destroy() self.contents.insert(0, obj) - self.dirty = true + self.dirty = True self.doChooseSelectTool() self.select(obj) @@ -1344,7 +1344,7 @@ class DrawingFrame(wxFrame): obj.setData(data) self.contents.append(obj) - self.dirty = false + self.dirty = False self.selection = [] self.undoInfo = None @@ -1363,7 +1363,7 @@ class DrawingFrame(wxFrame): cPickle.dump(objData, f) f.close() - self.dirty = false + self.dirty = False def askIfUserWantsToSave(self, action): @@ -1371,9 +1371,9 @@ class DrawingFrame(wxFrame): '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 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 + "?", "Confirm", wxYES_NO | wxCANCEL, self) @@ -1384,15 +1384,15 @@ class DrawingFrame(wxFrame): default_extension="psk", wildcard="*.psk", flags = wxSAVE | wxOVERWRITE_PROMPT) - if fileName == "": return false # User cancelled. + if fileName == "": return False # User cancelled. self.fileName = fileName self.saveContents() - return true + return True elif response == wxNO: - return true # User doesn't want changes saved. + return True # User doesn't want changes saved. elif response == wxCANCEL: - return false # User cancelled. + return False # User cancelled. # ===================== # == Private Methods == @@ -1434,8 +1434,8 @@ class DrawingFrame(wxFrame): # Enable/disable our toolbar icons. - self.toolbar.EnableTool(wxID_NEW, true) - self.toolbar.EnableTool(wxID_OPEN, true) + self.toolbar.EnableTool(wxID_NEW, True) + self.toolbar.EnableTool(wxID_OPEN, True) self.toolbar.EnableTool(wxID_SAVE, canSave) self.toolbar.EnableTool(menu_UNDO, canUndo) 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_5, "5-pixel line", kind=wxITEM_CHECK) - if lineSize == 0: menu.Check(id_LINESIZE_0, true) - elif lineSize == 1: menu.Check(id_LINESIZE_1, true) - elif lineSize == 2: menu.Check(id_LINESIZE_2, true) - elif lineSize == 3: menu.Check(id_LINESIZE_3, true) - elif lineSize == 4: menu.Check(id_LINESIZE_4, true) - elif lineSize == 5: menu.Check(id_LINESIZE_5, true) + if lineSize == 0: menu.Check(id_LINESIZE_0, True) + elif lineSize == 1: menu.Check(id_LINESIZE_1, True) + elif lineSize == 2: menu.Check(id_LINESIZE_2, True) + elif lineSize == 3: menu.Check(id_LINESIZE_3, True) + elif lineSize == 4: menu.Check(id_LINESIZE_4, True) + elif lineSize == 5: menu.Check(id_LINESIZE_5, True) EVT_MENU(self, id_LINESIZE_0, self._lineSizePopupSelected) EVT_MENU(self, id_LINESIZE_1, self._lineSizePopupSelected) @@ -1714,7 +1714,7 @@ class DrawingFrame(wxFrame): feedback_LINE -> draw line 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. 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). 'textFont' The text object's font name. '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. - 'textItalic' If true, this text object will be drawn in italic. - 'textUnderline' If true, this text object will be drawn underlined. + 'textItalic' If True, this text object will be drawn in italic. + 'textUnderline' If True, this text object will be drawn underlined. """ # ================== @@ -1803,9 +1803,9 @@ class DrawingObject: self.textFont = wxSystemSettings_GetSystemFont( wxSYS_DEFAULT_GUI_FONT).GetFaceName() self.textSize = 12 - self.textBoldface = false - self.textItalic = false - self.textUnderline = false + self.textBoldface = False + self.textItalic = False + self.textUnderline = False # ============================= # == Object Property Methods == @@ -2033,7 +2033,7 @@ class DrawingObject: """ Draw this DrawingObject into our window. '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.lineSize == 0: @@ -2052,21 +2052,21 @@ class DrawingObject: # ======================= 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. """ # Firstly, ignore any points outside of the object's bounds. - if x < self.position.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 + self.size.y: return false + if x < self.position.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 + self.size.y: return False if self.type in [obj_RECT, obj_TEXT]: # Rectangles and text are easy -- they're always selected if the # point is within their bounds. - return true + return True # Now things get tricky. There's no straightforward way of knowing # whether the point is within the object's bounds...to get around this, @@ -2082,13 +2082,13 @@ class DrawingObject: dc.Clear() dc.SetPen(wxPen(wxBLACK, self.lineSize + 5, wxSOLID)) dc.SetBrush(wxBLACK_BRUSH) - self._privateDraw(dc, wxPoint(5, 5), true) + self._privateDraw(dc, wxPoint(5, 5), True) dc.EndDrawing() 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): - return true + return True else: - return false + return False def getSelectionHandleContainingPoint(self, x, y): @@ -2124,13 +2124,13 @@ class DrawingObject: 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 + width < self.position.x + self.size.width: return false - if y > self.position.y: return false - if y + height < self.position.y + self.size.height: return false - return true + if x > self.position.x: return False + if x + width < self.position.x + self.size.width: return False + if y > self.position.y: return False + if y + height < self.position.y + self.size.height: return False + return True # ===================== # == Utility Methods == @@ -2163,7 +2163,7 @@ class DrawingObject: """ Private routine to draw this DrawingObject. '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 routine assumes that the pen and brush have already been set by the caller. @@ -2221,13 +2221,13 @@ class DrawingObject: 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 - elif x > rX + 3: return false - elif y < rY - 3: return false - elif y > rY + 3: return false - else: return true + if x < rX - 3: return False + elif x > rX + 3: return False + elif y < rY - 3: return False + elif y > rY + 3: return False + else: return True #---------------------------------------------------------------------------- @@ -2256,7 +2256,7 @@ class ToolPaletteIcon(wxStaticBitmap): self.iconID = iconID self.iconName = iconName - self.isSelected = false + self.isSelected = False def select(self): @@ -2269,7 +2269,7 @@ class ToolPaletteIcon(wxStaticBitmap): bmp = wxBitmap("images/" + self.iconName + "IconSel.bmp", wxBITMAP_TYPE_BMP) self.SetBitmap(bmp) - self.isSelected = true + self.isSelected = True def deselect(self): @@ -2282,7 +2282,7 @@ class ToolPaletteIcon(wxStaticBitmap): bmp = wxBitmap("images/" + self.iconName + "Icon.bmp", wxBITMAP_TYPE_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.italicCheckbox, style=wxITALIC) - self._setFontOptions(self.underlineCheckbox, underline=true) + self._setFontOptions(self.underlineCheckbox, underline=True) styleSizer = wxBoxSizer(wxHORIZONTAL) styleSizer.Add(self.boldCheckbox, 0, gap, 5) @@ -2421,7 +2421,7 @@ class EditTextObjectDialog(wxDialog): sizer.Add(10, 10) # Spacer. sizer.Add(btnSizer, 0, gap | wxALIGN_CENTRE, 5) - self.SetAutoLayout(true) + self.SetAutoLayout(True) self.SetSizer(sizer) sizer.Fit(self) @@ -2466,7 +2466,7 @@ class EditTextObjectDialog(wxDialog): def _setFontOptions(self, ctrl, family=None, pointSize=-1, style=wxNORMAL, weight=wxNORMAL, - underline=false): + underline=False): """ Change the font settings for the given control. The meaning of the 'family', 'pointSize', 'style', 'weight' and @@ -2486,7 +2486,7 @@ class EditTextObjectDialog(wxDialog): 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: wxMessageBox("A text object must contain some text!", "Error") - return false + return False else: - return true + return True def TransferToWindow(self): """ Transfer data from validator to window. - The default implementation returns false, indicating that an error - occurred. We simply return true, as we don't do any data transfer. + The default implementation returns False, indicating that an error + 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): """ Transfer data from window to validator. - The default implementation returns false, indicating that an error - occurred. We simply return true, as we don't do any data transfer. + The default implementation returns False, indicating that an error + 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. frame = DrawingFrame(None, -1, "Untitled") frame.Centre() - frame.Show(TRUE) + frame.Show(True) _docList.append(frame) else: # Load the file(s) specified on the command line. @@ -2611,10 +2611,10 @@ class SketchApp(wxApp): frame = DrawingFrame(None, -1, os.path.basename(fileName), fileName=fileName) - frame.Show(TRUE) + frame.Show(True) _docList.append(frame) - return TRUE + return True #---------------------------------------------------------------------------- diff --git a/wxPython/src/_extras.py b/wxPython/src/_extras.py index dbee2c12fd..d3b1e018c7 100644 --- a/wxPython/src/_extras.py +++ b/wxPython/src/_extras.py @@ -640,6 +640,9 @@ class _DeprecatedNonBool: import warnings warnings.warn("Use Python's %s instead" % self.__txt, DeprecationWarning, 3) return self.__val + def __nonzero__(self): + return self.__int__() + TRUE = true = _DeprecatedNonBool(True, 'True') FALSE = false = _DeprecatedNonBool(False, 'False') diff --git a/wxPython/src/gtk/wx.py b/wxPython/src/gtk/wx.py index c3e2bb5cc4..43827b38a2 100644 --- a/wxPython/src/gtk/wx.py +++ b/wxPython/src/gtk/wx.py @@ -1603,6 +1603,9 @@ class _DeprecatedNonBool: import warnings warnings.warn("Use Python's %s instead" % self.__txt, DeprecationWarning, 3) return self.__val + def __nonzero__(self): + return self.__int__() + TRUE = true = _DeprecatedNonBool(True, 'True') FALSE = false = _DeprecatedNonBool(False, 'False') diff --git a/wxPython/wxPython/lib/imagebrowser.py b/wxPython/wxPython/lib/imagebrowser.py index c2b5bb6e0e..6496bb1a13 100644 --- a/wxPython/wxPython/lib/imagebrowser.py +++ b/wxPython/wxPython/lib/imagebrowser.py @@ -144,7 +144,7 @@ class ImageDialog(wxDialog): 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() EVT_BUTTON(self, mID, self.SetDirect) @@ -158,7 +158,7 @@ class ImageDialog(wxDialog): self.list_height = 150 # 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) EVT_LISTBOX(self, mID, self.OnListClick) 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.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) EVT_COMBOBOX(self, mID, self.OnSetType) @@ -184,7 +184,7 @@ class ImageDialog(wxDialog): self.y_pos = self.y_pos + height + 20 - mID = NewId() + mID = wxNewId() wxButton(self, mID, ' Select ', wxPoint(100, self.y_pos), size).SetDefault() EVT_BUTTON(self, mID, self.OnOk)