Added logging capability if /tmp/drlaunch.log is present.
authorStefanos Harhalakis <v13@v13.gr>
Thu, 13 Jan 2011 22:51:16 +0000 (22:51 +0000)
committerStefanos Harhalakis <v13@v13.gr>
Thu, 13 Jan 2011 22:51:16 +0000 (22:51 +0000)
Added no-background config option.

src/config.py
src/drlaunch_widget.py
src/icon.py
src/widget.py
src/win_config.py

index 2ea4256..91e0a2e 100755 (executable)
@@ -66,6 +66,7 @@ class Config:
        self.indiv=True
        self.longpress=False
        self.animate=True
+       self.nobg=False
 
        self.maxsz=(8,4)
 
@@ -99,6 +100,12 @@ class Config:
     def getAnimate(self):
        return(self.animate)
 
+    def setNoBg(self, nobg):
+       self.nobg=nobg
+
+    def getNoBg(self):
+       return(self.nobg)
+
     def setApps(self, aps):
        """ apps is a dictionary of (x,y)=>appname """
        self.apps=aps
@@ -122,7 +129,7 @@ class Config:
 
        if dt==None:
            dt={
-               'version':  4,
+               'version':  5,
                'data': {},
                }
 
@@ -132,6 +139,7 @@ class Config:
            'indiv':        self.getIndiv(),
            'longpress':    self.getLongpress(),
            'animate':      self.getAnimate(),
+           'nobg':         self.getNoBg(),
            }
 
        fn=get_config_fn()
@@ -175,6 +183,14 @@ class Config:
 
        return(dt)
 
+    def parse_v4(self, dt):
+       dt['version']=5
+
+       for i in dt['data']:
+           dt['data'][i]['nobg']=False
+
+       return(dt)
+
     def load_all(self):
        fn=get_config_fn()
 
@@ -195,6 +211,9 @@ class Config:
 
                if ret['version']==3:
                    ret=parse_v3(ret)
+
+               if ret['version']==4:
+                   ret=parse_v4(ret)
        except:
            ret=None
 
@@ -217,6 +236,7 @@ class Config:
        self.setIndiv(dt['indiv'])
        self.setLongpress(dt['longpress'])
        self.setAnimate(dt['animate'])
+       self.setNoBg(dt['nobg'])
 
     def check_init(self):
        if self.id==None:
index e5e27bf..c0f1f2a 100755 (executable)
@@ -22,6 +22,7 @@
 
 __version__ = "$Id: 0.py 2265 2010-02-21 19:16:26Z v13 $"
 
+import os.path
 from drlaunch import widget
 
 class DrlaunchPlugin(widget.DrlaunchPlugin):
@@ -39,6 +40,9 @@ def redirect_err():
 
 hd_plugin_type = DrlaunchPlugin
 
+if os.path.exists('/tmp/drlaunch.log'):
+    redirect_err()
+
 if __name__=="__main__":
     import gobject
     import gtk
index a16f3bc..2982bf3 100755 (executable)
@@ -224,11 +224,12 @@ class Icon(gobject.GObject):
        cr=gtk.gdk.CairoContext(cr0)
 
        # Paint the background
-        s2=self.mkbg(t)
-       cr.save()
-       cr.set_source_surface(s2, 0, 0)
-       cr.paint()
-       cr.restore()
+       if not self.config.getNoBg():
+           s2=self.mkbg(t)
+           cr.save()
+           cr.set_source_surface(s2, 0, 0)
+           cr.paint()
+           cr.restore()
 
        # If there is no icon then don't do anything more
        if self.icon!=None:
index ac912e5..8a8bd3c 100755 (executable)
@@ -161,6 +161,7 @@ class DrlaunchPlugin(IconGrid, HomePluginItem, FremantleRotation):
        config.setIndiv(dt['indiv'])
        config.setLongpress(dt['longpress'])
        config.setAnimate(dt['animate'])
+       config.setNoBg(dt['nobg'])
        config.save()
        
        # Resize widget
@@ -176,6 +177,7 @@ class DrlaunchPlugin(IconGrid, HomePluginItem, FremantleRotation):
     def handle_click(self, sender, icon):
        """ common handler for longpress and click """
        if icon.name!=None and icon.name!='':
+           print "name:", icon.name
            launcher.launch(icon.name)
 
     def signalLongpress(self, sender, icon):
index 6d083b1..ba0eac2 100755 (executable)
@@ -130,9 +130,18 @@ class WinConfig(StackableWindow): #, FremantleRotation):
        # -----------------------------------------------
        # Second column of options
        vbox=gtk.VBox()
+
        al=gtk.Alignment(xalign=0, yalign=1, xscale=1)
        al.add(vbox)
        self.col2=al
+
+       but=hildon.CheckButton(
+               gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT)
+       but.set_label("No background")
+       #but.connect('toggled', self.slotButtonNoBackground)
+       self.buttonNoBackground=but
+       vbox.add(but)
+
 #1     hbox.add(al)
        but=hildon.Button(
                gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
@@ -162,6 +171,7 @@ class WinConfig(StackableWindow): #, FremantleRotation):
        self.setIndiv(self.config.getIndiv())
        self.setLongpress(self.config.getLongpress())
        self.setAnimate(self.config.getAnimate())
+       self.setNoBg(self.config.getNoBg())
 
        hbox=gtk.HBox()
        hbox.add(self.col1)
@@ -331,6 +341,9 @@ class WinConfig(StackableWindow): #, FremantleRotation):
     def setAnimate(self, ar):
        self.buttonAnimateRotation.set_active(ar)
 
+    def setNoBg(self, nobg):
+       self.buttonNoBackground.set_active(nobg)
+
     def doConfig(self, icon):
        aps=apps.scan()
 
@@ -419,6 +432,7 @@ class WinConfig(StackableWindow): #, FremantleRotation):
        indiv=self.buttonRotateIndividually.get_active()
        lp=self.buttonRequireLongpress.get_active()
        ar=self.buttonAnimateRotation.get_active()
+       nobg=self.buttonNoBackground.get_active()
 
        ret={
            'size':         sz,
@@ -426,6 +440,7 @@ class WinConfig(StackableWindow): #, FremantleRotation):
            'indiv':        indiv,
            'longpress':    lp,
            'animate':      ar,
+           'nobg':         nobg,
            }
 
        return(ret)