Beispiel #1
0
    def load(self, window):
        self.window = window

        self.spices = Spice_Harvester(self.collection_type, self.window)

        self.stack = SettingsStack()
        self.add_widget(self.stack)
        self.stack.expand = True

        manage_extensions_page = ManageDeskletsPage(self, self.spices,
                                                    self.window)
        self.stack.add_titled(manage_extensions_page, 'installed',
                              _("Manage desklets"))

        download_desklets_page = DownloadSpicesPage(self, self.collection_type,
                                                    self.spices, self.window)
        self.stack.add_titled(download_desklets_page, 'more',
                              _("Download desklets"))

        page = SettingsPage()
        self.stack.add_titled(page, 'general', _("General Settings"))

        settings = page.add_section(_("General Desklets Settings"))

        dec = [[0, _("No decoration")], [1, _("Border only")],
               [2, _("Border and header")]]
        widget = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)
        combo_box = GSettingsComboBox(_("Decoration of desklets"),
                                      "org.cinnamon",
                                      "desklet-decorations",
                                      dec,
                                      valtype="int")
        widget.pack_start(combo_box, False, False, 0)
        line1 = Gtk.Label()
        line1.set_markup("<i><small>%s</small></i>" % _(
            "Note: Some desklets require the border/header to be always present"
        ))
        line1.get_style_context().add_class("dim-label")
        widget.pack_start(line1, True, True, 0)
        line2 = Gtk.Label()
        line2.set_markup(
            "<i><small>%s</small></i>" %
            _("Such requirements override the settings selected here"))
        line2.get_style_context().add_class("dim-label")
        widget.pack_start(line2, True, True, 0)
        settings.add_row(widget)

        settings.add_row(
            GSettingsSwitch(_("Snap desklets to grid"), "org.cinnamon",
                            "desklet-snap"))
        settings.add_reveal_row(
            GSettingsSpinButton(_("Width of desklet snap grid"),
                                "org.cinnamon", "desklet-snap-interval", "", 0,
                                100, 1, 5), "org.cinnamon", "desklet-snap")
Beispiel #2
0
    def load(self, window):
        self.window = window

        self.spices = Spice_Harvester(self.collection_type, self.window)

        self.stack = SettingsStack()
        self.add_widget(self.stack)
        self.stack.expand = True

        manage_extensions_page = ManageAppletsPage(self, self.spices, window)
        self.stack.add_titled(manage_extensions_page, "installed", _("Manage"))

        download_applets_page = DownloadSpicesPage(self, self.collection_type, self.spices, window)
        self.stack.add_titled(download_applets_page, "more", _("Download"))
