[Dextrose] [PATCH][Flipsticks] pep8 fixes on montage.py

Rafael Ortiz rafael at activitycentral.com
Thu Feb 2 10:58:53 EST 2012


Pep8 fixes all along the montage.py source

Signed-off-by: Rafael Ortiz <rafael at activitycentral.com>
---
 montage.py |  196 ++++++++++++++++++++++++++++++------------------------------
 1 files changed, 99 insertions(+), 97 deletions(-)

diff --git a/montage.py b/montage.py
index 553c8b3..4664bb2 100644
--- a/montage.py
+++ b/montage.py
@@ -35,9 +35,10 @@ from theme import *
 
 logger = logging.getLogger('flipsticks')
 
+
 class View(gtk.EventBox):
     __gsignals__ = {
-        'frame-changed' : (SIGNAL_RUN_FIRST, None, [TYPE_PYOBJECT]) }
+        'frame-changed': (SIGNAL_RUN_FIRST, None, [TYPE_PYOBJECT])}
 
     def set_keyframe(self, value):
         i, key = value
@@ -66,7 +67,7 @@ class View(gtk.EventBox):
         self.emit('frame-changed', self.kfselected)
 
     def setplayspeed(self, value):
-        self.waittime = int((100-value)*5)
+        self.waittime = int((100 - value) * 5)
         if self.playing:
             gobject.source_remove(self.playing)
             self.playing = gobject.timeout_add(self.waittime, self.playframe)
@@ -125,7 +126,7 @@ class View(gtk.EventBox):
         pixmap = gtk.gdk.Pixmap(self.mfdraw.window, width, height)
         self._draw_frame(fsecs[0], pixmap)
         pixbuf = gtk.gdk.Pixbuf(gtk.gdk.COLORSPACE_RGB, False, 8, width, height)
-        gtk.gdk.Pixbuf.get_from_drawable(pixbuf,pixmap,pixmap.get_colormap(),0,0,0,0,width,height)
+        gtk.gdk.Pixbuf.get_from_drawable(pixbuf, pixmap, pixmap.get_colormap(), 0, 0, 0, 0, width, height)
 
         model.screen_shot(pixbuf)
 
@@ -135,13 +136,13 @@ class View(gtk.EventBox):
         self.updateentrybox()
 
     def expose_event(self, widget, event):
-        x , y, width, height = event.area
+        x, y, width, height = event.area
         widget.window.draw_drawable(widget.get_style().fg_gc[gtk.STATE_NORMAL],
                                     self.pixmap, x, y, x, y, width, height)
         return False
 
     def kf_expose_event(self, widget, event):
-        x , y, width, height = event.area
+        x, y, width, height = event.area
         widget.window.draw_drawable(widget.get_style().fg_gc[gtk.STATE_NORMAL],
                                     self.kfpixmap, x, y, x, y, width, height)
         return False
@@ -168,50 +169,50 @@ class View(gtk.EventBox):
                 if _inarea(widget, x, y):
                     #self.key.joints[self.jointpressed] = (x,y) # old hack way
                     # first find the parents x,y
-                    (px,py) = model.getparentjoint(self.jointpressed,self.key.joints,
+                    (px, py) = model.getparentjoint(self.jointpressed, self.key.joints,
                                                   self.key.middle)
-                    if x-px == 0:
+                    if x - px == 0:
                         #computeangle = 0
                         b = 1
                     else:
-                        b = float(px-x)
-                    a = float(y-py)
-                    computeangle = int(math.degrees(math.atan(a/b)))
+                        b = float(px - x)
+                    a = float(y - py)
+                    computeangle = int(math.degrees(math.atan(a / b)))
                     stickname = JOINTTOSTICK[self.jointpressed]
                     # add sum of parent angles to new angle
                     parents = model.getparentsticks(stickname)
                     panglesum = 0
                     for parentname in parents:
-                        (pangle,plen) = self.key.sticks[parentname]
+                        (pangle, plen) = self.key.sticks[parentname]
                         panglesum += pangle
                     (angle, len) = self.key.sticks[stickname]
                     #print 'X:%s,Y:%s,PX:%s,PY:%s,ANGLE:%s,NEWANGLE:%s' % (x,y,px,py,angle,newangle)
-                    newangle = computeangle-panglesum
+                    newangle = computeangle - panglesum
                     if (x < px) or (b == 1):
                         newangle = newangle + 180
                     if newangle < 0:
                         newangle = 360 + newangle
-                    self.key.sticks[stickname] = (newangle,len)
-                    self.key.setjoints() # this is overkill
+                    self.key.sticks[stickname] = (newangle, len)
+                    self.key.setjoints()  # this is overkill
                     self.drawmainframe()
                     self.updateentrybox()
             elif self.middlepressed:
                 if _inarea(widget, x, y):
-                    xdiff = x-self.key.middle[0]
-                    ydiff = y-self.key.middle[1]
+                    xdiff = x - self.key.middle[0]
+                    ydiff = y - self.key.middle[1]
                     self.key.move(xdiff, ydiff)
-                    self.key.middle = (x,y)
+                    self.key.middle = (x, y)
                     self.drawmainframe()
             elif self.rotatepressed:
                 if _inarea(widget, x, y):
-                    (px,py) = self.key.middle
-                    if x-px == 0:
+                    (px, py) = self.key.middle
+                    if x - px == 0:
                         #computeangle = 0
                         b = 1
                     else:
-                        b = float(px-x)
-                    a = float(y-py)
-                    computeangle = int(math.degrees(math.atan(a/b)))
+                        b = float(px - x)
+                    a = float(y - py)
+                    computeangle = int(math.degrees(math.atan(a / b)))
                     stickname = 'TORSO'
                     (angle, len) = self.key.sticks[stickname]
                     newangle = computeangle
@@ -219,17 +220,17 @@ class View(gtk.EventBox):
                         newangle = newangle + 180
                     if newangle < 0:
                         newangle = 360 + newangle
-                    anglediff = newangle-angle
-                    self.key.sticks[stickname] = (newangle,len)
+                    anglediff = newangle - angle
+                    self.key.sticks[stickname] = (newangle, len)
                     # now rotate the other sticks off of the middle
-                    for stickname in ['NECK','RIGHT SHOULDER','LEFT SHOULDER']:
-                        (sangle,slen) = self.key.sticks[stickname]
-                        newsangle = sangle+anglediff
+                    for stickname in ['NECK', 'RIGHT SHOULDER', 'LEFT SHOULDER']:
+                        (sangle, slen) = self.key.sticks[stickname]
+                        newsangle = sangle + anglediff
                         if newsangle < 0:
                             newsangle = 360 + newsangle
                         if newsangle > 360:
                             newsangle = newsangle - 360
-                        self.key.sticks[stickname] = (newsangle,slen)
+                        self.key.sticks[stickname] = (newsangle, slen)
                     self.key.setjoints()
                     self.drawmainframe()
                     self.updateentrybox()
@@ -249,7 +250,7 @@ class View(gtk.EventBox):
                     xdiff = int(x - self.kf_mouse_pos)
                     frame = model.keys[self.kfpressed]
                     if frame.x + xdiff > KEYFRAME_RADIUS \
-                            and frame.x + xdiff < KEYFRAMEWIDTH-KEYFRAME_RADIUS:
+                            and frame.x + xdiff < KEYFRAMEWIDTH - KEYFRAME_RADIUS:
                         frame.move(xdiff)
 
                         if self._emit_move_handle:
@@ -333,14 +334,14 @@ class View(gtk.EventBox):
                 self.playframenum = fsecs[-1]
             else:
                 i = fsecs.index(self.playframenum)
-                self.playframenum = fsecs[i-1]
+                self.playframenum = fsecs[i - 1]
         else:
             # increment playframenum
             if self.playframenum == fsecs[-1]:
                 self.playframenum = fsecs[0]
             else:
                 i = fsecs.index(self.playframenum)
-                self.playframenum = fsecs[i+1]
+                self.playframenum = fsecs[i + 1]
         if self.playing:
             return True
         else:
@@ -351,7 +352,7 @@ class View(gtk.EventBox):
         if stickname in self.key.sticks:
             newangle = int(entry.get_text())
             (angle, len) = self.key.sticks[stickname]
-            self.key.sticks[stickname] = (newangle,len)
+            self.key.sticks[stickname] = (newangle, len)
             self.anglel_adj.set_value(newangle)
             self.anglel_slider.set_sensitive(True)
         else:
@@ -380,7 +381,7 @@ class View(gtk.EventBox):
         newlen = int(entry.get_text())
         if stickname in self.key.sticks:
             (angle, len) = self.key.sticks[stickname]
-            self.key.sticks[stickname] = (angle,newlen)
+            self.key.sticks[stickname] = (angle, newlen)
         else:
             # part not stick
             self.key.parts[stickname] = newlen
@@ -406,49 +407,49 @@ class View(gtk.EventBox):
         #self.pixmap = gtk.gdk.Pixmap(self.mfdraw.window, width, height)
         # clear area
         drawgc.set_foreground(white)
-        self.pixmap.draw_rectangle(drawgc,True,0,0,width,height)
+        self.pixmap.draw_rectangle(drawgc, True, 0, 0, width, height)
 
         drawgc.set_foreground(black)
-        hsize = self.key.sticks['HEAD'][1] # really half of head size
+        hsize = self.key.sticks['HEAD'][1]  # really half of head size
         rhsize = self.key.parts['RIGHT HAND']
         lhsize = self.key.parts['LEFT HAND']
-        self.drawstickman(drawgc,self.pixmap,self.key.middle,self.key.joints,hsize,rhsize,lhsize)
+        self.drawstickman(drawgc, self.pixmap, self.key.middle, self.key.joints, hsize, rhsize, lhsize)
         # draw circle for middle
         drawgc.set_foreground(green)
         if self.middlepressed:
             drawgc.set_foreground(blue)
-        x,y = self.key.middle
-        self.pixmap.draw_arc(drawgc,True,x-5,y-5,10,10,0,360*64)
+        x, y = self.key.middle
+        self.pixmap.draw_arc(drawgc, True, x - 5, y - 5, 10, 10, 0, 360 * 64)
         # draw circle for rotate (should be halfway between middle and groin
-        (rx,ry) = self.key.getrotatepoint()
+        (rx, ry) = self.key.getrotatepoint()
         drawgc.set_foreground(yellow)
         if self.rotatepressed:
             drawgc.set_foreground(blue)
-        self.pixmap.draw_arc(drawgc,True,rx-5,ry-5,10,10,0,360*64)
+        self.pixmap.draw_arc(drawgc, True, rx - 5, ry - 5, 10, 10, 0, 360 * 64)
         # draw circles for joints
         drawgc.set_foreground(black)
         for jname in self.key.joints:
             if jname == 'head':
-               continue
-            x,y = self.key.joints[jname]
+                    continue
+            x, y = self.key.joints[jname]
             if self.jointpressed == jname:
                 drawgc.set_foreground(blue)
-                self.pixmap.draw_arc(drawgc,True,x-5,y-5,10,10,0,360*64)
+                self.pixmap.draw_arc(drawgc, True, x - 5, y - 5, 10, 10, 0, 360 * 64)
                 drawgc.set_foreground(black)
             else:
                 drawgc.set_foreground(red)
-                self.pixmap.draw_arc(drawgc,True,x-5,y-5,10,10,0,360*64)
+                self.pixmap.draw_arc(drawgc, True, x - 5, y - 5, 10, 10, 0, 360 * 64)
                 drawgc.set_foreground(black)
         self.mfdraw.queue_draw()
 
-    def drawstickman(self,drawgc,pixmap,middle,joints,hsize,rhsize,lhsize):
-        leftarm = [middle, joints['leftshoulder'],joints['leftelbow'],joints['lefthand']]
-        rightarm = [middle, joints['rightshoulder'],joints['rightelbow'],joints['righthand']]
-        torso = [joints['neck'],middle,joints['groin']]
-        leftleg = [joints['groin'],joints['lefthip'],joints['leftknee'],
-                   joints['leftheel'],joints['lefttoe']]
-        rightleg = [joints['groin'],joints['righthip'],joints['rightknee'],
-                    joints['rightheel'],joints['righttoe']]
+    def drawstickman(self, drawgc, pixmap, middle, joints, hsize, rhsize, lhsize):
+        leftarm = [middle, joints['leftshoulder'], joints['leftelbow'], joints['lefthand']]
+        rightarm = [middle, joints['rightshoulder'], joints['rightelbow'], joints['righthand']]
+        torso = [joints['neck'], middle, joints['groin']]
+        leftleg = [joints['groin'], joints['lefthip'], joints['leftknee'],
+                   joints['leftheel'], joints['lefttoe']]
+        rightleg = [joints['groin'], joints['righthip'], joints['rightknee'],
+                    joints['rightheel'], joints['righttoe']]
         # draw lines
         pixmap.draw_lines(drawgc, leftarm)
         pixmap.draw_lines(drawgc, rightarm)
@@ -456,13 +457,13 @@ class View(gtk.EventBox):
         pixmap.draw_lines(drawgc, leftleg)
         pixmap.draw_lines(drawgc, rightleg)
         # draw head
-        x,y = joints['head']
-        pixmap.draw_arc(drawgc,True,x-hsize,y-hsize,hsize*2,hsize*2,0,360*64)
+        x, y = joints['head']
+        pixmap.draw_arc(drawgc, True, x - hsize, y - hsize, hsize * 2, hsize * 2, 0, 360 * 64)
         # draw circles for hands
-        x,y = joints['righthand']
-        pixmap.draw_arc(drawgc,True,x-int(rhsize/2.0),y-int(rhsize/2.0),rhsize,rhsize,0,360*64)
-        x,y = joints['lefthand']
-        pixmap.draw_arc(drawgc,True,x-int(lhsize/2.0),y-int(lhsize/2.0),lhsize,lhsize,0,360*64)
+        x, y = joints['righthand']
+        pixmap.draw_arc(drawgc, True, x - int(rhsize / 2.0), y - int(rhsize / 2.0), rhsize, rhsize, 0, 360 * 64)
+        x, y = joints['lefthand']
+        pixmap.draw_arc(drawgc, True, x - int(lhsize / 2.0), y - int(lhsize / 2.0), lhsize, lhsize, 0, 360 * 64)
         
     def drawkeyframe(self):
         area = self.toplevel.window
@@ -482,15 +483,15 @@ class View(gtk.EventBox):
         self.kfpixmap = gtk.gdk.Pixmap(self.kfdraw.window, width, height)
         # clear area
         drawgc.set_foreground(bgcolor)
-        self.kfpixmap.draw_rectangle(drawgc,True,0,0,width,height)
+        self.kfpixmap.draw_rectangle(drawgc, True, 0, 0, width, height)
         # draw line in middle
         drawgc.set_foreground(darkgreen)
-        self.kfpixmap.draw_rectangle(drawgc,True,10,int(height/2.0)-5,width-20,10)
+        self.kfpixmap.draw_rectangle(drawgc, True, 10, int(height / 2.0) - 5, width - 20, 10)
         x = 10
-        y = int(height/2.0)
-        self.kfpixmap.draw_arc(drawgc,True,x-5,y-5,10,10,0,360*64)
-        x = width-10
-        self.kfpixmap.draw_arc(drawgc,True,x-5,y-5,10,10,0,360*64)
+        y = int(height / 2.0)
+        self.kfpixmap.draw_arc(drawgc, True, x - 5, y - 5, 10, 10, 0, 360 * 64)
+        x = width - 10
+        self.kfpixmap.draw_arc(drawgc, True, x - 5, y - 5, 10, 10, 0, 360 * 64)
 
         # draw the keyframe circles
         for i in list(reversed(self.keys_overlap_stack)):
@@ -500,21 +501,21 @@ class View(gtk.EventBox):
                 drawgc.set_foreground(pink)
             else:
                 drawgc.set_foreground(darkgreen)
-            self.kfpixmap.draw_arc(drawgc, True, x-KEYFRAME_RADIUS,
-                    y-KEYFRAME_RADIUS, KEYFRAME_RADIUS*2, KEYFRAME_RADIUS*2,
-                    0, 360*64)
+            self.kfpixmap.draw_arc(drawgc, True, x - KEYFRAME_RADIUS,
+                    y - KEYFRAME_RADIUS, KEYFRAME_RADIUS * 2, KEYFRAME_RADIUS * 2,
+                    0, 360 * 64)
             # then the inner circle
             drawgc.set_foreground(white)
-            self.kfpixmap.draw_arc(drawgc, True, x-KEYFRAME_RADIUS+5,
-                    y-KEYFRAME_RADIUS+5, (KEYFRAME_RADIUS-5)*2,
-                    (KEYFRAME_RADIUS-5)*2, 0, 360*64)
+            self.kfpixmap.draw_arc(drawgc, True, x - KEYFRAME_RADIUS + 5,
+                    y - KEYFRAME_RADIUS + 5, (KEYFRAME_RADIUS - 5) * 2,
+                    (KEYFRAME_RADIUS - 5) * 2, 0, 360 * 64)
             if model.keys[i].scaled_sticks:
                 # draw a man in the circle
                 drawgc.set_foreground(black)
                 hsize = model.keys[i].scaled_sticks['HEAD'][1]
-                rhsize = int(model.keys[i].parts['RIGHT HAND']*0.2)
-                lhsize = int(model.keys[i].parts['LEFT HAND']*0.2)
-                self.drawstickman(drawgc,self.kfpixmap,(x,y), model.keys[i].scaled_joints,hsize,rhsize,lhsize)
+                rhsize = int(model.keys[i].parts['RIGHT HAND'] * 0.2)
+                lhsize = int(model.keys[i].parts['LEFT HAND'] * 0.2)
+                self.drawstickman(drawgc, self.kfpixmap, (x, y), model.keys[i].scaled_joints, hsize, rhsize, lhsize)
                 #self.kfpixmap.draw_arc(drawgc,True,x-5,y-5,10,10,0,360*64)
         self.kfdraw.queue_draw()
 
@@ -536,14 +537,14 @@ class View(gtk.EventBox):
         self.fppixmap = gtk.gdk.Pixmap(self.fpdraw.window, width, height)
         # clear area
         drawgc.set_foreground(white)
-        self.fppixmap.draw_rectangle(drawgc,True,0,0,width,height)
+        self.fppixmap.draw_rectangle(drawgc, True, 0, 0, width, height)
         self.fpdraw.queue_draw()
 
     def selectstick(self, widget, event, data=None):
         if data:
             if self.stickselected:
                 ebox = self.stickbuttons[self.stickselected]
-                ebox.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse(BUTTON_BACKGROUND))
+                ebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BUTTON_BACKGROUND))
                 label = ebox.get_child()
                 label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BUTTON_FOREGROUND))
             self.stickselected = data
