Ejemplo n.º 1
0
 def __init__(self, parent, gconf_client, gconf_key):
     self._gconf_client = gconf_client
     self._gconf_key = gconf_key
     self._visible_options = None
     
     self._widget_tree = gtk.Builder()
     self._widget_tree.add_from_file(os.path.join(os.path.dirname(__file__), "weather.ui"))
     
     dialog = self._widget_tree.get_object("WeatherDialog")
     dialog.set_transient_for(parent)
     
     self._source = self._widget_tree.get_object("Source")
     self._source.connect("changed", self._load_options_for_source)
     
     self._sources_model = self._widget_tree.get_object("SourcesModel")
     for b in get_available_backends():
         l = [b, get_backend(b).backend_name ]
         self._sources_model.append(l)
     g15uigconf.configure_combo_from_gconf(gconf_client, "%s/source" % gconf_key, "Source", self._sources_model[0][0] if len(self._sources_model) > 0 else None, self._widget_tree)
     self._load_options_for_source()
     
     update = self._widget_tree.get_object("UpdateAdjustment")
     update.set_value(g15gconf.get_int_or_default(gconf_client, gconf_key + "/update", DEFAULT_UPDATE_INTERVAL))
     update.connect("value-changed", self._value_changed, update, gconf_key + "/update")
     
     unit = self._widget_tree.get_object("UnitCombo")
     unit.set_active(gconf_client.get_int(gconf_key + "/units"))
     unit.connect("changed", self._unit_changed, unit, gconf_key + "/units")
     
     g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/use_theme_icons" % gconf_key, "UseThemeIcons", True, self._widget_tree)
     g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/twenty_four_hour_times" % gconf_key, "TwentyFourHourTimes", True, self._widget_tree)
     
     dialog.run()
     dialog.hide()
Ejemplo n.º 2
0
def show_preferences(parent, driver, gconf_client, gconf_key):
    widget_tree = gtk.Builder()
    widget_tree.add_from_file(os.path.join(os.path.dirname(__file__), "trafficstats.ui"))
    dialog = widget_tree.get_object("TrafficStats")

    # Resets the value of the use_vnstat flag if vnstat is not installed
    vnstat_installed = g15os.is_program_in_path('vnstat')
    if not vnstat_installed:
        gconf_client.set_bool("%s/use_vnstat" % gconf_key, False)

    # Displays a warning message to the user if vnstat is not installed
    warning = widget_tree.get_object("NoVnstatMessage")
    warning.set_visible(not vnstat_installed)

    # Disables the vnstat checkbox if vnstat is not installed
    use_vnstat = widget_tree.get_object('UseVnstat')
    use_vnstat.set_sensitive(vnstat_installed)

    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/use_vnstat", "UseVnstat", vnstat_installed, widget_tree)
    ndevice = widget_tree.get_object("NetDevice")
    for netdev in gtop.netlist():
        ndevice.append([netdev])
    g15uigconf.configure_combo_from_gconf(gconf_client, gconf_key + "/networkdevice", "NetworkDevice", "lo", widget_tree)
    g15uigconf.configure_adjustment_from_gconf(gconf_client, gconf_key + "/refresh_interval", "RefreshingScale", 10.0, widget_tree)
    dialog.set_transient_for(parent)
    dialog.run()
    dialog.hide()
