#from portrait import FremantleRotation
#from xdg.IconTheme import getIconPath
-#import config
+import config
import apps
from icon import Icon, getIcon
from icongrid import IconGridWidget
+from about import DlgAbout
+from portrait import FremantleRotation
-class WinConfig(StackableWindow):
+class WinConfig(StackableWindow): #, FremantleRotation):
def __init__(self, config, *args):
StackableWindow.__init__(self)
+# FremantleRotation.__init__(self, "DrlaunchPlugin",
+# mode=FremantleRotation.AUTOMATIC)
self.config=config
self.setupUi()
def setupUi(self):
- self.igw=IconGridWidget(True, self.config)
-# self.igw.do_realize()
-# self.igw.setSize(config.getSize())
+ """
+ self.pa Main Pannable Area
+ self.col1 A VBox for the first column
+ self.col2 A VBox for the second column
+ self.w_igw The IGW in an alignment
+ """
+ self.set_title("DrLaunch v" + config.version)
self.pa=hildon.PannableArea()
- self.add(self.pa)
+# self.add(self.pa)
self.pa.set_property('mov-mode', hildon.MOVEMENT_MODE_HORIZ)
- hbox=gtk.HBox()
- self.pa.add_with_viewport(hbox)
+#1 hbox=gtk.HBox()
+#1 self.pa.add_with_viewport(hbox)
- # Now go for the right side
- al=gtk.Alignment(yscale=0)
- hbox.add(al)
+ # Add the first column of options
+ al=gtk.Alignment(yscale=1)
+#1 hbox.add(al)
vbox=gtk.VBox()
-# hbox.add(vbox)
al.add(vbox)
+ self.col1=al
maxsz=self.config.getMaxSize()
hbox2.add(but)
+ vbox2=gtk.VBox()
+
+ al=gtk.Alignment(xalign=0, yalign=1, xscale=1)
+ al.add(vbox2)
+ self.col11=al
+
+ vbox.add(al)
+ vbox=vbox2
+
but=hildon.CheckButton(
gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT)
but.set_label("Rotate icons individually")
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)
+ self.col2=al
+
+ but=hildon.CheckButton(
+ gtk.HILDON_SIZE_AUTO_WIDTH | gtk.HILDON_SIZE_FINGER_HEIGHT)
+ but.set_label("Theme background")
+ #but.connect('toggled', self.slotButtonNoBackground)
+ self.buttonThemeBackground=but
+ vbox.add(but)
+
+ 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,
+ 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, False)
+# 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.w_igw=al
+#1 hbox.add(al)
self.igw.connect('long-press', self.slotLongpress)
self.igw.connect('click', self.slotLongpress)
self.setIndiv(self.config.getIndiv())
self.setLongpress(self.config.getLongpress())
self.setAnimate(self.config.getAnimate())
+ self.setNoBg(self.config.getNoBg())
+ self.setThemeBg(self.config.getThemeBg())
+
+ hbox=gtk.HBox()
+ hbox.add(self.col1)
+ hbox.add(self.col2)
+ hbox.add(self.w_igw)
+ self.pa.add_with_viewport(hbox)
+
+ self.add(self.pa)
+
+# def setupUi(self, orientation):
+#
+# self.setupUi0()
+#
+# hbox=gtk.HBox()
+#
+# if orientation=='l':
+# hbox.add(self.col1)
+# hbox.add(self.col2)
+# hbox.add(self.w_igw)
+# else:
+# vbox=gtk.VBox()
+# hbox.add(vbox)
+# vbox.add(self.col1)
+# vbox.add(self.col2)
+# hbox.add(self.w_igw)
+#
+# self.pa.add_with_viewport(hbox)
+#
+# if self.get_child()!=None:
+# self.remove(self.get_child())
+# self.add(self.pa)
+# self.pa.show_all()
+
+ def setLayoutPortrait(self):
+ print "lo: p"
+ hbox=gtk.HBox()
+
+ vbox=gtk.VBox()
+ hbox.add(vbox)
+ self.col1.reparent(vbox)
+ self.col2.reparent(vbox)
+ self.w_igw.reparent(hbox)
+
+ r=self.pa.get_children()[0]
+ self.pa.remove(r)
+ r.destroy()
+ self.pa.add_with_viewport(hbox)
+
+ self.pa.show_all()
+
+ def setLayoutLandscape(self):
+ print "lo: l"
+ hbox=gtk.HBox()
+
+ self.col1.reparent(hbox)
+ self.col2.reparent(hbox)
+ self.w_igw.reparent(hbox)
+
+ r=self.pa.get_children()[0]
+ self.pa.remove(r)
+ r.destroy()
+ self.pa.add_with_viewport(hbox)
+
+ self.pa.show_all()
+
+ def on_orientation_changed(self, orientation):
+ # This is disabled for now since I've not found any reliable
+ # way for supporting orientation changes (#$#%$#*&% GTK)
+ return
+
+ print "orch:", orientation
+ if orientation=='portrait':
+ self.setLayoutPortrait()
+ else:
+ self.setLayoutLandscape()
def slotLongpress(self, sender, icon):
self.doConfig(icon)
but=self.buttonRotateIndividually
self.setIndiv(but.get_active())
+ def slotButtonAbout(self, sender):
+ DlgAbout.present2(self)
+
# def slotButtonLongpress(self, sender):
# but=self.buttonRequireLongpress
# self.set
def setAnimate(self, ar):
self.buttonAnimateRotation.set_active(ar)
+ def setNoBg(self, nobg):
+ self.buttonNoBackground.set_active(nobg)
+
+ def setThemeBg(self, themebg):
+ self.buttonThemeBackground.set_active(themebg)
+
def doConfig(self, icon):
aps=apps.scan()
indiv=self.buttonRotateIndividually.get_active()
lp=self.buttonRequireLongpress.get_active()
ar=self.buttonAnimateRotation.get_active()
+ nobg=self.buttonNoBackground.get_active()
+ themebg=self.buttonThemeBackground.get_active()
ret={
'size': sz,
'indiv': indiv,
'longpress': lp,
'animate': ar,
+ 'nobg': nobg,
+ 'themebg': themebg,
}
return(ret)