@@ -551,7 +552,7 @@ class View(gtk.EventBox):
 
     def selectstickebox(self):
         ebox = self.stickbuttons[self.stickselected]
-        ebox.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse(BUTTON_FOREGROUND))
+        ebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BUTTON_FOREGROUND))
         label = ebox.get_child()
         label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BUTTON_BACKGROUND))
 
@@ -616,19 +617,19 @@ class View(gtk.EventBox):
         self.mfdraw.set_size_request(DRAWWIDTH, DRAWHEIGHT)
 
         screen_box = gtk.EventBox()
-        screen_box.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse(BACKGROUND))
-        screen_box.set_border_width(PAD/2)
+        screen_box.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BACKGROUND))
+        screen_box.set_border_width(PAD / 2)
         screen_box.add(self.mfdraw)
 
         screen_pink = gtk.EventBox()
-        screen_pink.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse(PINK))
+        screen_pink.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(PINK))
         screen_pink.set_border_width(PAD)
         screen_pink.add(screen_box)
 
         # keyframes
 
         self.kfdraw = gtk.DrawingArea()
-        self.kfdraw.set_size_request(KEYFRAMEWIDTH,KEYFRAMEHEIGHT)
+        self.kfdraw.set_size_request(KEYFRAMEWIDTH, KEYFRAMEHEIGHT)
         self.kfdraw.connect('expose_event', self.kf_expose_event)
         self.kfdraw.connect('configure_event', self.kf_configure_event)
         self.kfdraw.connect('motion_notify_event', self.kf_motion_notify_event)
