diff options
author | Sebastian Silva <sebastian@sugarlabs.org> | 2011-10-12 01:03:11 (GMT) |
---|---|---|
committer | Sebastian Silva <sebastian@sugarlabs.org> | 2011-10-12 01:03:11 (GMT) |
commit | 1a4267444e34ad5e8a90864e396d851f083571b0 (patch) | |
tree | 47943f818b6a573ed3debf4c2b3153a194d51ff2 /activity.py | |
parent | fe1a1eb79bf0f1df8bbc56d2402e32061af79d06 (diff) |
Tidy up and make Gecko default.
Diffstat (limited to 'activity.py')
-rw-r--r-- | activity.py | 32 |
1 files changed, 20 insertions, 12 deletions
diff --git a/activity.py b/activity.py index 1c07f73..bd2aed3 100644 --- a/activity.py +++ b/activity.py @@ -34,7 +34,7 @@ USE_GECKO=True if not USE_GECKO: try: import webkit - from inspector import Inspector + from websdk.inspector import Inspector except ImportError: try: import websdk.webkit_local as webkit @@ -45,11 +45,7 @@ if not USE_GECKO: if USE_GECKO: import hulahop hulahop.startup(os.path.join(activity.get_activity_root(), 'data/gecko')) - from browser import Browser - -def sleep (t): - gobject.timeout_add (int (t*1000), gtk.main_quit) - gtk.main () + from websdk.browser import Browser def yieldsleep(func): def start(*args, **kwds): @@ -134,6 +130,17 @@ class HelloWorldActivity(activity.Activity): toolbar_box.toolbar.insert(separator, -1) separator.show() + #play_image = gtk.image_new_from_stock(gtk.STOCK_MEDIA_PLAY, + # gtk.ICON_SIZE_BUTTON) + #play_image.show() + + start_button = ToolButton('go-home') + #start_button.set_icon_widget(play_image) + start_button.show() + start_button.connect('clicked', self.__start_button_cb) + + toolbar_box.toolbar.insert(start_button, -1) + debug_button = ToolButton("activity-debug") toolbar_box.toolbar.insert(debug_button, -1) debug_button.connect('clicked', self.__debug_button_cb) @@ -159,7 +166,7 @@ class HelloWorldActivity(activity.Activity): else: self.web_view = Browser() - self.open("file:///%s/websdk/static/init.html" % self.bundle_dir) + self.open("file:///%s/studio/static/init.html" % self.bundle_dir) self.set_canvas(self.web_view) self.web_view.show() self.waitforport() @@ -171,17 +178,18 @@ class HelloWorldActivity(activity.Activity): if len(self._shared_activity.get_joined_buddies())==1: print "We are alone" + def __start_button_cb(self, widget): + self.open("http://localhost:%s/" % self.port) + return True + def __debug_button_cb(self, widget): - #self.inspector.emit('inspect-web-view') - #self.inspector.show() - self.open("file:///home/icarito/Descargas/CHUAS") + self.open("http://localhost:%s/debug" % self.port) return True @yieldsleep def waitforport(self): while 1: if isOpen("127.0.0.1", self.port): - print "port is open" if self._shared_activity: # we are shared self.open("http://localhost:%s/" % self.port) else: @@ -201,7 +209,7 @@ class HelloWorldActivity(activity.Activity): return True def start_server(self): - self.serverprocess = subprocess.Popen(("python", "websdk/studio.py", str(self.port))) + self.serverprocess = subprocess.Popen(("python", "studio/studio.py", str(self.port))) if self._shared_activity: self.share_server() |