Ejemplo n.º 1
0
    def __init__(self, parent):
        self.parent_obj = parent
        hulahop.startup(os.path.join(os.environ['SUGAR_ACTIVITY_ROOT'],'data','gecko'))
        #from hulahop.webview import WebView
        from browser import Browser
        import xpcom
        from xpcom.components import interfaces
        self.help_id = None
        self.handle = ActivityHandle()
        self.handle.activity_id = util.unique_id()
        Window.__init__(self)
        self.connect('realize',self.realize_cb)

        #self.props.max_participants = 1

        self._web_view = Browser()

        #Mimic the other tabs (hide the fact that this is another window)
        self.toolbox = Toolbox()
        self.toolbox.connect_after('current_toolbar_changed',self.goto_cb)
        self.set_toolbox(self.toolbox)
        self.toolbox.show()
        
        activitybar = gtk.Toolbar()
        self.toolbox.add_toolbar(_('Activity'), activitybar)
        activitybar.show_all()
        
        editbar = gtk.Toolbar()
        self.toolbox.add_toolbar(_('Edit'), editbar)
        editbar.show_all()
        
        usebar = gtk.Toolbar()
        self.toolbox.add_toolbar(_('Output'), usebar)
        usebar.show_all()
        
        self.help_toolbar = Toolbar(self._web_view)
        self.help_toolbar.show()
        self.toolbox.add_toolbar(_('Help'), self.help_toolbar)
        self.toolbox._notebook.set_current_page(HELP_PANE)

        self.set_canvas(self._web_view)
        self._web_view.show()

        self.toolbox.set_current_toolbar(HELP_PANE)
Ejemplo n.º 2
0
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

import os
import time
import hulahop
import gtk

from sugar.activity import activity
from sugar import env

from sugar.graphics.toolbarbox import ToolbarBox
from sugar.activity.widgets import StopButton

hulahop.startup(os.path.join(env.get_profile_path(), 'gecko'))
from hulahop.webview import WebView

BASEPATH = os.path.abspath(os.path.dirname(__file__))


class DesafioMundial(activity.Activity):
    def __init__(self, handle):

        activity.Activity.__init__(self, handle, False)

        toolbar = ToolbarBox()
        separator = gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar.toolbar.insert(separator, -1)
Ejemplo n.º 3
0
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software

import os
from gettext import gettext as _

import gtk
import gobject

from sugar.activity import activity
from sugar.graphics.toolbutton import ToolButton

import hulahop
hulahop.startup(os.path.join(activity.get_activity_root(), 'data/gecko'))

#from hulahop.webview import WebView
from browser import Browser
import xpcom
from xpcom.components import interfaces

gobject.threads_init()

HOME = os.path.join(activity.get_bundle_path(), 'help/inicio.html')
#HOME = "http://website.com/something.html"

class HelpActivity(activity.Activity):
    def __init__(self, handle):
        activity.Activity.__init__(self, handle)
Ejemplo n.º 4
0
Archivo: hula.py Proyecto: Afey/pyjs
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA


import os
import sys
import hulahop
# this is for storing the gecko stuff (cache, cookies, plugins etc.)
gecko_path = os.environ.get('HOME', '.')
gecko_path = os.path.join(gecko_path, ".pyjd")
hulahop.startup(gecko_path)

from hulahop.webview import WebView

import gtk
import gtk.gdk
import gobject
import xpcom

from xpcom.nsError import *
from xpcom import components
from xpcom.components import interfaces

from progresslistener import ProgressListener

class nsITimerCallback:
Ejemplo n.º 5
0
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

import os
import sys
import hulahop
# this is for storing the gecko stuff (cache, cookies, plugins etc.)
gecko_path = os.environ.get('HOME', '.')
gecko_path = os.path.join(gecko_path, ".pyjd")
hulahop.startup(gecko_path)

from hulahop.webview import WebView

import gtk
import gtk.gdk
import gobject
import xpcom

from xpcom.nsError import *
from xpcom import components
from xpcom.components import interfaces

from progresslistener import ProgressListener