@@ -651,14 +652,14 @@ class View(gtk.EventBox):
         anglelabel = gtk.Label(_('Angle:'))
         anglelabel.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BUTTON_BACKGROUND))
         anglelabel.set_size_request(60, -1)
-        angle_box.pack_start(anglelabel,False,False,5)
+        angle_box.pack_start(anglelabel, False, False, 5)
         self.angleentry = gtk.Entry()
         self.angleentry.set_max_length(3)
         self.angleentry.set_width_chars(3)
         self.angleentry.connect('activate', self.enterangle_callback, self.angleentry)
         self.angleentry.modify_bg(gtk.STATE_INSENSITIVE,
                 gtk.gdk.color_parse(BUTTON_FOREGROUND))
-        angle_box.pack_start(self.angleentry,False,False,0)
+        angle_box.pack_start(self.angleentry, False, False, 0)
         self.anglel_adj = gtk.Adjustment(0, 0, 360, 1, 60, 0)
         self.anglel_adj.connect('value_changed', self._anglel_adj_cb)
         self.anglel_slider = gtk.HScale(self.anglel_adj)
@@ -671,14 +672,14 @@ class View(gtk.EventBox):
         sizelabel = gtk.Label(_('Size:'))
         sizelabel.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BUTTON_BACKGROUND))
         sizelabel.set_size_request(60, -1)
