Switched to using True/False in the wxPython lib and demo instead of

true/false or TRUE/FALSE to prepare for the new boolean type and
constants being added to Python.  Added code to wx.py to test for the
existence of the new constants and to create suitable values if not
present.


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@19335 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-02-26 18:38:37 +00:00
parent a57fa3cc36
commit 64dfb023eb
135 changed files with 953 additions and 946 deletions

View File

@@ -276,10 +276,10 @@ class wxPythonRExec (rexec.RExec):
class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
this_exception = 0
populate_function = populate_wxPyNonFatalErrorDialogWithTraceback
no_continue_button = false
fatal = false
modal = true
exitjustreturns = false # really only for testing!
no_continue_button = False
fatal = False
modal = True
exitjustreturns = False # really only for testing!
def __init__(self, parent, id,
pos=wxPyDefaultPosition,
@@ -293,7 +293,7 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
caption="Python error!",
versionname=None,
errorname=None,
disable_exit_button=false):
disable_exit_button=False):
if self.fatal:
whetherNF = ""
@@ -309,7 +309,7 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
wxDialog.__init__(self, parent, id, title, pos, size, style)
self.topsizer = self.populate_function( false,true )
self.topsizer = self.populate_function( False,True )
self.SetProgramName(programname)
self.SetVersion(version)
@@ -332,10 +332,10 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
if not disable_mail_button:
EVT_BUTTON(self, wxPyError_ID_MAIL, self.OnMail)
else:
self.GetMailButton().Enable(false)
self.GetMailButton().Enable(False)
# disable the entry box for an e-mail address by default (NOT PROPERLY DOCUMENTED)
if not hasattr(self,"enable_mail_address_box"):
self.FindWindowById(wxPyError_ID_ADDRESS).Enable(false)
self.FindWindowById(wxPyError_ID_ADDRESS).Enable(False)
if not disable_exit_button:
EVT_BUTTON(self, wxPyError_ID_EXIT, self.OnExit)
@@ -415,7 +415,7 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
self.sizerAroundText.SetItemMinSize (c,w,h)
c.SetSize ((w,h))
c.SetSizeHints (w,h,w,h)
c.Refresh()#.SetAutoLayout(FALSE)
c.Refresh()#.SetAutoLayout(False)
#^ the reason we need the above seems to be to replace the
#faulty GetBestSize of wxTextCtrl...
@@ -503,7 +503,7 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
if self.modal:
self.ShowModal()
else:
self.Show(true)
self.Show(True)
except:
if not locals().has_key("c"):
@@ -654,8 +654,8 @@ class wxPyNonFatalErrorDialogWithTraceback(wxDialog):
class wxPyFatalErrorDialogWithTraceback(wxPyNonFatalErrorDialogWithTraceback):
populate_function = populate_wxPyFatalErrorDialogWithTraceback
no_continue_button = true
fatal = true
no_continue_button = True
fatal = True
class wxPyNonFatalErrorDialog(wxPyNonFatalErrorDialogWithTraceback):
populate_function = populate_wxPyNonFatalErrorDialog
@@ -719,7 +719,7 @@ def _writehtmlmessage(mailto,subject,html,text=None,parent=None,mailfrom=None):
def _createhtmlmail (html, text, subject, to=None, mailfrom=None):
"""Create a mime-message that will render HTML in popular
MUAs, text in better ones (if indeed text is not untrue (e.g. None)
MUAs, text in better ones (if indeed text is not unTrue (e.g. None)
"""
import MimeWriter, mimetools, cStringIO
@@ -849,7 +849,7 @@ def wxPyFatalOrNonFatalError(parent,
else:
populate_function = populate_wxPyNonFatalError
sizer = populate_function(dlg,false,true)
sizer = populate_function(dlg,False,True)
window = dlg.FindWindowById(wxPyError_ID_HTML)
window.SetPage(msg)
@@ -875,5 +875,5 @@ def wxPyFatalOrNonFatalError(parent,
dlg.Destroy()
return v
else:
dlg.Show(true)
dlg.Show(True)

View File

@@ -21,7 +21,7 @@ getwxPythonImage
PythonBitmaps
--This takes a single argument. If it tests true,
--This takes a single argument. If it tests True,
getPythonPoweredBitmap() is returned, else getwxPythonBitmap() is
returned.

View File

@@ -36,7 +36,7 @@ import imageutils
class wxGenButtonEvent(wxPyCommandEvent):
def __init__(self, eventType, ID):
wxPyCommandEvent.__init__(self, eventType, ID)
self.isDown = false
self.isDown = False
self.theButton = None
def SetIsDown(self, isDown):
@@ -65,10 +65,10 @@ class wxGenButton(wxPyControl):
style = wxNO_BORDER
wxPyControl.__init__(self, parent, ID, pos, size, style, validator, name)
self.up = true
self.up = True
self.bezelWidth = 2
self.hasFocus = false
self.useFocusInd = true
self.hasFocus = False
self.useFocusInd = True
self.SetLabel(label)
self.SetPosition(pos)
@@ -133,7 +133,7 @@ class wxGenButton(wxPyControl):
return self.IsShown() and self.IsEnabled()
def Enable(self, enable=true):
def Enable(self, enable=True):
wxPyControl.Enable(self, enable)
self.Refresh()
@@ -194,7 +194,7 @@ class wxGenButton(wxPyControl):
def _GetLabelSize(self):
""" used internally """
w, h = self.GetTextExtent(self.GetLabel())
return w, h, true
return w, h, True
def Notify(self):
@@ -277,7 +277,7 @@ class wxGenButton(wxPyControl):
def OnLeftDown(self, event):
if not self.IsEnabled():
return
self.up = false
self.up = False
self.CaptureMouse()
self.SetFocus()
self.Refresh()
@@ -291,7 +291,7 @@ class wxGenButton(wxPyControl):
self.ReleaseMouse()
if not self.up: # if the button was down when the mouse was released...
self.Notify()
self.up = true
self.up = True
self.Refresh()
event.Skip()
@@ -303,18 +303,18 @@ class wxGenButton(wxPyControl):
x,y = event.GetPositionTuple()
w,h = self.GetClientSizeTuple()
if self.up and x<w and x>=0 and y<h and y>=0:
self.up = false
self.up = False
self.Refresh()
return
if not self.up and (x<0 or y<0 or x>=w or y>=h):
self.up = true
self.up = True
self.Refresh()
return
event.Skip()
def OnGainFocus(self, event):
self.hasFocus = true
self.hasFocus = True
dc = wxClientDC(self)
w, h = self.GetClientSizeTuple()
if self.useFocusInd:
@@ -322,7 +322,7 @@ class wxGenButton(wxPyControl):
def OnLoseFocus(self, event):
self.hasFocus = false
self.hasFocus = False
dc = wxClientDC(self)
w, h = self.GetClientSizeTuple()
if self.useFocusInd:
@@ -331,14 +331,14 @@ class wxGenButton(wxPyControl):
def OnKeyDown(self, event):
if self.hasFocus and event.KeyCode() == ord(" "):
self.up = false
self.up = False
self.Refresh()
event.Skip()
def OnKeyUp(self, event):
if self.hasFocus and event.KeyCode() == ord(" "):
self.up = true
self.up = True
self.Notify()
self.Refresh()
event.Skip()
@@ -375,17 +375,17 @@ class wxGenBitmapButton(wxGenButton):
def SetBitmapFocus(self, bitmap):
"""Set bitmap to display when the button has the focus"""
self.bmpFocus = bitmap
self.SetUseFocusIndicator(false)
self.SetUseFocusIndicator(False)
def SetBitmapSelected(self, bitmap):
"""Set bitmap to display when the button is selected (pressed down)"""
self.bmpSelected = bitmap
def SetBitmapLabel(self, bitmap, createOthers=true):
def SetBitmapLabel(self, bitmap, createOthers=True):
"""
Set the bitmap to display normally.
This is the only one that is required. If
createOthers is true, then the other bitmaps
createOthers is True, then the other bitmaps
will be generated on the fly. Currently,
only the disabled bitmap is generated.
"""
@@ -399,8 +399,8 @@ class wxGenBitmapButton(wxGenButton):
def _GetLabelSize(self):
""" used internally """
if not self.bmpLabel:
return -1, -1, false
return self.bmpLabel.GetWidth()+2, self.bmpLabel.GetHeight()+2, false
return -1, -1, False
return self.bmpLabel.GetWidth()+2, self.bmpLabel.GetHeight()+2, False
def DrawLabel(self, dc, width, height, dw=0, dy=0):
bmp = self.bmpLabel
@@ -433,7 +433,7 @@ class wxGenBitmapTextButton(wxGenBitmapButton): # generic bitmapped button w
""" used internally """
w, h = self.GetTextExtent(self.GetLabel())
if not self.bmpLabel:
return w, h, true # if there isn't a bitmap use the size of the text
return w, h, True # if there isn't a bitmap use the size of the text
w_bmp = self.bmpLabel.GetWidth()+2
h_bmp = self.bmpLabel.GetHeight()+2
@@ -442,7 +442,7 @@ class wxGenBitmapTextButton(wxGenBitmapButton): # generic bitmapped button w
height = h_bmp
else:
height = h
return width, height, true
return width, height, True
def DrawLabel(self, dc, width, height, dw=0, dy=0):

View File

@@ -43,7 +43,7 @@ class CalDraw:
self.DefParms()
def DefParms(self):
self.num_auto = TRUE # auto scale of the cal number day size
self.num_auto = True # auto scale of the cal number day size
self.num_size = 12 # default size of calendar if no auto size
self.max_num_size = 12 # maximum size for calendar number
@@ -52,7 +52,7 @@ class CalDraw:
self.num_indent_horz = 0 # points indent from position, used to offset if not centered
self.num_indent_vert = 0
self.week_auto = TRUE # auto scale of week font text
self.week_auto = True # auto scale of week font text
self.week_size = 10
self.max_week_size = 12
@@ -70,13 +70,13 @@ class CalDraw:
self.font = wxSWISS
self.bold = wxNORMAL
self.hide_title = FALSE
self.hide_grid = FALSE
self.outer_border = TRUE
self.hide_title = False
self.hide_grid = False
self.outer_border = True
self.title_offset = 0
self.cal_week_scale = 0.7
self.show_weekend = FALSE
self.show_weekend = False
self.cal_type = "NORMAL"
def SetWeekColor(self, font_color, week_color): # set font and background color for week title
@@ -122,7 +122,7 @@ class CalDraw:
self.InitScale()
self.DrawBorder()
if self.hide_title is FALSE:
if self.hide_title is False:
self.DrawMonth()
self.Center()
@@ -130,7 +130,7 @@ class CalDraw:
self.DrawGrid()
self.GetRect()
if self.show_weekend is TRUE: # highlight weekend dates
if self.show_weekend is True: # highlight weekend dates
self.SetWeekEnd()
self.AddSelect(sel_lst) # overrides the weekend highlight
@@ -153,7 +153,7 @@ class CalDraw:
self.DC.SetBrush(brush)
self.DC.SetPen(wxPen(wxNamedColour(self.border_color), 1))
if self.outer_border is TRUE:
if self.outer_border is True:
rect = wxRect(self.cx_st, self.cy_st, self.sizew, self.sizeh) # full display window area
self.DC.DrawRectangle(rect.x, rect.y, rect.width, rect.height)
@@ -244,7 +244,7 @@ class CalDraw:
rect_w = self.gridx[7]-self.gridx[0]
f = wxFont(10, self.font, wxNORMAL, self.bold) # initial font setting
if self.week_auto == TRUE:
if self.week_auto == True:
test_size = self.max_week_size # max size
test_day = ' Sun '
while test_size > 2:
@@ -288,7 +288,7 @@ class CalDraw:
def DrawNum(self): # draw the day numbers
f = wxFont(10, self.font, wxNORMAL, self.bold) # initial font setting
if self.num_auto == TRUE:
if self.num_auto == True:
test_size = self.max_num_size # max size
test_day = ' 99 '
while test_size > 2:
@@ -361,7 +361,7 @@ class CalDraw:
brush = wxBrush(wxNamedColour(sel_color), wxSOLID)
self.DC.SetBrush(brush)
if self.hide_grid is FALSE:
if self.hide_grid is False:
self.DC.SetPen(wxPen(wxNamedColour(self.grid_color), 0))
else:
self.DC.SetPen(wxPen(wxNamedColour(self.back_color), 0))
@@ -383,7 +383,7 @@ class CalDraw:
y2 = y1 + self.cheight
for i in range(8):
if self.hide_grid is FALSE:
if self.hide_grid is False:
self.DC.DrawLine(x1, y1, x1, y2)
self.gridx.append(x1)
x1 = x1 + self.dl_w
@@ -393,7 +393,7 @@ class CalDraw:
x2 = x1 + self.cwidth
for i in range(8):
if self.hide_grid is FALSE:
if self.hide_grid is False:
self.DC.DrawLine(x1, y1, x2, y1)
self.gridy.append(y1)
if i == 0:
@@ -428,10 +428,10 @@ class wxCalendar(wxWindow):
self.grid_color = 'BLACK'
self.back_color = 'WHITE'
self.hide_grid = FALSE
self.hide_grid = False
self.sel_color = 'RED'
self.hide_title = FALSE
self.show_weekend = FALSE
self.hide_title = False
self.show_weekend = False
self.cal_type = "NORMAL"
self.week_color = 'LIGHT GREY'
@@ -459,10 +459,10 @@ class wxCalendar(wxWindow):
# control some of the main calendar attributes
def HideTitle(self):
self.hide_title = TRUE
self.hide_title = True
def HideGrid(self):
self.hide_grid = TRUE
self.hide_grid = True
# determine the calendar rectangle click area and draw a selection
@@ -605,13 +605,13 @@ class wxCalendar(wxWindow):
self.select_list.append(list_val)
def ShowWeekEnd(self):
self.show_weekend = TRUE # highlight weekend
self.show_weekend = True # highlight weekend
def SetBusType(self):
self.cal_type = "BUS"
def OnSize(self, evt):
self.Refresh(false)
self.Refresh(False)
evt.Skip()
def OnPaint(self, event):
@@ -684,7 +684,7 @@ class wxCalendar(wxWindow):
def SelectDay(self, key):
sel_size = 1
self.DrawRect(self.sel_key, self.back_color, sel_size) # clear large selection
if self.hide_grid is FALSE:
if self.hide_grid is False:
self.DrawRect(self.sel_key, self.grid_color)
self.DrawRect(key, self.sel_color, sel_size)

View File

@@ -32,7 +32,7 @@ class PyColourBox(wxPanel):
sizer = wxGridSizer(1, 1)
sizer.Add(self.colour_box, 0, wxALIGN_CENTER_VERTICAL | wxALIGN_CENTER_HORIZONTAL)
sizer.SetItemMinSize(self.colour_box, size[0] - 5, size[1] - 5)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(sizer)
self.Layout()

View File

@@ -189,7 +189,7 @@ class wxPyColourChooser(wxPanel):
sizer.Add(csizer, 0, wxEXPAND)
sizer.Add(10, 1)
sizer.Add(vsizer, 0, wxEXPAND)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(sizer)
sizer.Fit(self)
@@ -208,10 +208,10 @@ class wxPyColourChooser(wxPanel):
"""Highlights the selected colour box and updates the solid colour
display and colour slider to reflect the choice."""
if hasattr(self, '_old_custom_highlight'):
self._old_custom_highlight.SetHighlight(false)
self._old_custom_highlight.SetHighlight(False)
if hasattr(self, '_old_colour_highlight'):
self._old_colour_highlight.SetHighlight(false)
box.SetHighlight(true)
self._old_colour_highlight.SetHighlight(False)
box.SetHighlight(True)
self._old_colour_highlight = box
self.UpdateColour(box.GetColour())
@@ -219,10 +219,10 @@ class wxPyColourChooser(wxPanel):
"""Highlights the selected custom colour box and updates the solid
colour display and colour slider to reflect the choice."""
if hasattr(self, '_old_colour_highlight'):
self._old_colour_highlight.SetHighlight(false)
self._old_colour_highlight.SetHighlight(False)
if hasattr(self, '_old_custom_highlight'):
self._old_custom_highlight.SetHighlight(false)
box.SetHighlight(true)
self._old_custom_highlight.SetHighlight(False)
box.SetHighlight(True)
self._old_custom_highlight = box
self.UpdateColour(box.GetColour())
@@ -281,13 +281,13 @@ def main():
chooser = wxPyColourChooser(frame, -1)
sizer = wxBoxSizer(wxVERTICAL)
sizer.Add(chooser, 0, 0)
frame.SetAutoLayout(true)
frame.SetAutoLayout(True)
frame.SetSizer(sizer)
sizer.Fit(frame)
frame.Show(true)
frame.Show(True)
self.SetTopWindow(frame)
return true
return True
app = App()
app.MainLoop()

View File

@@ -76,7 +76,7 @@ class ColourSelect(wxButton):
def OnClick(self, event):
data = wxColourData()
data.SetChooseFull(true)
data.SetChooseFull(True)
data.SetColour(self.set_colour_val)
dlg = wxColourDialog(self.GetParent(), data)
changed = dlg.ShowModal() == wxID_OK

View File

@@ -122,7 +122,7 @@ class wxEditor(wxScrolledWindow):
if wxPlatform == "__WXMSW__":
return wxFont(10, wxMODERN, wxNORMAL, wxNORMAL)
else:
return wxFont(12, wxMODERN, wxNORMAL, wxNORMAL, false)
return wxFont(12, wxMODERN, wxNORMAL, wxNORMAL, False)
def UnixKeyHack(self, key):
# this will be obsolete when we get the new wxWindows patch
@@ -162,7 +162,7 @@ class wxEditor(wxScrolledWindow):
if dc.Ok():
self.SetCharDimensions()
self.KeepCursorOnScreen()
self.DrawSimpleCursor(0,0,dc, true)
self.DrawSimpleCursor(0,0,dc, True)
self.Draw(dc)
def OnPaint(self, event):
@@ -256,7 +256,7 @@ class wxEditor(wxScrolledWindow):
self.DrawSimpleCursor(x, y, dc)
def DrawSimpleCursor(self, xp, yp, dc = None, old=false):
def DrawSimpleCursor(self, xp, yp, dc = None, old=False):
if not dc:
dc = wxClientDC(self)
@@ -353,13 +353,13 @@ class wxEditor(wxScrolledWindow):
return len(self.lines)
def UnTouchBuffer(self):
self.bufferTouched = FALSE
self.bufferTouched = False
def BufferWasTouched(self):
return self.bufferTouched
def TouchBuffer(self):
self.bufferTouched = TRUE
self.bufferTouched = True
##-------------------------- Mouse scroll timing functions
@@ -367,7 +367,7 @@ class wxEditor(wxScrolledWindow):
def InitScrolling(self):
# we don't rely on the windows system to scroll for us; we just
# redraw the screen manually every time
self.EnableScrolling(FALSE, FALSE)
self.EnableScrolling(False, False)
self.nextScrollTime = 0
self.SCROLLDELAY = 0.050 # seconds
self.scrollTimer = wxTimer(self)
@@ -376,12 +376,12 @@ class wxEditor(wxScrolledWindow):
def CanScroll(self):
if time.time() > self.nextScrollTime:
self.nextScrollTime = time.time() + self.SCROLLDELAY
return true
return True
else:
return false
return False
def SetScrollTimer(self):
oneShot = true
oneShot = True
self.scrollTimer.Start(1000*self.SCROLLDELAY/2, oneShot)
EVT_TIMER(self, -1, self.OnTimer)
@@ -448,7 +448,7 @@ class wxEditor(wxScrolledWindow):
def OnMotion(self, event):
if event.LeftIsDown() and self.HasCapture():
self.Selecting = true
self.Selecting = True
self.MouseToCursor(event)
self.SelectUpdate()
@@ -466,8 +466,8 @@ class wxEditor(wxScrolledWindow):
if self.SelectEnd is None:
self.OnClick()
else:
self.Selecting = false
self.SelectNotify(false, self.SelectBegin, self.SelectEnd)
self.Selecting = False
self.SelectNotify(False, self.SelectBegin, self.SelectEnd)
self.ReleaseMouse()
self.scrollTimer.Stop()
@@ -629,8 +629,8 @@ class wxEditor(wxScrolledWindow):
def SelectOff(self):
self.SelectBegin = None
self.SelectEnd = None
self.Selecting = false
self.SelectNotify(false,None,None)
self.Selecting = False
self.SelectNotify(False,None,None)
def CopySelection(self, event):
selection = self.FindSelection()
@@ -836,29 +836,29 @@ class wxEditor(wxScrolledWindow):
keySettingFunction(action)
if not action.has_key(key):
return false
return False
if event.ShiftDown():
if not self.Selecting:
self.Selecting = true
self.Selecting = True
self.SelectBegin = (self.cy, self.cx)
action[key](event)
self.SelectEnd = (self.cy, self.cx)
else:
action[key](event)
if self.Selecting:
self.Selecting = false
self.Selecting = False
self.SelectNotify(self.Selecting, self.SelectBegin, self.SelectEnd)
self.UpdateView()
return true
return True
def MoveSpecialKey(self, event, key):
return self.Move(self.SetMoveSpecialFuncs, key, event)
def MoveSpecialControlKey(self, event, key):
if not event.ControlDown():
return false
return False
return self.Move(self.SetMoveSpecialControlFuncs, key, event)
def Dispatch(self, keySettingFunction, key, event):
@@ -867,21 +867,21 @@ class wxEditor(wxScrolledWindow):
if action.has_key(key):
action[key](event)
self.UpdateView()
return true
return false
return True
return False
def ModifierKey(self, key, event, modifierKeyDown, MappingFunc):
if not modifierKeyDown:
return false
return False
key = self.UnixKeyHack(key)
try:
key = chr(key)
except:
return false
return False
if not self.Dispatch(MappingFunc, key, event):
wxBell()
return true
return True
def ControlKey(self, event, key):
return self.ModifierKey(key, event, event.ControlDown(), self.SetControlFuncs)
@@ -891,14 +891,14 @@ class wxEditor(wxScrolledWindow):
def SpecialControlKey(self, event, key):
if not event.ControlDown():
return false
return False
if not self.Dispatch(self.SetSpecialControlFuncs, key, event):
wxBell()
return true
return True
def ShiftKey(self, event, key):
if not event.ShiftDown():
return false
return False
return self.Dispatch(self.SetShiftFuncs, key, event)
def NormalChar(self, event, key):

View File

@@ -1,5 +1,5 @@
TRUE = 1
FALSE = 0
True = 1
False = 0
def RestOfLine(sx, width, data, bool):
if len(data) == 0 and sx == 0:
@@ -10,16 +10,16 @@ def RestOfLine(sx, width, data, bool):
def Selection(SelectBegin,SelectEnd, sx, width, line, data):
if SelectEnd is None or SelectBegin is None:
return RestOfLine(sx, width, data, FALSE)
return RestOfLine(sx, width, data, False)
(bRow, bCol) = SelectBegin
(eRow, eCol) = SelectEnd
if (eRow < bRow):
(bRow, bCol) = SelectEnd
(eRow, eCol) = SelectBegin
if (line < bRow or eRow < line):
return RestOfLine(sx, width, data, FALSE)
return RestOfLine(sx, width, data, False)
if (bRow < line and line < eRow):
return RestOfLine(sx, width, data, TRUE)
return RestOfLine(sx, width, data, True)
if (bRow == eRow) and (eCol < bCol):
(bCol, eCol) = (eCol, bCol)
# selection either starts or ends on this line
@@ -31,12 +31,12 @@ def Selection(SelectBegin,SelectEnd, sx, width, line, data):
pieces = []
if (sx < bCol):
if bCol <= end:
pieces += [(data[sx:bCol], FALSE)]
pieces += [(data[sx:bCol], False)]
else:
return [(data[sx:end], FALSE)]
pieces += [(data[max(bCol,sx):min(eCol,end)], TRUE)]
return [(data[sx:end], False)]
pieces += [(data[max(bCol,sx):min(eCol,end)], True)]
if (eCol < end):
pieces += [(data[eCol:end], FALSE)]
pieces += [(data[eCol:end], False)]
return pieces

View File

@@ -267,7 +267,7 @@ class EventManager:
def __haveMessageAdapter(self, eventHandler, topicPattern):
"""
Return true if there's already a message adapter
Return True if there's already a message adapter
with these specs.
"""
try:
@@ -325,7 +325,7 @@ class EventMacroInfo:
def eventIsA(self, event, macroList):
"""
Return true if the event is one of the given
Return True if the event is one of the given
macros.
"""
eventType = event.GetEventType()
@@ -337,7 +337,7 @@ class EventMacroInfo:
def macroIsA(self, macro, macroList):
"""
Return true if the macro is in the macroList.
Return True if the macro is in the macroList.
The added value of this method is that it takes
multi-events into account. The macroList parameter
will be coerced into a sequence if needed.
@@ -348,7 +348,7 @@ class EventMacroInfo:
eventList = []
for m in macroList:
eventList.extend(self.getEventTypes(m))
# Return true if every element in testList is in eventList
# Return True if every element in testList is in eventList
for element in testList:
if element not in eventList:
return 0
@@ -357,7 +357,7 @@ class EventMacroInfo:
def isMultiEvent(self, macro):
"""
Return true if the given macro actually causes
Return True if the given macro actually causes
multiple events to be registered.
"""
return len(self.getEventTypes(macro)) > 1

View File

@@ -13,7 +13,7 @@ encoding, and color. See the example on the bottom for a better idea
of how this works.
Note that start and end tags for the string are provided if enclose is
true, so for instance, renderToBitmap("X<sub>1</sub>") will work.
True, so for instance, renderToBitmap("X<sub>1</sub>") will work.
"""
# Copyright 2001 Timothy Hochberg

View File

@@ -64,7 +64,7 @@ class FileBrowseButton(wxPanel):
self.fileMask = fileMask
self.fileMode = fileMode
self.changeCallback = changeCallback
self.callCallback = true
self.callCallback = True
# get background to match it
@@ -106,7 +106,7 @@ class FileBrowseButton(wxPanel):
outsidebox.Add(box, 1, wxEXPAND|wxALL, 3)
outsidebox.Fit(self)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer( outsidebox )
self.Layout()
if type( size ) == types.TupleType:
@@ -195,7 +195,7 @@ class FileBrowseButton(wxPanel):
def SetLabel( self, value ):
""" Set the label's current text """
rvalue = self.label.SetLabel( value )
self.Refresh( true )
self.Refresh( True )
return rvalue
@@ -404,7 +404,7 @@ if __name__ == "__main__":
ID = wxNewId()
innerbox.Add( wxButton( panel, ID,"Change Value", ), 1, wxEXPAND)
EVT_BUTTON( self, ID, self.OnChangeValue )
panel.SetAutoLayout(true)
panel.SetAutoLayout(True)
panel.SetSizer( innerbox )
self.history={"c:\\temp":1, "c:\\tmp":1, "r:\\temp":1,"z:\\temp":1}
@@ -417,7 +417,7 @@ if __name__ == "__main__":
self.history[event.GetString ()]=1
def OnCloseMe(self, event):
self.Close(true)
self.Close(True)
def OnChangeLabel( self, event ):
self.bottomcontrol.SetLabel( "Label Updated" )
def OnChangeValue( self, event ):
@@ -433,9 +433,9 @@ if __name__ == "__main__":
wxImage_AddHandler(wxGIFHandler())
frame = DemoFrame(NULL)
#frame = RulesPanel(NULL )
frame.Show(true)
frame.Show(True)
self.SetTopWindow(frame)
return true
return True
def test( ):
app = DemoApp(0)

View File

@@ -50,8 +50,8 @@ else:
wxToolBar subclass which can be dragged off its frame and later
replaced there. Drag on the toolbar to release it, close it like
a normal window to make it return to its original
position. Programmatically, call SetFloatable(true) and then
Float(true) to float, Float(false) to dock.
position. Programmatically, call SetFloatable(True) and then
Float(True) to float, Float(False) to dock.
"""
def __init__(self,*_args,**_kwargs):
@@ -175,7 +175,7 @@ else:
newpos = self.parentframe.GetPosition()
newpos.y = newpos.y + _DOCKTHRESHOLD * 2
self.floatframe.SetPosition(newpos)
self.floatframe.Show(true)
self.floatframe.Show(True)
EVT_CLOSE(self.floatframe, self.OnDock)
#EVT_MOVE(self.floatframe, self.OnMove)
@@ -208,9 +208,9 @@ else:
#homepos = homepos[0], homepos[1] + self.titleheight
#floatpos = self.floatframe.GetPositionTuple()
#if abs(homepos[0] - floatpos[0]) < 35 and abs(homepos[1] - floatpos[1]) < 35:
# self._SetFauxBarVisible(true)
# self._SetFauxBarVisible(True)
#else:
# self._SetFauxBarVisible(false)
# self._SetFauxBarVisible(False)
def OnMouse(self, e):
@@ -240,7 +240,7 @@ else:
if e.Dragging():
if not self.IsFloating():
self.Float(true)
self.Float(True)
self.oldpos = (e.GetX(), e.GetY())
else:
if hasattr(self, 'oldpos'):

View File

@@ -219,8 +219,8 @@ class wxGridColMover(wxEvtHandler):
self.ux = self.grid.GetScrollPixelsPerUnit()[0]
self.startX = -10
self.cellX = 0
self.didMove = false
self.isDragging = false
self.didMove = False
self.isDragging = False
EVT_MOTION(self,self.OnMouseMove)
EVT_LEFT_DOWN(self,self.OnPress)
@@ -229,7 +229,7 @@ class wxGridColMover(wxEvtHandler):
def OnMouseMove(self,evt):
if self.isDragging:
if abs(self.startX - evt.m_x) >= 3:
self.didMove = true
self.didMove = True
sx,y = self.grid.GetViewStart()
w,h = self.lwin.GetClientSizeTuple()
x = sx * self.ux
@@ -241,12 +241,12 @@ class wxGridColMover(wxEvtHandler):
else: x /= self.ux
if x != sx:
if wxPlatform == '__WXMSW__':
self.colWin.Show(false)
self.colWin.Show(False)
self.grid.Scroll(x,y)
x,y = self.lwin.ClientToScreenXY(evt.m_x,0)
x,y = self.grid.ScreenToClientXY(x,y)
if not self.colWin.IsShown():
self.colWin.Show(true)
self.colWin.Show(True)
px = x - self.cellX
if px < 0 + self.grid._rlSize: px = 0 + self.grid._rlSize
if px > w - self.colWin.GetSizeTuple()[0] + self.grid._rlSize:
@@ -265,8 +265,8 @@ class wxGridColMover(wxEvtHandler):
evt.Skip()
return
self.isDragging = true
self.didMove = false
self.isDragging = True
self.didMove = False
col = self.grid.XToCol(px + sx)
rect = self.grid.ColToRect(col)
self.cellX = px + sx - rect.x
@@ -276,14 +276,14 @@ class wxGridColMover(wxEvtHandler):
rect.height = size[1]
colImg = self._CaptureImage(rect)
self.colWin = ColDragWindow(self.grid,colImg,col)
self.colWin.Show(false)
self.colWin.Show(False)
self.lwin.CaptureMouse()
def OnRelease(self,evt):
if self.isDragging:
self.lwin.ReleaseMouse()
self.colWin.Show(false)
self.isDragging = false
self.colWin.Show(False)
self.isDragging = False
if not self.didMove:
px = self.lwin.ClientToScreenXY(self.startX,0)[0]
px = self.grid.ScreenToClientXY(px,0)[0]
@@ -324,8 +324,8 @@ class wxGridRowMover(wxEvtHandler):
self.uy = self.grid.GetScrollPixelsPerUnit()[1]
self.startY = -10
self.cellY = 0
self.didMove = false
self.isDragging = false
self.didMove = False
self.isDragging = False
EVT_MOTION(self,self.OnMouseMove)
EVT_LEFT_DOWN(self,self.OnPress)
@@ -334,7 +334,7 @@ class wxGridRowMover(wxEvtHandler):
def OnMouseMove(self,evt):
if self.isDragging:
if abs(self.startY - evt.m_y) >= 3:
self.didMove = true
self.didMove = True
x,sy = self.grid.GetViewStart()
w,h = self.lwin.GetClientSizeTuple()
y = sy * self.uy
@@ -346,12 +346,12 @@ class wxGridRowMover(wxEvtHandler):
else: y /= self.uy
if y != sy:
if wxPlatform == '__WXMSW__':
self.rowWin.Show(false)
self.rowWin.Show(False)
self.grid.Scroll(x,y)
x,y = self.lwin.ClientToScreenXY(0,evt.m_y)
x,y = self.grid.ScreenToClientXY(x,y)
if not self.rowWin.IsShown():
self.rowWin.Show(true)
self.rowWin.Show(True)
py = y - self.cellY
if py < 0 + self.grid._clSize: py = 0 + self.grid._clSize
if py > h - self.rowWin.GetSizeTuple()[1] + self.grid._clSize:
@@ -370,8 +370,8 @@ class wxGridRowMover(wxEvtHandler):
evt.Skip()
return
self.isDragging = true
self.didMove = false
self.isDragging = True
self.didMove = False
row = self.grid.YToRow(py + sy)
rect = self.grid.RowToRect(row)
self.cellY = py + sy - rect.y
@@ -381,14 +381,14 @@ class wxGridRowMover(wxEvtHandler):
rect.width = size[0]
rowImg = self._CaptureImage(rect)
self.rowWin = RowDragWindow(self.grid,rowImg,row)
self.rowWin.Show(false)
self.rowWin.Show(False)
self.lwin.CaptureMouse()
def OnRelease(self,evt):
if self.isDragging:
self.lwin.ReleaseMouse()
self.rowWin.Show(false)
self.isDragging = false
self.rowWin.Show(False)
self.isDragging = False
if not self.didMove:
py = self.lwin.ClientToScreenXY(0,self.startY)[1]
py = self.grid.ScreenToClientXY(0,py)[1]

View File

@@ -187,7 +187,7 @@ class _MyStatusBar(wxStatusBar):
self.button2.SetLabel ("Open New File")
self.useopenbutton = 1 - self.useopenbutton
self.OnSize("")
self.button2.Refresh(TRUE)
self.button2.Refresh(True)
self.Refresh()
@@ -269,7 +269,7 @@ class wxPyInformationalMessagesFrame:
useopenbutton=hasattr(self,
"nofile"))
self.frame.SetStatusBar(self.frame.sb)
self.frame.Show(true)
self.frame.Show(True)
EVT_CLOSE(self.frame, self.OnCloseWindow)
if hasattr(self,"nofile"):
@@ -341,7 +341,7 @@ class wxPyInformationalMessagesFrame:
if m is not None:# and m.__dict__.has_key("__debug__"):
m.__dict__["__debug__"] = 0
if self.frame is not None: # typically true, but, e.g., allows
if self.frame is not None: # typically True, but, e.g., allows
# DisableOutput method (which calls this
# one) to be called when the frame is not
# actually open, so that it is always safe

View File

@@ -313,19 +313,19 @@ class wxIntValidator( wxPyValidator ):
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.
#----------------------------------------------------------------------------
@@ -373,7 +373,7 @@ class wxIntCtrl(wxTextCtrl):
limited
Boolean indicating whether the control prevents values from
exceeding the currently set minimum and maximum values (bounds).
If false and bounds are set, out-of-bounds values will
If False and bounds are set, out-of-bounds values will
be colored with the current out-of-bounds color.
allow_none
@@ -539,7 +539,7 @@ class wxIntCtrl(wxTextCtrl):
"""
This function is a convenience function for setting the min and max
values at the same time. The function only applies the maximum bound
if setting the minimum bound is successful, and returns true
if setting the minimum bound is successful, and returns True
only if both operations succeed.
NOTE: leaving out an argument will remove the corresponding bound.
"""
@@ -558,7 +558,7 @@ class wxIntCtrl(wxTextCtrl):
def SetLimited(self, limited):
"""
If called with a value of true, this function will cause the control
If called with a value of True, this function will cause the control
to limit the value to fall within the bounds currently specified.
If the control's value currently exceeds the bounds, it will then
be limited accordingly.
@@ -581,7 +581,7 @@ class wxIntCtrl(wxTextCtrl):
def IsLimited(self):
"""
Returns true if the control is currently limiting the
Returns True if the control is currently limiting the
value to fall within the current bounds.
"""
return self.__limited
@@ -589,7 +589,7 @@ class wxIntCtrl(wxTextCtrl):
def IsInBounds(self, value=None):
"""
Returns true if no value is specified and the current value
Returns True if no value is specified and the current value
of the control falls within the current bounds. This function can
also be called with a value to see if that value would fall within
the current bounds of the given control.
@@ -607,7 +607,7 @@ class wxIntCtrl(wxTextCtrl):
if min is None: min = value
if max is None: max = value
# if bounds set, and value is None, return false
# if bounds set, and value is None, return False
if value == None and (min is not None or max is not None):
return 0
else:
@@ -822,7 +822,7 @@ if __name__ == '__main__':
hs.AddWindow( self.Cancel, 0, wxALIGN_CENTRE|wxALL, 5 )
vs.AddSizer(hs, 0, wxALIGN_CENTRE|wxALL, 5 )
self.SetAutoLayout( true )
self.SetAutoLayout( True )
self.SetSizer( vs )
vs.Fit( self )
vs.SetSizeHints( self )
@@ -842,8 +842,8 @@ if __name__ == '__main__':
EVT_BUTTON(self, 10, self.OnClick)
except:
traceback.print_exc()
return false
return true
return False
return True
def OnClick(self, event):
dlg = myDialog(self.panel, -1, "test wxIntCtrl")
@@ -856,7 +856,7 @@ if __name__ == '__main__':
self.frame.Destroy()
def Show(self):
self.frame.Show(true)
self.frame.Show(True)
try:
app = TestApp(0)

View File

@@ -202,7 +202,7 @@ if __name__=='__main__':
wxPyDefaultPosition, wxSize(500, 300))
EVT_CLOSE(self, self.OnCloseWindow)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
EVT_BUTTON(self, 100, self.OnButton)
EVT_BUTTON(self, 101, self.OnAbout)
@@ -234,7 +234,7 @@ if __name__=='__main__':
wxStaticText(self.panelD, -1, "Panel D", wxPoint(4, 4)).SetBackgroundColour(wxGREEN)
def OnButton(self, event):
self.Close(true)
self.Close(True)
def OnAbout(self, event):
try:

View File

@@ -49,7 +49,7 @@ def boxToExtent(box):
def pointInBox(x, y, box):
"""
Return true if the given point is contained in the box.
Return True if the given point is contained in the box.
"""
e = boxToExtent(box)
return x >= e[0] and x <= e[2] and y >= e[1] and y <= e[3]
@@ -57,7 +57,7 @@ def pointInBox(x, y, box):
def pointOnBox(x, y, box, thickness=1):
"""
Return true if the point is on the outside edge
Return True if the point is on the outside edge
of the box. The thickness defines how thick the
edge should be. This is necessary for HCI reasons:
For example, it's normally very difficult for a user
@@ -133,14 +133,14 @@ class RubberBand:
def __isMovingCursor(self):
"""
Return true if the current cursor is one used to
Return True if the current cursor is one used to
mean moving the rubberband.
"""
return self.__currentCursor == wxCURSOR_HAND
def __isSizingCursor(self):
"""
Return true if the current cursor is one of the ones
Return True if the current cursor is one of the ones
I may use to signify sizing.
"""
sizingCursors = [wxCURSOR_SIZENESW,

View File

@@ -213,8 +213,8 @@ class wxMultiSplit(wxWindow):
def CanSize(self,side,view):
if self.SizeTarget(side,view):
return true
return false
return True
return False
def SizeTarget(self,side,view):
if self.direction == side and self.view2 and view == self.view1:
@@ -372,20 +372,20 @@ class MultiClient(wxWindow):
self.child = childCls(self)
self.child.MoveXY(2,2)
self.normalColour = self.GetBackgroundColour()
self.selected = false
self.selected = False
EVT_SET_FOCUS(self,self.OnSetFocus)
EVT_CHILD_FOCUS(self,self.OnChildFocus)
def UnSelect(self):
if self.selected:
self.selected = false
self.selected = False
self.SetBackgroundColour(self.normalColour)
self.Refresh()
def Select(self):
self.GetParent().multiView.UnSelect()
self.selected = true
self.selected = True
self.SetBackgroundColour(wxColour(255,255,0)) # Yellow
self.Refresh()
@@ -432,7 +432,7 @@ class MultiSizer(wxWindow):
self.px = None # Previous X
self.py = None # Previous Y
self.isDrag = false # In Dragging
self.isDrag = False # In Dragging
self.dragTarget = None # View being sized
EVT_LEAVE_WINDOW(self,self.OnLeave)
@@ -482,7 +482,7 @@ class MultiSizer(wxWindow):
def OnPress(self,evt):
self.dragTarget = self.GetParent().SizeTarget(not self.side)
if self.dragTarget:
self.isDrag = true
self.isDrag = True
self.px,self.py = self.ClientToScreenXY(evt.m_x,evt.m_y)
self.px,self.py = self.dragTarget.ScreenToClientXY(self.px,self.py)
DrawSash(self.dragTarget,self.px,self.py,self.side)
@@ -494,7 +494,7 @@ class MultiSizer(wxWindow):
if self.isDrag:
DrawSash(self.dragTarget,self.px,self.py,self.side)
self.ReleaseMouse()
self.isDrag = false
self.isDrag = False
if self.side == MV_HOR:
self.dragTarget.SizeLeaf(self.GetParent(),
self.py,not self.side)
@@ -519,7 +519,7 @@ class MultiCreator(wxWindow):
self.px = None # Previous X
self.py = None # Previous Y
self.isDrag = false # In Dragging
self.isDrag = False # In Dragging
EVT_LEAVE_WINDOW(self,self.OnLeave)
EVT_ENTER_WINDOW(self,self.OnEnter)
@@ -566,7 +566,7 @@ class MultiCreator(wxWindow):
evt.Skip()
def OnPress(self,evt):
self.isDrag = true
self.isDrag = True
parent = self.GetParent()
self.px,self.py = self.ClientToScreenXY(evt.m_x,evt.m_y)
self.px,self.py = parent.ScreenToClientXY(self.px,self.py)
@@ -578,7 +578,7 @@ class MultiCreator(wxWindow):
parent = self.GetParent()
DrawSash(parent,self.px,self.py,self.side)
self.ReleaseMouse()
self.isDrag = false
self.isDrag = False
if self.side == MV_HOR:
parent.AddLeaf(MV_VER,self.py)
@@ -622,8 +622,8 @@ class MultiCloser(wxWindow):
size = wxSize(w,h),
style = wxCLIP_CHILDREN)
self.down = false
self.entered = false
self.down = False
self.entered = False
EVT_LEFT_DOWN(self,self.OnPress)
EVT_LEFT_UP(self,self.OnRelease)
@@ -633,14 +633,14 @@ class MultiCloser(wxWindow):
def OnLeave(self,evt):
self.SetCursor(wxStockCursor(wxCURSOR_ARROW))
self.entered = false
self.entered = False
def OnEnter(self,evt):
self.SetCursor(wxStockCursor(wxCURSOR_BULLSEYE))
self.entered = true
self.entered = True
def OnPress(self,evt):
self.down = true
self.down = True
evt.Skip()
def OnRelease(self,evt):
@@ -648,7 +648,7 @@ class MultiCloser(wxWindow):
self.GetParent().DestroyLeaf()
else:
evt.Skip()
self.down = false
self.down = False
def OnPaint(self,evt):
dc = wxPaintDC(self)

View File

@@ -47,9 +47,9 @@ class MVCTreeNode:
if self.kids is None:
self.kids = []
self.data = data
self.expanded = false
self.selected = false
self.built = false
self.expanded = False
self.selected = False
self.built = False
self.scale = 0
def GetChildren(self):
@@ -136,7 +136,7 @@ class Painter:
self.bgcolor = wxNamedColour("WHITE")
self.fgcolor = wxNamedColour("BLUE")
self.linecolor = wxNamedColour("GREY")
self.font = wxFont(9, wxDEFAULT, wxNORMAL, wxNORMAL, false)
self.font = wxFont(9, wxDEFAULT, wxNORMAL, wxNORMAL, False)
self.bmp = None
def GetFont(self):
@@ -239,10 +239,10 @@ class wxTreeModel:
raise NotImplementedError
def IsEditable(self, node):
return false
return False
def SetEditable(self, node):
return false
return False
class NodePainter:
"""
@@ -330,10 +330,10 @@ class BasicTreeModel(wxTreeModel):
return not self.children.has_key(node)
def IsEditable(self, node):
return false
return False
def SetEditable(self, node, bool):
return false
return False
class FileEditor(Editor):
@@ -374,9 +374,9 @@ class FileEditor(Editor):
def _key(self, evt):
if evt.KeyCode() == WXK_RETURN:
self.EndEdit(true)
self.EndEdit(True)
elif evt.KeyCode() == WXK_ESCAPE:
self.EndEdit(false)
self.EndEdit(False)
else:
evt.Skip()
@@ -385,7 +385,7 @@ class FileEditor(Editor):
pos = evt.GetPosition()
edsize = self.editcomp.GetSize()
if pos.x < 0 or pos.y < 0 or pos.x > edsize.width or pos.y > edsize.height:
self.EndEdit(false)
self.EndEdit(False)
class FileWrapper:
@@ -408,7 +408,7 @@ class FSTreeModel(BasicTreeModel):
fw = FileWrapper(path, path.split(os.sep)[-1])
self._Build(path, fw)
self.SetRoot(fw)
self._editable = true
self._editable = True
def _Build(self, path, fileWrapper):
for name in os.listdir(path):
fw = FileWrapper(path, name)
@@ -435,7 +435,7 @@ class LateFSTreeModel(FSTreeModel):
fw = FileWrapper(pathpart, name)
self._Build(path, fw)
self.SetRoot(fw)
self._editable = true
self._editable = True
self.children = {}
self.parents = {}
def _Build(self, path, parent):
@@ -494,8 +494,8 @@ class Rect:
if other.y >= self.y:
if other.width + other.x <= self.width + self.x:
if other.height + other.y <= self.height + self.y:
return true
return false
return True
return False
def __str__(self):
return "Rect: " + str([self.x, self.y, self.width, self.height])
@@ -614,7 +614,7 @@ class TreePainter(Painter):
if node.expanded:
for kid in node.kids:
if not self.paintWalk(kid, dc, paintRects):
return false
return False
for kid in node.kids:
px = (kid.projx - self.tree.layout.NODE_STEP) + 5
py = kid.projy + kid.height/2
@@ -638,7 +638,7 @@ class TreePainter(Painter):
if not node.expanded:
dc.DrawLine(px, py -2, px, py + 3)
dc.DrawLine(px -2, py, px + 3, py)
return true
return True
def OnMouse(self, evt):
Painter.OnMouse(self, evt)
@@ -750,12 +750,12 @@ class wxMVCTree(wxScrolledWindow):
painter = None, *args, **kwargs):
apply(wxScrolledWindow.__init__, (self, parent, id), kwargs)
self.nodemap = {}
self._multiselect = false
self._multiselect = False
self._selections = []
self._assumeChildren = false
self._scrollx = false
self._scrolly = false
self.doubleBuffered = false
self._assumeChildren = False
self._scrollx = False
self._scrolly = False
self.doubleBuffered = False
self._lastPhysicalSize = self.GetSize()
self._editors = []
if not model:
@@ -771,10 +771,10 @@ class wxMVCTree(wxScrolledWindow):
if not painter:
painter = TreePainter(self)
self.painter = painter
self.SetFont(wxFont(9, wxDEFAULT, wxNORMAL, wxNORMAL, false))
self.SetFont(wxFont(9, wxDEFAULT, wxNORMAL, wxNORMAL, False))
EVT_MOUSE_EVENTS(self, self.OnMouse)
EVT_KEY_DOWN(self, self.OnKeyDown)
self.doubleBuffered = true
self.doubleBuffered = True
EVT_SIZE(self, self.OnSize)
EVT_ERASE_BACKGROUND(self, self.OnEraseBackground)
EVT_PAINT(self, self.OnPaint)
@@ -783,7 +783,7 @@ class wxMVCTree(wxScrolledWindow):
def Refresh(self):
if self.doubleBuffered:
self.painter.ClearBuffer()
wxScrolledWindow.Refresh(self, false)
wxScrolledWindow.Refresh(self, False)
def GetPainter(self):
return self.painter
@@ -874,7 +874,7 @@ class wxMVCTree(wxScrolledWindow):
self._selections = []
self.layoutRoot = MVCTreeNode()
self.layoutRoot.data = self.model.GetRoot()
self.layoutRoot.expanded = true
self.layoutRoot.expanded = True
self.LoadChildren(self.layoutRoot)
self.currentRoot = self.layoutRoot
self.offset = [0,0]
@@ -895,7 +895,7 @@ class wxMVCTree(wxScrolledWindow):
layoutNode.Add(p)
p.data = self.GetModel().GetChildAt(layoutNode.data, i)
self.nodemap[p.data]=p
layoutNode.built = true
layoutNode.built = True
if not self._assumeChildren:
for kid in layoutNode.kids:
self.LoadChildren(kid)
@@ -923,10 +923,10 @@ class wxMVCTree(wxScrolledWindow):
return
for node in nodeTuple:
treenode = self.nodemap[node]
treenode.selected = true
treenode.selected = True
for node in self._selections:
treenode = self.nodemap[node]
node.selected = false
node.selected = False
self._selections = list(nodeTuple)
e = wxMVCTreeEvent(wxEVT_MVCTREE_SEL_CHANGED, self.GetId(), nodeTuple[0], nodes = nodeTuple)
self.GetEventHandler().ProcessEvent(e)
@@ -962,9 +962,9 @@ class wxMVCTree(wxScrolledWindow):
e = wxMVCTreeNotifyEvent(wxEVT_MVCTREE_END_EDIT, self.GetId(), node)
self.GetEventHandler().ProcessEvent(e)
if not e.notify.IsAllowed():
return false
return False
self._currentEditor = None
return true
return True
def SetExpanded(self, node, bool):
@@ -995,7 +995,7 @@ class wxMVCTree(wxScrolledWindow):
def IsExpanded(self, node):
return self.nodemap[node].expanded
def AddToSelection(self, nodeOrTuple, enableMulti = true, shiftMulti = false):
def AddToSelection(self, nodeOrTuple, enableMulti = True, shiftMulti = False):
nodeTuple = nodeOrTuple
if type(nodeOrTuple)!= type(()):
nodeTuple = (nodeOrTuple,)
@@ -1007,13 +1007,13 @@ class wxMVCTree(wxScrolledWindow):
if not (self.IsMultiSelect() and (enableMulti or shiftMulti)):
for node in self._selections:
treenode = self.nodemap[node]
treenode.selected = false
treenode.selected = False
changeparents.append(treenode)
node = nodeTuple[0]
self._selections = [node]
treenode = self.nodemap[node]
changeparents.append(treenode)
treenode.selected = true
treenode.selected = True
else:
if shiftMulti:
for node in nodeTuple:
@@ -1024,11 +1024,11 @@ class wxMVCTree(wxScrolledWindow):
for kid in oldtreenode.parent.kids:
if kid == treenode or kid == oldtreenode:
found = not found
kid.selected = true
kid.selected = True
self._selections.append(kid.data)
changeparents.append(kid)
elif found:
kid.selected = true
kid.selected = True
self._selections.append(kid.data)
changeparents.append(kid)
else:
@@ -1038,7 +1038,7 @@ class wxMVCTree(wxScrolledWindow):
except ValueError:
self._selections.append(node)
treenode = self.nodemap[node]
treenode.selected = true
treenode.selected = True
changeparents.append(treenode)
e = wxMVCTreeEvent(wxEVT_MVCTREE_SEL_CHANGED, self.GetId(), nodeTuple[0], nodes = nodeTuple)
self.GetEventHandler().ProcessEvent(e)
@@ -1057,7 +1057,7 @@ class wxMVCTree(wxScrolledWindow):
self._selections.remove(node)
treenode = self.nodemap[node]
changeparents.append(treenode)
treenode.selected = false
treenode.selected = False
e = wxMVCTreeEvent(wxEVT_MVCTREE_SEL_CHANGED, self.GetId(), node, nodes = nodeTuple)
self.GetEventHandler().ProcessEvent(e)
dc = wxClientDC(self)
@@ -1101,14 +1101,14 @@ class wxMVCTree(wxScrolledWindow):
to paint the control.
"""
try:
self.EnableScrolling(false, false)
self.EnableScrolling(False, False)
if not self.laidOut:
self.layout.Layout(self.currentRoot)
self.laidOut = true
self.transformed = false
self.laidOut = True
self.transformed = False
if not self.transformed:
self.transform.Transform(self.currentRoot, self.offset, self.rotation)
self.transformed = true
self.transformed = True
tsize = None
tsize = list(self.transform.GetSize())
tsize[0] = tsize[0] + 50

View File

@@ -18,8 +18,8 @@ class PopButton(wxPyControl):
def __init__(self,*_args,**_kwargs):
apply(wxPyControl.__init__,(self,) + _args,_kwargs)
self.up = true
self.didDown = false
self.up = True
self.didDown = False
self.InitColours()
@@ -52,8 +52,8 @@ class PopButton(wxPyControl):
def OnLeftDown(self, event):
if not self.IsEnabled():
return
self.didDown = true
self.up = false
self.didDown = True
self.up = False
self.CaptureMouse()
self.GetParent().textCtrl.SetFocus()
self.Refresh()
@@ -66,9 +66,9 @@ class PopButton(wxPyControl):
self.ReleaseMouse()
if not self.up:
self.Notify()
self.up = true
self.up = True
self.Refresh()
self.didDown = false
self.didDown = False
event.Skip()
def OnMotion(self, event):
@@ -79,11 +79,11 @@ class PopButton(wxPyControl):
x,y = event.GetPositionTuple()
w,h = self.GetClientSizeTuple()
if self.up and x<w and x>=0 and y<h and y>=0:
self.up = false
self.up = False
self.Refresh()
return
if not self.up and (x<0 or y<0 or x>=w or y>=h):
self.up = true
self.up = True
self.Refresh()
return
event.Skip()
@@ -151,7 +151,7 @@ class wxPopupDialog(wxDialog):
def SetContent(self,content):
self.content = content
self.content.Reparent(self.win)
self.content.Show(true)
self.content.Show(True)
self.win.SetClientSize(self.content.GetSize())
self.SetSize(self.win.GetSize())
@@ -221,7 +221,7 @@ class wxPopupControl(wxPyControl):
def SetPopupContent(self,content):
if not self.pop:
self.content = content
self.content.Show(false)
self.content.Show(False)
else:
self.pop.SetContent(content)

View File

@@ -45,14 +45,14 @@ class PrintBase:
fcolour = font["Colour"]
return wxColour(fcolour[0], fcolour[1], fcolour[2])
def OutTextRegion(self, textout, txtdraw = TRUE):
def OutTextRegion(self, textout, txtdraw = True):
textlines = textout.split('\n')
y = copy.copy(self.y) + self.pt_space_before
for text in textlines:
remain = 'X'
while remain != "":
vout, remain = self.SetFlow(text, self.region)
if self.draw == TRUE and txtdraw == TRUE:
if self.draw == True and txtdraw == True:
test_out = self.TestFull(vout)
if self.align == wxALIGN_LEFT:
self.DC.DrawText(test_out, self.indent+self.pcell_left_margin, y)
@@ -128,7 +128,7 @@ class PrintBase:
text = text + val
return text
def OutTextPageWidth(self, textout, y_out, align, indent, txtdraw = TRUE):
def OutTextPageWidth(self, textout, y_out, align, indent, txtdraw = True):
textlines = textout.split('\n')
y = copy.copy(y_out)
@@ -140,7 +140,7 @@ class PrintBase:
remain = 'X'
while remain != "":
vout, remain = self.SetFlow(text, pagew)
if self.draw == TRUE and txtdraw == TRUE:
if self.draw == True and txtdraw == True:
test_out = vout
if align == wxALIGN_LEFT:
self.DC.DrawText(test_out, indent, y)
@@ -355,21 +355,21 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.data_cnt = self.page_index[self.page-1]
self.draw = TRUE
self.draw = True
self.PrintHeader()
self.PrintFooter()
self.OutPage()
def GetTotalPages(self):
self.data_cnt = 0
self.draw = FALSE
self.draw = False
self.page_index = [0]
cnt = 0
while 1:
test = self.OutPage()
self.page_index.append(self.data_cnt)
if test == FALSE:
if test == False:
break
cnt = cnt + 1
@@ -383,23 +383,23 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
if self.label != []: # check if header defined
self.PrintLabel()
else:
return FALSE
return False
for val in self.data:
try:
row_val = self.data[self.data_cnt]
except:
self.FinishDraw()
return FALSE
return False
max_y = self.PrintRow(row_val, FALSE) # test to see if row will fit in remaining space
max_y = self.PrintRow(row_val, False) # test to see if row will fit in remaining space
test = max_y + self.space
if test > self.y_end:
break
self.ColourRowCells(max_y-self.y+self.space) # colour the row/column
max_y = self.PrintRow(row_val, TRUE) # row fits - print text
max_y = self.PrintRow(row_val, True) # row fits - print text
self.DrawGridLine() # top line of cell
self.y = max_y + self.space
@@ -411,9 +411,9 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.FinishDraw()
if self.data_cnt == len(self.data): # last value in list
return FALSE
return False
return TRUE
return True
def PrintLabel(self):
@@ -431,7 +431,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.align = wxALIGN_LEFT
max_out = self.OutTextRegion(vtxt, TRUE)
max_out = self.OutTextRegion(vtxt, True)
if max_out > max_y:
max_y = max_out
self.col = self.col + 1
@@ -440,7 +440,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.y = max_y + self.label_space
def PrintHeader(self): # print the header array
if self.draw == FALSE:
if self.draw == False:
return
for val in self.parent.header:
@@ -457,10 +457,10 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
else:
addtext = ""
self.OutTextPageWidth(text+addtext, self.pheader_margin, val["Align"], header_indent, TRUE)
self.OutTextPageWidth(text+addtext, self.pheader_margin, val["Align"], header_indent, True)
def PrintFooter(self): # print the header array
if self.draw == FALSE:
if self.draw == False:
return
footer_pos = self.parent.page_height * self.pheight - self.pfooter_margin + self.vertical_offset
@@ -484,7 +484,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
else:
addtext = ""
self.OutTextPageWidth(text+addtext, footer_pos, val["Align"], footer_indent, TRUE)
self.OutTextPageWidth(text+addtext, footer_pos, val["Align"], footer_indent, True)
def LabelColorRow(self, colour):
@@ -494,7 +494,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.DC.DrawRectangle(self.column[0], self.y, self.end_x-self.column[0]+1, height)
def ColourRowCells(self, height):
if self.draw == FALSE:
if self.draw == False:
return
col = 0
@@ -512,7 +512,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.DC.DrawRectangle(start_x, self.y, width, height)
col = col + 1
def PrintRow(self, row_val, draw = TRUE, align = wxALIGN_LEFT):
def PrintRow(self, row_val, draw = True, align = wxALIGN_LEFT):
self.SetPrintFont(self.text_font)
self.pt_space_before = self.text_pt_space_before # set the point spacing
@@ -565,7 +565,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.DrawColumns() # draw all vertical lines
def DrawGridLine(self):
if self.draw == TRUE:
if self.draw == True:
try:
size = self.row_line_size[self.data_cnt]
except:
@@ -583,7 +583,7 @@ class PrintTableDraw(wxScrolledWindow, PrintBase):
self.DC.DrawLine(self.column[0], y_out, self.end_x, y_out)
def DrawColumns(self):
if self.draw == TRUE:
if self.draw == True:
col = 0
for val in self.column:
try:
@@ -879,7 +879,7 @@ class PrintTable:
if self.parentFrame:
frame.SetPosition(self.preview_frame_pos)
frame.SetSize(self.preview_frame_size)
frame.Show(true)
frame.Show(True)
def Print(self):
pdd = wxPrintDialogData()
@@ -905,7 +905,7 @@ class PrintTable:
if self.preview is None:
table.SetPSize(size[0]/self.page_width, size[1]/self.page_height)
table.SetPTSize(size[0], size[1])
table.SetPreview(FALSE)
table.SetPreview(False)
else:
if self.preview == 1:
table.scale = self.scale
@@ -933,9 +933,9 @@ class PrintTable:
def HasPage(self, page):
if page <= self.page_total:
return true
return True
else:
return false
return False
def SetPage(self, page):
self.page = page
@@ -1025,7 +1025,7 @@ class SetPrintout(wxPrintout):
end = self.canvas.HasPage(page)
return end
except:
return true
return True
def GetPageInfo(self):
try:
@@ -1084,7 +1084,7 @@ class SetPrintout(wxPrintout):
self.canvas.SetPageSize(self.psizew, self.psizeh)
self.canvas.DoDrawing(dc)
return true
return True

View File

@@ -299,7 +299,7 @@ class Topic:
def matches(self, aTopic):
"""
Consider myself to be a topic pattern,
and return true if I match the given specific
and return True if I match the given specific
topic. For example,
a = ('sports')
b = ('sports','baseball')
@@ -326,7 +326,7 @@ class Topic:
def __eq__(self, aTopic):
"""
Return true if I equal the given topic. We're considered
Return True if I equal the given topic. We're considered
equal if our tuples are equal.
"""
if type(self) != type(aTopic):
@@ -337,7 +337,7 @@ class Topic:
def __ne__(self, aTopic):
"""
Return false if I equal the given topic.
Return False if I equal the given topic.
"""
return not self == aTopic

View File

@@ -387,8 +387,8 @@ if __name__ == '__main__':
self.frame = rpcFrame(NULL, -1, "wxPython RPCDemo", wxDefaultPosition,
wxSize(300,300),
rpcHost='localhost',rpcPort=port)
self.frame.Show(TRUE)
return TRUE
self.frame.Show(True)
return True
def testcon(port):

View File

@@ -20,26 +20,26 @@ class CTextCellEditor(wxTextCtrl):
key = evt.GetKeyCode()
if key == WXK_DOWN:
self._grid.DisableCellEditControl() # Commit the edit
self._grid.MoveCursorDown(false) # Change the current cell
self._grid.MoveCursorDown(False) # Change the current cell
elif key == WXK_UP:
self._grid.DisableCellEditControl() # Commit the edit
self._grid.MoveCursorUp(false) # Change the current cell
self._grid.MoveCursorUp(False) # Change the current cell
elif key == WXK_LEFT:
self._grid.DisableCellEditControl() # Commit the edit
self._grid.MoveCursorLeft(false) # Change the current cell
self._grid.MoveCursorLeft(False) # Change the current cell
elif key == WXK_RIGHT:
self._grid.DisableCellEditControl() # Commit the edit
self._grid.MoveCursorRight(false) # Change the current cell
self._grid.MoveCursorRight(False) # Change the current cell
evt.Skip() # Continue event
#---------------------------------------------------------------------------
class CCellEditor(wxPyGridCellEditor):
""" Custom cell editor """
def __init__(self, grid):
wxPyGridCellEditor.__init__(self)
self._grid = grid # Save a reference to the grid
def Create(self, parent, id, evtHandler):
""" Create the actual edit control. Must derive from wxControl.
Must Override
@@ -68,7 +68,7 @@ class CCellEditor(wxPyGridCellEditor):
"""
# Call base class method.
self.base_PaintBackground(self, rect, attr)
def BeginEdit(self, row, col, grid):
""" Fetch the value from the table and prepare edit control to begin editing.
Set the focus to the edit control. Must Override.
@@ -76,19 +76,19 @@ class CCellEditor(wxPyGridCellEditor):
self._startValue = grid.GetTable().GetValue(row, col)
self._tc.SetValue(self._startValue)
self._tc.SetFocus()
# Select the text when initiating an edit so that subsequent typing
# replaces the contents.
self._tc.SetSelection(0, self._tc.GetLastPosition())
def EndEdit(self, row, col, grid):
""" Commit editing the current cell. Returns true if the value has changed.
""" Commit editing the current cell. Returns True if the value has changed.
If necessary, the control may be destroyed. Must Override.
"""
changed = false # Assume value not changed
changed = False # Assume value not changed
val = self._tc.GetValue() # Get value in edit control
if val != self._startValue: # Compare
changed = true # If different then changed is true
changed = True # If different then changed is True
grid.GetTable().SetValue(row, col, val) # Update the table
self._startValue = '' # Clear the class' start value
self._tc.SetValue('') # Clear contents of the edit control
@@ -101,7 +101,7 @@ class CCellEditor(wxPyGridCellEditor):
self._tc.SetInsertionPointEnd()
def IsAcceptedKey(self, evt):
""" Return true to allow the given key to start editing. The base class
""" Return True to allow the given key to start editing. The base class
version only checks that the event has no modifiers. F2 is special
and will always start the editor.
"""
@@ -117,7 +117,7 @@ class CCellEditor(wxPyGridCellEditor):
if key in [WXK_NUMPAD0, WXK_NUMPAD1, WXK_NUMPAD2, WXK_NUMPAD3, WXK_NUMPAD4,
WXK_NUMPAD5, WXK_NUMPAD6, WXK_NUMPAD7, WXK_NUMPAD8, WXK_NUMPAD9]:
ch = chr(ord('0') + key - WXK_NUMPAD0)
elif key == WXK_BACK: # Empty text control when init w/ back key
ch = ""
# Handle normal keys
@@ -125,7 +125,7 @@ class CCellEditor(wxPyGridCellEditor):
ch = chr(key)
if not evt.ShiftDown():
ch = ch.lower()
if ch is not None: # If are at this point with a key,
self._tc.SetValue(ch) # replace the contents of the text control.
self._tc.SetInsertionPointEnd() # Move to the end so that subsequent keys are appended
@@ -150,7 +150,7 @@ class CCellEditor(wxPyGridCellEditor):
class CSheet(wxGrid):
def __init__(self, parent):
wxGrid.__init__(self, parent, -1)
# Init variables
self._lastCol = -1 # Init last cell column clicked
self._lastRow = -1 # Init last cell row clicked
@@ -159,7 +159,7 @@ class CSheet(wxGrid):
self.RegisterDataType(wxGRID_VALUE_STRING,
wxGridCellStringRenderer(),
CCellEditor(self))
self.CreateGrid(4, 3) # By default start with a 4 x 3 grid
self.SetColLabelSize(18) # Default sizes and alignment
self.SetRowLabelSize(50)
@@ -167,8 +167,8 @@ class CSheet(wxGrid):
self.SetColSize(0, 75) # Default column sizes
self.SetColSize(1, 75)
self.SetColSize(2, 75)
# Sink events
# Sink events
EVT_GRID_CELL_LEFT_CLICK( self, self.OnLeftClick)
EVT_GRID_CELL_RIGHT_CLICK( self, self.OnRightClick)
EVT_GRID_CELL_LEFT_DCLICK( self, self.OnLeftDoubleClick)
@@ -183,7 +183,7 @@ class CSheet(wxGrid):
# Save the last cell coordinates
self._lastRow, self._lastCol = event.GetRow(), event.GetCol()
event.Skip()
def OnRowSize(self, event):
event.Skip()
@@ -192,48 +192,48 @@ class CSheet(wxGrid):
def OnCellChange(self, event):
event.Skip()
def OnLeftClick(self, event):
""" Override left-click behavior to prevent left-click edit initiation """
# Save the cell clicked
currCell = (event.GetRow(), event.GetCol())
# Suppress event if same cell clicked twice in a row.
# This prevents a single-click from initiating an edit.
if currCell != (self._lastRow, self._lastCol): event.Skip()
def OnRightClick(self, event):
""" Move grid cursor when a cell is right-clicked """
self.SetGridCursor( event.GetRow(), event.GetCol() )
event.Skip()
def OnLeftDoubleClick(self, event):
""" Initiate the cell editor on a double-click """
# Move grid cursor to double-clicked cell
if self.CanEnableCellControl():
self.SetGridCursor( event.GetRow(), event.GetCol() )
self.EnableCellEditControl(true) # Show the cell editor
self.EnableCellEditControl(True) # Show the cell editor
event.Skip()
def OnRangeSelect(self, event):
""" Track which cells are selected so that copy/paste behavior can be implemented """
# If a single cell is selected, then Selecting() returns false (0)
# If a single cell is selected, then Selecting() returns False (0)
# and range coords are entire grid. In this case cancel previous selection.
# If more than one cell is selected, then Selecting() is true (1)
# If more than one cell is selected, then Selecting() is True (1)
# and range accurately reflects selected cells. Save them.
# If more cells are added to a selection, selecting remains true (1)
# If more cells are added to a selection, selecting remains True (1)
self._selected = None
if event.Selecting():
self._selected = ((event.GetTopRow(), event.GetLeftCol()),
(event.GetBottomRow(), event.GetRightCol()))
event.Skip()
def Copy(self):
""" Copy the currently selected cells to the clipboard """
# TODO: raise an error when there are no cells selected?
if self._selected == None: return
((r1, c1), (r2, c2)) = self._selected
# Build a string to put on the clipboard
# (Is there a faster way to do this in Python?)
crlf = chr(13) + chr(10)
@@ -245,7 +245,7 @@ class CSheet(wxGrid):
s += tab
s += self.GetCellValue(row, c2)
s += crlf
# Put the string on the clipboard
if wxTheClipboard.Open():
wxTheClipboard.Clear()
@@ -261,15 +261,15 @@ class CSheet(wxGrid):
wxTheClipboard.Close()
if not success: return # Exit on failure
s = td.GetText() # Get the text
crlf = chr(13) + chr(10) # CrLf characters
tab = chr(9) # Tab character
rows = s.split(crlf) # split into rows
rows = rows[0:-1] # leave out last element, which is always empty
for i in range(0, len(rows)): # split rows into elements
rows[i] = rows[i].split(tab)
# Get the starting and ending cell range to paste into
if self._selected == None: # If no cells selected...
r1 = self.GetGridCursorRow() # Start the paste at the current location
@@ -278,7 +278,7 @@ class CSheet(wxGrid):
c2 = self.GetNumberCols()-1
else: # If cells selected, only paste there
((r1, c1), (r2, c2)) = self._selected
# Enter data into spreadsheet cells one at a time
r = r1 # Init row and column counters
c = c1
@@ -306,8 +306,8 @@ class CSheet(wxGrid):
def SetNumberRows(self, numRows=1):
""" Set the number of rows in the sheet """
# Check for non-negative number
if numRows < 0: return false
if numRows < 0: return False
# Adjust number of rows
curRows = self.GetNumberRows()
if curRows < numRows:
@@ -315,13 +315,13 @@ class CSheet(wxGrid):
elif curRows > numRows:
self.DeleteRows(numRows, curRows - numRows)
return true
return True
def SetNumberCols(self, numCols=1):
""" Set the number of columns in the sheet """
# Check for non-negative number
if numCols < 0: return false
if numCols < 0: return False
# Adjust number of rows
curCols = self.GetNumberCols()
if curCols < numCols:
@@ -329,4 +329,4 @@ class CSheet(wxGrid):
elif curCols > numCols:
self.DeleteCols(numCols, curCols - numCols)
return true
return True

View File

@@ -58,11 +58,11 @@ class PyShellInput(wxPanel):
tid =wxNewId()
self.entry =wxTextCtrl(self, tid, style = wxTE_MULTILINE)
EVT_CHAR(self.entry, self.OnChar)
self.entry.SetFont(wxFont(9, wxMODERN, wxNORMAL, wxNORMAL, false))
self.entry.SetFont(wxFont(9, wxMODERN, wxNORMAL, wxNORMAL, False))
sizer =wxBoxSizer(wxVERTICAL)
sizer.AddMany([(self.label, 0, wxEXPAND), (self.entry, 1, wxEXPAND)])
self.SetSizer(sizer)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
EVT_SET_FOCUS(self, self.OnSetFocus)
# when in "continuation" mode,
# two consecutive newlines are required
@@ -153,7 +153,7 @@ class PyShellOutput(wxPanel):
self.client =self.html # used in OnSize()
self.text =self.intro
self.html.SetPage(self.text)
self.html.SetAutoLayout(TRUE)
self.html.SetAutoLayout(True)
self.line_buffer =""
# refreshes are annoying
self.in_batch =0
@@ -328,7 +328,7 @@ if __name__ == '__main__':
"""Demonstrates usage of both default and customized shells"""
def OnInit(self):
frame = MyFrame()
frame.Show(TRUE)
frame.Show(True)
self.SetTopWindow(frame)
## PyShellInput.PS1 =" let's get some work done..."
## PyShellInput.PS2 =" ok, what do you really mean?"
@@ -344,8 +344,8 @@ if __name__ == '__main__':
## "<br>&lt;-- move this sash to see html debug output</I><br>\n"
## PyShellOutput.html_debug =1
## frame = MyFrame(title="Customized wxPython Shell")
## frame.Show(TRUE)
return TRUE
## frame.Show(True)
return True
app = MyApp(0)
app.MainLoop()

View File

@@ -57,7 +57,7 @@ class SplashScreen(wxFrame):
EVT_PAINT(self, self.OnPaint)
EVT_ERASE_BACKGROUND(self, self.OnEraseBG)
self.Show(true)
self.Show(True)
class SplashTimer(wxTimer):
@@ -73,16 +73,16 @@ class SplashScreen(wxFrame):
def OnPaint(self, event):
dc = wxPaintDC(self)
dc.DrawBitmap(self.bitmap, 0,0, false)
dc.DrawBitmap(self.bitmap, 0,0, False)
def OnEraseBG(self, event):
pass
def OnSplashExitDefault(self, event=None):
self.Close(true)
self.Close(True)
def OnCloseWindow(self, event=None):
self.Show(false)
self.Show(False)
self.timer.Stop()
del self.timer
self.Destroy()
@@ -100,12 +100,12 @@ if __name__ == "__main__":
wxImage_AddHandler(wxPNGHandler())
wxImage_AddHandler(wxGIFHandler())
self.splash = SplashScreen(NULL, bitmapfile="splashscreen.jpg", callback=self.OnSplashExit)
self.splash.Show(true)
self.splash.Show(True)
self.SetTopWindow(self.splash)
return true
return True
def OnSplashExit(self, event=None):
print "Yay! Application callback worked!"
self.splash.Close(true)
self.splash.Close(True)
del self.splash
### Build working windows here...
def test(sceneGraph=None):

View File

@@ -96,7 +96,7 @@ class wxGenStaticText(wxPyControl):
def AcceptsFocus(self):
"""Overridden base class virtual."""
return false
return False
def OnPaint(self, event):

View File

@@ -132,9 +132,9 @@ class Throbber(wxPanel):
def Draw(self, dc):
dc.DrawBitmap(self.submaps[self.sequence[self.current]], 0, 0, true)
dc.DrawBitmap(self.submaps[self.sequence[self.current]], 0, 0, True)
if self.overlay and self.showOverlay:
dc.DrawBitmap(self.overlay, self.overlayX, self.overlayY, true)
dc.DrawBitmap(self.overlay, self.overlayX, self.overlayY, True)
if self.label and self.showLabel:
dc.DrawText(self.label, self.labelX, self.labelY)
dc.SetTextForeground(wxWHITE)
@@ -195,7 +195,7 @@ class Throbber(wxPanel):
def Running(self):
"""Returns true if the animation is running"""
"""Returns True if the animation is running"""
return not self.event.isSet()

View File

@@ -474,7 +474,7 @@ class wxTimeCtrl(wxTextCtrl):
selection = sel_start != sel_to
_dbg('sel_start=', sel_start, 'sel_to =', sel_to)
if not selection:
self.__bSelection = false # predict unselection of entire region
self.__bSelection = False # predict unselection of entire region
_dbg('keycode = ', key)
_dbg('pos = ', pos)
@@ -806,7 +806,7 @@ if __name__ == '__main__':
sizer.AddWindow( self.tc, 0, wxALIGN_CENTRE|wxLEFT|wxTOP|wxBOTTOM, 5 )
sizer.AddWindow( sb, 0, wxALIGN_CENTRE|wxRIGHT|wxTOP|wxBOTTOM, 5 )
self.SetAutoLayout( true )
self.SetAutoLayout( True )
self.SetSizer( sizer )
sizer.Fit( self )
sizer.SetSizeHints( self )
@@ -830,11 +830,11 @@ if __name__ == '__main__':
try:
frame = wxFrame(NULL, -1, "wxTimeCtrl Test", wxPoint(20,20), wxSize(100,100) )
panel = TestPanel(frame, -1, wxPoint(-1,-1), fmt24hr=fmt24hr, test_mx = test_mx)
frame.Show(true)
frame.Show(True)
except:
traceback.print_exc()
return false
return true
return False
return True
try:
app = MyApp(0)

View File

@@ -428,7 +428,7 @@ if __name__ == '__main__':
"""As of this writing, printing support in wxPython is shaky at best.
Are you sure you want to do this?""", "Danger!", wx.wxYES_NO)
if d.ShowModal() == wx.wxID_YES:
psdc = wx.wxPostScriptDC("out.ps", wx.TRUE, self)
psdc = wx.wxPostScriptDC("out.ps", wx.True, self)
self.client.redraw(psdc)
def OnFileExit(self, event):
@@ -454,9 +454,9 @@ Are you sure you want to do this?""", "Danger!", wx.wxYES_NO)
class MyApp(wx.wxApp):
def OnInit(self):
frame = AppFrame(wx.NULL, -1, "wxPlotCanvas")
frame.Show(wx.TRUE)
frame.Show(wx.True)
self.SetTopWindow(frame)
return wx.TRUE
return wx.True
app = MyApp(0)

View File

@@ -162,18 +162,18 @@ class wxpTagHandler(wxHtmlWinTagHandler):
obj = apply(self.ctx.classObj,
(parent,),
self.ctx.kwargs)
obj.Show(true)
obj.Show(True)
# add it to the HtmlWindow
self.GetParser().GetContainer().InsertCell(wxHtmlWidgetCell(obj, self.ctx.floatWidth))
self.ctx = None
return true
return True
def HandleParamTag(self, tag):
if not tag.HasParam('NAME'):
return false
return False
name = tag.GetParam('NAME')
value = ""
@@ -209,7 +209,7 @@ class wxpTagHandler(wxHtmlWinTagHandler):
pass
self.ctx.kwargs[str(name)] = value
return false
return False
#----------------------------------------------------------------------

View File

@@ -17,7 +17,7 @@ class Panel(wxNotebook):
wxNotebook.__init__(self, parent, id)
global panel
g.panel = panel = self
self.modified = false
self.modified = False
# List of child windows
self.pages = []
@@ -25,14 +25,14 @@ class Panel(wxNotebook):
self.page1 = wxScrolledWindow(self, -1)
sizer = wxBoxSizer()
sizer.Add(wxBoxSizer()) # dummy sizer
self.page1.SetAutoLayout(true)
self.page1.SetAutoLayout(True)
self.page1.SetSizer(sizer)
self.AddPage(self.page1, 'Properties')
# Second page
self.page2 = wxScrolledWindow(self, -1)
sizer = wxBoxSizer()
sizer.Add(wxBoxSizer()) # dummy sizer
self.page2.SetAutoLayout(true)
self.page2.SetAutoLayout(True)
self.page2.SetSizer(sizer)
# Cache for already used panels
self.pageCache = {} # cached property panels
@@ -75,7 +75,7 @@ class Panel(wxNotebook):
wxDefaultSize, wxSUNKEN_BORDER)
html.SetPage(g.helpText)
sizer.Add(html, 1, wxEXPAND)
g.conf.panic = false
g.conf.panic = False
else:
sizer.Add(wxStaticText(self.page1, -1, 'Select a tree item.'))
else:
@@ -103,7 +103,7 @@ class Panel(wxNotebook):
sizer.Add(page, 0, wxEXPAND | wxTOP, 5)
self.page1.Layout()
size = self.page1.GetSizer().GetMinSize()
self.page1.SetScrollbars(1, 1, size.x, size.y, 0, 0, true)
self.page1.SetScrollbars(1, 1, size.x, size.y, 0, 0, True)
# Second page
# Create if does not exist
@@ -125,17 +125,17 @@ class Panel(wxNotebook):
self.AddPage(self.page2, 'Style')
self.page2.Layout()
size = self.page2.GetSizer().GetMinSize()
self.page2.SetScrollbars(1, 1, size.x, size.y, 0, 0, true)
self.page2.SetScrollbars(1, 1, size.x, size.y, 0, 0, True)
else:
# Remove page if exists
if self.GetPageCount() == 2:
self.SetSelection(0)
self.page1.Refresh()
self.RemovePage(1)
self.modified = false
self.modified = False
def Clear(self):
self.SetData(None)
self.modified = false
self.modified = False
# If some parameter has changed
def IsModified(self):
return self.modified
@@ -164,7 +164,7 @@ class ParamPage(wxPanel):
xxx = self.xxx
param = evt.GetEventObject().GetName()
w = self.controls[param]
w.Enable(true)
w.Enable(True)
objElem = xxx.element
if evt.IsChecked():
# Ad new text node in order of allParams
@@ -179,12 +179,12 @@ class ParamPage(wxPanel):
else:
xxx.params[param] = xxxParam(elem)
# Find place to put new element: first present element after param
found = false
found = False
paramStyles = xxx.allParams + xxx.styles
for p in paramStyles[paramStyles.index(param) + 1:]:
# Content params don't have same type
if xxx.params.has_key(p) and p != 'content':
found = true
found = True
break
if found:
nextTextElem = xxx.params[p].node
@@ -196,10 +196,10 @@ class ParamPage(wxPanel):
xxx.params[param].remove()
del xxx.params[param]
w.SetValue('')
w.modified = false # mark as not changed
w.Enable(false)
w.modified = False # mark as not changed
w.Enable(False)
# Set modified flag (provokes undo storing is necessary)
panel.SetModified(true)
panel.SetModified(True)
def Apply(self):
xxx = self.xxx
if self.controlName:
@@ -235,7 +235,7 @@ class ParamPage(wxPanel):
for k,v,e in state[1]:
self.controls[k].SetValue(v)
self.controls[k].Enable(e)
if e: self.controls[k].modified = true
if e: self.controls[k].modified = True
if self.controlName:
self.controlName.SetValue(state[2])
@@ -282,34 +282,34 @@ class PropPage(ParamPage):
(control, 0, wxALIGN_CENTER_VERTICAL) ])
self.controls[param] = control
topSizer.Add(sizer, 1, wxALL | wxEXPAND, 3)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(topSizer)
topSizer.Fit(self)
def SetValues(self, xxx):
self.xxx = xxx
self.origChecks = []
self.origControls = []
# Set values, checkboxes to false, disable defaults
# Set values, checkboxes to False, disable defaults
if xxx.hasName:
self.controlName.SetValue(xxx.name)
self.origName = xxx.name
for param in xxx.allParams:
w = self.controls[param]
w.modified = false
w.modified = False
try:
value = xxx.params[param].value()
w.Enable(true)
w.Enable(True)
w.SetValue(value)
if not param in xxx.required:
self.checks[param].SetValue(true)
self.origChecks.append((param, true))
self.origControls.append((param, value, true))
self.checks[param].SetValue(True)
self.origChecks.append((param, True))
self.origControls.append((param, value, True))
except KeyError:
self.checks[param].SetValue(false)
self.checks[param].SetValue(False)
w.SetValue('')
w.Enable(false)
self.origChecks.append((param, false))
self.origControls.append((param, '', false))
w.Enable(False)
self.origChecks.append((param, False))
self.origControls.append((param, '', False))
################################################################################
@@ -333,7 +333,7 @@ class StylePage(ParamPage):
self.checks[param] = check
self.controls[param] = control
topSizer.Add(sizer, 1, wxALL | wxEXPAND, 3)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(topSizer)
topSizer.Fit(self)
# Set data for a cahced page
@@ -346,7 +346,7 @@ class StylePage(ParamPage):
check = self.checks[param]
check.SetValue(present)
w = self.controls[param]
w.modified = false
w.modified = False
if present:
value = xxx.params[param].value()
else:

View File

@@ -22,15 +22,15 @@ buttonSize = (55,-1)
class PPanel(wxPanel):
def __init__(self, parent, name):
wxPanel.__init__(self, parent, -1, name=name)
self.modified = self.freeze = false
self.modified = self.freeze = False
def Enable(self, value):
# Something strange is going on with enable so we make sure...
for w in self.GetChildren():
w.Enable(value)
wxPanel.Enable(self, value)
def SetModified(self):
self.modified = true
g.panel.SetModified(true)
self.modified = True
g.panel.SetModified(True)
# Common method to set modified state
def OnChange(self, evt):
if self.freeze: return
@@ -48,7 +48,7 @@ class ParamBinaryOr(PPanel):
sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5)
self.button = wxButton(self, self.ID_BUTTON_CHOICES, 'Edit...', size=buttonSize)
sizer.Add(self.button, 0, wxALIGN_CENTER_VERTICAL)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(sizer)
sizer.Fit(self)
EVT_BUTTON(self, self.ID_BUTTON_CHOICES, self.OnButtonChoices)
@@ -56,9 +56,9 @@ class ParamBinaryOr(PPanel):
def GetValue(self):
return self.text.GetValue()
def SetValue(self, value):
self.freeze = true
self.freeze = True
self.text.SetValue(value)
self.freeze = false
self.freeze = False
def OnButtonChoices(self, evt):
dlg = wxDialog(self, -1, 'Choices')
topSizer = wxBoxSizer(wxVERTICAL)
@@ -84,7 +84,7 @@ class ParamBinaryOr(PPanel):
sizer.Add(0, 0, 1)
sizer.Add(wxButton(dlg, wxID_CANCEL, 'Cancel'))
topSizer.Add(sizer, 0, wxALL | wxEXPAND, 10)
dlg.SetAutoLayout(true)
dlg.SetAutoLayout(True)
dlg.SetSizer(topSizer)
topSizer.Fit(dlg)
dlg.Center()
@@ -143,23 +143,23 @@ class ParamColour(PPanel):
sizer.Add(self.text, 0, wxRIGHT, 5)
self.button = wxPanel(self, self.ID_BUTTON, wxDefaultPosition, wxSize(20, 20))
sizer.Add(self.button, 0, wxGROW)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(sizer)
sizer.Fit(self)
self.textModified = false
self.textModified = False
EVT_PAINT(self.button, self.OnPaintButton)
EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
EVT_LEFT_DOWN(self.button, self.OnLeftDown)
def GetValue(self):
return self.text.GetValue()
def SetValue(self, value):
self.freeze = true
self.freeze = True
if not value: value = '#FFFFFF'
self.text.SetValue(str(value)) # update text ctrl
colour = wxColour(int(value[1:3], 16), int(value[3:5], 16), int(value[5:7], 16))
self.button.SetBackgroundColour(colour)
self.button.Refresh()
self.freeze = false
self.freeze = False
def OnPaintButton(self, evt):
dc = wxPaintDC(self.button)
dc.SetBrush(wxTRANSPARENT_BRUSH)
@@ -203,15 +203,15 @@ class ParamFont(PPanel):
sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5)
self.button = wxButton(self, self.ID_BUTTON_SELECT, 'Select...', size=buttonSize)
sizer.Add(self.button, 0, wxALIGN_CENTER_VERTICAL)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(sizer)
sizer.Fit(self)
self.textModified = false
self.textModified = False
EVT_BUTTON(self, self.ID_BUTTON_SELECT, self.OnButtonSelect)
EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
def OnChange(self, evt):
PPanel.OnChange(self, evt)
self.textModified = true
self.textModified = True
def _defaultValue(self):
return ['12', 'default', 'normal', 'normal', '0', '', '']
def GetValue(self):
@@ -223,11 +223,11 @@ class ParamFont(PPanel):
return self._defaultValue()
return self.value
def SetValue(self, value):
self.freeze = true # disable other handlers
self.freeze = True # disable other handlers
if not value: value = self._defaultValue()
self.value = value
self.text.SetValue(str(value)) # update text ctrl
self.freeze = false
self.freeze = False
def OnButtonSelect(self, evt):
if self.textModified: # text has newer value
try:
@@ -244,23 +244,23 @@ class ParamFont(PPanel):
face = ''
enc = wxFONTENCODING_DEFAULT
# Fall back to default if exceptions
error = false
error = False
try:
try: size = int(self.value[0])
except ValueError: error = true
except ValueError: error = True
try: family = fontFamiliesXml2wx[self.value[1]]
except KeyError: error = true
except KeyError: error = True
try: style = fontStylesXml2wx[self.value[2]]
except KeyError: error = true
except KeyError: error = True
try: weight = fontWeightsXml2wx[self.value[3]]
except KeyError: error = true
except KeyError: error = True
try: underlined = int(self.value[4])
except ValueError: error = true
except ValueError: error = True
face = self.value[5]
mapper = wxFontMapper()
if not self.value[6]: enc = mapper.CharsetToEncoding(self.value[6])
except IndexError:
error = true
error = True
if error: wxLogError('Invalid font specification')
if enc == wxFONTENCODING_DEFAULT: enc = wxFONTENCODING_SYSTEM
font = wxFont(size, family, style, weight, underlined, face, enc)
@@ -280,7 +280,7 @@ class ParamFont(PPanel):
# Add ignored flags
self.SetValue(value)
self.SetModified()
self.textModified = false
self.textModified = False
dlg.Destroy()
################################################################################
@@ -293,17 +293,17 @@ class ParamInt(PPanel):
self.spin = wxSpinCtrl(self, self.ID_SPIN_CTRL, size=wxSize(50,-1))
self.SetBackgroundColour(g.panel.GetBackgroundColour())
sizer.Add(self.spin)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(sizer)
sizer.Fit(self)
EVT_SPINCTRL(self, self.ID_SPIN_CTRL, self.OnChange)
def GetValue(self):
return str(self.spin.GetValue())
def SetValue(self, value):
self.freeze = true
self.freeze = True
if not value: value = 0
self.spin.SetValue(int(value))
self.freeze = false
self.freeze = False
class ParamText(PPanel):
def __init__(self, parent, name, textWidth=260):
@@ -314,16 +314,16 @@ class ParamText(PPanel):
self.SetBackgroundColour(g.panel.GetBackgroundColour())
self.text = wxTextCtrl(self, self.ID_TEXT_CTRL, size=wxSize(textWidth,-1))
sizer.Add(self.text, 0, wxALIGN_CENTER_VERTICAL)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(sizer)
sizer.Fit(self)
EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
def GetValue(self):
return self.text.GetValue()
def SetValue(self, value):
self.freeze = true # disable other handlers
self.freeze = True # disable other handlers
self.text.SetValue(value)
self.freeze = false # disable other handlers
self.freeze = False # disable other handlers
class ParamAccel(ParamText):
def __init__(self, parent, name):
@@ -345,7 +345,7 @@ class ContentDialog(wxDialogPtr):
# Set list items
for v in value:
self.list.Append(v)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.GetSizer().Fit(self)
# Callbacks
self.ID_BUTTON_APPEND = XMLID('BUTTON_APPEND')
@@ -398,7 +398,7 @@ class ContentCheckListDialog(wxDialogPtr):
self.list.Append(v)
self.list.Check(i, ch)
i += 1
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.GetSizer().Fit(self)
# Callbacks
self.ID_BUTTON_APPEND = XMLID('BUTTON_APPEND')
@@ -455,15 +455,15 @@ class ParamContent(PPanel):
sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5)
self.button = wxButton(self, self.ID_BUTTON_EDIT, 'Edit...', size=buttonSize)
sizer.Add(self.button, 0, wxALIGN_CENTER_VERTICAL)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(sizer)
sizer.Fit(self)
self.textModified = false
self.textModified = False
EVT_BUTTON(self, self.ID_BUTTON_EDIT, self.OnButtonEdit)
EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
def OnChange(self, evt):
PPanel.OnChange(self, evt)
self.textModified = true
self.textModified = True
def GetValue(self):
if self.textModified: # text has newer value
try:
@@ -473,11 +473,11 @@ class ParamContent(PPanel):
return []
return self.value
def SetValue(self, value):
self.freeze = true
self.freeze = True
if not value: value = []
self.value = value
self.text.SetValue(str(value)) # update text ctrl
self.freeze = false
self.freeze = False
def OnButtonEdit(self, evt):
if self.textModified: # text has newer value
try:
@@ -493,7 +493,7 @@ class ParamContent(PPanel):
# Add ignored flags
self.SetValue(value)
self.SetModified()
self.textModified = false
self.textModified = False
dlg.Destroy()
# CheckList content
@@ -515,7 +515,7 @@ class ParamContentCheckList(ParamContent):
# Add ignored flags
self.SetValue(value)
self.SetModified()
self.textModified = false
self.textModified = False
dlg.Destroy()
class IntListDialog(wxDialogPtr):
@@ -533,7 +533,7 @@ class IntListDialog(wxDialogPtr):
wxLogError('Invalid item type')
else:
self.list.Append(str(v))
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.GetSizer().Fit(self)
# Callbacks
self.ID_BUTTON_ADD = XMLID('BUTTON_ADD')
@@ -550,10 +550,10 @@ class IntListDialog(wxDialogPtr):
i = self.list.FindString(s)
if i == -1: # ignore non-unique
# Find place to insert
found = false
found = False
for i in range(self.list.Number()):
if int(self.list.GetString(i)) > v:
found = true
found = True
break
if found: self.list.InsertItems([s], i)
else: self.list.Append(s)
@@ -584,7 +584,7 @@ class ParamIntList(ParamContent):
# Add ignored flags
self.SetValue(value)
self.SetModified()
self.textModified = false
self.textModified = False
dlg.Destroy()
# Boxless radiobox
@@ -599,15 +599,15 @@ class RadioBox(PPanel):
button = wxRadioButton(self, -1, i, name=i)
topSizer.Add(button)
EVT_RADIOBUTTON(self, button.GetId(), self.OnRadioChoice)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(topSizer)
topSizer.Fit(self)
def SetStringSelection(self, value):
self.freeze = true
self.freeze = True
for i in self.choices:
self.FindWindowByName(i).SetValue(i == value)
self.value = value
self.freeze = false
self.freeze = False
def OnRadioChoice(self, evt):
if self.freeze: return
if evt.GetSelection():
@@ -649,24 +649,24 @@ class ParamFile(PPanel):
sizer.Add(self.text, 0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5)
self.button = wxButton(self, self.ID_BUTTON_BROWSE, 'Browse...',size=buttonSize)
sizer.Add(self.button, 0, wxALIGN_CENTER_VERTICAL)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(sizer)
sizer.Fit(self)
self.textModified = false
self.textModified = False
EVT_BUTTON(self, self.ID_BUTTON_BROWSE, self.OnButtonBrowse)
EVT_TEXT(self, self.ID_TEXT_CTRL, self.OnChange)
def OnChange(self, evt):
PPanel.OnChange(self, evt)
self.textModified = true
self.textModified = True
def GetValue(self):
if self.textModified: # text has newer value
return self.text.GetValue()
return self.value
def SetValue(self, value):
self.freeze = true
self.freeze = True
self.value = value
self.text.SetValue(value) # update text ctrl
self.freeze = false
self.freeze = False
def OnButtonBrowse(self, evt):
if self.textModified: # text has newer value
self.value = self.text.GetValue()
@@ -682,7 +682,7 @@ class ParamFile(PPanel):
common = os.path.commonprefix([curpath, dlg.GetPath()])
self.SetValue(dlg.GetPath()[len(common):])
self.SetModified()
self.textModified = false
self.textModified = False
dlg.Destroy()
class ParamBitmap(PPanel):
@@ -692,15 +692,15 @@ class ParamBitmap(PPanel):
# Perform initialization with class pointer
wxPanelPtr.__init__(self, w.this)
self.thisown = 1
self.modified = self.freeze = false
self.modified = self.freeze = False
self.SetBackgroundColour(g.panel.GetBackgroundColour())
self.radio_std = self.FindWindowByName('RADIO_STD')
self.radio_file = self.FindWindowByName('RADIO_FILE')
self.combo = self.FindWindowByName('COMBO_STD')
self.text = self.FindWindowByName('TEXT_FILE')
self.button = self.FindWindowByName('BUTTON_BROWSE')
self.textModified = false
self.SetAutoLayout(true)
self.textModified = False
self.SetAutoLayout(True)
self.GetSizer().SetMinSize((260, -1))
self.GetSizer().Fit(self)
EVT_RADIOBUTTON(self, XMLID('RADIO_STD'), self.OnRadioStd)
@@ -717,18 +717,18 @@ class ParamBitmap(PPanel):
self.SetValue(['',''])
def updateRadios(self):
if self.value[0]:
self.radio_std.SetValue(true)
self.text.Enable(false)
self.button.Enable(false)
self.combo.Enable(true)
self.radio_std.SetValue(True)
self.text.Enable(False)
self.button.Enable(False)
self.combo.Enable(True)
else:
self.radio_file.SetValue(true)
self.text.Enable(true)
self.button.Enable(true)
self.combo.Enable(false)
self.radio_file.SetValue(True)
self.text.Enable(True)
self.button.Enable(True)
self.combo.Enable(False)
def OnChange(self, evt):
PPanel.OnChange(self, evt)
self.textModified = true
self.textModified = True
def OnCombo(self, evt):
PPanel.OnChange(self, evt)
self.value[0] = self.combo.GetValue()
@@ -737,7 +737,7 @@ class ParamBitmap(PPanel):
return [self.combo.GetValue(), self.text.GetValue()]
return self.value
def SetValue(self, value):
self.freeze = true
self.freeze = True
if not value:
self.value = ['', '']
else:
@@ -745,7 +745,7 @@ class ParamBitmap(PPanel):
self.combo.SetValue(self.value[0])
self.text.SetValue(self.value[1]) # update text ctrl
self.updateRadios()
self.freeze = false
self.freeze = False
def OnButtonBrowse(self, evt):
if self.textModified: # text has newer value
self.value[1] = self.text.GetValue()
@@ -761,7 +761,7 @@ class ParamBitmap(PPanel):
common = os.path.commonprefix([curpath, dlg.GetPath()])
self.SetValue(['', dlg.GetPath()[len(common):]])
self.SetModified()
self.textModified = false
self.textModified = False
dlg.Destroy()
paramDict = {

View File

@@ -161,12 +161,12 @@ class XML_Tree(wxTreeCtrl):
EVT_LEFT_DCLICK(self, self.OnDClick)
EVT_RIGHT_DOWN(self, self.OnRightDown)
self.needUpdate = false
self.needUpdate = False
self.pendingHighLight = None
self.ctrl = self.shift = false
self.ctrl = self.shift = False
self.dom = None
# Create image list
il = wxImageList(16, 16, true)
il = wxImageList(16, 16, True)
self.rootImage = il.AddIcon(images.getTreeRootIcon())
xxxObject.image = il.AddIcon(images.getTreeDefaultIcon())
xxxPanel.image = il.AddIcon(images.getTreePanelIcon())
@@ -296,7 +296,7 @@ class XML_Tree(wxTreeCtrl):
if IsObject(n):
self.AddNode(newItem, treeObj, n)
return newItem
# Remove leaf of tree, return it's data object
def RemoveLeaf(self, leaf):
xxx = self.GetPyData(leaf)
@@ -367,7 +367,7 @@ class XML_Tree(wxTreeCtrl):
if g.testWin:
if g.testWin.highLight:
g.testWin.highLight.Remove()
self.needUpdate = true
self.needUpdate = True
status = 'Changes were applied'
g.frame.SetStatusText(status)
# Generate view
@@ -382,11 +382,11 @@ class XML_Tree(wxTreeCtrl):
self.pendingHighLight = self.selection
# Check if item is in testWin subtree
def IsHighlatable(self, item):
if item == g.testWin.item: return false
if item == g.testWin.item: return False
while item != self.root:
item = self.GetItemParent(item)
if item == g.testWin.item: return true
return false
if item == g.testWin.item: return True
return False
# Highlight selected item
def HighLight(self, item):
self.pendingHighLight = None
@@ -419,7 +419,7 @@ class XML_Tree(wxTreeCtrl):
return
# Show item in bold
if g.testWin: # Reset old
self.SetItemBold(g.testWin.item, false)
self.SetItemBold(g.testWin.item, False)
self.CreateTestWin(item)
# Maybe an error occured, so we need to test
if g.testWin: self.SetItemBold(g.testWin.item)
@@ -515,20 +515,20 @@ class XML_Tree(wxTreeCtrl):
testWin.CreateStatusBar()
testWin.panel = testWin
testWin.SetPosition(pos)
testWin.Show(true)
testWin.Show(True)
elif xxx.__class__ == xxxPanel:
# Create new frame
if not testWin:
testWin = g.testWin = wxFrame(g.frame, -1, 'Panel: ' + name, pos=pos)
testWin.panel = res.LoadPanel(testWin, self.stdName)
testWin.SetClientSize(testWin.panel.GetSize())
testWin.Show(true)
testWin.Show(True)
elif xxx.__class__ == xxxDialog:
testWin = g.testWin = res.LoadDialog(None, self.stdName)
testWin.panel = testWin
testWin.Layout()
testWin.SetPosition(pos)
testWin.Show(true)
testWin.Show(True)
elif xxx.__class__ == xxxMenuBar:
testWin = g.testWin = wxFrame(g.frame, -1, 'MenuBar: ' + name, pos=pos)
testWin.panel = None
@@ -536,7 +536,7 @@ class XML_Tree(wxTreeCtrl):
testWin.CreateStatusBar()
testWin.menuBar = res.LoadMenuBar(self.stdName)
testWin.SetMenuBar(testWin.menuBar)
testWin.Show(true)
testWin.Show(True)
elif xxx.__class__ == xxxToolBar:
testWin = g.testWin = wxFrame(g.frame, -1, 'ToolBar: ' + name, pos=pos)
testWin.panel = None
@@ -544,7 +544,7 @@ class XML_Tree(wxTreeCtrl):
testWin.CreateStatusBar()
testWin.toolBar = res.LoadToolBar(testWin, self.stdName)
testWin.SetToolBar(testWin.toolBar)
testWin.Show(true)
testWin.Show(True)
wxMemoryFSHandler_RemoveFile('xxx.xrc')
testWin.item = item
EVT_CLOSE(testWin, self.OnCloseTestWin)
@@ -556,7 +556,7 @@ class XML_Tree(wxTreeCtrl):
wxEndBusyCursor()
def OnCloseTestWin(self, evt):
self.SetItemBold(g.testWin.item, false)
self.SetItemBold(g.testWin.item, False)
g.testWinPos = g.testWin.GetPosition()
g.testWin.Destroy()
g.testWin = None
@@ -586,14 +586,14 @@ class XML_Tree(wxTreeCtrl):
item = self.GetFirstChild(item, 0)[0]
for k in range(i): item = self.GetNextSibling(item)
return item
# True if next item should be inserted after current (vs. appended to it)
def NeedInsert(self, item):
xxx = self.GetPyData(item)
if item == self.root: return false # root item
if xxx.hasChildren and not self.GetChildrenCount(item, false):
return false
return not (self.IsExpanded(item) and self.GetChildrenCount(item, false))
if item == self.root: return False # root item
if xxx.hasChildren and not self.GetChildrenCount(item, False):
return False
return not (self.IsExpanded(item) and self.GetChildrenCount(item, False))
# Pull-down
def OnRightDown(self, evt):
@@ -616,7 +616,7 @@ class XML_Tree(wxTreeCtrl):
self.shift = evt.ShiftDown() # and Shift too
m = wxMenu() # create menu
if self.ctrl:
needInsert = true
needInsert = True
else:
needInsert = self.NeedInsert(item)
if item == self.root or needInsert and self.GetItemParent(item) == self.root:
@@ -641,9 +641,9 @@ class XML_Tree(wxTreeCtrl):
else:
SetMenu(m, pullDownMenu.controls)
if xxx.__class__ == xxxNotebook:
m.Enable(m.FindItem('sizer'), false)
m.Enable(m.FindItem('sizer'), False)
elif not (xxx.isSizer or xxx.parent and xxx.parent.isSizer):
m.Enable(pullDownMenu.ID_NEW_SPACER, false)
m.Enable(pullDownMenu.ID_NEW_SPACER, False)
# Select correct label for create menu
if not needInsert:
if self.shift:
@@ -688,5 +688,5 @@ class XML_Tree(wxTreeCtrl):
if isinstance(xxx, xxxBoxSizer):
self.SetItemImage(item, xxx.treeImage())
# Set global modified state
g.frame.modified = true
g.frame.modified = True

View File

@@ -20,13 +20,13 @@ class UndoManager:
undoObj = self.undo.pop()
undoObj.undo()
self.redo.append(undoObj)
g.frame.modified = true
g.frame.modified = True
g.frame.SetStatusText('Undone')
def Redo(self):
undoObj = self.redo.pop()
undoObj.redo()
self.undo.append(undoObj)
g.frame.modified = true
g.frame.modified = True
g.frame.SetStatusText('Redone')
def Clear(self):
for i in self.undo: i.destroy()
@@ -37,7 +37,7 @@ class UndoManager:
return not not self.undo
def CanRedo(self):
return not not self.redo
class UndoCutDelete:
def __init__(self, itemIndex, parent, elem):
self.itemIndex = itemIndex
@@ -56,7 +56,7 @@ class UndoCutDelete:
# Update testWin if needed
if g.testWin and g.tree.IsHighlatable(item):
if g.conf.autoRefresh:
g.tree.needUpdate = true
g.tree.needUpdate = True
g.tree.pendingHighLight = item
else:
g.tree.pendingHighLight = None
@@ -72,7 +72,7 @@ class UndoCutDelete:
# Remove highlight, update testWin
if g.testWin.highLight:
g.testWin.highLight.Remove()
g.tree.needUpdate = true
g.tree.needUpdate = True
self.elem = g.tree.RemoveLeaf(item)
g.tree.Unselect()
g.panel.Clear()
@@ -102,7 +102,7 @@ class UndoPasteCreate:
# Remove highlight, update testWin
if g.testWin.highLight:
g.testWin.highLight.Remove()
g.tree.needUpdate = true
g.tree.needUpdate = True
def redo(self):
item = g.tree.InsertNode(g.tree.ItemAtFullIndex(self.itemParentIndex),
self.parent, self.elem,
@@ -114,7 +114,7 @@ class UndoPasteCreate:
# Update testWin if needed
if g.testWin and g.tree.IsHighlatable(item):
if g.conf.autoRefresh:
g.tree.needUpdate = true
g.tree.needUpdate = True
g.tree.pendingHighLight = item
else:
g.tree.pendingHighLight = None
@@ -134,7 +134,7 @@ class UndoEdit:
g.testWin.highLight.Remove()
g.tree.pendingHighLight = selected
if g.testWin:
g.tree.needUpdate = true
g.tree.needUpdate = True
def undo(self):
# Restore selection
selected = g.tree.ItemAtFullIndex(self.selectedIndex)

View File

@@ -19,7 +19,7 @@ Options:
-v Print version info.
"""
from globals import *
@@ -73,7 +73,7 @@ class ScrolledMessageDialog(wxDialog):
text.SetConstraints(Layoutf('t=t5#1;b=t5#2;l=l5#1;r=r5#1', (self,ok)))
text.SetSize((w * 80 + 30, h * 40))
ok.SetConstraints(Layoutf('b=b5#1;x%w50#1;w!80;h!25', (self,)))
self.SetAutoLayout(TRUE)
self.SetAutoLayout(True)
self.Fit()
self.CenterOnScreen(wxBOTH)
@@ -88,7 +88,7 @@ class Frame(wxFrame):
self.SetIcon(images.getIconIcon())
# Idle flag
self.inIdle = false
self.inIdle = False
# Make menus
menuBar = wxMenuBar()
@@ -119,7 +119,7 @@ class Frame(wxFrame):
menu = wxMenu()
self.ID_EMBED_PANEL = wxNewId()
menu.Append(self.ID_EMBED_PANEL, '&Embed Panel',
'Toggle embedding properties panel in the main window', true)
'Toggle embedding properties panel in the main window', True)
menu.Check(self.ID_EMBED_PANEL, conf.embedPanel)
menu.AppendSeparator()
self.ID_TEST = wxNewId()
@@ -128,7 +128,7 @@ class Frame(wxFrame):
menu.Append(self.ID_REFRESH, '&Refresh\tCtrl-R', 'Refresh test window')
self.ID_AUTO_REFRESH = wxNewId()
menu.Append(self.ID_AUTO_REFRESH, '&Auto-refresh\tCtrl-A',
'Toggle auto-refresh mode', true)
'Toggle auto-refresh mode', True)
menu.Check(self.ID_AUTO_REFRESH, conf.autoRefresh)
menuBar.Append(menu, '&View')
@@ -163,7 +163,7 @@ class Frame(wxFrame):
tb.AddSimpleTool(self.ID_REFRESH, images.getRefreshBitmap(),
'Refresh', 'Refresh view')
tb.AddSimpleTool(self.ID_AUTO_REFRESH, images.getAutoRefreshBitmap(),
'Auto-refresh', 'Toggle auto-refresh mode', true)
'Auto-refresh', 'Toggle auto-refresh mode', True)
if wxPlatform == '__WXGTK__':
tb.AddSeparator() # otherwise auto-refresh sticks in status line
tb.ToggleTool(self.ID_AUTO_REFRESH, conf.autoRefresh)
@@ -221,7 +221,7 @@ class Frame(wxFrame):
(conf.panelWidth, conf.panelHeight))
self.miniFrame = miniFrame
sizer2 = wxBoxSizer()
miniFrame.SetAutoLayout(true)
miniFrame.SetAutoLayout(True)
miniFrame.SetSizer(sizer2)
EVT_CLOSE(self.miniFrame, self.OnCloseMiniFrame)
# Create panel for parameters
@@ -233,10 +233,10 @@ class Frame(wxFrame):
else:
panel = Panel(miniFrame)
sizer2.Add(panel, 1, wxEXPAND)
miniFrame.Show(true)
miniFrame.Show(True)
splitter.Initialize(tree)
sizer.Add(splitter, 1, wxEXPAND)
self.SetAutoLayout(true)
self.SetAutoLayout(True)
self.SetSizer(sizer)
# Init pull-down menu data
@@ -441,14 +441,14 @@ class Frame(wxFrame):
selected = tree.selection
if not selected: return # key pressed event
xxx = tree.GetPyData(selected)
self.clipboard = xxx.element.cloneNode(true)
self.clipboard = xxx.element.cloneNode(True)
self.SetStatusText('Copied')
def OnPaste(self, evt):
selected = tree.selection
if not selected: return # key pressed event
# For pasting with Ctrl pressed
if evt.GetId() == pullDownMenu.ID_PASTE_SIBLING: appendChild = false
if evt.GetId() == pullDownMenu.ID_PASTE_SIBLING: appendChild = False
else: appendChild = not tree.NeedInsert(selected)
xxx = tree.GetPyData(selected)
if not appendChild:
@@ -456,47 +456,47 @@ class Frame(wxFrame):
nextItem = tree.GetNextSibling(selected)
parentLeaf = tree.GetItemParent(selected)
# Expanded container (must have children)
elif tree.IsExpanded(selected) and tree.GetChildrenCount(selected, false):
elif tree.IsExpanded(selected) and tree.GetChildrenCount(selected, False):
# Insert as first child
nextItem = tree.GetFirstChild(selected, 0)[0]
parentLeaf = selected
else:
# No children or unexpanded item - appendChild stays true
# No children or unexpanded item - appendChild stays True
nextItem = wxTreeItemId() # no next item
parentLeaf = selected
parent = tree.GetPyData(parentLeaf).treeObject()
# Create a copy of clipboard element
elem = self.clipboard.cloneNode(true)
elem = self.clipboard.cloneNode(True)
# Tempopary xxx object to test things
xxx = MakeXXXFromDOM(parent, elem)
# Check compatibility
error = false
error = False
# Top-level
x = xxx.treeObject()
if x.__class__ in [xxxDialog, xxxFrame, xxxMenuBar]:
# Top-level classes
if parent.__class__ != xxxMainNode: error = true
if parent.__class__ != xxxMainNode: error = True
elif x.__class__ == xxxToolBar:
# Toolbar can be top-level of child of panel or frame
if parent.__class__ not in [xxxMainNode, xxxPanel, xxxFrame]: error = true
if parent.__class__ not in [xxxMainNode, xxxPanel, xxxFrame]: error = True
elif x.__class__ == xxxPanel and parent.__class__ == xxxMainNode:
pass
elif x.__class__ == xxxSpacer:
if not parent.isSizer: error = true
if not parent.isSizer: error = True
elif x.__class__ == xxxSeparator:
if not parent.__class__ in [xxxMenu, xxxToolBar]: error = true
if not parent.__class__ in [xxxMenu, xxxToolBar]: error = True
elif x.__class__ == xxxTool:
if parent.__class__ != xxxToolBar: error = true
if parent.__class__ != xxxToolBar: error = True
elif x.__class__ == xxxMenu:
if not parent.__class__ in [xxxMainNode, xxxMenuBar, xxxMenu]: error = true
if not parent.__class__ in [xxxMainNode, xxxMenuBar, xxxMenu]: error = True
elif x.__class__ == xxxMenuItem:
if not parent.__class__ in [xxxMenuBar, xxxMenu]: error = true
elif x.isSizer and parent.__class__ == xxxNotebook: error = true
if not parent.__class__ in [xxxMenuBar, xxxMenu]: error = True
elif x.isSizer and parent.__class__ == xxxNotebook: error = True
else: # normal controls can be almost anywhere
if parent.__class__ == xxxMainNode or \
parent.__class__ in [xxxMenuBar, xxxMenu]: error = true
parent.__class__ in [xxxMenuBar, xxxMenu]: error = True
if error:
if parent.__class__ == xxxMainNode: parentClass = 'root'
else: parentClass = parent.className
@@ -517,7 +517,7 @@ class Frame(wxFrame):
elem = xxx.child.element # replace
# This may help garbage collection
xxx.child.parent = None
isChildContainer = false
isChildContainer = False
# Parent is sizer or notebook, child is not child container
if parent.isSizer and not isChildContainer and not isinstance(xxx, xxxSpacer):
# Create sizer item element
@@ -540,11 +540,11 @@ class Frame(wxFrame):
# Update view?
if g.testWin and tree.IsHighlatable(newItem):
if conf.autoRefresh:
tree.needUpdate = true
tree.needUpdate = True
tree.pendingHighLight = newItem
else:
tree.pendingHighLight = None
self.modified = true
self.modified = True
self.SetStatusText('Pasted')
def OnCutDelete(self, evt):
@@ -567,7 +567,7 @@ class Frame(wxFrame):
# Remove highlight, update testWin
if g.testWin.highLight:
g.testWin.highLight.Remove()
tree.needUpdate = true
tree.needUpdate = True
# Prepare undo data
panel.Apply()
index = tree.ItemFullIndex(selected)
@@ -576,11 +576,11 @@ class Frame(wxFrame):
undoMan.RegisterUndo(UndoCutDelete(index, parent, elem))
if evt.GetId() == wxID_CUT:
if self.clipboard: self.clipboard.unlink()
self.clipboard = elem.cloneNode(true)
self.clipboard = elem.cloneNode(True)
tree.pendingHighLight = None
tree.Unselect()
panel.Clear()
self.modified = true
self.modified = True
self.SetStatusText(status)
def OnSelect(self, evt):
@@ -609,7 +609,7 @@ class Frame(wxFrame):
# Widen
self.SetDimensions(pos.x, pos.y, size.x + sizePanel.x, size.y)
self.splitter.SplitVertically(tree, panel, conf.sashPos)
self.miniFrame.Show(false)
self.miniFrame.Show(False)
else:
conf.sashPos = self.splitter.GetSashPosition()
pos = self.GetPosition()
@@ -618,9 +618,9 @@ class Frame(wxFrame):
self.splitter.Unsplit(panel)
sizer = self.miniFrame.GetSizer()
panel.Reparent(self.miniFrame)
panel.Show(true)
panel.Show(True)
sizer.Add(panel, 1, wxEXPAND)
self.miniFrame.Show(true)
self.miniFrame.Show(True)
self.miniFrame.SetDimensions(conf.panelX, conf.panelY,
conf.panelWidth, conf.panelHeight)
wxYield()
@@ -642,7 +642,7 @@ class Frame(wxFrame):
if g.testWin:
# (re)create
tree.CreateTestWin(g.testWin.item)
tree.needUpdate = false
tree.needUpdate = False
def OnAutoRefresh(self, evt):
conf.autoRefresh = evt.IsChecked()
@@ -684,7 +684,7 @@ Homepage: http://xrced.sourceforge.net\
def OnCreate(self, evt):
selected = tree.selection
if tree.ctrl: appendChild = false
if tree.ctrl: appendChild = False
else: appendChild = not tree.NeedInsert(selected)
xxx = tree.GetPyData(selected)
if not appendChild:
@@ -699,7 +699,7 @@ Homepage: http://xrced.sourceforge.net\
parentLeaf = tree.GetItemParent(selected)
# Expanded container (must have children)
elif tree.shift and tree.IsExpanded(selected) \
and tree.GetChildrenCount(selected, false):
and tree.GetChildrenCount(selected, False):
nextItem = tree.GetFirstChild(selected, 0)[0]
parentLeaf = selected
else:
@@ -731,7 +731,7 @@ Homepage: http://xrced.sourceforge.net\
# Update view?
if g.testWin and tree.IsHighlatable(newItem):
if conf.autoRefresh:
tree.needUpdate = true
tree.needUpdate = True
tree.pendingHighLight = newItem
else:
tree.pendingHighLight = None
@@ -765,7 +765,7 @@ Homepage: http://xrced.sourceforge.net\
def OnIdle(self, evt):
if self.inIdle: return # Recursive call protection
self.inIdle = true
self.inIdle = True
if tree.needUpdate:
if conf.autoRefresh:
if g.testWin:
@@ -774,12 +774,12 @@ Homepage: http://xrced.sourceforge.net\
tree.CreateTestWin(g.testWin.item)
wxYield()
self.SetStatusText('')
tree.needUpdate = false
tree.needUpdate = False
elif tree.pendingHighLight:
tree.HighLight(tree.pendingHighLight)
else:
evt.Skip()
self.inIdle = false
self.inIdle = False
# We don't let close panel window
def OnCloseMiniFrame(self, evt):
@@ -807,7 +807,7 @@ Homepage: http://xrced.sourceforge.net\
self.clipboard.unlink()
self.clipboard = None
undoMan.Clear()
self.modified = false
self.modified = False
tree.Clear()
panel.Clear()
if g.testWin:
@@ -822,7 +822,7 @@ Homepage: http://xrced.sourceforge.net\
def Open(self, path):
if not os.path.exists(path):
wxLogError('File does not exists: %s' % path)
return false
return False
# Try to read the file
try:
f = open(path)
@@ -852,8 +852,8 @@ Homepage: http://xrced.sourceforge.net\
inf = sys.exc_info()
wxLogError(traceback.format_exception(inf[0], inf[1], None)[-1])
wxLogError('Error reading file: %s' % path)
return false
return true
return False
return True
def Indent(self, node, indent = 0):
# Copy child list because it will change soon
@@ -880,22 +880,22 @@ Homepage: http://xrced.sourceforge.net\
f = open(path, 'w')
# Make temporary copy for formatting it
# !!! We can't clone dom node, it works only once
#self.domCopy = tree.dom.cloneNode(true)
#self.domCopy = tree.dom.cloneNode(True)
self.domCopy = MyDocument()
mainNode = self.domCopy.appendChild(tree.mainNode.cloneNode(true))
mainNode = self.domCopy.appendChild(tree.mainNode.cloneNode(True))
self.Indent(mainNode)
self.domCopy.writexml(f, encoding=tree.rootObj.params['encoding'].value())
f.close()
self.domCopy.unlink()
self.domCopy = None
self.modified = false
panel.SetModified(false)
self.modified = False
panel.SetModified(False)
except:
wxLogError('Error writing file: %s' % path)
raise
def AskSave(self):
if not (self.modified or panel.IsModified()): return true
if not (self.modified or panel.IsModified()): return True
flags = wxICON_EXCLAMATION | wxYES_NO | wxCANCEL | wxCENTRE
dlg = wxMessageDialog( self, 'File is modified. Save before exit?',
'Save before too late?', flags )
@@ -904,12 +904,12 @@ Homepage: http://xrced.sourceforge.net\
if say == wxID_YES:
self.OnSaveOrSaveAs(wxCommandEvent(wxID_SAVE))
# If save was successful, modified flag is unset
if not self.modified: return true
if not self.modified: return True
elif say == wxID_NO:
self.modified = false
panel.SetModified(false)
return true
return false
self.modified = False
panel.SetModified(False)
return True
return False
def SaveUndo(self):
pass # !!!
@@ -935,7 +935,7 @@ class App(wxApp):
usage()
sys.exit(0)
elif o == '-d':
debug = true
debug = True
elif o == '-v':
print 'XRCed version', version
sys.exit(0)
@@ -944,10 +944,10 @@ class App(wxApp):
# Settings
global conf
conf = g.conf = wxConfig(style = wxCONFIG_USE_LOCAL_FILE)
conf.autoRefresh = conf.ReadInt('autorefresh', true)
conf.autoRefresh = conf.ReadInt('autorefresh', True)
pos = conf.ReadInt('x', -1), conf.ReadInt('y', -1)
size = conf.ReadInt('width', 800), conf.ReadInt('height', 600)
conf.embedPanel = conf.ReadInt('embedPanel', true)
conf.embedPanel = conf.ReadInt('embedPanel', True)
conf.sashPos = conf.ReadInt('sashPos', 200)
if not conf.embedPanel:
conf.panelX = conf.ReadInt('panelX', -1)
@@ -962,17 +962,17 @@ class App(wxApp):
wxInitAllImageHandlers()
# Create main frame
frame = Frame(pos, size)
frame.Show(true)
frame.Show(True)
# Load resources from XRC file (!!! should be transformed to .py later?)
frame.res = wxXmlResource('')
frame.res.Load(os.path.join(basePath, 'xrced.xrc'))
# Load file after showing
if args:
conf.panic = false
conf.panic = False
frame.open = frame.Open(args[0])
return true
return True
def OnExit(self):
# Write config
@@ -994,7 +994,7 @@ class App(wxApp):
wc.Flush()
def main():
app = App(0, useBestVisual=false)
app = App(0, useBestVisual=False)
app.MainLoop()
app.OnExit()
global conf