Beispiel #3
0
    def on_module_selected(self):
        if not self.loaded:
            print("Loading Themes module")

            self.spices = Spice_Harvester('theme', self.window)

            self.sidePage.stack = SettingsStack()
            self.sidePage.add_widget(self.sidePage.stack)

            self.settings = Gio.Settings.new("org.cinnamon.desktop.interface")
            self.wm_settings = Gio.Settings.new(
                "org.cinnamon.desktop.wm.preferences")
            self.cinnamon_settings = Gio.Settings.new("org.cinnamon.theme")

            self.scale = self.window.get_scale_factor()

            self.icon_chooser = self.create_button_chooser(
                self.settings,
                'icon-theme',
                'icons',
                'icons',
                button_picture_size=ICON_SIZE,
                menu_pictures_size=ICON_SIZE,
                num_cols=4)
            self.cursor_chooser = self.create_button_chooser(
                self.settings,
                'cursor-theme',
                'icons',
                'cursors',
                button_picture_size=32,
                menu_pictures_size=32,
                num_cols=4)
            self.theme_chooser = self.create_button_chooser(
                self.settings,
                'gtk-theme',
                'themes',
                'gtk-3.0',
                button_picture_size=35,
                menu_pictures_size=35,
                num_cols=4)
            self.metacity_chooser = self.create_button_chooser(
                self.wm_settings,
                'theme',
                'themes',
                'metacity-1',
                button_picture_size=32,
                menu_pictures_size=32,
                num_cols=4)
            self.cinnamon_chooser = self.create_button_chooser(
                self.cinnamon_settings,
                'name',
                'themes',
                'cinnamon',
                button_picture_size=60,
                menu_pictures_size=60 * self.scale,
                num_cols=4)

            page = SettingsPage()
            self.sidePage.stack.add_titled(page, "themes", _("Themes"))

            settings = page.add_section(_("Themes"))

            widget = self.make_group(_("Window borders"),
                                     self.metacity_chooser)
            settings.add_row(widget)

            widget = self.make_group(_("Icons"), self.icon_chooser)
            settings.add_row(widget)

            widget = self.make_group(_("Controls"), self.theme_chooser)
            settings.add_row(widget)

            widget = self.make_group(_("Mouse Pointer"), self.cursor_chooser)
            settings.add_row(widget)

            widget = self.make_group(_("Desktop"), self.cinnamon_chooser)
            settings.add_row(widget)

            page = DownloadSpicesPage(self, 'theme', self.spices, self.window)
            self.sidePage.stack.add_titled(page, 'download', _("Add/Remove"))

            page = SettingsPage()
            self.sidePage.stack.add_titled(page, "options", _("Settings"))

            settings = page.add_section(_("Miscellaneous options"))

            widget = GSettingsSwitch(
                _("Show icons in menus"),
                "org.cinnamon.settings-daemon.plugins.xsettings",
                "menus-have-icons")
            settings.add_row(widget)

            widget = GSettingsSwitch(
                _("Show icons on buttons"),
                "org.cinnamon.settings-daemon.plugins.xsettings",
                "buttons-have-icons")
            settings.add_row(widget)

            settings = page.add_section(_("Scrollbar behavior"))

            # Translators: The 'trough' is the part of the scrollbar that the 'handle'
            # rides in.  This setting determines whether clicking in that trough somewhere
            # jumps directly to the new position, or if it only scrolls towards it.
            switch = GtkSettingsSwitch(
                _("Jump to position when clicking in a trough"),
                "gtk-primary-button-warps-slider")
            settings.add_row(switch)

            widget = GSettingsSwitch(_("Use overlay scroll bars"),
                                     "org.cinnamon.desktop.interface",
                                     "gtk-overlay-scrollbars")
            settings.add_row(widget)

            self.gtk2_scrollbar_editor = Gtk2ScrollbarSizeEditor(
                widget.get_scale_factor())

            switch = CssOverrideSwitch(
                _("Override the current theme's scrollbar width"))
            settings.add_row(switch)
            self.scrollbar_switch = switch.content_widget

            widget = CssRange(_("Scrollbar width"), "scrollbar slider",
                              ["min-width", "min-height"], 2, 40, "px", None,
                              switch)
            settings.add_reveal_row(widget)
            widget.sync_initial_switch_state()
            self.scrollbar_css_range = widget.content_widget
            self.scrollbar_css_range.get_adjustment().set_page_increment(2.0)

            switch.content_widget.connect("notify::active",
                                          self.on_css_override_active_changed)
            widget.content_widget.connect("value-changed",
                                          self.on_range_slider_value_changed)

            self.on_css_override_active_changed(switch)

            widget = PreviewWidget()
            settings.add_row(widget)

            label_widget = LabelRow(
                _("""Changes will take effect the next time you log in and may not affect all applications."""
                  ))
            settings.add_row(label_widget)

            self.builder = self.sidePage.builder

            for path in [
                    os.path.expanduser("~/.themes"),
                    os.path.expanduser("~/.icons")
            ]:
                try:
                    os.makedirs(path)
                except OSError:
                    pass

            self.monitors = []
            for path in [
                    os.path.expanduser("~/.themes"), "/usr/share/themes",
                    os.path.expanduser("~/.icons"), "/usr/share/icons"
            ]:
                if os.path.exists(path):
                    file_obj = Gio.File.new_for_path(path)
                    try:
                        file_monitor = file_obj.monitor_directory(
                            Gio.FileMonitorFlags.SEND_MOVED, None)
                        file_monitor.connect("changed", self.on_file_changed)
                        self.monitors.append(file_monitor)
                    except Exception as e:
                        # File monitors can fail when the OS runs out of file handles
                        print(e)

            self.refresh()
