Esempio n. 1
0
 def _on_view__navigation_policy_decision_requested(self, view, frame,
                                                    request, action,
                                                    policy):
     uri = request.props.uri
     if not uri.startswith('file:///'):
         policy.ignore()
         open_browser(uri, self.toplevel.get_screen())
Esempio n. 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)
Esempio n. 3
0
 def _open_uri(self, uri):
     if self._view:
         self._view.load_uri(uri)
         self.ok_button.grab_focus()
     else:
         open_browser(uri, self.toplevel.get_screen())
         self.toplevel.hide()
Esempio n. 4
0
 def _open_uri(self, uri):
     if self._view:
         self._view.load_uri(uri)
         self.ok_button.grab_focus()
     else:
         open_browser(uri, self.toplevel.get_screen())
         self.toplevel.hide()
Esempio n. 5
0
 def _on_view__navigation_policy_decision_requested(self, view, frame,
                                                    request, action,
                                                    policy):
     uri = request.props.uri
     if not uri.startswith('file:///'):
         policy.ignore()
         open_browser(uri, self.toplevel.get_screen())
Esempio n. 6
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)
Esempio n. 7
0
 def _policy_decision(self, uri, policy):
     if uri.startswith('file:///'):
         policy.use()
     elif uri.startswith('http://localhost'):
         policy.use()
     elif uri.startswith('stoq://'):
         policy.ignore()
         self._parse_stoq_uri(uri)
     else:
         open_browser(uri, self.get_screen())
Esempio n. 8
0
 def _policy_decision(self, uri, policy):
     if uri.startswith('file:///'):
         policy.use()
     elif uri.startswith('http://localhost'):
         policy.use()
     elif uri.startswith('stoq://'):
         policy.ignore()
         self._parse_stoq_uri(uri)
     else:
         open_browser(uri, self.get_screen())
Esempio n. 9
0
    def run_application(self, app_name, **params):
        """
        Load and show an application in a shell window.

        :param ShellWindow shell_window: shell window to run application in
        :param str appname: the name of the application to run
        :param params: extra arguments passed to the application
        :returns: the shell application or ``None`` if the user doesn't have
          access to open the application
        :rtype: ShellApp
        """
        # FIXME: Maybe we should really have an app that would be responsible
        # for doing administration tasks related to stoqlink here? Right now
        # we are only going to open the stoq.link url
        if app_name == 'link':
            toplevel = self.get_toplevel()
            user_hash = api.sysparam.get_string('USER_HASH')
            url = 'https://stoq.link?source=stoq&hash={}'.format(user_hash)
            open_browser(url, toplevel.get_screen())
            return

        if params.pop('hide', False):
            self.hide_app(empty=True)

        shell_app = self._load_shell_app(app_name)
        if shell_app is None:
            return None

        # Set the icon for the application
        app_icon = get_application_icon(app_name)
        toplevel = self.get_toplevel()
        icon = toplevel.render_icon(app_icon, Gtk.IconSize.MENU)
        toplevel.set_icon(icon)

        # FIXME: We should remove the toplevel windows of all ShellApp's
        #        glade files, as we don't use them any longer.
        shell_app_window = shell_app.get_toplevel()
        self.show_app(shell_app, shell_app_window.get_child(), **params)
        shell_app_window.hide()

        return shell_app
Esempio n. 10
0
    def run_application(self, app_name, **params):
        """
        Load and show an application in a shell window.

        :param ShellWindow shell_window: shell window to run application in
        :param str appname: the name of the application to run
        :param params: extra arguments passed to the application
        :returns: the shell application or ``None`` if the user doesn't have
          access to open the application
        :rtype: ShellApp
        """
        # FIXME: Maybe we should really have an app that would be responsible
        # for doing administration tasks related to stoqlink here? Right now
        # we are only going to open the stoq.link url
        if app_name == 'link':
            toplevel = self.get_toplevel()
            user_hash = api.sysparam.get_string('USER_HASH')
            url = 'https://stoq.link?source=stoq&hash={}'.format(user_hash)
            open_browser(url, toplevel.get_screen())
            return

        if params.pop('hide', False):
            self.hide_app(empty=True)

        shell_app = self._load_shell_app(app_name)
        if shell_app is None:
            return None

        # Set the icon for the application
        app_icon = get_application_icon(app_name)
        toplevel = self.get_toplevel()
        icon = toplevel.render_icon(app_icon, gtk.ICON_SIZE_MENU)
        toplevel.set_icon(icon)

        # FIXME: We should remove the toplevel windows of all ShellApp's
        #        glade files, as we don't use them any longer.
        shell_app_window = shell_app.get_toplevel()
        self.show_app(shell_app, shell_app_window.get_child(), **params)
        shell_app_window.hide()

        return shell_app
Esempio n. 11
0
 def _show_uri(self, uri):
     toplevel = self.get_toplevel()
     open_browser(uri, toplevel.get_screen())
Esempio n. 12
0
 def _show_uri(self, uri):
     toplevel = self.get_toplevel()
     open_browser(uri, toplevel.get_screen())
Esempio n. 13
0
 def on_image_eventbox__button_press_event(self, widget, event):
     if self._inside_button(event):
         url = 'https://www.stoq.com.br?source=stoqwizard'
         open_browser(url, self.wizard)
Esempio n. 14
0
 def on_image_eventbox__button_press_event(self, widget, event):
     if self._inside_button(event):
         url = 'https://www.stoq.com.br?source=stoqwizard'
         open_browser(url, self.wizard)
Esempio n. 15
0
 def on_image_eventbox__button_press_event(self, widget, event):
     if self._inside_button(event):
         url = 'https://stoq.link?source=stoqwizard&hash={}'
         user_hash = api.sysparam.get_string('USER_HASH')
         open_browser(url.format(user_hash), self.wizard)
Esempio n. 16
0
 def on_image_eventbox__button_press_event(self, widget, event):
     if self._inside_button(event):
         open_browser('http://stoq.link?source=stoqwizard', self.wizard)
Esempio n. 17
0
 def on_image_eventbox__button_press_event(self, widget, event):
     if self._inside_button(event):
         url = 'https://stoq.link?source=stoqwizard&hash={}'
         user_hash = api.sysparam.get_string('USER_HASH')
         open_browser(url.format(user_hash), self.wizard)