-        size_box.pack_start(sizelabel,False,False,5)
+        size_box.pack_start(sizelabel, False, False, 5)
         self.sizeentry = gtk.Entry()
         self.sizeentry.set_max_length(3)
         self.sizeentry.set_width_chars(3)
         self.sizeentry.connect('activate', self.enterlen_callback, self.sizeentry)
         self.sizeentry.modify_bg(gtk.STATE_INSENSITIVE,
                 gtk.gdk.color_parse(BUTTON_FOREGROUND))
-        size_box.pack_start(self.sizeentry,False,False,0)
+        size_box.pack_start(self.sizeentry, False, False, 0)
         self.size_adj = gtk.Adjustment(0, 0, 200, 1, 30, 0)
         self.size_adj.connect('value_changed', self._size_adj_cb)
         size_slider = gtk.HScale(self.size_adj)
@@ -692,7 +693,7 @@ class View(gtk.EventBox):
         control_head_box.pack_start(size_box)
 
         control_head = gtk.EventBox()
-        control_head.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse(BUTTON_FOREGROUND))
+        control_head.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BUTTON_FOREGROUND))
         control_head.add(control_head_box)
 
         control_options = gtk.VBox()
@@ -703,12 +704,12 @@ class View(gtk.EventBox):
             label.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BUTTON_FOREGROUND))
             self.sticklabels[stickpartname] = label
             ebox = gtk.EventBox()
