clean-ups
authorStefanos Harhalakis <v13@v13.gr>
Thu, 24 Jun 2010 17:28:46 +0000 (17:28 +0000)
committerStefanos Harhalakis <v13@v13.gr>
Thu, 24 Jun 2010 17:28:46 +0000 (17:28 +0000)
src/config.py
src/icon.py
src/icongrid.py
src/icons.py
src/portrait.py
src/widget.py
src/win_config.py

index e89ed89..d208444 100755 (executable)
@@ -91,7 +91,6 @@ def get_config_fn():
 
 def save():
     fn=get_config_fn()
-    print "save", fn
 
     dt={
        'version':  1,
@@ -99,8 +98,6 @@ def save():
        'apps':     getApps()
        }
 
-    print "save:", dt
-
     st=pickle.dumps(dt)
     f=file(fn, 'w')
     f.write(st)
@@ -108,7 +105,6 @@ def save():
 
 def load():
     fn=get_config_fn()
-    print "load", fn
 
     try:
        f=file(fn, 'r')
@@ -118,8 +114,6 @@ def load():
     except:
        return
 
-    print "load:", dt
-
     setSize(dt['size'])
     setApps(dt['apps'])
 
index f050463..8d2c099 100755 (executable)
@@ -66,9 +66,6 @@ class Icon(gobject.GObject):
 
        self.clickcount=0
 
-    def __del__(self):
-       print "del"
-
     def timePressed(self):
        """ return how much time a button is pressed """
        dt=time.time() - self.lastpress
@@ -84,7 +81,6 @@ class Icon(gobject.GObject):
        return(config.iconsize+config.iconspace)
 
     def draw(self, cr, x, y, mode):
-       #print "draw", x, y, mode
        self.x=x
        self.y=y
 
@@ -141,8 +137,6 @@ class Icon(gobject.GObject):
        return(False)
 
     def timerPressed(self):
-       #print "timer"
-
        if not self.ispressed:
            return(False)
 
@@ -156,7 +150,6 @@ class Icon(gobject.GObject):
        return(ret)
 
     def doPress(self):
-       #print "doPress()"
        # Double-time: time for pressed and time for not-pressed
        if time.time() - self.lastpress > self.presstime*2:
            self.clickcount=0
@@ -164,31 +157,24 @@ class Icon(gobject.GObject):
        self.lastpress=time.time()
        self.ispressed=True
        gobject.timeout_add(20, self.timerPressed)
-       #print "doPress() end"
 
     def doRelease(self):
-       print "doRelease()"
        dt=time.time() - self.lastpress
        self.ispressed=False
        self.invalidate()
        if dt<=self.presstime:
            self.clickcount+=1
            if self.clickcount==1:
-               print "click"
                self.emit('click')
            elif self.clickcount==2:
-               print "double-click"
                self.emit('double-click')
            if self.clickcount==3:
-               print "tripple-click"
                self.emit('tripple-click')
                self.clickcount=0
        elif dt>self.presstime and dt<2:
-           print "long-press"
            self.emit('long-press')
 
     def doCancel(self):
-       print "doCancel()"
        self.ispressed=False
 
     def invalidate(self, window=None):
@@ -202,7 +188,6 @@ class Icon(gobject.GObject):
 
        w=config.iconsize + config.iconspace
        rect=gdk.Rectangle(self.x, self.y, w, w)
-       #print "rect", self.x, self.y, w, w
        gdk.Window.invalidate_rect(window, rect, True)
 
 gobject.type_register(Icon)
index 1308bb0..ad4f84f 100755 (executable)
@@ -79,8 +79,6 @@ class IconGrid(object):       #(gobject.GObject):
            super(IconGrid, self).connect(what, *args)
 
     def setSize(self, size):
-       print "igw::setSize", size
-#      config.setSize(size)
        self.size=size
        self.icons.setSize(size)
 
@@ -101,7 +99,6 @@ class IconGrid(object):      #(gobject.GObject):
            x2=self.size - int(y/w) - 1
            y2=int(x/w)
 
-       print "x2,y2", x2, y2
        ret=self.get(x2,y2)
 
        return(ret)
@@ -112,13 +109,8 @@ class IconGrid(object):    #(gobject.GObject):
        return(ret)
 
     def _draw(self, cr, event):
-#      print "mode:", self.mode
-#      print "icons", len(self.icons)
-
        w=config.iconsize + config.iconspace
        for x,y in self.icons:
-#          print x, y
-
            if self.mode=='l':
                x2=x * (config.iconsize + config.iconspace)
                y2=y * (config.iconsize + config.iconspace)
@@ -132,7 +124,6 @@ class IconGrid(object):     #(gobject.GObject):
            if t.width==0 and t.height==0:
                continue
 
-#          print "draw:", x, y
            ico=self.icons.get(x,y)
            ico.draw(cr, x2, y2, self.mode)
 
@@ -156,7 +147,6 @@ class IconGrid(object):     #(gobject.GObject):
        self.lasticon=icon
 
     def do_button_press_event(self, event):
-       print "press", event.type
        icon=self.iconAt(event.x, event.y)
        if icon==None:
            return
