def init_gtkmozembed(): """We need to set up mozilla with set_comp_path in order for it not to crash. The fun part is not hardcoding that path since we have no way of getting it from the module itself. good luck with this""" logging.info("initializing mozilla") assert HAS_MOZILLA #new, easy behavior if os.path.exists('/usr/lib/xulrunner-1.9'): gtkmozembed.set_comp_path('/usr/lib/xulrunner-1.9') return #old, disgusting behavior if not os.environ.has_key('MOZILLA_FIVE_HOME'): return False moz_path = os.environ['MOZILLA_FIVE_HOME'] cmd = "ldd " + moz_path + '/libxpcom.so | grep "not found"' p = subprocess.Popen(cmd, shell=True, close_fds=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) retval = p.wait() stderr = p.stderr.read() stdout = p.stdout.read() if len(stderr) > 1 or len(stdout) > 0: print """***ERROR initializing mozilla. PenguinTV may crash shortly. You may need to export LD_LIBRARY_PATH=$MOZILLA_FIVE_HOME """ return False _init_mozilla_proxy() logging.info("initializing mozilla in " + str(moz_path)) gtkmozembed.set_comp_path(moz_path) return True
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # ### import logging,ConfigParser import gobject import gtkmozembed _logger = logging.getLogger("mozembed_wrap") try: cf = ConfigParser.ConfigParser() cf.read('/etc/gre.d/gre.conf') comp_path=cf.get(cf.sections()[0], 'GRE_PATH') gtkmozembed.set_comp_path(comp_path) except: _logger.error("Cannot load GRE configuration", exc_info=True) """ This class wrap MozEmbed Use workaround to resolve binding problem: - freeze when more than 150ko are render - crash when render data and the widget is not realize """ class MozClient(gtkmozembed.MozEmbed): def __init__(self): super(MozClient,self).__init__() self.connect("realize",self.on_realize)
FIXME: add navigation buttons (back, history) """ import gtk import urllib import urlparse import re engine = None try: import webkit engine = 'webkit' except ImportError: try: import gtkmozembed gtkmozembed.set_comp_path('') engine = 'mozembed' except ImportError: try: import gtkhtml2 engine = 'gtkhtml2' except ImportError: pass from gettext import gettext as _ from advene.gui.views import AdhocView class gtkhtml_wrapper: def __init__(self, controller=None, notify=None): self.controller = controller
FIXME: add navigation buttons (back, history) """ import gtk import urllib import urlparse import re engine=None try: import webkit engine='webkit' except ImportError: try: import gtkmozembed gtkmozembed.set_comp_path('') engine='mozembed' except ImportError: try: import gtkhtml2 engine='gtkhtml2' except ImportError: pass from gettext import gettext as _ from advene.gui.views import AdhocView class gtkhtml_wrapper: def __init__(self, controller=None, notify=None): self.controller=controller self.notify=notify