changeset 22:09337777193c

Resolved some pylint warnings/errors.
author Atul Varma <varmaa@toolness.com>
date Sat, 23 Feb 2008 07:07:55 -0600
parents 98931006fbfb
children a9366c61ef5c
files enso/graphics/xmltextlayout.py enso/ui/messages/__init__.py enso/ui/messages/miniwindows.py enso/ui/messages/primarywindow.py enso/ui/messages/windows.py enso/ui/quasimode/__init__.py enso/ui/quasimode/layout.py enso/ui/quasimode/window.py
diffstat 8 files changed, 27 insertions(+), 22 deletions(-) [+]
line wrap: on
line diff
--- a/enso/graphics/xmltextlayout.py	Fri Feb 22 19:09:54 2008 -0600
+++ b/enso/graphics/xmltextlayout.py	Sat Feb 23 07:07:55 2008 -0600
@@ -433,7 +433,7 @@
 
         glyphs = []
         
-        font = font.theFontRegistry.get(
+        fontObj = font.theFontRegistry.get(
             self._property( "font_family" ),
             self._propertyToPoints( "font_size" ),
             self._property( "font_style" ) == "italic"
@@ -442,7 +442,7 @@
         color = self._propertyToColor( "color" )
 
         for char in characters:
-            fontGlyph = font.getGlyph( char )
+            fontGlyph = fontObj.getGlyph( char )
             glyph = textlayout.Glyph(
                 fontGlyph,
                 color,
--- a/enso/ui/messages/__init__.py	Fri Feb 22 19:09:54 2008 -0600
+++ b/enso/ui/messages/__init__.py	Sat Feb 23 07:07:55 2008 -0600
@@ -383,7 +383,7 @@
         oldMsg = self.__primaryMessage
         if oldMsg != None:
             if oldMsg.isMini() and not oldMsg.isFinished():
-               self.__newMiniMessage( oldMsg )
+                self.__newMiniMessage( oldMsg )
 
         self.__primaryMessage = msg
         self.__primaryMsgWind.setMessage( msg )
--- a/enso/ui/messages/miniwindows.py	Fri Feb 22 19:09:54 2008 -0600
+++ b/enso/ui/messages/miniwindows.py	Sat Feb 23 07:07:55 2008 -0600
@@ -44,17 +44,13 @@
 # Imports
 # ----------------------------------------------------------------------------
 
-import cairo
-
 from enso import config
 from enso import graphics
-from enso.graphics.transparentwindow import TransparentWindow
 from enso.graphics.measurement import pointsToPixels, pixelsToPoints
-from enso.graphics.measurement import inchesToPoints
 from enso.ui.graphics import UPPER_LEFT, drawRoundedRect
 from enso.ui import events
 from enso.ui.messages.windows import MessageWindow, computeWidth
-from enso.ui.messages.primarywindow import layoutMessageXml, splitContent
+from enso.ui.messages.primarywindow import layoutMessageXml
 from enso.ui.messages import Message
 
 
@@ -316,7 +312,8 @@
         self.__msgManager.onMiniMessageFinished()
 
     def __onAppearingTick( self, msPassed ):
-        unusedArgs( msPassed )
+        # So pychecker doesn't complain
+        dummy = msPassed
 
         fracPer = 0.1
         msg = self.__visibleMessages[ self.__changingIndex ]
@@ -327,7 +324,8 @@
             msg.fadeIn( fracPer )
 
     def __onVanishingTick( self, msPassed ):
-        unusedArgs( msPassed )
+        # So pychecker doesn't complain
+        dummy = msPassed
 
         distancePer = pixelsToPoints( 1 )
         msg = self.__visibleMessages[ self.__changingIndex ]
@@ -445,8 +443,8 @@
                                         size = size,
                                         height = height, )
                 return doc
-            except:
-                # LONGTERM TODO: Lookup actual errors.
+            except Exception:
+                # TODO: Lookup actual errors and catch them.
                 pass
 
         doc = layoutMessageXml( xmlMarkup = text,
--- a/enso/ui/messages/primarywindow.py	Fri Feb 22 19:09:54 2008 -0600
+++ b/enso/ui/messages/primarywindow.py	Sat Feb 23 07:07:55 2008 -0600
@@ -44,7 +44,7 @@
 
 from enso import graphics
 from enso.graphics import xmltextlayout
-from enso.graphics.measurement import pointsToPixels, pixelsToPoints
+from enso.graphics.measurement import pixelsToPoints
 from enso.graphics.measurement import inchesToPoints
 from enso.ui.graphics import drawRoundedRect, ALL_CORNERS
 from enso.utils.xml_tools import escapeXml
@@ -324,8 +324,8 @@
                 else:
                     capDoc = None
                 return msgDoc, capDoc
-            except:
-                # LONGTERM TODO: Lookup exact error.
+            except Exception:
+                # TODO: Lookup exact error.
                 pass
             
         # This time, ellipsify.
--- a/enso/ui/messages/windows.py	Fri Feb 22 19:09:54 2008 -0600
+++ b/enso/ui/messages/windows.py	Sat Feb 23 07:07:55 2008 -0600
@@ -45,8 +45,8 @@
 from enso import graphics
 from enso.graphics.transparentwindow import TransparentWindow
 
-from enso.graphics.measurement import pointsToPixels, pixelsToPoints
-from enso.graphics.measurement import inchesToPoints, convertUserSpaceToPoints
+from enso.graphics.measurement import pointsToPixels
+from enso.graphics.measurement import convertUserSpaceToPoints
 
 
 # ----------------------------------------------------------------------------
--- a/enso/ui/quasimode/__init__.py	Fri Feb 22 19:09:54 2008 -0600
+++ b/enso/ui/quasimode/__init__.py	Sat Feb 23 07:07:55 2008 -0600
@@ -49,6 +49,7 @@
 # ----------------------------------------------------------------------------
 
 import weakref
+import logging
 
 from enso.ui import events
 from enso.ui import commands
@@ -288,7 +289,8 @@
         be lagging behind the user a half a second or more. 
         """
 
-        unusedArgs( timePassed )
+        # So pychecker doesn't complain...
+        dummy = timePassed
 
         assert self._inQuasimode == True
 
--- a/enso/ui/quasimode/layout.py	Fri Feb 22 19:09:54 2008 -0600
+++ b/enso/ui/quasimode/layout.py	Sat Feb 23 07:07:55 2008 -0600
@@ -42,8 +42,7 @@
 
 from enso import graphics
 from enso.graphics import xmltextlayout
-from enso.graphics.measurement import pointsToPixels, pixelsToPoints
-from enso.ui.graphics import getTextSize
+from enso.graphics.measurement import pixelsToPoints
 from enso.utils.xml_tools import escapeXml
 
 
@@ -235,10 +234,16 @@
                 )
             usedSize = size
             break
-        except:
+        except Exception:
             # NOTE: If the error is fundamental (not size-related),
             # then it will be raised again below
+
+            # TODO: Figure out what exact types of exceptions are
+            # "non-fundamental" and catch those instead of using
+            # a blanket catch like this.
+
             pass
+
     if document == None:
         # no size above worked; use the smallest size
         _updateStyles( styles, scale, scale[0] )
--- a/enso/ui/quasimode/window.py	Fri Feb 22 19:09:54 2008 -0600
+++ b/enso/ui/quasimode/window.py	Sat Feb 23 07:07:55 2008 -0600
@@ -62,7 +62,7 @@
 
 import time
 
-from enso.graphics.measurement import pointsToPixels, pixelsToPoints
+from enso.graphics.measurement import pointsToPixels
 
 from enso.ui.quasimode.linewindows import TextWindow
 from enso.ui.quasimode.layout import QuasimodeLayout