-            ebox.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse(BUTTON_BACKGROUND))
+            ebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BUTTON_BACKGROUND))
             ebox.set_events(gtk.gdk.BUTTON_PRESS_MASK)
-            ebox.connect('button_press_event',self.selectstick,stickpartname)
+            ebox.connect('button_press_event', self.selectstick, stickpartname)
             ebox.add(label)
             self.stickbuttons[stickpartname] = ebox
-            control_options.pack_start(ebox,False,False,0)
+            control_options.pack_start(ebox, False, False, 0)
         self.selectstickebox()
 
         control_scroll = gtk.ScrolledWindow()
@@ -722,19 +723,19 @@ class View(gtk.EventBox):
         control_box.pack_start(control_scroll)
 
         control_bg = gtk.EventBox()
-        control_bg.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse(BUTTON_BACKGROUND))
-        control_bg.set_border_width(PAD/2)
+        control_bg.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BUTTON_BACKGROUND))
+        control_bg.set_border_width(PAD / 2)
         control_bg.add(control_box)
 
         control_pink = gtk.EventBox()
-        control_pink.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse(PINK))
+        control_pink.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(PINK))
         control_pink.set_border_width(PAD)
         control_pink.add(control_bg)
 
         # left control box
 
         logo = gtk.Image()
-        logo.set_from_file(os.path.join(self.iconsdir,'logo.png'))
+        logo.set_from_file(os.path.join(self.iconsdir, 'logo.png'))
 
         leftbox = gtk.VBox()
         leftbox.pack_start(logo, False, False)
