Example #1
0
def show_section(section, screen=None):
    if library.uninstalled:
        root = library.get_root()
        uri = os.path.join(root, 'docs', 'manual', 'pt_BR')
        if section != '':
            uri += '/' + section + '.page'
    else:
        if library.get_resource_exists('stoq', 'docs', 'manual', 'pt_BR'):
            manual_dir = library.get_resource_filename('stoq', 'docs',
                                                       'manual', 'pt_BR')
            if section:
                uri = os.path.join(manual_dir, section + '.page')
            else:
                uri = manual_dir
        else:
            uri = 'stoq'
            if section:
                uri += '?' + section

    if not screen:
        toplevel = get_current_toplevel()
        if toplevel:
            screen = toplevel.get_screen()

    try:
        gtk.show_uri(screen, 'ghelp:' + uri, gtk.get_current_event_time())
    except glib.GError:
        open_browser(
            'http://doc.stoq.com.br/manual/%s/%s.html' % (
                stoq.short_version,
                section or 'index',
            ), screen)
Example #2
0
def show_section(section, screen=None):
    if library.uninstalled:
        root = library.get_root()
        uri = os.path.join(root, 'docs', 'manual', 'pt_BR')
        if section != '':
            uri += '/' + section + '.page'
    else:
        if library.get_resource_exists('stoq', 'docs', 'manual', 'pt_BR'):
            manual_dir = library.get_resource_filename(
                'stoq', 'docs', 'manual', 'pt_BR')
            if section:
                uri = os.path.join(manual_dir, section + '.page')
            else:
                uri = manual_dir
        else:
            uri = 'stoq'
            if section:
                uri += '?' + section

    if not screen:
        toplevel = get_current_toplevel()
        if toplevel:
            screen = toplevel.get_screen()

    try:
        Gtk.show_uri(screen, 'ghelp:' + uri, Gtk.get_current_event_time())
    except GLib.GError:
        open_browser('http://doc.stoq.com.br/manual/%s/%s.html' % (
            stoq.short_version,
            section or 'index', ), screen)
Example #3
0
    def _read_plugin_descriptions(self):
        # Development plugins on the same checkout
        paths = [os.path.join(library.get_root(), 'plugins')]

        # Plugins on $HOME/.stoq/plugins
        paths.append(os.path.join(get_application_dir(), 'plugins'))

        if library.get_resource_exists('stoq', 'plugins'):
            paths.append(library.get_resource_filename('stoq', 'plugins'))

        paths.extend(list(self._get_external_plugins_paths()))

        for path in paths:
            for filename in glob.iglob(os.path.join(path, '*', '*.plugin')):
                self._register_plugin_description(filename)
            for filename in glob.iglob(os.path.join(path, '*.egg')):
                self._register_plugin_description(filename, is_egg=True)
Example #4
0
    def _read_plugin_descriptions(self):
        # Development plugins on the same checkout
        paths = [os.path.join(library.get_root(), 'plugins')]

        # Plugins on $HOME/.stoq/plugins
        paths.append(os.path.join(get_application_dir(), 'plugins'))

        if library.get_resource_exists('stoq', 'plugins'):
            paths.append(library.get_resource_filename('stoq', 'plugins'))

        paths.extend(list(self._get_external_plugins_paths()))

        for path in paths:
            for filename in glob.iglob(os.path.join(path, '*', '*.plugin')):
                self._register_plugin_description(filename)
            for filename in glob.iglob(os.path.join(path, '*.egg')):
                self._register_plugin_description(filename, is_egg=True)