Esempio n. 1
0
    def _launcher_ui_bootstrap(self):
        self._restore_window_size()

        self.hide_app(empty=True)

        self._check_demo_mode()
        self._check_online_plugins()
        self._birthdays_bar = None
        self._check_client_birthdays()
        # json will restore tuples as lists. We need to convert them
        # to tuples or the comparison bellow won't work.
        actual_version = tuple(api.user_settings.get('actual-version', (0, )))
        if stoq.stoq_version > actual_version:
            api.user_settings.set('last-version-check', None)
            self._display_changelog_message()
            # Display the changelog message only once. Most users will never
            # click on the "See what's new" button, and that will affect its
            # visual identity.
            api.user_settings.set('actual-version', stoq.stoq_version)

        self._check_information()

        if not stoq.stable and not api.is_developer_mode():
            self._display_unstable_version_message()

        toplevel = self.get_toplevel()
        toplevel.connect('configure-event', self._on_toplevel__configure)
        toplevel.connect('delete-event', self._on_toplevel__delete_event)

        # 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(toplevel)
Esempio n. 2
0
    def _launcher_ui_bootstrap(self):
        self._restore_window_size()

        self.hide_app(empty=True)

        self._check_demo_mode()
        self._check_online_plugins()
        self._birthdays_bar = None
        self._check_client_birthdays()
        # json will restore tuples as lists. We need to convert them
        # to tuples or the comparison bellow won't work.
        actual_version = tuple(api.user_settings.get('actual-version', (0,)))
        if stoq.stoq_version > actual_version:
            api.user_settings.set('last-version-check', None)
            self._display_changelog_message()
            # Display the changelog message only once. Most users will never
            # click on the "See what's new" button, and that will affect its
            # visual identity.
            api.user_settings.set('actual-version', stoq.stoq_version)

        self._check_information()

        if not stoq.stable and not api.is_developer_mode():
            self._display_unstable_version_message()

        toplevel = self.get_toplevel()
        toplevel.connect('configure-event', self._on_toplevel__configure)
        toplevel.connect('delete-event', self._on_toplevel__delete_event)

        # 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(toplevel)
Esempio n. 3
0
def test_api():
    store = api.get_default_store()

    assert store is get_default_store()
    assert api.get_current_user(store) is get_current_user(store)
    assert api.db_settings is db_settings
    assert api.user_settings is get_settings()
    assert isinstance(api.device_manager, DeviceManager)
    with pytest.raises(NotImplementedError):
        assert isinstance(api.config, IStoqConfig)
    assert api.is_developer_mode() is is_developer_mode()
    assert api.get_l10n_field('CPF') is get_l10n_field('CPF')
Esempio n. 4
0
    def check_new_version(self):
        if api.is_developer_mode():
            return
        log.debug('Checking version')
        date = api.user_settings.get('last-version-check')
        if date:
            check_date = datetime.datetime.strptime(date, '%Y-%m-%d')
            diff = datetime.date.today() - check_date.date()
            if diff.days >= self.DAYS_BETWEEN_CHECKS:
                return self._download_details()
        else:
            return self._download_details()

        latest_version = api.user_settings.get('latest-version')
        if latest_version:
            self._check_details(latest_version)
Esempio n. 5
0
    def check_new_version(self):
        if api.is_developer_mode():
            return
        log.debug("Checking version")
        date = api.user_settings.get("last-version-check")
        if date:
            check_date = datetime.datetime.strptime(date, "%Y-%m-%d")
            diff = datetime.date.today() - check_date.date()
            if diff.days >= self.DAYS_BETWEEN_CHECKS:
                return self._download_details()
        else:
            return self._download_details()

        latest_version = api.user_settings.get("latest-version")
        if latest_version:
            self._check_details(latest_version)