Beispiel #4
0
    def on_module_selected(self):
        if not self.loaded:
            print("Loading Themes module")

            self.spices = SU_Spice_Harvester('theme', self.window)

            self.sidePage.stack = SettingsStack()
            self.sidePage.add_widget(self.sidePage.stack)

            self.settings = Gio.Settings.new("org.cinnamon.desktop.interface")
            self.wm_settings = Gio.Settings.new(
                "org.cinnamon.desktop.wm.preferences")
            self.cinnamon_settings = Gio.Settings.new("org.cinnamon.theme")

            self.icon_chooser = self.create_button_chooser(
                self.settings,
                'icon-theme',
                'icons',
                'icons',
                button_picture_size=ICON_SIZE,
                menu_pictures_size=ICON_SIZE,
                num_cols=4)
            self.cursor_chooser = self.create_button_chooser(
                self.settings,
                'cursor-theme',
                'icons',
                'cursors',
                button_picture_size=32,
                menu_pictures_size=32,
                num_cols=4)
            self.theme_chooser = self.create_button_chooser(
                self.settings,
                'gtk-theme',
                'themes',
                'gtk-3.0',
                button_picture_size=35,
                menu_pictures_size=35,
                num_cols=4)
            self.metacity_chooser = self.create_button_chooser(
                self.wm_settings,
                'theme',
                'themes',
                'metacity-1',
                button_picture_size=32,
                menu_pictures_size=32,
                num_cols=4)
            self.cinnamon_chooser = self.create_button_chooser(
                self.cinnamon_settings,
                'name',
                'themes',
                'cinnamon',
                button_picture_size=60,
                menu_pictures_size=60,
                num_cols=4)

            page = SettingsPage()
            self.sidePage.stack.add_titled(page, "themes", _("Themes"))

            settings = page.add_section(_("Themes"))

            widget = self.make_group(_("Window borders"),
                                     self.metacity_chooser)
            settings.add_row(widget)

            widget = self.make_group(_("Icons"), self.icon_chooser)
            settings.add_row(widget)

            widget = self.make_group(_("Controls"), self.theme_chooser)
            settings.add_row(widget)

            widget = self.make_group(_("Mouse Pointer"), self.cursor_chooser)
            settings.add_row(widget)

            widget = self.make_group(_("Desktop"), self.cinnamon_chooser)
            settings.add_row(widget)

            page = DownloadSpicesPage(self, 'theme', self.spices, self.window)
            self.sidePage.stack.add_titled(page, 'download', _("Add/Remove"))

            page = SettingsPage()
            self.sidePage.stack.add_titled(page, "options", _("Settings"))

            settings = page.add_section(_("Miscellaneous options"))

            widget = GSettingsSwitch(
                _("Show icons in menus"),
                "org.cinnamon.settings-daemon.plugins.xsettings",
                "menus-have-icons")
            settings.add_row(widget)

            widget = GSettingsSwitch(
                _("Show icons on buttons"),
                "org.cinnamon.settings-daemon.plugins.xsettings",
                "buttons-have-icons")
            settings.add_row(widget)

            self.builder = self.sidePage.builder

            for path in [
                    os.path.expanduser("~/.themes"),
                    os.path.expanduser("~/.icons")
            ]:
                try:
                    os.makedirs(path)
                except OSError:
                    pass

            self.monitors = []
            for path in [
                    os.path.expanduser("~/.themes"), "/usr/share/themes",
                    os.path.expanduser("~/.icons"), "/usr/share/icons"
            ]:
                if os.path.exists(path):
                    file_obj = Gio.File.new_for_path(path)
                    try:
                        file_monitor = file_obj.monitor_directory(
                            Gio.FileMonitorFlags.SEND_MOVED, None)
                        file_monitor.connect("changed", self.on_file_changed)
                        self.monitors.append(file_monitor)
                    except Exception as e:
                        # File monitors can fail when the OS runs out of file handles
                        print(e)

            self.refresh()