@@ -751,11 +752,11 @@ class View(gtk.EventBox):
         desktop.pack_start(kfdraw_box, False, False, 0)
 
         greenbox = gtk.EventBox()
-        greenbox.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse(BACKGROUND))
-        greenbox.set_border_width(PAD/2)
+        greenbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(BACKGROUND))
+        greenbox.set_border_width(PAD / 2)
         greenbox.add(desktop)
 
-        self.modify_bg(gtk.STATE_NORMAL,gtk.gdk.color_parse(YELLOW))
+        self.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(YELLOW))
         self.add(greenbox)
         self.show_all()
 
@@ -774,7 +775,7 @@ class View(gtk.EventBox):
         #pixmap = gtk.gdk.Pixmap(self.mfdraw.window, width, height)
         # clear area
         drawgc.set_foreground(white)
-        pixmap.draw_rectangle(drawgc,True,0,0,width,height)
+        pixmap.draw_rectangle(drawgc, True, 0, 0, width, height)
 
         drawgc.set_foreground(black)
         hsize = self.frames[index].hsize
@@ -784,7 +785,7 @@ class View(gtk.EventBox):
         self.drawstickman(drawgc, pixmap, middle, joints, hsize, rhsize, lhsize)
 
     def _inkeyframe(self, x, y):
-        dy = math.pow(abs(y - KEYFRAMEHEIGHT/2), 2)
+        dy = math.pow(abs(y - KEYFRAMEHEIGHT / 2), 2)
 
         for i, key in enumerate(self.keys_overlap_stack):
             dx = math.pow(abs(x - model.keys[key].x), 2)
@@ -809,6 +810,7 @@ class View(gtk.EventBox):
         self.emit('frame-changed', key)
         return False
 
+
 def _inarea(widget, x, y):
     x_, y_, width, height = widget.get_allocation()
     if x < 0 or y < 0 or x >= width or y >= height:
-- 
1.7.5.4



More information about the Dextrose mailing list