Ejemplo n.º 6
0
import os
import gtk
import hulahop
from sugar import env
from sugar.activity import activity
from path import path
hulahop.startup(os.path.join(env.get_profile_path(), 'gecko'))

from hulahop.webview import WebView

BUNDLEPATH = path(activity.get_bundle_path()) / 'tw'
DATAPATH = path(activity.get_activity_root()) / 'data'
TESTFILE = BUNDLEPATH / 'slides.html'
WORKFILE = 'file://' + DATAPATH / 'slides.html'

class Htmlview(gtk.VBox):
    def __init__(self):
        gtk.VBox.__init__(self)
        #vbox = gtk.VBox(False, 8)
        wv = WebView()
        print 'show', WORKFILE, path(WORKFILE).exists()
        wv.load_uri(WORKFILE)
        wv.show()
        self.pack_start(wv, True, True, 0)
        #self.add(wv)
        self.show_all()

Ejemplo n.º 7
0
if __name__ == "__main__":
    ROOT_PATH = unicode(os.path.realpath('content/'))
    STARTUP_DIR = os.path.realpath('gecko')
else:
    from sugar.activity import activity
    ROOT_PATH = unicode(os.path.join(activity.get_bundle_path(), 'content/'))
    STARTUP_DIR = os.path.join(activity.get_activity_root(), 'data/gecko')

ignore_list = ["images", "old", "bak", "default.html", "default-avanzado.html", "default-simple.html"]

HOME_PAGE = u"file://" + os.path.join(ROOT_PATH, u'01-Introducción-avanzado.html')

hulahop_ok = True
try:
    import hulahop
    hulahop.startup(STARTUP_DIR)
    from hulahop.webview import WebView
    from progresslistener import ProgressListener
except:
    hulahop_ok = False

gobject.threads_init()

# filesystemencoding should be used, but for some reason its value is ascii instead of utf-8
# the following lines are used to fix that problem, asumming all paths as utf-8
fencoding = 'utf-8'     
uni = lambda s: unicode(s, fencoding)
listdir = lambda x: map(uni, os.listdir(x.encode(fencoding)))
isfile = lambda x: os.path.isfile(x.encode(fencoding))
exists = lambda x: os.path.exists(x.encode(fencoding))
#
Ejemplo n.º 8
0
    @autor Jordi Piguillem
    
    @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