@@ -171,7 +161,6 @@ class IconGrid(object):     #(gobject.GObject):
        return(True)
 
     def do_button_release_event(self, event):
-       print "release"
        if self.lasticon!=None:
            self.lasticon.invalidate(self.window)
            self.lasticon.doRelease()
@@ -181,13 +170,10 @@ class IconGrid(object):   #(gobject.GObject):
        return(True)
 
     def do_leave_notify_event(self, event):
-       print "leave"
-       #print "leave", event.x, event.y
        self.setLastIcon(None)
        return(True)
 
     def do_pproperty_notify_event(self, event):
-       print "property"
        icon=self.iconAt(event.x, event.y)
        if icon==None:
            return
@@ -196,7 +182,6 @@ class IconGrid(object):     #(gobject.GObject):
        return(True)
 
     def do_motion_notify_event(self, event):
-       print "motion"
        icon=self.iconAt(event.x, event.y)
        if self.lasticon==icon:
            return(True)
@@ -207,9 +192,7 @@ class IconGrid(object):     #(gobject.GObject):
        return(True)
 
     def do_button_press_event_old(self, event):
-       #print "press"
        if event.type==gdk.BUTTON_PRESS:
-           print "press", event.type
            if self.mode=='p':
                self.setMode('l')
            else:
@@ -221,9 +204,6 @@ class IconGrid(object):     #(gobject.GObject):
     def do_event1(self, event):
        print "event:", event, event.type
 
-    def butTest(self, arg):
-       print "but", arg
-
     def reloadIcons(self):
        self.icons.load()
 
index 515a512..e0d1c9a 100755 (executable)
@@ -113,15 +113,15 @@ class Icons(gobject.GObject):
        self.size=sz
 
     def signalLongpress(self, icon):
-       print "signalLongpress()", icon
+       #print "signalLongpress()", icon
        self.emit('long-press', icon)
 
     def signalClick(self, icon):
-       print "signalClick()", icon
+       #print "signalClick()", icon
        self.emit('click', icon)
 
     def signalTrippleClick(self, icon):
-       print "signalTrippleClick()", icon
+       #print "signalTrippleClick()", icon
        self.emit('tripple-click', icon)
 
     def get(self, x, y):
@@ -166,9 +166,6 @@ class Icons(gobject.GObject):
 #              y+=1
 ##         self.icons.append(p)
 
-       print "end of Icons init"
-
-
 gobject.type_register(Icons)
 Icons.register_signals()
 
index 45043c5..c398e39 100644 (file)
@@ -177,7 +177,6 @@ class FremantleRotation(object):
             self._keyboard_state_changed()
 
     def _on_orientation_signal(self, orientation, stand, face, x, y, z):
-       print "orsignal"
         if orientation in (self._PORTRAIT, self._LANDSCAPE):
             if self._mode == self.AUTOMATIC and \
                     self._keyboard_state != self._KBD_OPEN:
index 53bf2df..ed254c0 100755 (executable)
@@ -82,7 +82,6 @@ class DrlaunchPlugin(IconGrid, HomePluginItem, FremantleRotation):
        HomePluginItem.do_realize(self)
 
     def on_orientation_changed(self, orientation):
-       print "orch:", orientation
        o=orientation[0]
        self.setMode(o)
 #      self.queue_draw()
@@ -91,19 +90,13 @@ class DrlaunchPlugin(IconGrid, HomePluginItem, FremantleRotation):
        IconGrid.do_expose_event(self, event)
        HomePluginItem.do_expose_event(self, event)
 
-    def do_buttonn_press_event(self, event):
-       print "press0"
-
     def slot_show_settings(self, dt):
-       print "settings", dt
        s=WinConfig()
        s.show_all()
        s.connect('destroy', self.slotConfigDestroy)
 
     def slotConfigDestroy(self, sender):
-       print "destroy", sender
        dt=sender.getData()
-       print "dt:", dt
        config.setSize(dt['size'])
        config.setApps(dt['apps'])
        config.save()
@@ -115,8 +108,8 @@ class DrlaunchPlugin(IconGrid, HomePluginItem, FremantleRotation):
 #      self.queue_draw()
 
     def signalLongpress(self, sender, icon):
-       print "launch:", icon.name
-       launcher.launch(icon.name)
+       if icon.name!=None and icon.name!='':
+           launcher.launch(icon.name)
 
     def resize(self):
        w=(self.size * config.iconsize) + \
index 47b7436..5aafacb 100755 (executable)
@@ -85,12 +85,9 @@ class WinConfig(StackableWindow):
        self.setSize(config.getSize())
 
     def slotLongpress(self, sender, icon):
-       print "slp", icon
        self.doConfig(icon)
 
     def slotButtonSize(self, sender, id):
-       print "size:", id
-
        self.setSize(id+1)
        
     def setSize(self, sz):
@@ -177,8 +174,6 @@ class WinConfig(StackableWindow):
            if but.get_active()==True:
                break
 
-       print "conf: sz=", sz
-
        wapps={}
 
        for x in xrange(sz):
@@ -192,8 +187,6 @@ class WinConfig(StackableWindow):
            'apps':     wapps
            }
 
-       print "ret:", ret
-
        return(ret)
 
 if __name__=="__main__":