[Skencil-commits] r796 - skencil/branches/skencil-0.6/src/Sketch/UI

scm-commit@wald.intevation.org scm-commit at wald.intevation.org
Sun Feb 6 20:10:58 CET 2011


Author: bh
Date: 2011-02-06 20:10:57 +0100 (Sun, 06 Feb 2011)
New Revision: 796

Modified:
   skencil/branches/skencil-0.6/src/Sketch/UI/ruler.py
Log:
Fix code formatting.


Modified: skencil/branches/skencil-0.6/src/Sketch/UI/ruler.py
===================================================================
--- skencil/branches/skencil-0.6/src/Sketch/UI/ruler.py	2011-02-06 19:10:04 UTC (rev 795)
+++ skencil/branches/skencil-0.6/src/Sketch/UI/ruler.py	2011-02-06 19:10:57 UTC (rev 796)
@@ -38,7 +38,7 @@
 
 tick_lengths = (8, 5, 3, 2)
 
-# (base_unit_factor, (subdiv1, subdiv2,...))
+# (base_unit_factor, (subdiv1, subdiv2, ...))
 tick_config = {'in': (1.0, (2, 2, 2, 2)),
                'cm': (1.0, (2, 5)),
                'mm': (10.0, (2, 5)),
@@ -51,61 +51,71 @@
          '-': (4, [(0, 2, 2, 2)]),
          '0': (5, [(0, 0, 3, 0), (3, 0, 3, 4), (3, 4, 0, 4), (0, 4, 0, 0)]),
          '1': (3, [(1, 0, 1, 4), (1, 4, 0, 4)]),
-         '2': (5, [(3, 0, 0, 0), (0, 0, 0, 2), (0, 2, 3, 2), (3, 2, 3, 4), (3, 4, 0, 4)]),
+         '2': (5, [(3, 0, 0, 0), (0, 0, 0, 2), (0, 2, 3, 2), (3, 2, 3, 4),
+                   (3, 4, 0, 4)]),
          '3': (5, [(0, 0, 3, 0), (0, 2, 3, 2), (0, 4, 3, 4), (3, 4, 3, 0)]),
          '4': (5, [(0, 4, 0, 1), (0, 1, 3, 1), (3, 0, 3, 4)]),
-         '5': (5, [(0, 0, 3, 0), (3, 0, 3, 2), (3, 2, 0, 2), (0, 2, 0, 4), (0, 4, 3, 4)]),
-         '6': (5, [(2, 4, 0, 4), (0, 4, 0, 0), (0, 0, 3, 0), (3, 0, 3, 2), (3, 2, 0, 2)]),
+         '5': (5, [(0, 0, 3, 0), (3, 0, 3, 2), (3, 2, 0, 2), (0, 2, 0, 4),
+                   (0, 4, 3, 4)]),
+         '6': (5, [(2, 4, 0, 4), (0, 4, 0, 0), (0, 0, 3, 0), (3, 0, 3, 2),
+                   (3, 2, 0, 2)]),
          '7': (5, [(0, 4, 3, 4), (3, 3, 1, 1), (1, 1, 1, 0)]),
-         '8': (5, [(0, 0, 0, 4), (3, 0, 3, 4), (0, 0, 3, 0), (0, 2, 3, 2), (0, 4, 3, 4)]),
-         '9': (5, [(1, 0, 3, 0), (3, 0, 3, 4), (3, 4, 0, 4), (0, 4, 0, 2), (0, 2, 3, 2)]),
-        }
+         '8': (5, [(0, 0, 0, 4), (3, 0, 3, 4), (0, 0, 3, 0), (0, 2, 3, 2),
+                   (0, 4, 3, 4)]),
+         '9': (5, [(1, 0, 3, 0), (3, 0, 3, 4), (3, 4, 0, 4), (0, 4, 0, 2),
+                   (0, 2, 3, 2)]),
+         }
 
 VFONT = {'.': (2, [(0, 0, 0, 0),]),
          ',': (2, [(0, 0, 0, 0),]),
          '-': (4, [(2, 0, 2, 2),]),
          '0': (5, [(0, 0, 4, 0), (4, 0, 4, 3), (4, 3, 0, 3), (0, 3, 0, 0)]),
          '1': (3, [(0, 1, 4, 1), (4, 1, 4, 0)]),
-         '2': (5, [(0, 3, 0, 0), (0, 0, 2, 0), (2, 0, 2, 3), (2, 3, 4, 3), (4, 3, 4, 0)]),
+         '2': (5, [(0, 3, 0, 0), (0, 0, 2, 0), (2, 0, 2, 3), (2, 3, 4, 3),
+                   (4, 3, 4, 0)]),
          '3': (5, [(0, 0, 0, 3), (0, 3, 4, 3), (4, 3, 4, 0), (2, 3, 2, 0)]),
          '4': (5, [(4, 0, 1, 0), (1, 0, 1, 3), (4, 3, 0, 3)]),
-         '5': (5, [(4, 3, 4, 0), (4, 0, 2, 0), (2, 0, 2, 3), (2, 3, 0, 3), (0, 3, 0, 0)]),
-         '6': (5, [(4, 2, 4, 0), (4, 0, 0, 0), (0, 0, 0, 3), (0, 3, 2, 3), (2, 3, 2, 0)]),
+         '5': (5, [(4, 3, 4, 0), (4, 0, 2, 0), (2, 0, 2, 3), (2, 3, 0, 3),
+                   (0, 3, 0, 0)]),
+         '6': (5, [(4, 2, 4, 0), (4, 0, 0, 0), (0, 0, 0, 3), (0, 3, 2, 3),
+                   (2, 3, 2, 0)]),
          '7': (5, [(4, 0, 4, 3), (3, 3, 1, 1), (1, 1, 0, 1)]),
-         '8': (5, [(0, 0, 0, 3), (0, 3, 4, 3), (4, 3, 4, 0), (2, 3, 2, 0), (4, 0, 0, 0)]),
-         '9': (5, [(0, 1, 0, 3), (0, 3, 4, 3), (4, 3, 4, 0), (4, 0, 2, 0), (2, 0, 2, 2)]),
-        }
+         '8': (5, [(0, 0, 0, 3), (0, 3, 4, 3), (4, 3, 4, 0), (2, 3, 2, 0),
+                   (4, 0, 0, 0)]),
+         '9': (5, [(0, 1, 0, 3), (0, 3, 4, 3), (4, 3, 4, 0), (4, 0, 2, 0),
+                   (2, 0, 2, 2)]),
+         }
 
 
 class Ruler(PyWidget):
 
-    def __init__(self, master=None, orient = HORIZONTAL, canvas = None, **kw):
+    def __init__(self, master=None, orient=HORIZONTAL, canvas=None, **kw):
         apply(PyWidget.__init__, (self, master), kw)
         self.orient = orient
         self.canvas = canvas
-        
+
         self.gc_initialized = 0
         self.gc = GraphicsDevice()
         self.gc.SetViewportTransform(1.0, Identity, Identity)
 
         self.positions = None
-        self.SetRange(0.0, 1.0, force = 1)
+        self.SetRange(0.0, 1.0, force=1)
 
         self['height'] = 19
         self['width'] = 19
-        
+
         self.border_color = XRGBColor(ui_colors.light_border)
         self.bg_color = XRGBColor(ui_colors.menubackground)
         self.fg_color = XRGBColor(ui_colors.fg)
-        
+
         self.gradient = []
         start = ui_colors.menubackground
         stop = ui_colors.light_border
         for pos in range(20):
             color = gtkutils.middle_color(start, stop, pos * 3.5 /100)
             self.gradient.append(XRGBColor(color))
-            
 
+
         self.bind('<ButtonPress>', self.ButtonPressEvent)
         self.bind('<ButtonRelease>', self.ButtonReleaseEvent)
         self.bind('<Motion>', self.PointerMotionEvent)
@@ -124,9 +134,9 @@
             self.gc_initialized = 1
 
     def ResizedMethod(self, width, height):
-        self.SetRange(self.start, self.pixel_per_pt, force = 1)
+        self.SetRange(self.start, self.pixel_per_pt, force=1)
 
-    def SetRange(self, start, pixel_per_pt, force = 0):
+    def SetRange(self, start, pixel_per_pt, force=0):
         if not force and start==self.start and pixel_per_pt==self.pixel_per_pt:
             return
         self.start = start
@@ -228,7 +238,7 @@
         return self.positions, self.texts
 
 
-    def RedrawMethod(self, region = None):
+    def RedrawMethod(self, region=None):
         if self.orient == HORIZONTAL:
             self.draw_ruler_horizontal()
         else:
@@ -238,11 +248,11 @@
         DrawLine = self.gc.gc.DrawLine
         height = self.tkwin.height
         width = self.tkwin.width
-        
-        for pos in range(0,20):
+
+        for pos in range(0, 20):
             self.gc.SetFillColor(self.gradient[pos])
             DrawLine(0, pos, width, pos)
-        
+
         self.gc.SetFillColor(self.fg_color)
         ticks, texts = self.get_positions()
         for h, pos in ticks:
@@ -256,7 +266,8 @@
                 data = HFONT[character]
                 lines = data[1]
                 for line in lines:
-                    DrawLine(line[0] + pos, y - line[1], line[2] + pos, y - line[3])
+                    DrawLine(line[0] + pos, y - line[1],
+                             line[2] + pos, y - line[3])
                 pos += data[0]
 
         self.gc.SetFillColor(self.border_color)
@@ -268,7 +279,7 @@
         height = self.tkwin.height
         width = self.tkwin.width
 
-        for pos in range(0,20):
+        for pos in range(0, 20):
             self.gc.SetFillColor(self.gradient[pos])
             DrawLine(pos, 0, pos, height)
 
@@ -287,9 +298,10 @@
                 data = VFONT[character]
                 lines = data[1]
                 for line in lines:
-                    DrawLine(x - line[0], pos - line[1], x - line[2], pos - line[3])
+                    DrawLine(x - line[0], pos - line[1],
+                             x - line[2], pos - line[3])
                 pos -= data[0]
-                
+
         self.gc.SetFillColor(self.border_color)
         DrawLine(0, 0, width, 0)
         DrawLine(width - 1, 0, width - 1, height)



More information about the Skencil-commits mailing list