Added about dialog.
[drlaunch] / src / win_config.py
index fbcd05c..77526ee 100755 (executable)
@@ -35,6 +35,7 @@ from hildon import StackableWindow
 import apps
 from icon import Icon, getIcon
 from icongrid import IconGridWidget
+from about import DlgAbout
 
 class WinConfig(StackableWindow):
     def __init__(self, config, *args):
@@ -45,22 +46,20 @@ class WinConfig(StackableWindow):
        self.setupUi()
 
     def setupUi(self):
-       self.igw=IconGridWidget(True, self.config)
-#      self.igw.do_realize()
-#      self.igw.setSize(config.getSize())
+       self.set_title("DrLaunch Configuration")
 
-       hbox=gtk.HBox()
-       self.add(hbox)
+       self.pa=hildon.PannableArea()
+       self.add(self.pa)
+       self.pa.set_property('mov-mode', hildon.MOVEMENT_MODE_HORIZ)
 
-       # Add the icongrid
-       hbox.add(self.igw)
+       hbox=gtk.HBox()
+       self.pa.add_with_viewport(hbox)
 
-       # Now go for the right side
+       # Add the first column of options
        al=gtk.Alignment(yscale=0)
        hbox.add(al)
 
        vbox=gtk.VBox()
-#      hbox.add(vbox)
        al.add(vbox)
 
        maxsz=self.config.getMaxSize()
@@ -112,6 +111,36 @@ class WinConfig(StackableWindow):
        self.buttonRequireLongpress=but
        vbox.add(but)
 
+       but=hildon.CheckButton(
+               gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT)
+       but.set_label("Animate rotation")
+       self.buttonAnimateRotation=but
+       vbox.add(but)
+
+       # -----------------------------------------------
+       # Second column of options
+       vbox=gtk.VBox()
+       al=gtk.Alignment(xalign=0, yalign=1, xscale=1)
+       al.add(vbox)
+       hbox.add(al)
+       but=hildon.Button(
+               gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT,
+               hildon.BUTTON_ARRANGEMENT_VERTICAL)
+       but.set_title("About")
+       but.connect("clicked", self.slotButtonAbout)
+       vbox.add(but)
+       self.buttonAbout=but
+
+       # -----------------------------------------------
+       # Add the icongrid
+       self.igw=IconGridWidget(True, self.config)
+#      self.igw.do_realize()
+#      self.igw.setSize(config.getSize())
+       al=gtk.Alignment(xalign=0, xscale=0)
+       al.add(self.igw)
+       al.set_padding(0, 0, 20, 0)
+       hbox.add(al)
+
        self.igw.connect('long-press', self.slotLongpress)
        self.igw.connect('click', self.slotLongpress)
 
@@ -120,6 +149,7 @@ class WinConfig(StackableWindow):
        self.setSize(self.config.getSize())
        self.setIndiv(self.config.getIndiv())
        self.setLongpress(self.config.getLongpress())
+       self.setAnimate(self.config.getAnimate())
 
     def slotLongpress(self, sender, icon):
        self.doConfig(icon)
@@ -142,6 +172,12 @@ class WinConfig(StackableWindow):
        but=self.buttonRotateIndividually
        self.setIndiv(but.get_active())
 
+    def slotButtonAbout(self, sender):
+       print "about"
+       #dlg=DlgAbout()
+       #dlg.run()
+       DlgAbout.present2()
+
 #    def slotButtonLongpress(self, sender):
 #      but=self.buttonRequireLongpress
 #      self.set
@@ -184,9 +220,19 @@ class WinConfig(StackableWindow):
        if indiv:
            for i in self.butsSizeY:
                i.set_sensitive(True)
+           for i in self.butsSizeX:
+               i.set_sensitive(True)
+
        else:
            for i in self.butsSizeY:
                i.set_sensitive(False)
+
+           cnt=0
+           for i in self.butsSizeX:
+               cnt+=1
+               if cnt>4:
+                   i.set_sensitive(False)
+
            sz=self.getSize()
            szx=sz[0]
            if szx>4:
@@ -198,6 +244,9 @@ class WinConfig(StackableWindow):
     def setLongpress(self, lp):
        self.buttonRequireLongpress.set_active(lp)
 
+    def setAnimate(self, ar):
+       self.buttonAnimateRotation.set_active(ar)
+
     def doConfig(self, icon):
        aps=apps.scan()
 
@@ -285,12 +334,14 @@ class WinConfig(StackableWindow):
 
        indiv=self.buttonRotateIndividually.get_active()
        lp=self.buttonRequireLongpress.get_active()
+       ar=self.buttonAnimateRotation.get_active()
 
        ret={
            'size':         sz,
            'apps':         wapps,
            'indiv':        indiv,
            'longpress':    lp,
+           'animate':      ar,
            }
 
        return(ret)