'''
from sugar.activity import activity
import os
import hulahop
import paths
import logging
import gtk
import gtk.glade
import gobject
#starting module hulahop
try:
    hula_path = os.path.join(activity.get_activity_root(), 'data/test')
    hulahop.startup(hula_path)
except RuntimeError:
    hula_path = os.path.join(os.getcwd(), 'data/test')
    hulahop.startup(hula_path)
from gettext import gettext as _
from controller import Controller
import ManagerData
from olpcgames import gtkEvent
import pygame
from browser import Browser
from ClicActivity import Constants


class Manager:
    def __init__(self, runaslib=True):
        #if runaslib is True -> we are in a Xo laptop
Ejemplo n.º 9
0
import os

import gtk

import hulahop
hulahop.startup(os.path.expanduser('~/.test-hulahop'))
from hulahop.webview import WebView

from xpcom import components


def _quit(window):
    hulahop.shutdown()
    gtk.main_quit()


cls = components.classes["@mozilla.org/preferences-service;1"]
prefService = cls.getService(components.interfaces.nsIPrefService)
branch = prefService.getBranch('')
branch.setBoolPref('security.warn_submit_insecure', False)
branch.setBoolPref('security.warn_submit_insecure.show_once', False)

window = gtk.Window()
window.connect("destroy", _quit)

web_view = WebView()
web_view.load_uri('http://www.google.com')
window.add(web_view)
web_view.show()

window.show()
Ejemplo n.º 10
0
import os

import gtk

import hulahop
hulahop.startup(os.path.expanduser('~/.test-hulahop'))
from hulahop.webview import WebView

from xpcom import components
    
def _quit(window):
    hulahop.shutdown()
    gtk.main_quit()

cls = components.classes["@mozilla.org/preferences-service;1"]
prefService = cls.getService(components.interfaces.nsIPrefService)
branch = prefService.getBranch('')
branch.setBoolPref('security.warn_submit_insecure', False)
branch.setBoolPref('security.warn_submit_insecure.show_once', False)

window = gtk.Window()
window.connect("destroy", _quit)

web_view = WebView()
web_view.load_uri('http://www.google.com')
window.add(web_view)
web_view.show()

window.show()

gtk.main()
Ejemplo n.º 11
0
        c.execute('''INSERT INTO moz_cookies (name, value, host, 
                                              path, expiry, lastAccessed,
                                              isSecure, isHttpOnly)
                     VALUES(?,?,?,?,?,?,?,?)''',
                  ('xoid', cjson.encode(cookie_data), jabber_server,
                   '/', expire, 0, 0, 0 ))
        cookies_db.commit()
        cookies_db.close()
    except sqlite3.Error, e:
        _logger.error('seed_xs_cookie: %s' % e)
    else:
        _logger.debug('seed_xs_cookie: Updated cookie successfully')

import hulahop
hulahop.set_app_version(os.environ['SUGAR_BUNDLE_VERSION'])
hulahop.startup(_profile_path)

from xpcom import components
from xpcom.components import interfaces

def _set_accept_languages():
    ''' Set intl.accept_languages based on the locale
    '''
    try:
        lang = os.environ['LANG'].strip('\n') # e.g. es_UY.UTF-8 
    except KeyError:
        return

    if (not lang.endswith(".utf8") or not lang.endswith(".UTF-8")) \
            and lang[2] != "_":
        _logger.debug("Set_Accept_language: unrecognised LANG format")
Ejemplo n.º 12
0
import gobject
import wnck
#from time import time
from sugar import util

from sugar.activity import activity
from sugar.graphics.window import Window
from sugar.graphics.toolbox import Toolbox
from sugar.activity.activityhandle import ActivityHandle
from sugar import wm, env
#from IPython.Debugger import Tracer
from pdb import *
from sugar.graphics.toolbutton import ToolButton
import hulahop

hulahop.startup(os.path.join(os.environ['SUGAR_ACTIVITY_ROOT'], 'data/gecko'))
import xpcom
from xpcom.nsError import *
#from xpcom import components
#from xpcom.components import interfaces
from browser import Browser
from xpcom.components import interfaces

gobject.threads_init()

HELP_PANE = 3

# Initialize logging.
import logging

_logger = logging.getLogger('PyDebug')
Ejemplo n.º 13
0
#http://blog.tomeuvizoso.net/2009/01/embedding-mozilla.html
import hulahop
import os
hulahop.startup(os.path.expanduser('~/.hulahop_profile'))
from hulahop.webview import WebView
import xpcom
import gobject
from xpcom.components import interfaces
import gtk

class ProgressListener(gobject.GObject):
    _com_interfaces_ = interfaces.nsIWebProgressListener
    __gsignals__ = {'finished':(gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE,([]))}

    def onStateChange(self, webProgress, request, stateFlags, status):
        if not (stateFlags & interfaces.nsIWebProgressListener.STATE_IS_NETWORK and \
                stateFlags & interfaces.nsIWebProgressListener.STATE_STOP):
            return
        self.emit('finished')

class GeckoDownloader(object):
    def __init__(self, callback):
        self.callback = callback
        self.w = gtk.Window()
        self.w.show()
        self.w.hide()

    def _callback(self,listener):
        html = self.v.dom_window.document.documentElement.innerHTML
        self.callback(html)
        gtk.main_quit()
Ejemplo n.º 14
0
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

import os
from gettext import gettext as _

import gtk
import gobject

from sugar.activity import activity
from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.toolcombobox import ToolComboBox

import hulahop

hulahop.startup(os.path.join(activity.get_activity_root(), "data/gecko"))

# from hulahop.webview import WebView
from browser import Browser
import xpcom
from xpcom.components import interfaces
from viewtoolbar import ViewToolbar

gobject.threads_init()

HOME = os.path.join(activity.get_bundle_path(), "printbot/XO_Introduction.html")
# HOME = "http://website.com/something.html"


class PrintbotActivity(activity.Activity):
    def __init__(self, handle):