dabo Commit
Revision 5431
Date: 2009-09-26 10:41:20 -0700 (Sat, 26 Sep 2009)
Author: Ed
Trac: http://trac.dabodev.com/changeset/5431

Changed:
U   trunk/dabo/ui/uiwx/dLed.py
U   trunk/dabo/ui/uiwx/dPageFrame.py
U   trunk/dabo/ui/uiwx/dPageFrameMixin.py
U   trunk/dabo/ui/uiwx/dPageFrameNoTabs.py
U   trunk/dabo/ui/uiwx/dPanel.py
U   trunk/dabo/ui/uiwx/dPemMixin.py
U   trunk/dabo/ui/uiwx/dRadioList.py
U   trunk/dabo/ui/uiwx/dShell.py
U   trunk/dabo/ui/uiwx/dSizerMixin.py
U   trunk/dabo/ui/uiwx/dSpinner.py
U   trunk/dabo/ui/uiwx/dSplitter.py
U   trunk/dabo/ui/uiwx/dTextBoxMixin.py
U   trunk/dabo/ui/uiwx/dToggleButton.py
U   trunk/dabo/ui/uiwx/dToolBar.py
U   trunk/dabo/ui/uiwx/uiApp.py

Log:
Lots of minor fixes revealed by running pychecker against the code.


Diff:
Modified: trunk/dabo/ui/uiwx/dLed.py
===================================================================
--- trunk/dabo/ui/uiwx/dLed.py  2009-09-26 17:30:03 UTC (rev 5430)
+++ trunk/dabo/ui/uiwx/dLed.py  2009-09-26 17:41:20 UTC (rev 5431)
@@ -9,6 +9,7 @@
 
 class dLed(dabo.ui.dPanel):
        def afterInit(self):
+               self._baseClass = dLed
                self._offColor = "darkred"
                self._onColor = "green"
                self._on = False

Modified: trunk/dabo/ui/uiwx/dPageFrame.py
===================================================================
--- trunk/dabo/ui/uiwx/dPageFrame.py    2009-09-26 17:30:03 UTC (rev 5430)
+++ trunk/dabo/ui/uiwx/dPageFrame.py    2009-09-26 17:41:20 UTC (rev 5431)
@@ -469,7 +469,7 @@
                        elif val == "Firefox":
                                self._addWindowStyleFlag(fnb.FNB_FF2)
                        else:
