def on_gvr_lessons1_activate(self, widget, *args):
        """Display the GvR lessons in the default browser.
        This only works if the gvr lessons package version 0.2 is installed."""
        import webbrowser
        file = os.path.join(utils.get_rootdir(), 'docs', 'lessons', utils.get_locale()[:2], 'html', 'index.html')
        self.logger.debug("Looking for the lessons in %s" % file)
        if not os.path.exists(file) and utils.get_locale()[:2] != 'en':
            file = os.path.join(utils.get_rootdir(),'docs','lessons','en','html','index.html')
            self.logger.debug("Looking for the lessons in %s" % file)

        if os.path.exists(file):
            try:
                webbrowser.open(file, new=0)

            except webbrowser.Error,info:
                txt = str(info)+ '\n'+ "Be sure to set your env. variable 'BROWSER' to your preffered browser."
                self.show_warning(txt)
Example #2
0
 def __init__(self,parent,title=''):
     self.parent = parent
     self.logger = logging.getLogger("gvr.Editors.Editor")
     self.logger.debug("Using gtksourceview version %s" % SRCVIEW)
     # remove any children from previous sessions
     for child in self.parent.get_children():
         self.parent.remove(child)       
     # Look for the locale to which the syntax highlighting should be set
     # We assume the locale is available, if not there won't be any higlighting.
     try:
         loc = utils.get_locale()[:2]
     except Exception,info:
         self.logger.exception("Error in checking locale")
         loc = ''
Example #3
0
 def __init__(self,parent,title=''):
     self.parent = parent
     self.logger = logging.getLogger("gvr.Editors.Editor")
     self.logger.debug("Using gtksourceview version %s" % SRCVIEW)
     # remove any children from previous sessions
     for child in self.parent.get_children():
         self.parent.remove(child)       
     # Look for the locale to which the syntax highlighting should be set
     # We assume the locale is available, if not there won't be any higlighting.
     try:
         loc = utils.get_locale()[:2]
     except Exception,info:
         self.logger.exception("Error in checking locale")
         loc = ''
    def __init__(self, handle, parent=None, **kwargs):
        gvr_gtk_glade.window_main.__init__(self)

        self._parent = parent
        self._parent.set_canvas(self)
        self.logger = logging.getLogger("gvr.gvr_gtk.WindowXO")

        # Get and set the sugar toolbar
        toolbarbox = ToolbarBox()
        self._parent.set_toolbar_box(toolbarbox)
        toolbarbox.show_all()

        toolbar = toolbarbox.toolbar

        separator = Gtk.SeparatorToolItem()
        separator.props.draw = False
        separator.set_expand(True)
        toolbar.insert(separator, -1)

        stop_button = StopButton(self._parent)
        toolbar.insert(stop_button, -1)

        toolbar.show_all()

        # remove seperator and 'quit' menu items as we have the sugar toolbox
        self.imagemenuitem49.destroy()

        # Embed webview as the lessons display
        self.WV = WebView()

        file = os.path.join(utils.get_rootdir(), 'docs', 'lessons', utils.get_locale()[:2], 'html', 'index.html')
        self.logger.debug("Looking for the lessons in %s" % file)
        if not os.path.exists(file):
            self.logger.debug("%s not found, loading default English lessons" % file)
            file = os.path.join(utils.get_rootdir(), 'docs', 'lessons', 'en', 'html', 'index.html')

        self.WV.open('file:///%s' % file)

        scroll = Gtk.ScrolledWindow()
        scroll.add(self.WV)

        vbox = Gtk.VBox(False, 4)
        vbox.pack_start(Widgets.WebToolbar(self.WV), False, False, 2)
        vbox.pack_start(scroll, True, True, 2)
        vbox.show_all()
        self.eventboxlessons.add(vbox)

        self.new()
        self.show_all()
Example #5
0
 def on_load_finish(self, view, webframe):
     self.load_finish_flag = True;
     agent.webv = self
     # overlay extra variables of web part
     variables = {
           'platform': 'Linux'
         , 'conf_dir': config.CONF_DIR
         , 'cache_dir': config.CACHE_DIR
         , 'avatar_cache_dir': config.AVATAR_CACHE_DIR
         , 'extra_fonts': utils.get_extra_fonts()
         , 'extra_exts': utils.get_extra_exts()
         , 'locale': utils.get_locale()
     };
     # and then, notify web part i am ready to work :)
     gobject.idle_add(view.execute_script, '''
         overlay_variables(%s);
         globals.load_flags = 1;
         ''' % json.dumps(variables))
Example #6
0
 def on_load_finish(self, view, webframe):
     if self.load_finish_flag:
         return
     self.load_finish_flag = True;
     agent.webv = self
     # overlay extra variables of web part
     variables = {
           'platform': platform.system()
         , 'wrapper': 'python-gtk3'
         , 'conf_dir': config.get_path("conf")
         , 'cache_dir': config.get_path("cache")
         , 'avatar_cache_dir': config.get_path("avatar")
         , 'extra_fonts': utils.get_extra_fonts()
         , 'extra_exts': utils.get_extra_exts()
         , 'extra_themes': utils.get_extra_themes()
         , 'locale': utils.get_locale()
     };
     # and then, notify web part i am ready to work :)
     GObject.idle_add(view.execute_script, '''
         overlay_variables(%s);
         globals.load_flags = 1;
         ''' % json.dumps(variables))
Example #7
0
 def on_load_finish(self, view, webframe):
     if self.load_finish_flag:
         return
     self.load_finish_flag = True;
     agent.webv = self
     # overlay extra variables of web part
     variables = {
           'platform': platform.system()
         , 'wrapper': 'python-gtk2'
         , 'conf_dir': config.CONF_DIR
         , 'cache_dir': config.CACHE_DIR
         , 'avatar_cache_dir': config.AVATAR_CACHE_DIR
         , 'extra_fonts': utils.get_extra_fonts()
         , 'extra_exts': utils.get_extra_exts()
         , 'extra_themes': utils.get_extra_themes()
         , 'locale': utils.get_locale()
     };
     # and then, notify web part i am ready to work :)
     gobject.idle_add(view.execute_script, '''
         overlay_variables(%s);
         globals.load_flags = 1;
         ''' % json.dumps(variables))
Example #8
0
# See SP manual for more info

module_logger = logging.getLogger("childsplay.fallingletters")

# standard modules you probably need
import os, sys, random, string

import pygame
from pygame.constants import *

import utils
from SPConstants import *
import SPSpriteUtils
import Timer

if utils.get_locale()[0][:2] in SUPPORTEDKEYMAPS:
    LANG = utils.get_locale()[0][:2]
else:
    LANG = None
module_logger.debug("LANG set to %s" % LANG)


# containers that can be used globally to store stuff
class Misc:
    pass


class Letter(SPSpriteUtils.SPSprite):  # we derive from this high-level class
    def __init__(self, c, x, y, step, delay):
        # create a image of the character c
        size = 48
Example #9
0
def before_request():
    g.locale = get_locale().replace("_", "-")
Example #10
0
File: index.py Project: lhysrc/me
def before_request():
    g.locale = get_locale().replace("_", "-")
Example #11
0
 def main(self):
     moment.locale(utils.get_locale())