Beispiel #5
0
    def on_module_selected(self):
        if not self.loaded:
            print "Loading Themes module"

            self.spices = Spice_Harvester('theme', self.window)

            self.sidePage.stack = SettingsStack()
            self.sidePage.add_widget(self.sidePage.stack)

            self.settings = Gio.Settings.new("org.cinnamon.desktop.interface")
            self.wm_settings = Gio.Settings.new(
                "org.cinnamon.desktop.wm.preferences")
            self.cinnamon_settings = Gio.Settings.new("org.cinnamon.theme")

            self.icon_chooser = self.create_button_chooser(
                self.settings,
                'icon-theme',
                'icons',
                'icons',
                button_picture_size=ICON_SIZE,
                menu_pictures_size=ICON_SIZE,
                num_cols=4)
            self.cursor_chooser = self.create_button_chooser(
                self.settings,
                'cursor-theme',
                'icons',
                'cursors',
                button_picture_size=32,
                menu_pictures_size=32,
                num_cols=4)
            self.theme_chooser = self.create_button_chooser(
                self.settings,
                'gtk-theme',
                'themes',
                'gtk-3.0',
                button_picture_size=35,
                menu_pictures_size=35,
                num_cols=4)
            self.metacity_chooser = self.create_button_chooser(
                self.wm_settings,
                'theme',
                'themes',
                'metacity-1',
                button_picture_size=32,
                menu_pictures_size=32,
                num_cols=4)
            self.cinnamon_chooser = self.create_button_chooser(
                self.cinnamon_settings,
                'name',
                'themes',
                'cinnamon',
                button_picture_size=60,
                menu_pictures_size=60,
                num_cols=4)

            page = SettingsPage()
            self.sidePage.stack.add_titled(page, "themes", _("Themes"))

            settings = page.add_section(_("Themes"))

            widget = self.make_group(_("Window borders"),
                                     self.metacity_chooser)
            settings.add_row(widget)

            widget = self.make_group(_("Icons"), self.icon_chooser)
            settings.add_row(widget)

            widget = self.make_group(_("Controls"), self.theme_chooser)
            settings.add_row(widget)

            widget = self.make_group(_("Mouse Pointer"), self.cursor_chooser)
            settings.add_row(widget)

            widget = self.make_group(_("Desktop"), self.cinnamon_chooser)
            settings.add_row(widget)

            page = DownloadSpicesPage(self, 'theme', self.spices, self.window)
            self.sidePage.stack.add_titled(page, 'download', _("Add/Remove"))

            page = SettingsPage()
            self.sidePage.stack.add_titled(page, "options", _("Settings"))

            settings = page.add_section(_("Miscellaneous options"))

            widget = GSettingsSwitch(
                _("Show icons in menus"),
                "org.cinnamon.settings-daemon.plugins.xsettings",
                "menus-have-icons")
            settings.add_row(widget)

            widget = GSettingsSwitch(
                _("Show icons on buttons"),
                "org.cinnamon.settings-daemon.plugins.xsettings",
                "buttons-have-icons")
            settings.add_row(widget)

            dark_text = _(
                "Use a dark theme variant when available in certain applications"
            )
            dark_italic = _(
                "(Applications must be restarted for this change to take effect)"
            )

            widget = GtkSettingsSwitch(
                "%s\n<i><small>%s</small></i>" % (dark_text, dark_italic),
                "gtk-application-prefer-dark-theme")
            settings.add_row(widget)

            self.builder = self.sidePage.builder

            for path in [
                    os.path.expanduser("~/.themes"),
                    os.path.expanduser("~/.icons")
            ]:
                try:
                    os.makedirs(path)
                except OSError:
                    pass

            self.monitors = []
            for path in [
                    os.path.expanduser("~/.themes"), "/usr/share/themes",
                    os.path.expanduser("~/.icons"), "/usr/share/icons"
            ]:
                if os.path.exists(path):
                    file_obj = Gio.File.new_for_path(path)
                    file_monitor = file_obj.monitor_directory(
                        Gio.FileMonitorFlags.SEND_MOVED, None)
                    file_monitor.connect("changed", self.on_file_changed)
                    self.monitors.append(file_monitor)

            self.refresh()