-                               ValueError, (_("The only possible values are 
'Default' and 'VC8', 'VC71', 'Fancy', or 'Firefox'"))
+                               raise ValueError(_("The only possible values 
are 'Default' and 'VC8', 'VC71', 'Fancy', or 'Firefox'"))
 
                        self._tabStyle = val
 

Modified: trunk/dabo/ui/uiwx/dPageFrameMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPageFrameMixin.py       2009-09-26 17:30:03 UTC (rev 
5430)
+++ trunk/dabo/ui/uiwx/dPageFrameMixin.py       2009-09-26 17:41:20 UTC (rev 
5431)
@@ -251,8 +251,10 @@
                """
                fwd = num > 0
                self.lockDisplay()
-               for ii in range(abs(num)):
+               numToMove = abs(num)
+               while numToMove:
                        self.AdvanceSelection(fwd)
+                       numToMove -= 1
                self.unlockDisplay()
                
                
@@ -312,14 +314,17 @@
                        if val < 0:
                                raise ValueError(_("Cannot set PageCount to 
less than zero."))
                
-                       if val > pageCount:
-                               for i in range(pageCount, val):
+                       diff = val - pageCount
+                       if diff > 0:
+                               while diff:
                                        pg = self.appendPage(pageClass)
+                                       diff -= 1
                                        if not pg.Caption:
                                                pg.Caption = _("Page %s") % 
(i+1,)
-                       elif val < pageCount:
-                               for i in range(pageCount, val, -1):
+                       else:
+                               while diff:
                                        self.DeletePage(i-1)
+                                       diff += 1
                else:
                        self._properties["PageCount"] = val
 

Modified: trunk/dabo/ui/uiwx/dPageFrameNoTabs.py
===================================================================
--- trunk/dabo/ui/uiwx/dPageFrameNoTabs.py      2009-09-26 17:30:03 UTC (rev 
5430)
+++ trunk/dabo/ui/uiwx/dPageFrameNoTabs.py      2009-09-26 17:41:20 UTC (rev 
5431)
@@ -79,12 +79,10 @@
                the page is released, and None is returned. If delPage is
                False, the page is returned.
                """
-               pos = pgOrPos
                if isinstance(pgOrPos, int):
                        pg = self.Pages[pgOrPos]
                else:
                        pg = pgOrPos
-                       pos = self.Pages.index(pg)
                self._pages.remove(pg)
                if delPage:
                        pg.release()
@@ -188,8 +186,9 @@
                diff = (val - len(self._pages))
                if diff > 0:
                        # Need to add pages
-                       for ii in range(diff):
+                       while diff:
                                self.appendPage()
+                               diff -= 1
                elif diff < 0:
                        # Need to remove pages. If the active page is one 
                        # of those being removed, set the active page to the

Modified: trunk/dabo/ui/uiwx/dPanel.py
===================================================================
--- trunk/dabo/ui/uiwx/dPanel.py        2009-09-26 17:30:03 UTC (rev 5430)
+++ trunk/dabo/ui/uiwx/dPanel.py        2009-09-26 17:41:20 UTC (rev 5431)
@@ -57,6 +57,8 @@
 
 
        def _onPaintBuffer(self, evt):
+               # We create it; as soon as 'dc' goes out of scope, the
+               # DC is destroyed, which copies its contents to the display
                dc = wx.BufferedPaintDC(self, self._buffer)
        
        
@@ -90,8 +92,8 @@
        def _getActiveControl(self):
                return getattr(self, "_activeControl", None)
 
-       def _setActiveControl(self, val):
-               self.setFocus(val)
+       def _setActiveControl(self, obj):
+               obj.setFocus()
        
        def _getAlwaysResetSizer(self):
                return self._alwaysResetSizer

Modified: trunk/dabo/ui/uiwx/dPemMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dPemMixin.py     2009-09-26 17:30:03 UTC (rev 5430)
+++ trunk/dabo/ui/uiwx/dPemMixin.py     2009-09-26 17:41:20 UTC (rev 5431)
@@ -246,7 +246,7 @@
        def _constructed(self):
                """Returns True if the ui object has been fully created yet, 
False otherwise."""
                try:
-                       return self == self._pemObject
+                       return self is self._pemObject
                except Exception, e:
                        return False
        
@@ -978,7 +978,6 @@
                if isinstance(cnt, dabo.ui.dPage):
                        cnt = cnt.Parent
                p = self
-               lastPar = None
                found = False
                while (p is not None):
                        if p is cnt:
@@ -986,7 +985,6 @@
                                break
                        l += p.Left
                        t += p.Top
-                       lastPar = p
                        p = p.Parent
                # If we didn't find the container, that means that the object
                # is not contained by the container. This can happen when 
@@ -1330,6 +1328,7 @@
                                # Need to adjust for the title bar
                                offset = self.Top - cltTop
                        elif self.Application.Platform == "GTK":
+                               # Probably no longer needed; currently 
commented out below.
                                htReduction = cltTop - self.Top
                else:
                        dc = wx.ClientDC(obj)
@@ -1491,7 +1490,7 @@
                """
                obj = DrawObject(self, FillColor=fillColor, PenColor=penColor,
                                PenWidth=penWidth, LineStyle=lineStyle, 
DrawMode=mode, 
-                               Shape="line", Points=((x1,y1), (x2,y2)) )
+                               Shape="line", Points=((x1,y1), (x2,y2)), 
Visible=visible)
                # Add it to the list of drawing objects
                obj = self._addToDrawnObjects(obj, persist)
                return obj
@@ -1938,7 +1937,8 @@
        def _setDroppedTextHandler(self, val):
                if self._constructed():
                        self._droppedTextHandler = val
-                       target = self.GetDropTarget()
+                       # EGL: 2009-09-22 - is this needed? The name 'target' 
is never used.
+                       #target = self.GetDropTarget()
                        if self._dropTarget == None:
                                self._dropTarget = _DropTarget()
                                if isinstance(self, dabo.ui.dGrid):
@@ -1980,7 +1980,7 @@
                        self._font = val
                        try:
                                self.SetFont(val._nativeFont)
-                       except AttributeError, e:
+                       except AttributeError:
                                dabo.errorLog.write(_("Error setting font for 
%s") % self.Name)
                        val.bindEvent(dabo.dEvents.FontPropertiesChanged, 
self._onFontPropsChanged)
                else:
@@ -2302,7 +2302,8 @@
                                # Can't do the name check for siblings, so 
allow it for now.
                                # This problem would only apply to top-level 
forms, so it really
                                # wouldn't matter anyway in a practical sense.
-                               name = name
+                               pass
+
        
                        name = str(name)
                        self._name = name
@@ -2502,10 +2503,10 @@
                                sleeptime = delay / 10.0
                                oldVal = self._transparency
                                self._transparency = val
-                               slice = (val - oldVal) / 10
+                               incr = (val - oldVal) / 10
                                newVal = oldVal
                                for i in xrange(10):
-                                       newVal = int(round(newVal + slice, 0))
+                                       newVal = int(round(newVal + incr, 0))
                                        newVal = min(max(newVal, 0), 255)
                                        self.SetTransparent(newVal)
                                        self.refresh()

Modified: trunk/dabo/ui/uiwx/dRadioList.py
===================================================================
--- trunk/dabo/ui/uiwx/dRadioList.py    2009-09-26 17:30:03 UTC (rev 5430)
+++ trunk/dabo/ui/uiwx/dRadioList.py    2009-09-26 17:41:20 UTC (rev 5431)
@@ -219,83 +219,83 @@
                        itm.SetValue(pos==val)
                
 
-       def enableKey(self, item, val=True):
+       def enableKey(self, itm, val=True):
                """Enables or disables an individual button, referenced by key 
value."""
-               index = self.Keys[item]
+               index = self.Keys[itm]
                self._items[index].Enabled = val
        
 
-       def enablePosition(self, item, val=True):
+       def enablePosition(self, itm, val=True):
                """Enables or disables an individual button, referenced by 
position (index)."""
-               self._items[item].Enabled = val
+               self._items[itm].Enabled = val
                
 
-       def enableString(self, item, val=True):
+       def enableString(self, itm, val=True):
                """Enables or disables an individual button, referenced by 
string display value."""
                mtch = [btn for btn in self.Children
                                if isinstance(btn, _dRadioButton)
-                               and btn.Caption == item]
+                               and btn.Caption == itm]
                try:
                        itm = mtch[0]
                        idx = self._items.index(itm)
                        self._items[idx].Enabled = val
                except IndexError:
-                       dabo.errorLog.write(_("Could not find a button with 
Caption of '%s'") % item)
+                       dabo.errorLog.write(_("Could not find a button with 
Caption of '%s'") % itm)
                
 
-       def enable(self, item, val=True):
+       def enable(self, itm, val=True):
                """Enables or disables an individual button.
                
-               The item argument specifies which button to enable/disable, and 
its type
+               The itm argument specifies which button to enable/disable, and 
its type
                depends on the setting of self.ValueType:               
                        "position" : The item is referenced by index position.
                        "string"   : The item is referenced by its string 
display value.
                        "key"      : The item is referenced by its key value.
                """
                if self.ValueMode == "position":
-                       self.enablePosition(item, val)
+                       self.enablePosition(itm, val)
                elif self.ValueMode == "string":
-                       self.enableString(item, val)
+                       self.enableString(itm, val)
                elif self.ValueMode == "key":
-                       self.enableKey(item, val)
+                       self.enableKey(itm, val)
                
                
-       def showKey(self, item, val=True):
+       def showKey(self, itm, val=True):
                """Shows or hides an individual button, referenced by key 
value."""
-               index = self.Keys[item]
+               index = self.Keys[itm]
                self._items[index].Visible = val
                self.layout()
                
        
-       def showPosition(self, item, val=True):
+       def showPosition(self, itm, val=True):
                """Shows or hides an individual button, referenced by position 
(index)."""
-               self._items[item].Visible = val
+               self._items[itm].Visible = val
                self.layout()
                
                
-       def showString(self, item, val=True):
+       def showString(self, itm, val=True):
                """Shows or hides an individual button, referenced by string 
display value."""
-               mtch = [btn for btn in self._items if btn.Caption == item]
+               mtch = [btn for btn in self._items if btn.Caption == itm]
                if mtch:
                        mtch[0].Visible = val
                self.layout()
                
                
-       def show(self, item, val=True):
+       def show(self, itm, val=True):
                """Shows or hides an individual button.
                
-               The item argument specifies which button to hide/show, and its 
type
+               The itm argument specifies which button to hide/show, and its 
type
                depends on the setting of self.ValueType:               
                        "position" : The item is referenced by index position.
                        "string"   : The item is referenced by its string 
display value.
                        "key"      : The item is referenced by its key value.
                """
                if self.ValueMode == "position":
-                       self.showPosition(item, val)
+                       self.showPosition(itm, val)
                elif self.ValueMode == "string":
-                       self.showString(item, val)
+                       self.showString(itm, val)
                elif self.ValueMode == "key":
-                       self.showKey(item, val)
+                       self.showKey(itm, val)
                
 
        def _getFudgedButtonSpacing(self):

Modified: trunk/dabo/ui/uiwx/dShell.py
===================================================================
--- trunk/dabo/ui/uiwx/dShell.py        2009-09-26 17:30:03 UTC (rev 5430)
+++ trunk/dabo/ui/uiwx/dShell.py        2009-09-26 17:41:20 UTC (rev 5431)
@@ -175,8 +175,8 @@
                if edt:
                        # push the latest command into the stack
                        self.Form.addToHistory(self.history[0])
-               
-               
+
+
        def setDefaultFont(self, fontFace, fontSize):
                # Global default styles for all languages
                self.StyleSetSpec(stc.STC_STYLE_DEFAULT, "face:%s,size:%d" % 
(fontFace, fontSize))

Modified: trunk/dabo/ui/uiwx/dSizerMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dSizerMixin.py   2009-09-26 17:30:03 UTC (rev 5430)
+++ trunk/dabo/ui/uiwx/dSizerMixin.py   2009-09-26 17:41:20 UTC (rev 5431)
@@ -76,8 +76,8 @@
        def appendItems(self, items, *args, **kwargs):
                """Append each item to the sizer."""
                ret = []
-               for item in items:
-                       ret.append(self.append(item, *args, **kwargs))
+               for itm in items:
+                       ret.append(self.append(itm, *args, **kwargs))
                return ret
        try:
                appendItems.__doc__ += _doc_additions
@@ -161,36 +161,36 @@
                """Insert the object at the beginning of the sizer layout."""
                return self.insert(0, obj, layout=layout, proportion=proportion,
                                alignment=alignment, halign=halign, 
valign=valign, border=border,
-                               borderSides=None)
+                               borderSides=borderSides)
        try:
                prepend.__doc__ += _doc_additions
        except TypeError:
                # If compressed to .pyo, __doc__ will be None.
                pass    
        
-       def remove(self, item, destroy=None):
+       def remove(self, itm, destroy=None):
                """This will remove the item from the sizer. It will not cause
                the item to be destroyed unless the 'destroy' parameter is 
True. 
                If the item is not one of this sizer's items, no error will be 
                raised - it will simply do nothing.
                """
                try:
-                       item.Name
+                       itm.Name
                except dabo.ui.deadObjectException:
                        # The use of callAfter can sometimes result in destroyed
                        # objects being removed.
                        return
-               if self.Detach(item):
-                       item._controllingSizer = None
-                       item._controllingSizerItem = None
+               if self.Detach(itm):
+                       itm._controllingSizer = None
+                       itm._controllingSizerItem = None
                        if destroy:
                                try:
-                                       if isinstance(item, 
dabo.ui.dSizerMixin):
-                                               item.release(True)
+                                       if isinstance(itm, dabo.ui.dSizerMixin):
+                                               itm.release(True)
                                        else:
-                                               item.release()
+                                               itm.release()
                                except AttributeError:
-                                       item.Destroy()
+                                       itm.Destroy()
        
        
        def clear(self, destroy=False):

Modified: trunk/dabo/ui/uiwx/dSpinner.py
===================================================================
--- trunk/dabo/ui/uiwx/dSpinner.py      2009-09-26 17:30:03 UTC (rev 5430)
+++ trunk/dabo/ui/uiwx/dSpinner.py      2009-09-26 17:41:20 UTC (rev 5431)
@@ -143,7 +143,6 @@
                except TypeError:
                        # Usually Decimal/float problems
                        tCurr = type(curr)
-                       tInc = type(inc)
                        if tCurr == decimal:
                                ret = op(curr, self._toDec(inc))
                        elif tCurr == float:
@@ -161,7 +160,6 @@
                        margin = -0.0001
 
                ret = True
-               curr = self._proxy_textbox.Value
                newVal = self._applyIncrement(incrementFunc)
                minn, maxx, margin = self._coerceTypes(newVal, self.Min, 
self.Max, margin)
 

Modified: trunk/dabo/ui/uiwx/dSplitter.py
===================================================================
--- trunk/dabo/ui/uiwx/dSplitter.py     2009-09-26 17:30:03 UTC (rev 5430)
+++ trunk/dabo/ui/uiwx/dSplitter.py     2009-09-26 17:41:20 UTC (rev 5431)
@@ -261,7 +261,7 @@
                ret = self.IsSplit()
                if not ret:
                        # Make sure that there is at least one level of 
splitting somewhere
-                       obj = self
+                       obj = pnl
                        while obj.Parent and not ret:
                                obj = obj.Parent
                                if isinstance(obj, dSplitter):

Modified: trunk/dabo/ui/uiwx/dTextBoxMixin.py
===================================================================
--- trunk/dabo/ui/uiwx/dTextBoxMixin.py 2009-09-26 17:30:03 UTC (rev 5430)
+++ trunk/dabo/ui/uiwx/dTextBoxMixin.py 2009-09-26 17:41:20 UTC (rev 5431)
@@ -640,7 +640,7 @@
                        try:
                                convertedVal = 
self.convertStringValueToDataType(strVal, dataType)
                                if self.getStringValue(convertedVal) != 
self.GetValue():
-                                       self._updateStringDisplay
+                                       self._updateStringDisplay()
                        except ValueError:
                                # It couldn't convert; return the previous 
value.
                                convertedVal = self._value
@@ -694,7 +694,7 @@
                        if strVal != _oldVal:
                                try:
                                        setter(strVal)
-                               except ValueError, e:
+                               except ValueError:
                                        #PVG: maskedtextedit sometimes fails, 
on value error..allow the code to continue
                                        uStrVal = 
self.Application.str2Unicode(strVal)
                                        dabo.errorLog.write(_("Error setting 
value to '%(uStrVal)s: %(e)s") % locals())

Modified: trunk/dabo/ui/uiwx/dToggleButton.py
===================================================================
--- trunk/dabo/ui/uiwx/dToggleButton.py 2009-09-26 17:30:03 UTC (rev 5430)
+++ trunk/dabo/ui/uiwx/dToggleButton.py 2009-09-26 17:41:20 UTC (rev 5431)
@@ -69,7 +69,6 @@
                                bmp = val
                        else:
                                bmp = dabo.ui.strToBmp(val, self._imgScale, 
self._imgWd, self._imgHt)
-                       all = not self._downPicture
                        self.SetBitmapSelected(bmp)
                        self.refresh()
                else:
@@ -86,8 +85,8 @@
                                bmp = val
                        else:
                                bmp = dabo.ui.strToBmp(val, self._imgScale, 
self._imgWd, self._imgHt)
-                       all = not self._downPicture
-                       self.SetBitmapLabel(bmp, all)
+                       notdown = not self._downPicture
+                       self.SetBitmapLabel(bmp, notdown)
                        self.refresh()
                else:
                        self._properties["Picture"] = val

Modified: trunk/dabo/ui/uiwx/dToolBar.py
===================================================================
--- trunk/dabo/ui/uiwx/dToolBar.py      2009-09-26 17:30:03 UTC (rev 5430)
+++ trunk/dabo/ui/uiwx/dToolBar.py      2009-09-26 17:41:20 UTC (rev 5431)
@@ -66,33 +66,33 @@
                """
                try:
                        self.Realize()
-               except wx._core.PyAssertionError, e:
+               except wx._core.PyAssertionError:
                        # Only happens on the Mac
                        pass
 
 
-       def appendItem(self, item):
+       def appendItem(self, itm):
                """Insert a dToolBarItem at the end of the toolbar."""
-               wxItem = self.AddToolItem(item._wxToolBarItem)
-               self._daboChildren.append(item)
-               item._parent = self
+               self.AddToolItem(itm._wxToolBarItem)
+               self._daboChildren.append(itm)
+               itm._parent = self
                self._realize()
-               return item
+               return itm
 
 
-       def insertItem(self, pos, item):
+       def insertItem(self, pos, itm):
                """Insert a dToolBarItem before the specified position in the 
toolbar."""
-               wxItem = self.InsertToolItem(pos, item._wxToolBarItem)
-               self._daboChildren.insert(pos, item)
-               item._parent = self
+               self.InsertToolItem(pos, itm._wxToolBarItem)
+               self._daboChildren.insert(pos, itm)
+               itm._parent = self
                self._realize()
-               return item
+               return itm
                
 
-       def prependItem(self, item):
+       def prependItem(self, itm):
                """Insert a dToolBarItem at the beginning of the toolbar."""
-               self.insertItem(0, item)
-               return item
+               self.insertItem(0, itm)
+               return itm
 
 
        def appendButton(self, caption, pic, toggle=False, tip="", 
@@ -252,31 +252,31 @@
                """
                if isinstance(idxOrItem, (int, long)):
                        idx = idxOrItem
-                       item = self.Children[idx]
+                       itm = self.Children[idx]
                else:
                        idx = self._getIndexByItem(idxOrItem)
-                       item = idxOrItem
-               if not self.hasItem(item):
+                       itm = idxOrItem
+               if not self.hasItem(itm):
                        # Nothing to do!
                        return
                try:
-                       id_ = item._id
+                       id_ = itm._id
                        self.RemoveTool(id_)
                except AttributeError:
                        # A control, not a toolbar tool
-                       item.Visible = False                                    
+                       itm.Visible = False                                     
                del(self._daboChildren[idx])
-               item._parent = None
+               itm._parent = None
                if release:
-                       item.Destroy()
-               return item
+                       itm.Destroy()
+               return itm
 
 
-       def hasItem(self, item):
+       def hasItem(self, itm):
                """Given a toolbar item, returns True or False depending on 
whether
                that item is currently in this toolbar.
                """
-               return (item in self._daboChildren)
+               return (itm in self._daboChildren)
 
 
        def getItemIndex(self, caption):
@@ -321,26 +321,25 @@
                return self._daboChildren
 
        
-       def _recreateItem(self, item):
+       def _recreateItem(self, itm):
                """Recreate the passed dToolBarItem, and put it back in its 
original place.
 
                This is necessary when changing some or all of the dToolBarItem 
properties,
                and is called from within that object as a callafter.
                """
-               id_ = item._id
-               idx = self._getIndexByItem(item)
+               idx = self._getIndexByItem(itm)
                if idx is not None:
                        self.remove(idx, False)
-                       self.insertItem(idx, item)              
+                       self.insertItem(idx, itm)               
 
 
-       def _getIndexByItem(self, item):
+       def _getIndexByItem(self, itm):
                """Given a dToolBarItem object reference, return the index in 
the toolbar.
 
                Return None if the item doesn't exist in the toolbar.
                """
                for idx, o in enumerate(self.Children):
-                       if o == item:
+                       if o == itm:
                                return idx
                return None
 

Modified: trunk/dabo/ui/uiwx/uiApp.py
===================================================================
--- trunk/dabo/ui/uiwx/uiApp.py 2009-09-26 17:30:03 UTC (rev 5430)
+++ trunk/dabo/ui/uiwx/uiApp.py 2009-09-26 17:41:20 UTC (rev 5431)
@@ -205,7 +205,6 @@
        def checkForUpdates(self, force=False):
                answer = False
                msg = ""
-               vers = None
                updAvail = False
                checkResult = self.dApp._checkForUpdates(force=force)
                if isinstance(checkResult, Exception):
@@ -311,7 +310,6 @@
 
 
        def _setUpdatePathLocations(self):
-               projects = ("dabo", "demo", "ide")
                prf = self.dApp._frameworkPrefs
                loc_demo = prf.getValue("demo_directory")
                loc_ide = prf.getValue("ide_directory")
@@ -363,10 +361,6 @@
                alt = evt.AltDown()
                ctl = evt.ControlDown()
                kcd = evt.GetKeyCode()
-               uch = evt.GetUniChar()
-               uk = evt.GetUnicodeKey()
-               met = evt.MetaDown()
-               sh = evt.ShiftDown()
                if not self.ActiveForm or alt or not ctl:
                        evt.Skip()
                        return
@@ -374,9 +368,9 @@
                        char = chr(evt.GetKeyCode())
                except (ValueError, OverflowError):
                        char = None
-               plus = (char == "=") or (char == "+") or (kcd == 
wx.WXK_NUMPAD_ADD)
-               minus = (char == "-") or (kcd == wx.WXK_NUMPAD_SUBTRACT)
-               slash = (char == "/") or (kcd == wx.WXK_NUMPAD_DIVIDE)
+               plus = char in ("=", "+", wx.WXK_NUMPAD_ADD)
+               minus = char in ("-", wx.WXK_NUMPAD_SUBTRACT)
+               slash = char in ("/", wx.WXK_NUMPAD_DIVIDE)
                if plus:
                        self.fontZoomIn()
                elif minus:
@@ -432,7 +426,7 @@
                val._EventBindings = eb
 
 
-       def start(self, dApp):
+       def start(self):
                # Manually raise Activate, as wx doesn't do that automatically
                try:
                        self.dApp.MainForm.raiseEvent(dEvents.Activate)
@@ -578,7 +572,7 @@
                                # This will allow forms to veto closing (i.e., 
user doesn't
                                # want to save pending changes). 
                                if frm:
-                                       if frm.close(force=True) == False:
+                                       if frm.close(force=True) is False:
                                                # The form stopped the closing 
process. The user
                                                # must deal with this form 
(save changes, etc.) 
                                                # before the app can exit.
@@ -891,7 +885,7 @@
                try:
                        fd = self.findReplaceData
                        self.OnFind(fd)
-               except AttributeError, e:
+               except AttributeError:
                        self.onEditFind(None)
                        return
                        
@@ -945,7 +939,6 @@
                flags = self.findReplaceData.GetFlags()
                findString = self.findReplaceData.GetFindString()
                replaceString = self.findReplaceData.GetReplaceString()
-               replaceString2 = self.findReplaceData.GetReplaceString()
                downwardSearch = (flags & wx.FR_DOWN) == wx.FR_DOWN
                wholeWord = (flags & wx.FR_WHOLEWORD) == wx.FR_WHOLEWORD
                matchCase = (flags & wx.FR_MATCHCASE) == wx.FR_MATCHCASE
@@ -1090,7 +1083,7 @@
                                try:
                                        pos = kids.index(itm)
                                        menu.remove(pos, True)
-                               except IndexError, ValueErrror:
+                               except (IndexError, ValueError):
                                        pass
                        # Add them all back
                        lnks = {}




_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-dev
Searchable Archives: http://leafe.com/archives/search/dabo-dev
This message: 
http://leafe.com/archives/byMID/[email protected]

Reply via email to