/usr/share/screenlets-manager/WebappScreenlet.py is in screenlets 0.1.2-8.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 | #!/usr/bin/env python
# This application is released under the GNU General Public License
# v3 (or, at your option, any later version). You can find the full
# text of the license under http://www.gnu.org/licenses/gpl.txt.
# By using, editing and/or distributing this software you agree to
# the terms and conditions of this license.
# Thank you for using free software!
# WebappScreenlet (c) 2007 bu Helder Fraga aka Whise
import screenlets
from screenlets import DefaultMenuItem
from screenlets.options import BoolOption, IntOption, ColorOption
import cairo
import gtk
import gobject
import commands
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################
class WebappScreenlet (screenlets.Screenlet):
"""Brings Web applications to your desktop"""
# default meta-info for Screenlets
__name__ = 'WebappScreenlet'
__version__ = '0.1'
__author__ = 'Helder Fraga aka Whise'
__desc__ = __doc__
mypath = sys.argv[0][:sys.argv[0].find('WebappScreenlet.py')].strip()
url = 'myurl'
def __init__ (self, **keyword_args):
# init stuff
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.win = gtk.Window()
#self.win.maximize()
self.win.add(self.moz)
self.moz.load_url(self.url)
self.win.connect('destroy',self.quitall)
self.win.connect("configure-event", self.configure)
self.moz.connect("title",self.update)
def configure (self, widget, event):
if event.x != self.x:
self.x = event.x
if event.y != self.y:
self.y = event.y
if event.width != self.width:
self.width = event.width
if event.height != self.height:
self.height = event.height
def on_init(self):
if self.width == 325 and self.height == 370:
self.win.set_default_size(700,500)
else:
self.win.set_default_size(self.width,self.height)
self.win.move(self.x,self.y)
self.win.show_all()
def update(self,widget):
title = self.moz.get_title()
self.win.set_title(title)
def quitall(self,widget):
if len(self.session.instances) > 1:
self.session.delete_instance (self.id)
# notify about being rmeoved (does this get send???)
self.service.instance_removed(self.id)
else:
self.session.quit_instance (self.id)
self.service.instance_removed(self.id)
if __name__ == "__main__":
import screenlets.session
screenlets.session.create_session(WebappScreenlet)
|