screenlets-dev team mailing list archive
-
screenlets-dev team
-
Mailing list archive
-
Message #00786
[Merge] lp:~chrisccoulson/screenlets/webkit-port into lp:screenlets
Chris Coulson has proposed merging lp:~chrisccoulson/screenlets/webkit-port into lp:screenlets.
Requested reviews:
Screenlets Dev Team (screenlets-dev)
For more details, see:
https://code.launchpad.net/~chrisccoulson/screenlets/webkit-port/+merge/63787
Hi,
We're planning to drop xulrunner from Ubuntu in Oneiric, and Mozilla have dropped support for GtkMozEmbed anyway. Here is a first cut at porting the gtkmozembed parts of screenlets to webkit
(see https://blueprints.launchpad.net/ubuntu/+spec/desktop-o-mozilla-rapid-release-maintenance)
--
https://code.launchpad.net/~chrisccoulson/screenlets/webkit-port/+merge/63787
Your team Screenlets Dev Team is requested to review the proposed merge of lp:~chrisccoulson/screenlets/webkit-port into lp:screenlets.
=== modified file 'debian/control'
--- debian/control 2011-04-25 12:40:42 +0000
+++ debian/control 2011-06-07 23:50:55 +0000
@@ -28,7 +28,7 @@
python-xdg,
python-gconf,
python-beautifulsoup,
-Recommends: python-gtkmozembed | python-gnome2-extras (<< 2.19),
+Recommends: python-webkit,
python-evolution | python-gnome2-desktop,
python-rsvg | python-gnome2-desktop,
metacity (>= 2.21.4) | xcompmgr | compiz | xfwm4 (>= 4.2) | mutter,
=== modified file 'setup.py'
--- setup.py 2011-03-26 19:27:07 +0000
+++ setup.py 2011-06-07 23:50:55 +0000
@@ -81,7 +81,6 @@
'src/share/screenlets-manager/KarambaScreenlet.py',
'src/share/screenlets-manager/widget.png',
'src/share/screenlets-manager/WidgetScreenlet.py',
- 'src/share/screenlets-manager/prefs.js',
'src/share/screenlets-manager/webapp.png',
'src/share/screenlets-manager/WebappScreenlet.py',
'src/share/screenlets-manager/karamba.png']))
=== modified file 'src/share/screenlets-manager/WebappScreenlet.py'
--- src/share/screenlets-manager/WebappScreenlet.py 2008-04-10 15:10:23 +0000
+++ src/share/screenlets-manager/WebappScreenlet.py 2011-06-07 23:50:55 +0000
@@ -21,60 +21,7 @@
import sys
import os
from screenlets import sensors
-
-#########WORKARROUND FOR GTKOZEMBED BUG BY WHISE################
-myfile = 'WebappScreenlet.py'
-mypath = sys.argv[0][:sys.argv[0].find('myfile')].strip()
-
-if sys.argv[0].endswith(myfile): # Makes Shure its not the manager running...
- # First workarround
- c = None
- workarround = "python "+ sys.argv[0] + " &"
- a = str(commands.getoutput('whereis firefox')).replace('firefox: ','').split(' ')
- for b in a:
- if os.path.isfile(b + '/run-mozilla.sh'):
- c = b + '/run-mozilla.sh'
- workarround = c + " " + sys.argv[0] + " &"
-
- if c == None:
- # Second workarround
- print 'First workarround didnt work let run a second manual workarround'
- if str(sensors.sys_get_distrib_name()).lower().find('ubuntu') != -1: # Works for ubuntu 32
- workarround = "export LD_LIBRARY_PATH=/usr/lib/firefox \n export MOZILLA_FIVE_HOME=/usr/lib/firefox \n python "+ sys.argv[0] + " &"
- elif str(sensors.sys_get_distrib_name()).lower().find('debian') != -1: # Works for debian 32 with iceweasel installed
- workarround = "export LD_LIBRARY_PATH=/usr/lib/iceweasel \n export MOZILLA_FIVE_HOME=/usr/lib/iceweasel \n python " + sys.argv[0] + " &"
- elif str(sensors.sys_get_distrib_name()).lower().find('suse') != -1: # Works for suse 32 with seamonkey installed
- workarround = "export LD_LIBRARY_PATH=/usr/lib/seamonkey \n export MOZILLA_FIVE_HOME=/usr/lib/seamonkey \n python "+ sys.argv[0] + " &"
- print 'Your running suse , make shure you have seamonkey installed'
- elif str(sensors.sys_get_distrib_name()).lower().find('fedora') != -1: # Works for fedora 32 with seamonkey installed
- workarround = "export LD_LIBRARY_PATH=/usr/lib/seamonkey \n export MOZILLA_FIVE_HOME=/usr/lib/seamonkey \n python "+ sys.argv[0] + " &"
- print 'Your running fedora , make shure you have seamonkey installed'
-
-
- if os.path.isfile("/tmp/"+ myfile+"running"):
- os.system("rm -f " + "/tmp/"+ myfile+"running")
-
- else:
- if workarround == "python "+ sys.argv[0] + " &":
- print 'No workarround will be applied to your sistem , this screenlet will probably not work properly'
- os.system (workarround)
- fileObj = open("/tmp/"+ myfile+"running","w") #// open for for write
- fileObj.write('gtkmozembed bug workarround')
-
- fileObj.close()
- sys.exit()
-
-
-else:
- pass
-try:
- import gtkmozembed
-except:
- if sys.argv[0].endswith(myfile):screenlets.show_error(None,"You need Gtkmozembed to run this Screenlet , please install it")
- else: print "You need Gtkmozembed to run this Screenlet , please install it"
-#########WORKARROUND FOR GTKOZEMBED BUG BY WHISE################
-
-
+import webkit
class WebappScreenlet (screenlets.Screenlet):
"""Brings Web applications to your desktop"""
@@ -93,21 +40,16 @@
screenlets.Screenlet.__init__(self, width=325, height=370,uses_theme=True,
is_widget=False, is_sticky=True,draw_buttons=False, **keyword_args)
- if hasattr(gtkmozembed, 'set_profile_path'):
- gtkmozembed.set_profile_path(self.mypath,'mozilla')
- else:
- gtkmozembed.gtk_moz_embed_set_profile_path(self.mypath ,'mozilla')
-
- self.moz = gtkmozembed.MozEmbed()
+ self.view = webkit.WebView()
self.win = gtk.Window()
#self.win.maximize()
- self.win.add(self.moz)
+ self.win.add(self.view)
- self.moz.load_url(self.url)
+ self.view.load_uri(self.url)
self.win.connect('destroy',self.quitall)
self.win.connect("configure-event", self.configure)
- self.moz.connect("title",self.update)
+ self.view.connect("notify::title",self.update)
def configure (self, widget, event):
@@ -133,7 +75,7 @@
def update(self,widget):
- title = self.moz.get_title()
+ title = self.view.get_title()
self.win.set_title(title)
def quitall(self,widget):
if len(self.session.instances) > 1:
=== modified file 'src/share/screenlets-manager/WidgetScreenlet.py'
--- src/share/screenlets-manager/WidgetScreenlet.py 2008-05-25 13:40:09 +0000
+++ src/share/screenlets-manager/WidgetScreenlet.py 2011-06-07 23:50:55 +0000
@@ -21,62 +21,11 @@
import sys
import os
from screenlets import sensors
-
-
-
-#########WORKARROUND FOR GTKOZEMBED BUG BY WHISE################
+import webkit
+
+#Check for internet connection required for web widgets
+
myfile = 'WidgetScreenlet.py'
-mypath = sys.argv[0][:sys.argv[0].find(myfile)].strip()
-
-if sys.argv[0].endswith(myfile): # Makes Shure its not the manager running...
- # First workarround
- c = None
- workarround = "python "+ sys.argv[0] + " &"
- a = str(commands.getoutput('whereis firefox')).replace('firefox: ','').split(' ')
- for b in a:
- if os.path.isfile(b + '/run-mozilla.sh'):
- c = b + '/run-mozilla.sh'
- workarround = c + " " + sys.argv[0] + " &"
-
-
- if c == None:
- # Second workarround
- print 'First workarround didnt work let run a second manual workarround'
- if str(sensors.sys_get_distrib_name()).lower().find('ubuntu') != -1: # Works for ubuntu 32
- workarround = "export LD_LIBRARY_PATH=/usr/lib/firefox \n export MOZILLA_FIVE_HOME=/usr/lib/firefox \n python "+ sys.argv[0] + " &"
- elif str(sensors.sys_get_distrib_name()).lower().find('debian') != -1: # Works for debian 32 with iceweasel installed
- workarround = "export LD_LIBRARY_PATH=/usr/lib/iceweasel \n export MOZILLA_FIVE_HOME=/usr/lib/iceweasel \n python " + sys.argv[0] + " &"
- elif str(sensors.sys_get_distrib_name()).lower().find('suse') != -1: # Works for suse 32 with seamonkey installed
- workarround = "export LD_LIBRARY_PATH=/usr/lib/seamonkey \n export MOZILLA_FIVE_HOME=/usr/lib/seamonkey \n python "+ sys.argv[0] + " &"
- print 'Your running suse , make shure you have seamonkey installed'
- elif str(sensors.sys_get_distrib_name()).lower().find('fedora') != -1: # Works for fedora 32 with seamonkey installed
- workarround = "export LD_LIBRARY_PATH=/usr/lib/seamonkey \n export MOZILLA_FIVE_HOME=/usr/lib/seamonkey \n python "+ sys.argv[0] + " &"
- print 'Your running fedora , make shure you have seamonkey installed'
-
-
- if os.path.isfile("/tmp/"+ myfile+"running"):
- os.system("rm -f " + "/tmp/"+ myfile+"running")
-
- else:
- if workarround == "python "+ sys.argv[0] + " &":
- print 'No workarround will be applied to your sistem , this screenlet will probably not work properly'
- os.system (workarround)
- fileObj = open("/tmp/"+ myfile+"running","w") #// open for for write
- fileObj.write('gtkmozembed bug workarround')
-
- fileObj.close()
- sys.exit()
-
-
-else:
- pass
-try:
- import gtkmozembed
-except:
- if sys.argv[0].endswith(myfile):screenlets.show_error(None,"You need Gtkmozembed to run this Screenlet , please install it")
- else: print "You need Gtkmozembed to run this Screenlet , please install it"
-#########WORKARROUND FOR GTKOZEMBED BUG BY WHISE################
-#Check for internet connection required for web widgets
if sys.argv[0].endswith(myfile):# Makes Shure its not the manager running...
#os.system('wget www.google.com -O/tmp/index.html &')
@@ -97,7 +46,7 @@
__desc__ = __doc__
started = False
- moz = None
+ view = None
box = None
mypath = sys.argv[0][:sys.argv[0].find('WidgetScreenlet.py')].strip()
url = mypath + 'index.html'
@@ -130,12 +79,8 @@
self.disable_option('scale')
self.theme_name = 'default'
self.box = gtk.VBox(False, 0)
- if hasattr(gtkmozembed, 'set_profile_path'):
- gtkmozembed.set_profile_path(self.mypath,'mozilla')
- else:
- gtkmozembed.gtk_moz_embed_set_profile_path(self.mypath ,'mozilla')
- self.moz = gtkmozembed.MozEmbed()
- self.box.pack_start(self.moz, False, False, 0)
+ self.view = webkit.WebView()
+ self.box.pack_start(self.view, False, False, 0)
self.window.add(self.box)
@@ -202,7 +147,7 @@
#ctx.translate(0,10)
self.draw_scaled_image(ctx,0,0,self.width,self.height,self.mypath + 'icon.png')
- self.moz.shape_combine_mask(self.bgpbms,0,0)
+ self.view.shape_combine_mask(self.bgpbms,0,0)
else:
self.bgpb = gtk.gdk.pixbuf_new_from_file(self.mypath + 'icon.png').scale_simple(int(self.widget_width),int(self.widget_height),gtk.gdk.INTERP_HYPER)
self.bgpbim, self.bgpbms = self.bgpb.render_pixmap_and_mask(alpha_threshold=128)
@@ -211,7 +156,7 @@
ctx.translate(0,10)
self.draw_image(ctx,0,0,self.mypath + 'icon.png')
- self.moz.shape_combine_mask(self.bgpbms,8,8)
+ self.view.shape_combine_mask(self.bgpbms,8,8)
@@ -276,7 +221,7 @@
self.url = self.widget_info[13:][:(len(self.widget_info)-24)]
self.engine = 'google'
- self.moz.load_url(self.url)
+ self.view.load_uri(self.url)
print 'loading ' + self.url
self.width = int(self.widget_width)+30
@@ -291,9 +236,9 @@
self.box.set_uposition(-1,7)
- self.moz.set_size_request(-1,int(self.widget_height))
+ self.view.set_size_request(-1,int(self.widget_height))
else:
- self.moz.set_size_request(-1,int(self.height))
+ self.view.set_size_request(-1,int(self.height))
self.redraw_canvas()
def on_mouse_down(self,event):
=== modified file 'src/share/screenlets-manager/screenlets-manager.py'
--- src/share/screenlets-manager/screenlets-manager.py 2011-04-24 20:51:36 +0000
+++ src/share/screenlets-manager/screenlets-manager.py 2011-06-07 23:50:55 +0000
@@ -1060,7 +1060,6 @@
os.system('cp ' + screenlets.INSTALL_PREFIX + '/share/screenlets-manager/WebappScreenlet.py ' +DIR_USER + '/' + a + '/' + a + 'Screenlet.py')
os.system('cp ' + screenlets.INSTALL_PREFIX + '/share/screenlets-manager/webapp.png ' +DIR_USER + '/' + a + '/icon.png')
os.system('cp ' + screenlets.INSTALL_PREFIX + '/share/screenlets-manager/webapp.png ' +DIR_USER + '/' + a + '/themes/default')
- os.system('cp ' + screenlets.INSTALL_PREFIX + '/share/screenlets-manager/prefs.js ' +DIR_USER + '/' + a + '/mozilla')
enginecopy = open(DIR_USER + '/' + a + '/' + a + 'Screenlet.py','r')
enginesave = enginecopy.read()
@@ -1147,7 +1146,6 @@
os.system('cp ' + screenlets.INSTALL_PREFIX + '/share/screenlets-manager/WidgetScreenlet.py ' +DIR_USER + '/' + a + '/' + a + 'Screenlet.py')
os.system('cp ' + screenlets.INSTALL_PREFIX + '/share/screenlets-manager/widget.png ' +DIR_USER + '/' + a + '/icon.png')
os.system('cp ' + screenlets.INSTALL_PREFIX + '/share/screenlets-manager/widget.png ' +DIR_USER + '/' + a + '/themes/default')
- os.system('cp ' + screenlets.INSTALL_PREFIX + '/share/screenlets-manager/prefs.js ' +DIR_USER + '/' + a + '/mozilla')
enginecopy = open(DIR_USER + '/' + a + '/' + a + 'Screenlet.py','r')
enginesave = enginecopy.read()
enginesave = enginesave.replace('WidgetScreenlet',a + 'Screenlet')