def prepare_scene(self):
        """ Called when doing the scene setup. """

        # Settings
        self.settings = Settings("org.semplicelinux.vera.settings")
        self.openboxsettings = Settings("org.semplicelinux.vera.openbox")

        self.scene_container = Gtk.Alignment()
        self.scene_container.set_padding(10, 10, 10, 10)

        self.container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,
                                 spacing=5)

        self.stack = Gtk.Stack()
        self.stack.set_homogeneous(False)
        self.stack.set_transition_type(
            Gtk.StackTransitionType.SLIDE_LEFT_RIGHT)
        self.stack_switcher = Gtk.StackSwitcher()
        self.stack_switcher.set_halign(Gtk.Align.CENTER)
        self.stack_switcher.set_stack(self.stack)

        self.container.pack_start(self.stack_switcher, False, False, 0)
        self.container.pack_start(self.stack, True, True, 0)

        # Gtk theme page
        self.stack.add_titled(GtkTheme(self.settings, self.openboxsettings),
                              "gtktheme", _("Theme"))
        self.stack.add_titled(Paranoid(self.settings), "paranoid",
                              _("Effects"))
        self.stack.add_titled(Fonts(self.settings, self.openboxsettings),
                              "font", _("Fonts"))

        self.scene_container.add(self.container)
        self.scene_container.show_all()
示例#2
0
    def __init__(self, gtksettings):
        """
		Initializes the page.
		"""

        super().__init__(orientation=Gtk.Orientation.VERTICAL)

        # Also connect to the compton settings
        comptonsettings = Settings("org.semplicelinux.vera.compton")

        desktop_effects_frame = DesktopEffectsFrame(gtksettings,
                                                    comptonsettings)
        shadow_frame = ShadowFrame(gtksettings, comptonsettings)
        fading_frame = FadingFrame(gtksettings, comptonsettings)
        transparency_frame = TransparencyFrame(gtksettings, comptonsettings)
        advanced_frame = AdvancedFrame(gtksettings, comptonsettings)

        self.pack_start(desktop_effects_frame, False, False, 2)
        self.pack_start(shadow_frame, False, False, 2)
        self.pack_start(fading_frame, False, False, 2)
        self.pack_start(transparency_frame, False, False, 2)
        self.pack_start(advanced_frame, False, False, 2)

        # Bind compton_enable to the sensitiveness of the compton related frames
        for frame in (shadow_frame, fading_frame, transparency_frame,
                      advanced_frame):
            desktop_effects_frame.compton_enabled.bind_property(
                "active", frame, "sensitive", GObject.BindingFlags.SYNC_CREATE)

        self.show_all()
示例#3
0
    def prepare_scene(self):
        """
		Scene set-up.
		"""

        self.scene_container = self.objects.main

        self.settings = Settings("org.semplicelinux.vera")
        self.desktop_settings = Settings("org.semplicelinux.vera.desktop")

        # Set-up actions combobox
        renderer = Gtk.CellRendererText()
        self.objects.last_exit_action.pack_start(renderer, True)
        self.objects.last_exit_action.add_attribute(renderer, "text", 0)
        self.settings.bind_with_convert("last-exit-action",
                                        self.objects.last_exit_action,
                                        "active",
                                        self.convert_exit_action_from_dconf,
                                        self.convert_exit_action_from_ui)

        # Confirmation window
        self.settings.bind("hide-exit-window", self.objects.hide_exit_window,
                           "active")

        # Ninja shortcut
        self.settings.bind("ninja-shortcut", self.objects.ninja_shortcut,
                           "active")

        # Ninja container
        self.objects.ninja_shortcut.bind_property("active",
                                                  self.objects.ninja_container,
                                                  "sensitive")

        # Desktop launcher
        self.desktop_settings.bind("show-launcher",
                                   self.objects.enable_launcher, "active")