View File

@@ -138,7 +138,7 @@ class xxxParamContentCheckList(xxxNode):
l = []
for s,ch in value:
itemElem = g.tree.dom.createElement('item')
# Add checked only if true
# Add checked only if True
if ch: itemElem.setAttribute('checked', '1')
itemText = g.tree.dom.createTextNode(s)
itemElem.appendChild(itemText)
@@ -171,10 +171,10 @@ class xxxParamBitmap(xxxParam):
# Classes to interface DOM objects
class xxxObject:
# Default behavior
hasChildren = false # has children elements?
hasStyle = true # almost everyone
hasName = true # has name attribute?
isSizer = hasChild = false
hasChildren = False # has children elements?
hasStyle = True # almost everyone
hasName = True # has name attribute?
isSizer = hasChild = False
allParams = None # Some nodes have no parameters
# Style parameters (all optional)
styles = ['fg', 'bg', 'font', 'enabled', 'focused', 'hidden', 'tooltip']
@@ -286,7 +286,7 @@ class xxxParamFont(xxxObject, xxxNode):
################################################################################
class xxxContainer(xxxObject):
hasChildren = true
hasChildren = True
# Simulate normal parameter for encoding
class xxxEncoding:
@@ -301,7 +301,7 @@ class xxxEncoding:
class xxxMainNode(xxxContainer):
allParams = ['encoding']
required = ['encoding']
hasStyle = hasName = false
hasStyle = hasName = False
def __init__(self, dom):
xxxContainer.__init__(self, None, dom.documentElement)
self.className = 'XML tree'
@@ -324,7 +324,7 @@ class xxxDialog(xxxContainer):
winStyles = ['wxDEFAULT_DIALOG_STYLE', 'wxSTAY_ON_TOP',
'wxDIALOG_MODAL', 'wxDIALOG_MODELESS',
'wxCAPTION', 'wxSYSTEM_MENU', 'wxRESIZE_BORDER', 'wxRESIZE_BOX',
'wxTHICK_FRAME',
'wxTHICK_FRAME',
'wxNO_3D', 'wxTAB_TRAVERSAL', 'wxCLIP_CHILDREN']
styles = ['fg', 'bg', 'font', 'enabled', 'focused', 'hidden', 'exstyle',
'tooltip']
@@ -335,7 +335,7 @@ class xxxFrame(xxxContainer):
paramDict = {'centered': ParamBool}
required = ['title']
winStyles = ['wxDEFAULT_FRAME_STYLE', 'wxDEFAULT_DIALOG_STYLE',
'wxSTAY_ON_TOP',
'wxSTAY_ON_TOP',
'wxCAPTION', 'wxSYSTEM_MENU', 'wxRESIZE_BORDER',
'wxRESIZE_BOX', 'wxMINIMIZE_BOX', 'wxMAXIMIZE_BOX',
'wxFRAME_FLOAT_ON_PARENT', 'wxFRAME_TOOL_WINDOW',
@@ -348,12 +348,12 @@ class xxxTool(xxxObject):
allParams = ['bitmap', 'bitmap2', 'toggle', 'tooltip', 'longhelp']
required = ['bitmap']
paramDict = {'bitmap2': ParamBitmap, 'toggle': ParamBool}
hasStyle = false
hasStyle = False
class xxxToolBar(xxxContainer):
allParams = ['bitmapsize', 'margins', 'packing', 'separation',
allParams = ['bitmapsize', 'margins', 'packing', 'separation',
'pos', 'size', 'style']
hasStyle = false
hasStyle = False
paramDict = {'bitmapsize': ParamPosSize, 'margins': ParamPosSize,
'packing': ParamInt, 'separation': ParamInt,
'style': ParamNonGenericStyle}
@@ -411,7 +411,7 @@ class xxxSlider(xxxObject):
class xxxGauge(xxxObject):
allParams = ['range', 'pos', 'size', 'style', 'value', 'shadow', 'bezel']
paramDict = {'range': ParamInt, 'value': ParamInt,
paramDict = {'range': ParamInt, 'value': ParamInt,
'shadow': ParamInt, 'bezel': ParamInt}
winStyles = ['wxGA_HORIZONTAL', 'wxGA_VERTICAL', 'wxGA_PROGRESSBAR', 'wxGA_SMOOTH']
@@ -521,14 +521,14 @@ class xxxCheckList(xxxObject):
'wxLC_USER_TEXT', 'wxLC_EDIT_LABELS', 'wxLC_NO_HEADER',
'wxLC_SINGLE_SEL', 'wxLC_SORT_ASCENDING', 'wxLC_SORT_DESCENDING']
paramDict = {'content': ParamContentCheckList}
################################################################################
# Sizers
class xxxSizer(xxxContainer):
hasName = hasStyle = false
hasName = hasStyle = False
paramDict = {'orient': ParamOrient}
isSizer = true
isSizer = True
class xxxBoxSizer(xxxSizer):
allParams = ['orient']
@@ -589,8 +589,8 @@ class xxxFlexGridSizer(xxxGridSizer):
# Container with only one child.
# Not shown in tree.
class xxxChildContainer(xxxObject):
hasName = hasStyle = false
hasChild = true
hasName = hasStyle = False
hasChild = True
def __init__(self, parent, element):
xxxObject.__init__(self, parent, element)
# Must have one child with 'object' tag, but we don't check it
@@ -635,7 +635,7 @@ class xxxNotebookPage(xxxChildContainer):
self.child.allParams.remove('size')
class xxxSpacer(xxxObject):
hasName = hasStyle = false
hasName = hasStyle = False
allParams = ['size', 'option', 'flag', 'border']
paramDict = {'option': ParamInt}
default = {'size': '0,0'}
@@ -655,10 +655,10 @@ class xxxMenuItem(xxxObject):
allParams = ['label', 'bitmap', 'accel', 'help',
'checkable', 'radio', 'enabled', 'checked']
default = {'label': ''}
hasStyle = false
hasStyle = False
class xxxSeparator(xxxObject):
hasName = hasStyle = false
hasName = hasStyle = False
################################################################################
# Unknown control
@@ -675,7 +675,7 @@ xxxDict = {
'wxFrame': xxxFrame,
'tool': xxxTool,
'wxToolBar': xxxToolBar,
'wxBitmap': xxxBitmap,
'wxIcon': xxxIcon,
@@ -707,7 +707,7 @@ xxxDict = {
'wxCalendarCtrl': xxxCalendarCtrl,
'wxGenericDirCtrl': xxxGenericDirCtrl,
'wxSpinCtrl': xxxSpinCtrl,
'wxBoxSizer': xxxBoxSizer,
'wxStaticBoxSizer': xxxStaticBoxSizer,
'wxGridSizer': xxxGridSizer,
@@ -752,7 +752,7 @@ def MakeXXXFromDOM(parent, element):
return klass(parent, element)
# Make empty DOM element
def MakeEmptyDOM(className):
def MakeEmptyDOM(className):
elem = g.tree.dom.createElement('object')
elem.setAttribute('class', className)
# Set required and default parameters