Esempio n. 6
0
    def _launcher_ui_bootstrap(self):
        self._restore_window_size()
        self._update_toolbar_style()

        self.hide_app(empty=True)

        self._check_demo_mode()
        self._check_online_plugins()
        self._birthdays_bar = None
        self._check_client_birthdays()
        # json will restore tuples as lists. We need to convert them
        # to tuples or the comparison bellow won't work.
        actual_version = tuple(api.user_settings.get('actual-version', (0, )))
        if stoq.stoq_version > actual_version:
            api.user_settings.set('last-version-check', None)
            self._display_changelog_message()
            # Display the changelog message only once. Most users will never
            # click on the "See what's new" button, and that will affect its
            # visual identity.
            api.user_settings.set('actual-version', stoq.stoq_version)

        self._check_information()

        if not stoq.stable and not api.is_developer_mode():
            self._display_unstable_version_message()

        if not self.in_ui_test:
            # Initial fullscreen state for launcher must be handled
            # separate since the window is not realized when the state loading
            # is run in hide_app() the first time.
            window = self.get_toplevel()
            window.realize()
            self.ToggleFullscreen.set_active(
                self._app_settings.get('show-fullscreen', False))
            self.ToggleFullscreen.notify('active')

        toplevel = self.get_toplevel()
        toplevel.connect('configure-event', self._on_toplevel__configure)
        toplevel.connect('delete-event', self._on_toplevel__delete_event)
        toplevel.add_accel_group(self.uimanager.get_accel_group())

        # 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(toplevel)
Esempio n. 7
0
    def _launcher_ui_bootstrap(self):
        self._restore_window_size()
        self._update_toolbar_style()

        self.hide_app(empty=True)

        self._check_demo_mode()
        self._check_online_plugins()
        self._birthdays_bar = None
        self._check_client_birthdays()
        # json will restore tuples as lists. We need to convert them
        # to tuples or the comparison bellow won't work.
        actual_version = tuple(api.user_settings.get('actual-version', (0,)))
        if stoq.stoq_version > actual_version:
            api.user_settings.set('last-version-check', None)
            self._display_changelog_message()
            # Display the changelog message only once. Most users will never
            # click on the "See what's new" button, and that will affect its
            # visual identity.
            api.user_settings.set('actual-version', stoq.stoq_version)

        self._check_information()

        if not stoq.stable and not api.is_developer_mode():
            self._display_unstable_version_message()

        if not self.in_ui_test:
            # Initial fullscreen state for launcher must be handled
            # separate since the window is not realized when the state loading
            # is run in hide_app() the first time.
            window = self.get_toplevel()
            window.realize()
            self.ToggleFullscreen.set_active(
                self._app_settings.get('show-fullscreen', False))
            self.ToggleFullscreen.notify('active')

        toplevel = self.get_toplevel()
        toplevel.connect('configure-event', self._on_toplevel__configure)
        toplevel.connect('delete-event', self._on_toplevel__delete_event)
        toplevel.add_accel_group(self.uimanager.get_accel_group())

        # 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(toplevel)
Esempio n. 8
0
    def get_available_applications(self):
        user = api.get_current_user(self.store)

        permissions = user.profile.get_permissions()
        descriptions = get_utility(IApplicationDescriptions).get_descriptions()

        available_applications = []

        # sorting by app_full_name
        for name, full, icon, descr in locale_sorted(
                descriptions, key=operator.itemgetter(1)):
            # FIXME: The delivery app is still experimental. Remove this
            # once it is considered stable enough for our users
            if name == 'delivery' and not api.is_developer_mode():
                continue
            if permissions.get(name):
                available_applications.append(
                    Application(name, full, icon, descr))
        return available_applications
Esempio n. 9
0
    def _launcher_ui_bootstrap(self):
        self._restore_window_size()
        self._update_toolbar_style()

        self.hide_app(empty=True)

        self._check_demo_mode()

        # json will restore tuples as lists. We need to convert them
        # to tuples or the comparison bellow won't work.
        actual_version = tuple(api.user_settings.get("actual-version", (0,)))
        if stoq.stoq_version > actual_version:
            api.user_settings.set("last-version-check", None)
            self._display_changelog_message()

        if not stoq.stable and not api.is_developer_mode():
            self._display_unstable_version_message()

        if not self.in_ui_test:
            # Initial fullscreen state for launcher must be handled
            # separate since the window is not realized when the state loading
            # is run in hide_app() the first time.
            window = self.get_toplevel()
            window.realize()
            self.ToggleFullscreen.set_active(self._app_settings.get("show-fullscreen", False))
            self.ToggleFullscreen.notify("active")

        toplevel = self.get_toplevel()
        toplevel.connect("configure-event", self._on_toplevel__configure)
        toplevel.connect("delete-event", self._on_toplevel__delete_event)
        toplevel.add_accel_group(self.uimanager.get_accel_group())

        # 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(toplevel)