#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.set_title("DrLaunch Configuration")
+ """
+ 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)
# Add the first column of options
al=gtk.Alignment(yscale=0)
- hbox.add(al)
+#1 hbox.add(al)
vbox=gtk.VBox()
al.add(vbox)
+ self.col1=al
maxsz=self.config.getMaxSize()
# -----------------------------------------------
# Second column of options
vbox=gtk.VBox()
+
al=gtk.Alignment(xalign=0, yalign=1, xscale=1)
al.add(vbox)
- hbox.add(al)
+ 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,
hildon.BUTTON_ARRANGEMENT_VERTICAL)
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())
+
+ 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)
self.setIndiv(but.get_active())
def slotButtonAbout(self, sender):
- print "about"
- #dlg=DlgAbout()
- #dlg.run()
- DlgAbout.present2()
+ DlgAbout.present2(self)
# def slotButtonLongpress(self, sender):
# but=self.buttonRequireLongpress
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()
indiv=self.buttonRotateIndividually.get_active()
lp=self.buttonRequireLongpress.get_active()
ar=self.buttonAnimateRotation.get_active()
+ nobg=self.buttonNoBackground.get_active()
ret={
'size': sz,
'indiv': indiv,
'longpress': lp,
'animate': ar,
+ 'nobg': nobg,
}
return(ret)