Ejemplo n.º 3
0
    def __init__(self, parent, driver, gconf_client, gconf_key):

        widget_tree = gtk.Builder()
        widget_tree.add_from_file(os.path.join(os.path.dirname(__file__), "background.ui"))

        self.gconf_client = gconf_client
        self.gconf_key = gconf_key

        # Widgets
        dialog = widget_tree.get_object("BackgroundDialog")
        dialog.set_transient_for(parent)
        g15uigconf.configure_radio_from_gconf(gconf_client, gconf_key + "/type", ["UseDesktop", "UseFile"],
                                              ["desktop", "file"], "desktop", widget_tree, True)
        g15uigconf.configure_combo_from_gconf(gconf_client, gconf_key + "/style", "StyleCombo", "zoom", widget_tree)
        widget_tree.get_object("UseDesktop").connect("toggled", self.set_available, widget_tree)
        widget_tree.get_object("UseFile").connect("toggled", self.set_available, widget_tree)
        g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/allow_profile_override",
                                                 "AllowProfileOverride", True, widget_tree)
        g15uigconf.configure_adjustment_from_gconf(gconf_client, gconf_key + "/brightness", "BrightnessAdjustment", 50,
                                                   widget_tree)

        # Currently, only GNOME is supported for getting the desktop background
        if g15desktop.get_desktop() in ["gnome", "gnome-shell"]:
            widget_tree.get_object("UseFile").set_active(True)

        # The file chooser
        chooser = gtk.FileChooserDialog("Open..",
                                        None,
                                        gtk.FILE_CHOOSER_ACTION_OPEN,
                                        (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                         gtk.STOCK_OPEN, gtk.RESPONSE_OK))
        chooser.set_default_response(gtk.RESPONSE_OK)

        filter = gtk.FileFilter()
        filter.set_name("Images")
        filter.add_mime_type("image/png")
        filter.add_mime_type("image/jpeg")
        filter.add_mime_type("image/gif")
        filter.add_pattern("*.png")
        filter.add_pattern("*.jpg")
        filter.add_pattern("*.jpeg")
        filter.add_pattern("*.gif")
        chooser.add_filter(filter)

        filter = gtk.FileFilter()
        filter.set_name("All files")
        filter.add_pattern("*")
        chooser.add_filter(filter)

        chooser_button = widget_tree.get_object("FileChooserButton")
        chooser_button.dialog = chooser
        chooser_button.connect("file-set", self.file_set)
        widget_tree.connect_signals(self)
        bg_img = gconf_client.get_string(gconf_key + "/path")
        if bg_img is None:
            bg_img = ""
        chooser_button.set_filename(bg_img)
        self.set_available(None, widget_tree)
        dialog.run()
        dialog.hide()
Ejemplo n.º 4
0
    def __init__(self, device, parent, gconf_client):
        self.gconf_client = gconf_client
        self.device = device

        g15locale.get_translation("driver_g15direct")
        widget_tree = gtk.Builder()
        widget_tree.set_translation_domain("driver_g15direct")
        widget_tree.add_from_file(
            os.path.join(g15globals.ui_dir, "driver_g15direct.ui"))
        self.window = widget_tree.get_object("G15DirectDriverSettings")
        self.window.set_transient_for(parent)

        g15uigconf.configure_spinner_from_gconf(
            gconf_client, "/apps/gnome15/%s/timeout" % device.uid, "Timeout",
            10000, widget_tree, False)
        if not device.model_id == g15driver.MODEL_G13:
            widget_tree.get_object("JoyModeCombo").destroy()
            widget_tree.get_object("JoyModeLabel").destroy()
            widget_tree.get_object("Offset").destroy()
            widget_tree.get_object("OffsetLabel").destroy()
            widget_tree.get_object("OffsetDescription").destroy()
        else:
            g15uigconf.configure_combo_from_gconf(
                gconf_client, "/apps/gnome15/%s/joymode" % device.uid,
                "JoyModeCombo", "macro", widget_tree)
            # We have separate offset values for digital / analogue,
            # so swap between them based on configuration
            self.offset_widget = widget_tree.get_object("Offset")
            self._set_offset_depending_on_mode(None)
            widget_tree.get_object("JoyModeCombo").connect(
                "changed", self._set_offset_depending_on_mode)
            self.offset_widget.connect("value-changed", self._spinner_changed)
Ejemplo n.º 5
0
Archivo: fx.py Proyecto: FPar/gnome15
def show_preferences(parent, driver, gconf_client, gconf_key):
    widget_tree = gtk.Builder()
    widget_tree.add_from_file(os.path.join(os.path.dirname(__file__), "fx.ui"))
    dialog = widget_tree.get_object("FxDialog")
    dialog.set_transient_for(parent)    
    g15uigconf.configure_combo_from_gconf(gconf_client, gconf_key + "/transition_effect", "TransitionCombo", "random", widget_tree)
    g15uigconf.configure_adjustment_from_gconf(gconf_client, gconf_key + "/anim_speed", "AnimationSpeedAdjustment", 5.0, widget_tree)
    dialog.run()
    dialog.hide()
Ejemplo n.º 6
0
 def __init__(self, parent, driver, gconf_client, gconf_key):
     
     widget_tree = gtk.Builder()
     widget_tree.add_from_file(os.path.join(os.path.dirname(__file__), "background.ui"))
     
     self.gconf_client = gconf_client
     self.gconf_key = gconf_key
     
     # Widgets
     dialog = widget_tree.get_object("BackgroundDialog")
     dialog.set_transient_for(parent)        
     g15uigconf.configure_radio_from_gconf(gconf_client, gconf_key + "/type", [ "UseDesktop", "UseFile" ], [ "desktop", "file" ], "desktop", widget_tree, True)
     g15uigconf.configure_combo_from_gconf(gconf_client, gconf_key + "/style", "StyleCombo", "zoom", widget_tree)
     widget_tree.get_object("UseDesktop").connect("toggled", self.set_available, widget_tree)
     widget_tree.get_object("UseFile").connect("toggled", self.set_available, widget_tree)
     g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/allow_profile_override", "AllowProfileOverride", True, widget_tree)
     g15uigconf.configure_adjustment_from_gconf(gconf_client, gconf_key + "/brightness", "BrightnessAdjustment", 50, widget_tree)
     
     # Currently, only GNOME is supported for getting the desktop background
     if g15desktop.get_desktop() in [ "gnome", "gnome-shell" ]:
         widget_tree.get_object("UseFile").set_active(True)
     
     # The file chooser
     chooser = gtk.FileChooserDialog("Open..",
                            None,
                            gtk.FILE_CHOOSER_ACTION_OPEN,
                            (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                             gtk.STOCK_OPEN, gtk.RESPONSE_OK))
     chooser.set_default_response(gtk.RESPONSE_OK)
     
     filter = gtk.FileFilter()
     filter.set_name("Images")
     filter.add_mime_type("image/png")
     filter.add_mime_type("image/jpeg")
     filter.add_mime_type("image/gif")
     filter.add_pattern("*.png")
     filter.add_pattern("*.jpg")
     filter.add_pattern("*.jpeg")
     filter.add_pattern("*.gif")
     chooser.add_filter(filter)
     
     filter = gtk.FileFilter()
     filter.set_name("All files")
     filter.add_pattern("*")
     chooser.add_filter(filter)
     
     chooser_button = widget_tree.get_object("FileChooserButton")        
     chooser_button.dialog = chooser        
     chooser_button.connect("file-set", self.file_set)
     widget_tree.connect_signals(self)
     bg_img = gconf_client.get_string(gconf_key + "/path")
     if bg_img == None:
         bg_img = ""
     chooser_button.set_filename(bg_img)
     self.set_available(None, widget_tree)
     dialog.run()
     dialog.hide()
Ejemplo n.º 7
0
def show_preferences(parent, driver, gconf_client, gconf_key):
    widget_tree = gtk.Builder()
    widget_tree.add_from_file(os.path.join(os.path.dirname(__file__), "panel.ui"))
    dialog = widget_tree.get_object("PanelDialog")
    dialog.set_transient_for(parent)
    g15uigconf.configure_adjustment_from_gconf(gconf_client, gconf_key + "/size", "SizeAdjustment", 24, widget_tree)
    g15uigconf.configure_combo_from_gconf(gconf_client, gconf_key + "/position", "PositionCombo", "bottom", widget_tree)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/stretch", "Stretch", False, widget_tree)
    g15uigconf.configure_colorchooser_from_gconf(gconf_client, gconf_key + "/color", "Color", ( 128, 128, 128 ), widget_tree, default_alpha = 128)
    dialog.run()
    dialog.hide()
Ejemplo n.º 8
0
def show_preferences(parent, driver, gconf_client, gconf_key):
    widget_tree = Gtk.Builder()
    widget_tree.add_from_file(os.path.join(os.path.dirname(__file__), "panel.ui"))
    dialog = widget_tree.get_object("PanelDialog")
    dialog.set_transient_for(parent)
    g15uigconf.configure_adjustment_from_gconf(gconf_client, gconf_key + "/size", "SizeAdjustment", 24, widget_tree)
    g15uigconf.configure_combo_from_gconf(gconf_client, gconf_key + "/position", "PositionCombo", "bottom", widget_tree)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/stretch", "Stretch", False, widget_tree)
    g15uigconf.configure_colorchooser_from_gconf(gconf_client, gconf_key + "/color", "Color", ( 128, 128, 128 ), widget_tree, default_alpha = 128)
    dialog.run()
    dialog.hide()
Ejemplo n.º 9
0
def show_preferences(parent, driver, gconf_client, gconf_key):
    def refresh_devices(widget):
        new_soundcard_name = soundcard_model[widget.get_active()][0]
        new_soundcard_index = alsa_soundcards.index(new_soundcard_name)
        '''
        We temporarily block the handler for the mixer_combo 'changed' signal, since we are going
        to change the combobox contents.
        '''
        mixer_combo.handler_block(changed_handler_id)
        mixer_model.clear()
        for mixer in alsaaudio.mixers(new_soundcard_index):
            mixer_model.append([mixer])
        # Now we can unblock the handler
        mixer_combo.handler_unblock(changed_handler_id)
        # And since the list of mixers has changed, we select the first one by default
        mixer_combo.set_active(0)

    widget_tree = gtk.Builder()
    widget_tree.add_from_file(
        os.path.join(os.path.dirname(__file__), "volume.ui"))
    dialog = widget_tree.get_object("VolumeDialog")
    soundcard_combo = widget_tree.get_object('SoundcardCombo')
    mixer_combo = widget_tree.get_object('MixerCombo')
    soundcard_model = widget_tree.get_object("SoundcardModel")
    mixer_model = widget_tree.get_object("MixerModel")
    alsa_soundcards = alsaaudio.cards()
    soundcard_name = g15gconf.get_string_or_default(gconf_client,
                                                    gconf_key + "/soundcard",
                                                    str(alsa_soundcards[0]))
    soundcard_index = alsa_soundcards.index(soundcard_name)
    soundcard_mixers = alsaaudio.mixers(soundcard_index)

    for card in alsa_soundcards:
        soundcard_model.append([card])
    for mixer in soundcard_mixers:
        mixer_model.append([mixer])

    g15uigconf.configure_combo_from_gconf(gconf_client, \
                                          gconf_key + "/soundcard", \
                                          "SoundcardCombo", \
                                          str(alsa_soundcards[0]), \
                                          widget_tree)

    changed_handler_id = g15uigconf.configure_combo_from_gconf(gconf_client, \
                                                               gconf_key + "/mixer", \
                                                               "MixerCombo", \
                                                                str(soundcard_mixers[0]), \
                                                                widget_tree)
    soundcard_combo.connect('changed', refresh_devices)

    dialog.set_transient_for(parent)
    dialog.run()
    dialog.hide()
Ejemplo n.º 10
0
    def __init__(self, parent, driver, gconf_client, gconf_key):
        self.gconf_client = gconf_client
        self.gconf_key = gconf_key
        widget_tree = gtk.Builder()
        widget_tree.add_from_file(
            os.path.join(os.path.dirname(__file__), "lcdshot.ui"))
        dialog = widget_tree.get_object("LCDShotDialog")
        dialog.set_transient_for(parent)
        chooser = gtk.FileChooserDialog("Open..", None,
                                        gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
                                        (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                         gtk.STOCK_OPEN, gtk.RESPONSE_OK))
        chooser.set_default_response(gtk.RESPONSE_OK)
        chooser_button = widget_tree.get_object("FileChooserButton")
        chooser_button.dialog = chooser
        chooser_button.connect("file-set", self._file_set)
        chooser_button.connect("file-activated", self._file_activated)
        chooser_button.connect("current-folder-changed", self._file_activated)
        bg_img = g15gconf.get_string_or_default(
            self.gconf_client, "%s/folder" % self.gconf_key,
            os.path.expanduser("~/Desktop"))
        chooser_button.set_current_folder(bg_img)

        # Reset the value of the mode setting to 'still' if mencoder is not installed
        mencoder_is_installed = g15os.is_program_in_path('mencoder')
        if not mencoder_is_installed:
            gconf_client.set_string("%s/mode" % self.gconf_key, "still")

        # Initialize the mode combobox content
        modes = widget_tree.get_object("ModeModel")
        modes.clear()
        modes.append(('still', 'Still', True))
        modes.append(('video', 'Video', mencoder_is_installed))

        # Display a warning message to the user if mencoder is not installed
        warning = widget_tree.get_object("NoVideoMessage")
        warning.set_visible(not mencoder_is_installed)

        g15uigconf.configure_combo_from_gconf(self.gconf_client,
                                              "%s/mode" % self.gconf_key,
                                              "Mode", "still", widget_tree)
        mode = widget_tree.get_object("Mode")
        mode.connect("changed", self._mode_changed)

        g15uigconf.configure_spinner_from_gconf(self.gconf_client,
                                                "%s/fps" % gconf_key, "FPS",
                                                10, widget_tree, False)
        self._spinner = widget_tree.get_object("FPS")
        self._mode_changed(mode)

        dialog.run()
        dialog.hide()
Ejemplo n.º 11
0
def show_preferences(parent, driver, gconf_client, gconf_key):
    def refresh_devices(widget):
        new_soundcard_name = soundcard_model[widget.get_active()][0]
        new_soundcard_index = alsa_soundcards.index(new_soundcard_name)
        '''
        We temporarily block the handler for the mixer_combo 'changed' signal, since we are going
        to change the combobox contents.
        '''
        mixer_combo.handler_block(changed_handler_id)
        mixer_model.clear()
        for mixer in alsaaudio.mixers(new_soundcard_index):
            mixer_model.append([mixer])
        # Now we can unblock the handler
        mixer_combo.handler_unblock(changed_handler_id)
        # And since the list of mixers has changed, we select the first one by default
        mixer_combo.set_active(0)

    widget_tree = gtk.Builder()
    widget_tree.add_from_file(os.path.join(os.path.dirname(__file__), "volume.ui"))
    dialog = widget_tree.get_object("VolumeDialog") 
    soundcard_combo = widget_tree.get_object('SoundcardCombo')
    mixer_combo = widget_tree.get_object('MixerCombo')
    soundcard_model = widget_tree.get_object("SoundcardModel")
    mixer_model = widget_tree.get_object("MixerModel")
    alsa_soundcards = alsaaudio.cards()
    soundcard_name = g15gconf.get_string_or_default(gconf_client,
                                                    gconf_key + "/soundcard",
                                                    str(alsa_soundcards[0]))
    soundcard_index = alsa_soundcards.index(soundcard_name)
    soundcard_mixers = alsaaudio.mixers(soundcard_index)

    for card in alsa_soundcards:
        soundcard_model.append([card])
    for mixer in soundcard_mixers:
        mixer_model.append([mixer])

    g15uigconf.configure_combo_from_gconf(gconf_client, \
                                          gconf_key + "/soundcard", \
                                          "SoundcardCombo", \
                                          str(alsa_soundcards[0]), \
                                          widget_tree)

    changed_handler_id = g15uigconf.configure_combo_from_gconf(gconf_client, \
                                                               gconf_key + "/mixer", \
                                                               "MixerCombo", \
                                                                str(soundcard_mixers[0]), \
                                                                widget_tree)
    soundcard_combo.connect('changed', refresh_devices)

    dialog.set_transient_for(parent)
    dialog.run()
    dialog.hide()
Ejemplo n.º 12
0
def show_preferences(parent, driver, gconf_client, gconf_key):
    widget_tree = Gtk.Builder()
    widget_tree.add_from_file(os.path.join(os.path.dirname(__file__), "fx.ui"))
    dialog = widget_tree.get_object("FxDialog")
    dialog.set_transient_for(parent)
    g15uigconf.configure_combo_from_gconf(gconf_client,
                                          gconf_key + "/transition_effect",
                                          "TransitionCombo", "random",
                                          widget_tree)
    g15uigconf.configure_adjustment_from_gconf(gconf_client,
                                               gconf_key + "/anim_speed",
                                               "AnimationSpeedAdjustment", 5.0,
                                               widget_tree)
    dialog.run()
    dialog.hide()
Ejemplo n.º 13
0
    def __init__(self, device, parent, gconf_client):
        g15locale.get_translation("driver_gtk")
        widget_tree = gtk.Builder()
        widget_tree.set_translation_domain("driver_gtk")
        widget_tree.add_from_file(
            os.path.join(g15globals.ui_dir, "driver_gtk.ui"))
        self.window = widget_tree.get_object("GtkDriverSettings")
        self.window.set_transient_for(parent)

        mode_model = widget_tree.get_object("ModeModel")
        mode_model.clear()
        for mode in g15driver.MODELS:
            mode_model.append([mode])
        g15uigconf.configure_combo_from_gconf(
            gconf_client, "/apps/gnome15/%s/gtk_mode" % device.uid,
            "ModeCombo", g15driver.MODEL_G19, widget_tree)
Ejemplo n.º 14
0
    def __init__(self, device, parent, gconf_client):
        g15locale.get_translation("driver_gtk")
        widget_tree = gtk.Builder()
        widget_tree.set_translation_domain("driver_gtk")
        widget_tree.add_from_file(os.path.join(g15globals.ui_dir, "driver_gtk.ui"))
        self.window = widget_tree.get_object("GtkDriverSettings")
        self.window.set_transient_for(parent)

        mode_model = widget_tree.get_object("ModeModel")
        mode_model.clear()
        for mode in g15driver.MODELS:
            mode_model.append([mode])
        g15uigconf.configure_combo_from_gconf(gconf_client,
                                              "/apps/gnome15/%s/gtk_mode" % device.uid,
                                              "ModeCombo",
                                              g15driver.MODEL_G19,
                                              widget_tree)
Ejemplo n.º 15
0
    def __init__(self, parent, driver, gconf_client, gconf_key):
        self.gconf_client = gconf_client
        self.gconf_key = gconf_key
        widget_tree = gtk.Builder()
        widget_tree.add_from_file(os.path.join(os.path.dirname(__file__), "lcdshot.ui"))
        dialog = widget_tree.get_object("LCDShotDialog")
        dialog.set_transient_for(parent)        
        chooser = gtk.FileChooserDialog("Open..",
                               None,
                               gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
                               (gtk.STOCK_CANCEL, gtk.RESPONSE_CANCEL,
                                gtk.STOCK_OPEN, gtk.RESPONSE_OK))
        chooser.set_default_response(gtk.RESPONSE_OK)
        chooser_button = widget_tree.get_object("FileChooserButton")        
        chooser_button.dialog = chooser 
        chooser_button.connect("file-set", self._file_set)
        chooser_button.connect("file-activated", self._file_activated)
        chooser_button.connect("current-folder-changed", self._file_activated)
        bg_img = g15gconf.get_string_or_default(self.gconf_client, "%s/folder" % self.gconf_key, os.path.expanduser("~/Desktop"))
        chooser_button.set_current_folder(bg_img)

        # Reset the value of the mode setting to 'still' if mencoder is not installed
        mencoder_is_installed = g15os.is_program_in_path('mencoder')
        if not mencoder_is_installed:
            gconf_client.set_string("%s/mode" % self.gconf_key, "still")

        # Initialize the mode combobox content
        modes = widget_tree.get_object("ModeModel")
        modes.clear()
        modes.append(('still','Still', True))
        modes.append(('video','Video', mencoder_is_installed))

        # Display a warning message to the user if mencoder is not installed
        warning = widget_tree.get_object("NoVideoMessage")
        warning.set_visible(not mencoder_is_installed)

        g15uigconf.configure_combo_from_gconf(self.gconf_client, "%s/mode" % self.gconf_key, "Mode", "still", widget_tree)
        mode = widget_tree.get_object("Mode")
        mode.connect("changed", self._mode_changed)

        g15uigconf.configure_spinner_from_gconf(self.gconf_client, "%s/fps" % gconf_key, "FPS", 10, widget_tree, False)
        self._spinner = widget_tree.get_object("FPS")
        self._mode_changed(mode)

        dialog.run()
        dialog.hide()
Ejemplo n.º 16
0
    def __init__(self, parent, gconf_client, gconf_key):
        self._gconf_client = gconf_client
        self._gconf_key = gconf_key
        self._visible_options = None

        self._widget_tree = Gtk.Builder()
        self._widget_tree.add_from_file(
            os.path.join(os.path.dirname(__file__), "weather.ui"))

        dialog = self._widget_tree.get_object("WeatherDialog")
        dialog.set_transient_for(parent)

        self._source = self._widget_tree.get_object("Source")
        self._source.connect("changed", self._load_options_for_source)

        self._sources_model = self._widget_tree.get_object("SourcesModel")
        for b in get_available_backends():
            l = [b, get_backend(b).backend_name]
            self._sources_model.append(l)
        g15uigconf.configure_combo_from_gconf(
            gconf_client, "%s/source" % gconf_key, "Source",
            self._sources_model[0][0]
            if len(self._sources_model) > 0 else None, self._widget_tree)
        self._load_options_for_source()

        update = self._widget_tree.get_object("UpdateAdjustment")
        update.set_value(
            g15gconf.get_int_or_default(gconf_client, gconf_key + "/update",
                                        DEFAULT_UPDATE_INTERVAL))
        update.connect("value-changed", self._value_changed, update,
                       gconf_key + "/update")

        unit = self._widget_tree.get_object("UnitCombo")
        unit.set_active(gconf_client.get_int(gconf_key + "/units"))
        unit.connect("changed", self._unit_changed, unit, gconf_key + "/units")

        g15uigconf.configure_checkbox_from_gconf(
            gconf_client, "%s/use_theme_icons" % gconf_key, "UseThemeIcons",
            True, self._widget_tree)
        g15uigconf.configure_checkbox_from_gconf(
            gconf_client, "%s/twenty_four_hour_times" % gconf_key,
            "TwentyFourHourTimes", True, self._widget_tree)

        dialog.run()
        dialog.hide()
Ejemplo n.º 17
0
    def __init__(self, device, parent, gconf_client):
        self.gconf_client = gconf_client
        self.device = device

        g15locale.get_translation("driver_g15direct")
        widget_tree = gtk.Builder()
        widget_tree.set_translation_domain("driver_g15direct")
        widget_tree.add_from_file(os.path.join(g15globals.ui_dir, "driver_g15direct.ui"))
        self.window = widget_tree.get_object("G15DirectDriverSettings")
        self.window.set_transient_for(parent)

        g15uigconf.configure_spinner_from_gconf(gconf_client,
                                                "/apps/gnome15/%s/timeout" % device.uid,
                                                "Timeout",
                                                10000,
                                                widget_tree,
                                                False)
        if not device.model_id == g15driver.MODEL_G13:
            widget_tree.get_object("JoyModeCombo").destroy()
            widget_tree.get_object("JoyModeLabel").destroy()
            widget_tree.get_object("Offset").destroy()
            widget_tree.get_object("OffsetLabel").destroy()
            widget_tree.get_object("OffsetDescription").destroy()
        else:
            g15uigconf.configure_combo_from_gconf(gconf_client,
                                                  "/apps/gnome15/%s/joymode" % device.uid,
                                                  "JoyModeCombo",
                                                  "macro",
                                                  widget_tree)
            # We have separate offset values for digital / analogue,
            # so swap between them based on configuration
            self.offset_widget = widget_tree.get_object("Offset")
            self._set_offset_depending_on_mode(None)
            widget_tree.get_object("JoyModeCombo").connect("changed",
                                                           self._set_offset_depending_on_mode)
            self.offset_widget.connect("value-changed", self._spinner_changed)
Ejemplo n.º 18
0
def show_preferences(parent, driver, gconf_client, gconf_key):
    widget_tree = gtk.Builder()
    widget_tree.add_from_file(
        os.path.join(os.path.dirname(__file__), "trafficstats.ui"))
    dialog = widget_tree.get_object("TrafficStats")

    # Resets the value of the use_vnstat flag if vnstat is not installed
    vnstat_installed = g15os.is_program_in_path('vnstat')
    if not vnstat_installed:
        gconf_client.set_bool("%s/use_vnstat" % gconf_key, False)

    # Displays a warning message to the user if vnstat is not installed
    warning = widget_tree.get_object("NoVnstatMessage")
    warning.set_visible(not vnstat_installed)

    # Disables the vnstat checkbox if vnstat is not installed
    use_vnstat = widget_tree.get_object('UseVnstat')
    use_vnstat.set_sensitive(vnstat_installed)

    g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                             gconf_key + "/use_vnstat",
                                             "UseVnstat", vnstat_installed,
                                             widget_tree)
    ndevice = widget_tree.get_object("NetDevice")
    for netdev in gtop.netlist():
        ndevice.append([netdev])
    g15uigconf.configure_combo_from_gconf(gconf_client,
                                          gconf_key + "/networkdevice",
                                          "NetworkDevice", "lo", widget_tree)
    g15uigconf.configure_adjustment_from_gconf(gconf_client,
                                               gconf_key + "/refresh_interval",
                                               "RefreshingScale", 10.0,
                                               widget_tree)
    dialog.set_transient_for(parent)
    dialog.run()
    dialog.hide()
Ejemplo n.º 19
0
def show_preferences(parent, driver, gconf_client, gconf_key):
    widget_tree = gtk.Builder()
    widget_tree.add_from_file(os.path.join(os.path.dirname(__file__), "impulse15.ui"))
    
    dialog = widget_tree.get_object("ImpulseDialog")
    dialog.set_transient_for(parent)
    
    # Set up the audio source model  
    audio_source_model = widget_tree.get_object("AudioSourceModel")
    status, output = g15os.get_command_output("pacmd list-sources")
    source_name = "0"
    if status == 0 and len(output) > 0:
        i = 0
        for line in output.split("\n"):
            line = line.strip()
            if line.startswith("index: "):
                i = int(line[7:])
                source_name = str(i)
            elif line.startswith("name: "):
                source_name = line[7:-1]
            elif line.startswith("device.description = "):
                audio_source_model.append((source_name, line[22:-1]))
    else:
        for i in range(0, 9):
            audio_source_model.append((str(i), "Source %d" % i))

    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/disco", "Disco", False, widget_tree)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/animate_mkeys", "AnimateMKeys", False, widget_tree)
    g15uigconf.configure_combo_from_gconf(gconf_client, gconf_key + "/mode", "ModeCombo", "spectrum", widget_tree)
    g15uigconf.configure_combo_from_gconf(gconf_client, gconf_key + "/paint", "PaintCombo", "screen", widget_tree)
    g15uigconf.configure_spinner_from_gconf(gconf_client, gconf_key + "/bars", "BarsSpinner", 16, widget_tree)
    g15uigconf.configure_combo_from_gconf(gconf_client, gconf_key + "/audio_source_name", "AudioSource", source_name, widget_tree)
    g15uigconf.configure_spinner_from_gconf(gconf_client, gconf_key + "/bar_width", "BarWidthSpinner", 16, widget_tree)
    g15uigconf.configure_spinner_from_gconf(gconf_client, gconf_key + "/spacing", "SpacingSpinner", 0, widget_tree)
    g15uigconf.configure_spinner_from_gconf(gconf_client, gconf_key + "/rows", "RowsSpinner", 16, widget_tree)
    g15uigconf.configure_spinner_from_gconf(gconf_client, gconf_key + "/bar_height", "BarHeightSpinner", 2, widget_tree)
    g15uigconf.configure_colorchooser_from_gconf(gconf_client, gconf_key + "/col1", "Color1", ( 255, 0, 0 ), widget_tree, default_alpha = 255)
    g15uigconf.configure_colorchooser_from_gconf(gconf_client, gconf_key + "/col2", "Color2", ( 0, 0, 255 ), widget_tree, default_alpha = 255)
    g15uigconf.configure_adjustment_from_gconf(gconf_client, gconf_key + "/frame_rate", "FrameRateAdjustment", 10.0, widget_tree)
    g15uigconf.configure_adjustment_from_gconf(gconf_client, gconf_key + "/gain", "GainAdjustment", 1.0, widget_tree)
    
    if driver.get_bpp() == 0:
        widget_tree.get_object("LCDTable").set_visible(False)

    
    dialog.run()
    dialog.hide()