示例#4
0
    def __init__(self, cancellable):
        """
		Initializes the class.
		"""

        super().__init__()

        self.settings = Settings("org.semplicelinux.vera")

        self.timeout_id = -1

        self.countdown = self.settings.get_int("exit-window-countdown")

        # The dialog may be unexpected, so if the countdown setting is < 10,
        # default to 10 to be on the safe side
        if self.countdown > 0 and self.countdown < 10:
            self.countdown = 10

        self.cancellable = cancellable

        self.bus = Gio.bus_get_sync(Gio.BusType.SESSION, self.cancellable)
        self.Vera = Gio.DBusProxy.new_sync(self.bus, 0, None,
                                           "org.semplicelinux.vera",
                                           "/org/semplicelinux/vera",
                                           "org.semplicelinux.vera",
                                           self.cancellable)

        self.set_title(_("Reboot"))
        self.set_modal(True)

        self.set_markup("<big>%s</big>" % _("Reboot required"))
        self.format_secondary_text(
            _("""In order to apply the changes, a reboot is required.

Please save your work and press "Reboot now" to reboot or press "Cancel" to reboot later."""
              ))

        self.add_buttons(
            _("_Cancel"), Gtk.ResponseType.CANCEL, self.REBOOT_NOW_STRING %
            self.countdown if self.countdown > 0 else _("_Reboot now"),
            Gtk.ResponseType.OK)

        self.set_default_response(Gtk.ResponseType.OK)

        self.connect("show", self.on_dialog_shown)
        self.connect("response", self.on_dialog_response)
    def prepare_scene(self):
        """ Called when doing the scene setup. """

        self.scene_container = self.objects.main

        self.objects.wallpapers.set_pixbuf_column(1)

        self.settings = Settings("org.semplicelinux.vera.desktop")
        self.openbox_settings = Settings("org.semplicelinux.vera.openbox")

        # Build monitor list
        self.monitor_number = Gdk.Screen.get_default().get_n_monitors()

        # Build monitor chooser
        self.monitor_model = Gtk.ListStore(str)
        self.objects.monitor_chooser.set_model(self.monitor_model)
        renderer = Gtk.CellRendererText()
        self.objects.monitor_chooser.pack_start(renderer, True)
        self.objects.monitor_chooser.add_attribute(renderer, "text", 0)

        # Current wallpaper
        self.settings.bind_with_convert(
            "image-path", self.properties, "current-wallpapers",
            lambda x: [(x[y] if y < len(x) else "")
                       for y in range(0, self.monitor_number)], lambda x: x)

        # Populate monitor model
        self.monitor_model.insert_with_valuesv(
            -1, [0], [_("All monitors")])  # "All monitors"
        for monitor in range(1, self.monitor_number + 1):
            self.monitor_model.insert_with_valuesv(
                -1, [0], [_("Monitor %d") % (monitor)])
        self.objects.monitor_chooser.set_active(0)
        self.objects.monitor_chooser.bind_property(
            "active", self.properties, "current-selected-monitor",
            GObject.BindingFlags.SYNC_CREATE)
        self.properties.connect("notify::current-selected-monitor",
                                self.on_current_selected_monitor_changed)

        if self.properties.current_wallpapers.count(
                "") == self.monitor_number - 1:
            # Probably we are in an "All monitors" situation
            # We do not use set_active() to avoid trigger an useless write action
            # to dconf.
            self.set_selection(self.properties.current_wallpapers[0])
        else:
            # Single monitor, default to Monitor 1
            self.objects.monitor_chooser.set_active(1)

        # Show it if we should
        if self.monitor_number > 1: self.objects.monitor_chooser.show()

        # Background color
        self.settings.bind_with_convert("background-color",
                                        self.objects.background_color, "rgba",
                                        lambda x: self.new_rgba_from_string(x),
                                        lambda x: x.to_string())

        # Background mode
        renderer = Gtk.CellRendererText()
        self.objects.background_mode.pack_start(renderer, True)
        self.objects.background_mode.add_attribute(renderer, "text", 1)
        self.settings.bind("background-mode", self.objects.background_mode,
                           "active_id")

        # Background random enabled?
        self.settings.bind("background-random-enabled",
                           self.objects.background_random_enabled, "active")

        # Background random timeout
        self.settings.bind("background-random-timeout",
                           self.objects.background_random_timeout, "value")

        # Ensure the random timeout spinbutton is insensitive if
        # the checkbutton is not active
        self.objects.background_random_enabled.bind_property(
            "active", self.objects.background_random_timeout_spin, "sensitive",
            GObject.BindingFlags.SYNC_CREATE)

        # Virtual desktops
        self.openbox_settings.bind("desktops-number",
                                   self.objects.virtual_desktops_spin, "value")

        # Prepare the "Add background" dialog...
        self.objects.add_background_window.add_buttons(_("_Cancel"),
                                                       Gtk.ResponseType.CANCEL,
                                                       _("_Open"),
                                                       Gtk.ResponseType.ACCEPT)
        self.objects.all_files.set_name(_("All Files"))
        self.objects.image_filter.set_name(_("Images"))
        self.objects.add_background_window.add_filter(
            self.objects.image_filter)
        self.objects.add_background_window.add_filter(self.objects.all_files)

        # Prepare the "About background" dialog...
        self.objects.about_background_dialog.add_buttons(
            _("_Close"), Gtk.ResponseType.CLOSE)

        self.objects.main.show_all()

        # Ensure the user doesn't change wallpaper while we are builing the list
        GObject.idle_add(self.objects.wallpapers.set_sensitive, False)

        self.populate_wallpapers()
    def __init__(self, settings):
        """
		Initializes the frame.
		"""

        super().__init__(name=_("Widgets"))

        # Settings
        self.settings = settings
        self.desktopsettings = Settings("org.semplicelinux.vera.desktop")

        # Container
        self.main_container = Gtk.Box(orientation=Gtk.Orientation.VERTICAL)

        # Combobox
        self.combobox_container = Gtk.Box(
            orientation=Gtk.Orientation.HORIZONTAL)
        self.combobox = Gtk.ComboBoxText()
        self.combobox_label = Gtk.Label(_("Theme"))
        self.combobox_label.set_alignment(0, 0.50)

        self.combobox_container.pack_start(self.combobox_label, True, True, 0)
        self.combobox_container.pack_start(self.combobox, False, False, 0)

        # Populate it and bind
        self.populate_themes()

        # Images in buttons
        self.button_images = Gtk.CheckButton(_("Show images in buttons"))
        self.settings.bind("button-images", self.button_images, "active")

        # Images in menus
        self.menu_images = Gtk.CheckButton(_("Show images in menus"))
        self.settings.bind("menu-images", self.menu_images, "active")

        # Vera color
        self.vera_color_enabled = Gtk.CheckButton(
            _("Use custom color for selected items (when supported)"))
        self.desktopsettings.bind("vera-color-enabled",
                                  self.vera_color_enabled, "active")

        # Vera color selection
        self.vera_color_selection = Gtk.Box(
            orientation=Gtk.Orientation.VERTICAL)
        self.vera_color_selection.set_margin_start(20)
        self.vera_color_enabled.bind_property("active",
                                              self.vera_color_selection,
                                              "sensitive",
                                              GObject.BindingFlags.SYNC_CREATE)
        self.vera_color_from_wallpaper = Gtk.RadioButton.new_with_label_from_widget(
            None, _("Pick color from the current wallpaper"))
        self.vera_color_manual_container = Gtk.Box(
            orientation=Gtk.Orientation.HORIZONTAL)
        self.vera_color_manual_color = Gtk.ColorButton()
        self.desktopsettings.bind_with_convert(
            "vera-color", self.vera_color_manual_color, "rgba",
            lambda x: self.new_rgba_from_string(x), lambda x: x.to_string())
        self.vera_color_manual_color.set_sensitive(True)
        self.vera_color_manual = Gtk.RadioButton.new_with_label_from_widget(
            self.vera_color_from_wallpaper, _("Use this color"))
        self.vera_color_manual.bind_property("active",
                                             self.vera_color_manual_color,
                                             "sensitive",
                                             GObject.BindingFlags.SYNC_CREATE)
        self.desktopsettings.bind("vera-color-lock", self.vera_color_manual,
                                  "active")
        self.vera_color_manual_container.pack_start(self.vera_color_manual,
                                                    True, True, 0)
        self.vera_color_manual_container.pack_start(
            self.vera_color_manual_color, False, False, 0)

        self.vera_color_selection.pack_start(self.vera_color_from_wallpaper,
                                             False, False, 0)
        self.vera_color_selection.pack_start(self.vera_color_manual_container,
                                             False, False, 2)

        self.main_container.pack_start(self.combobox_container, False, False,
                                       0)
        self.main_container.pack_start(self.button_images, False, False, 2)
        self.main_container.pack_start(self.menu_images, False, False, 2)
        self.main_container.pack_start(self.vera_color_enabled, False, False,
                                       2)
        self.main_container.pack_start(self.vera_color_selection, False, False,
                                       2)

        self.get_alignment().add(self.main_container)
from xdg.DesktopEntry import DesktopEntry

from veracc.utils import Settings

from veracc.widgets.ApplicationSelectionDialog import ApplicationSelectionDialog

# Search path for the applications.
#
# /usr/share/vera/autostart is taken out volountairly because it contains
# core applications that the user doesn't want to disable.
# You can still disable those by manually modifying the vera settings via
# e.g. dconf-editor.
SEARCH_PATH = ("/etc/xdg/autostart", os.path.expanduser("~/.config/autostart"))

# dconf settings
SETTINGS = Settings("org.semplicelinux.vera")

# Blacklist
BLACKLIST = SETTINGS.get_strv("autostart-ignore")


class ApplicationRow(Gtk.ListBoxRow):
    """
	An ApplicationRow is a modified Gtk.ListBoxRow that shows informations
	about an application to autostart.
	It permits to enable or disable the application via a Switch.
	
	--------------------------------------------------------------------
	|  ICON   Program name                                       ##ON  |
	--------------------------------------------------------------------
	"""