__version__ = "$Id: 0.py 2265 2010-02-21 19:16:26Z v13 $"
+# HACK
+# Add the current module's directory to sys.path to bypass
+# problems when running as widget.
+# Restore the path at the end of the imports
+import sys
+import os
+
+orig_path=sys.path[:]
+tmp_path=os.path.dirname( os.path.realpath( __file__ ) )
+sys.path.append(tmp_path)
+
+# End of hack
+
import gtk
import gobject
import hildon
from icon import Icon
from icongrid import IconGrid
+# Restore path
+sys.path=orig_path
+
# IconGrid must be before HomePluginItem for its connect()
# and do_button_*() to override those of HomePluginItem
class DrlaunchPlugin(IconGrid, HomePluginItem, FremantleRotation):
HomePluginItem.do_realize(self)
def on_orientation_changed(self, orientation):
- print "orch:", orientation
o=orientation[0]
self.setMode(o)
# self.queue_draw()
IconGrid.do_expose_event(self, event)
HomePluginItem.do_expose_event(self, event)
- def do_buttonn_press_event(self, event):
- print "press0"
-
def slot_show_settings(self, dt):
- print "settings", dt
s=WinConfig()
s.show_all()
s.connect('destroy', self.slotConfigDestroy)
def slotConfigDestroy(self, sender):
- print "destroy", sender
dt=sender.getData()
- print "dt:", dt
config.setSize(dt['size'])
config.setApps(dt['apps'])
config.save()
# self.queue_draw()
def signalLongpress(self, sender, icon):
- print "launch:", icon.name
- launcher.launch(icon.name)
+ if icon.name!=None and icon.name!='':
+ launcher.launch(icon.name)
def resize(self):
w=(self.size * config.iconsize) + \
hd_plugin_type = DrlaunchPlugin
-def do1():
-# gobject.type_register(MyQ)
+if __name__=="__main__":
gobject.type_register(hd_plugin_type)
obj=gobject.new(hd_plugin_type, plugin_id="plugin_id")
obj.show_all()
gtk.main()
-def do2():
- win=DrlaunchPlugin()
- win.connect('delete-event', gtk.main_quit)
-
- print "win:", win
-
-# t=DrlaunchPlugin()
-# win.add(t)
-
- win.show_all()
- gtk.main()
-
-if __name__=="__main__":
- do1()
-
# vim: set ts=8 sts=4 sw=4 noet formatoptions=r ai nocindent: