from gtk import gdk
from math import pi
import cairo
+import gconf
import time
from subprocess import Popen,PIPE
self.winConfig=None
+ self.gconf=gconf.client_get_default()
+
self.set_settings(True)
self.id=None
return(self.config)
+ def get_desktop_orientation(self):
+ """
+ Return desktop orientation
+
+ NOTE: This is the desktop orientation as it was introduced in CSSU.
+ Not the device orientation.
+
+ @return "portrait" or "landscape"
+ """
+
+ sw=gdk.screen_width()
+ sh=gdk.screen_height()
+
+ if sw>=sh:
+ ret='landscape'
+ else:
+ ret='portrait'
+
+ return(ret)
+
+ def is_rotating_desktop(self):
+ """
+ Check whether the desktop will change to portrait mode, as
+ added in CSSU.
+
+ @return True/False
+ """
+
+ c=self.gconf
+
+ # This returns False if the key doesn't exist
+ ret=c.get_bool('/apps/osso/hildon-desktop/ui_can_rotate')
+
+ return(ret)
+
def do_realize(self):
launcher.init()
config=self.get_config()
# Get the first character of the string (l/p)
o=orientation[0]
+
+ # Get desktop orientation
+ #do=self.get_desktop_orientation()
+
+ # Is desktop rotation (per CSSU) enabled?
+ rd=self.is_rotating_desktop()
+
+ #print "desktop: %s / %s, device: %s" % (do, rd, o)
+
+ # In case of a rotating desktop, force orientation to be
+ # 'landscape'
+ if rd:
+ o='l'
+
self.setMode(o)
# self.queue_draw()
cfg.save()
# Resize widget
+ self.icons.resizeMax()
self.setSize(dt['size'])
self.reloadIcons()
- self.icons.resizeMax()
# Free memory that is used for animations if animations are disabled
if not dt['animate']: