コード例 #1
0
ファイル: shell.py プロジェクト: romaia/stoq
    def run(self, appdesc=None, appname=None):
        if not self._do_login():
            raise SystemExit
        from stoq.gui.launcher import Launcher
        from stoqlib.gui.events import StartApplicationEvent
        from stoqlib.lib.message import error
        import gtk
        app_window = Launcher(self._options, self)
        app_window.show()
        app = app_window.app
        StartApplicationEvent.emit(app.name, app)

        # A GtkWindowGroup controls grabs (blocking mouse/keyboard interaction),
        # by default all windows are added to the same window group.
        # We want to avoid setting modallity on other windows
        # when running a dialog using gtk_dialog_run/run_dialog.
        window_group = gtk.WindowGroup()
        window_group.add_window(app_window.get_toplevel())

        if appname is not None:
            appdesc = self.get_app_by_name(appname)

        if not appdesc:
            return
        if (appdesc.name != 'launcher' and
            not self._user.profile.check_app_permission(appdesc.name)):
            error(_("This user lacks credentials \nfor application %s") %
                  appdesc.name)
            return

        self.run_embedded(appdesc, app_window)
コード例 #2
0
ファイル: shellwindow.py プロジェクト: n3zsistemas-bkp/stoq
    def show_app(self, app, app_window, **params):
        app_window.reparent(self.application_box)
        self.application_box.set_child_packing(app_window, True, True, 0,
                                               Gtk.PackType.START)
        # Default action settings for applications
        self.Print.set_visible(True)
        self.Print.set_sensitive(False)
        self.ExportSpreadSheet.set_visible(True)
        self.ExportSpreadSheet.set_sensitive(False)
        self.ChangePassword.set_visible(False)
        self.SignOut.set_visible(False)
        self.Close.set_sensitive(True)
        self.HomeToolItem.set_sensitive(True)
        # We only care about Quit on OSX
        self.Quit.set_visible(bool(self._osx_app))

        self.NewToolItem.set_tooltip("")
        self.NewToolItem.set_sensitive(True)
        self.SearchToolItem.set_tooltip("")
        self.SearchToolItem.set_sensitive(True)
        self._update_toggle_actions(app.app_name)

        self.get_toplevel().set_title(app.get_title())
        self.application_box.show()
        app.toplevel = self.get_toplevel()
        if app.app_name != 'launcher':
            self.application_actions[app.app_name].set_visible(False)

        if self._birthdays_bar is not None:
            if app.app_name in ['launcher', 'sales']:
                self._birthdays_bar.show()
            else:
                self._birthdays_bar.hide()

        # StartApplicationEvent must be emitted before calling app.activate(),
        # so that the plugins can have the chance to modify the application
        # before any other event is emitted.
        StartApplicationEvent.emit(app.app_name, app)
        app.activate(**params)

        self.uimanager.ensure_update()
        self.current_app = app
        self.current_widget = app_window

        if not self.in_ui_test:
            while Gtk.events_pending():
                Gtk.main_iteration()
            app_window.show()
        app.setup_focus()
コード例 #3
0
ファイル: shellwindow.py プロジェクト: adrianoaguiar/stoq
    def show_app(self, app, app_window, **params):
        app_window.reparent(self.application_box)
        self.application_box.set_child_packing(app_window, True, True, 0,
                                               gtk.PACK_START)
        # Default action settings for applications
        self.Print.set_visible(True)
        self.Print.set_sensitive(False)
        self.ExportSpreadSheet.set_visible(True)
        self.ExportSpreadSheet.set_sensitive(False)
        self.ChangePassword.set_visible(False)
        self.SignOut.set_visible(False)
        self.Close.set_sensitive(True)
        self.HomeToolItem.set_sensitive(True)
        # We only care about Quit on OSX
        self.Quit.set_visible(bool(self._osx_app))

        self.NewToolItem.set_tooltip("")
        self.NewToolItem.set_sensitive(True)
        self.SearchToolItem.set_tooltip("")
        self.SearchToolItem.set_sensitive(True)
        self._update_toggle_actions(app.app_name)

        self.get_toplevel().set_title(app.get_title())
        self.application_box.show()
        app.toplevel = self.get_toplevel()
        if app.app_name != 'launcher':
            self.application_actions[app.app_name].set_visible(False)

        if self._birthdays_bar is not None:
            if app.app_name in ['launcher', 'sales']:
                self._birthdays_bar.show()
            else:
                self._birthdays_bar.hide()

        # StartApplicationEvent must be emitted before calling app.activate(),
        # so that the plugins can have the chance to modify the application
        # before any other event is emitted.
        StartApplicationEvent.emit(app.app_name, app)
        app.activate(**params)

        self.uimanager.ensure_update()
        self.current_app = app
        self.current_widget = app_window

        if not self.in_ui_test:
            while gtk.events_pending():
                gtk.main_iteration()
            app_window.show()
        app.setup_focus()
コード例 #4
0
ファイル: shellwindow.py プロジェクト: 5l1v3r1/stoq-1
    def show_app(self, app, app_window, **params):
        self.stoq_menu.set_visible(False)
        app_window.get_parent().remove(app_window)
        self.application_box.add(app_window)
        self.application_box.set_child_packing(app_window, True, True, 0,
                                               Gtk.PackType.START)

        self._current_app_settings = self._app_settings.setdefault(
            app.app_name, {})

        self.header_bar.set_title(app.get_title())
        self.header_bar.set_subtitle(app.app_title)
        self.application_box.show()
        app.toplevel = self.get_toplevel()

        if self._birthdays_bar is not None:
            if app.app_name in ['launcher', 'sales']:
                self._birthdays_bar.show()
            else:
                self._birthdays_bar.hide()

        if app.app_name == 'launcher':
            icon_name = 'fa-power-off-symbolic'
        else:
            icon_name = 'fa-chevron-left-symbolic'
        self.set_close_button_icon(icon_name)

        # StartApplicationEvent must be emitted before calling app.activate(),
        # so that the plugins can have the chance to modify the application
        # before any other event is emitted.
        StartApplicationEvent.emit(app.app_name, app)
        app.activate(**params)

        self.current_app = app
        self.current_widget = app_window

        if not self.in_ui_test:
            while Gtk.events_pending():
                Gtk.main_iteration()
            app_window.show()
        app.setup_focus()
コード例 #5
0
ファイル: shellwindow.py プロジェクト: hackedbellini/stoq
    def show_app(self, app, app_window, **params):
        self.stoq_menu.set_visible(False)
        app_window.get_parent().remove(app_window)
        self.application_box.add(app_window)
        self.application_box.set_child_packing(app_window, True, True, 0,
                                               Gtk.PackType.START)

        self._current_app_settings = self._app_settings.setdefault(app.app_name, {})

        self.header_bar.set_title(app.get_title())
        self.header_bar.set_subtitle(app.app_title)
        self.application_box.show()
        app.toplevel = self.get_toplevel()

        if self._birthdays_bar is not None:
            if app.app_name in ['launcher', 'sales']:
                self._birthdays_bar.show()
            else:
                self._birthdays_bar.hide()

        if app.app_name == 'launcher':
            icon_name = 'fa-power-off-symbolic'
        else:
            icon_name = 'fa-chevron-left-symbolic'
        self.set_close_button_icon(icon_name)

        # StartApplicationEvent must be emitted before calling app.activate(),
        # so that the plugins can have the chance to modify the application
        # before any other event is emitted.
        StartApplicationEvent.emit(app.app_name, app)
        app.activate(**params)

        self.current_app = app
        self.current_widget = app_window

        if not self.in_ui_test:
            while Gtk.events_pending():
                Gtk.main_iteration()
            app_window.show()
        app.setup_focus()
コード例 #6
0
ファイル: shellwindow.py プロジェクト: tmaxter/stoq
    def show_app(self, app, app_window, params=None):
        app_window.reparent(self.application_box)
        self.application_box.set_child_packing(app_window, True, True, 0,
                                               gtk.PACK_START)
        # Default action settings for applications
        self.Print.set_visible(True)
        self.Print.set_sensitive(False)
        self.ExportSpreadSheet.set_visible(True)
        self.ExportSpreadSheet.set_sensitive(False)
        self.ChangePassword.set_visible(False)
        self.SignOut.set_visible(False)
        self.Close.set_sensitive(True)
        # We only care about Quit on OSX
        self.Quit.set_visible(bool(self._osx_app))

        self.NewToolItem.set_tooltip("")
        self.NewToolItem.set_sensitive(True)
        self.SearchToolItem.set_tooltip("")
        self.SearchToolItem.set_sensitive(True)
        self._update_toggle_actions(app.app_name)

        self.get_toplevel().set_title(app.get_title())
        self.application_box.show()
        app.toplevel = self.get_toplevel()

        # StartApplicationEvent must be emitted before calling app.activate(),
        # so that the plugins can have the chance to modify the application
        # before any other event is emitted.
        StartApplicationEvent.emit(app.app_name, app)
        app.activate(params or {})

        self.uimanager.ensure_update()
        self.current_app = app
        self.current_widget = app_window

        if not self.in_ui_test:
            while gtk.events_pending():
                gtk.main_iteration()
            app_window.show()
        app.setup_focus()
コード例 #7
0
ファイル: shell.py プロジェクト: romaia/stoq
    def _load_app(self, appdesc, app_window):
        import gtk
        module = __import__("stoq.gui.%s" % (appdesc.name, ),
                            globals(), locals(), [''])
        window = appdesc.name.capitalize() + 'App'
        window_class = getattr(module, window, None)
        if window_class is None:
            raise SystemExit("%s app misses a %r attribute" % (
                appdesc.name, window))

        embedded = getattr(window_class, 'embedded', False)
        from stoq.gui.application import App
        app = App(window_class, self._login, self._options, self, embedded,
                  app_window, appdesc.name)

        toplevel = app.main_window.get_toplevel()
        icon = toplevel.render_icon(appdesc.icon, gtk.ICON_SIZE_MENU)
        toplevel.set_icon(icon)

        from stoqlib.gui.events import StartApplicationEvent
        StartApplicationEvent.emit(appdesc.name, app)

        return app