Exemplo n.º 1
0
Arquivo: rss.py Projeto: FPar/gnome15
 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__), "rss.ui"))
     
     # Feeds
     self.feed_model = widget_tree.get_object("FeedModel")
     self.reload_model()
     self.feed_list = widget_tree.get_object("FeedList")
     self.url_renderer = widget_tree.get_object("URLRenderer")
     
     # Optins
     self.update_adjustment = widget_tree.get_object("UpdateAdjustment")
     self.update_adjustment.set_value(g15gconf.get_int_or_default(self._gconf_client, "%s/update_time" % self._gconf_key, 60))
     g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/twenty_four_hour_times" % gconf_key, "TwentyFourHourTimes", True, widget_tree)
     
     # Connect to events
     self.update_adjustment.connect("value-changed", self.update_time_changed)
     self.url_renderer.connect("edited", self.url_edited)
     widget_tree.get_object("NewURL").connect("clicked", self.new_url)
     widget_tree.get_object("RemoveURL").connect("clicked", self.remove_url)
     
     # Display
     
     # Show dialog
     dialog = widget_tree.get_object("RSSDialog")
     dialog.set_transient_for(parent)
     
     ah = gconf_client.notify_add(gconf_key + "/urls", self.urls_changed);
     dialog.run()
     dialog.hide()
     gconf_client.notify_remove(ah);
Exemplo n.º 2
0
    def __init__(self, device, parent, gconf_client):
        g15locale.get_translation("driver_g19direct")
        widget_tree = gtk.Builder()
        widget_tree.set_translation_domain("driver_g19direct")
        widget_tree.add_from_file(os.path.join(g15globals.ui_dir, "driver_g19direct.ui"))
        self.window = widget_tree.get_object("G19DirectDriverSettings")
        self.window.set_transient_for(parent)

        g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                                 "/apps/gnome15/%s/reset_usb" % device.uid,
                                                 "Reset",
                                                 False,
                                                 widget_tree,
                                                 True)
        g15uigconf.configure_spinner_from_gconf(gconf_client,
                                                "/apps/gnome15/%s/timeout" % device.uid,
                                                "Timeout",
                                                10000,
                                                widget_tree,
                                                False)
        g15uigconf.configure_spinner_from_gconf(gconf_client,
                                                "/apps/gnome15/%s/reset_wait" % device.uid,
                                                "ResetWait",
                                                0,
                                                widget_tree,
                                                False)
Exemplo n.º 3
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__), "screensaver.ui"))

    dialog = widget_tree.get_object("ScreenSaverDialog")
    dialog.set_transient_for(parent)

    g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                             "%s/dim_keyboard" % gconf_key,
                                             "DimKeyboardCheckbox", True,
                                             widget_tree)

    if driver.get_bpp() == 0:
        widget_tree.get_object("MessageFrame").hide()

    text_buffer = widget_tree.get_object("TextBuffer")
    text = gconf_client.get_string(gconf_key + "/message_text")
    if text == None:
        text = ""
    text_buffer.set_text(text)
    text_h = text_buffer.connect("changed", changed,
                                 gconf_key + "/message_text", gconf_client)

    dialog.run()
    dialog.hide()
    text_buffer.disconnect(text_h)
Exemplo n.º 4
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()
Exemplo n.º 5
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()
Exemplo n.º 6
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()
Exemplo 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__), "sysmon.ui"))
    dialog = widget_tree.get_object("SysmonDialog")
    dialog.set_transient_for(parent)    
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/show_cpu_on_panel", "ShowCPUUsageOnPanel", True, widget_tree)
    dialog.run()
    dialog.hide()
Exemplo n.º 8
0
 def create_general_options(self):
     widget_tree = gtk.Builder()
     widget_tree.add_from_file(
         os.path.join(os.path.dirname(__file__), "cal.ui"))
     g15uigconf.configure_checkbox_from_gconf(
         self.gconf_client, "%s/twenty_four_hour_times" % self.gconf_key,
         "TwentyFourHourTimes", True, widget_tree)
     return widget_tree.get_object("OptionPanel")
Exemplo n.º 9
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__), "mounts.ui"))
    dialog = widget_tree.get_object("MountsDialog")
    dialog.set_transient_for(parent)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/raise" % gconf_key, "RaisePageCheckbox", True, widget_tree)
    dialog.run()
    dialog.hide()
Exemplo n.º 10
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__), "indicator-messages.ui"))
    dialog = widget_tree.get_object("IndicatorMessagesDialog")
    dialog.set_transient_for(parent)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/raise" % gconf_key, "RaisePageCheckbox", True, widget_tree)
    dialog.run()
    dialog.hide()
Exemplo n.º 11
0
Arquivo: voip.py Projeto: 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__), "voip.ui"))
    dialog = widget_tree.get_object("VoipDialog")
    dialog.set_transient_for(parent)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/raise_on_talk_status_change" % gconf_key, "RaiseOnTalkStatusChange", False, widget_tree)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/raise_on_chat_message" % gconf_key, "RaiseOnChatMessage", False, widget_tree)
    dialog.run()
    dialog.hide()
Exemplo n.º 12
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()
Exemplo n.º 13
0
 def __init__(self, device, parent, gconf_client):
     self.device = device
     
     widget_tree = Gtk.Builder()
     widget_tree.add_from_file(os.path.join(g15globals.ui_dir, "driver_g930.ui"))
     self.window = widget_tree.get_object("G930DriverSettings")
     self.window.set_transient_for(parent)
     
     self.grab_multimedia = widget_tree.get_object("GrabMultimedia")
     g15uigconf.configure_checkbox_from_gconf(gconf_client, "/apps/gnome15/%s/grab_multimedia" % device.uid, "GrabMultimedia", False, widget_tree)
Exemplo n.º 14
0
 def __init__(self, device, parent, gconf_client):
     self.device = device
     
     widget_tree = gtk.Builder()
     widget_tree.add_from_file(os.path.join(g15globals.ui_dir, "driver_g930.ui"))
     self.window = widget_tree.get_object("G930DriverSettings")
     self.window.set_transient_for(parent)
     
     self.grab_multimedia = widget_tree.get_object("GrabMultimedia")
     g15uigconf.configure_checkbox_from_gconf(gconf_client, "/apps/gnome15/%s/grab_multimedia" % device.uid, "GrabMultimedia", False, widget_tree)
Exemplo n.º 15
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()
Exemplo n.º 16
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()
Exemplo n.º 17
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__), "sysmon.ui"))
    dialog = widget_tree.get_object("SysmonDialog")
    dialog.set_transient_for(parent)
    g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                             gconf_key + "/show_cpu_on_panel",
                                             "ShowCPUUsageOnPanel", True,
                                             widget_tree)
    dialog.run()
    dialog.hide()
Exemplo 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__), "voip.ui"))
    dialog = widget_tree.get_object("VoipDialog")
    dialog.set_transient_for(parent)
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, "%s/raise_on_talk_status_change" % gconf_key,
        "RaiseOnTalkStatusChange", False, widget_tree)
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, "%s/raise_on_chat_message" % gconf_key,
        "RaiseOnChatMessage", False, widget_tree)
    dialog.run()
    dialog.hide()
Exemplo 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() 
Exemplo n.º 20
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()
Exemplo n.º 21
0
    def __init__(self, device, parent, gconf_client):
        g15locale.get_translation("driver_g19direct")
        widget_tree = gtk.Builder()
        widget_tree.set_translation_domain("driver_g19direct")
        widget_tree.add_from_file(
            os.path.join(g15globals.ui_dir, "driver_g19direct.ui"))
        self.window = widget_tree.get_object("G19DirectDriverSettings")
        self.window.set_transient_for(parent)

        g15uigconf.configure_checkbox_from_gconf(
            gconf_client, "/apps/gnome15/%s/reset_usb" % device.uid, "Reset",
            False, widget_tree, True)
        g15uigconf.configure_spinner_from_gconf(
            gconf_client, "/apps/gnome15/%s/timeout" % device.uid, "Timeout",
            10000, widget_tree, False)
        g15uigconf.configure_spinner_from_gconf(
            gconf_client, "/apps/gnome15/%s/reset_wait" % device.uid,
            "ResetWait", 0, widget_tree, False)
Exemplo n.º 22
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__), "rss.ui"))

        # Feeds
        self.feed_model = widget_tree.get_object("FeedModel")
        self.reload_model()
        self.feed_list = widget_tree.get_object("FeedList")
        self.url_renderer = widget_tree.get_object("URLRenderer")

        # Optins
        self.update_adjustment = widget_tree.get_object("UpdateAdjustment")
        self.update_adjustment.set_value(
            g15gconf.get_int_or_default(self._gconf_client,
                                        "%s/update_time" % self._gconf_key,
                                        60))
        g15uigconf.configure_checkbox_from_gconf(
            gconf_client, "%s/twenty_four_hour_times" % gconf_key,
            "TwentyFourHourTimes", True, widget_tree)

        # Connect to events
        self.update_adjustment.connect("value-changed",
                                       self.update_time_changed)
        self.url_renderer.connect("edited", self.url_edited)
        widget_tree.get_object("NewURL").connect("clicked", self.new_url)
        widget_tree.get_object("RemoveURL").connect("clicked", self.remove_url)

        # Display

        # Show dialog
        dialog = widget_tree.get_object("RSSDialog")
        dialog.set_transient_for(parent)

        ah = gconf_client.notify_add(gconf_key + "/urls", self.urls_changed)
        dialog.run()
        dialog.hide()
        gconf_client.notify_remove(ah)
Exemplo n.º 23
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__), "g15daemon-server.ui"))

    dialog = widget_tree.get_object("G15DaemonServerDialog")
    dialog.set_transient_for(parent)

    g15uigconf.configure_adjustment_from_gconf(gconf_client,
                                               gconf_key + "/port",
                                               "PortAdjustment", 15550,
                                               widget_tree)
    g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                             gconf_key + "/keep_aspect_ratio",
                                             "KeepAspectRatio", False,
                                             widget_tree, True)
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, gconf_key + "/take_over_macro_keys", "TakeOverMacroKeys",
        True, widget_tree, True)

    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, gconf_key + "/use_custom_foreground",
        "UseCustomForeground", False, widget_tree)
    g15uigconf.configure_colorchooser_from_gconf(
        gconf_client, gconf_key + "/custom_foreground", "CustomForeground",
        (255, 255, 255), widget_tree)

    dialog.run()
    dialog.hide()
Exemplo n.º 24
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__), "screensaver.ui"))
    
    dialog = widget_tree.get_object("ScreenSaverDialog")
    dialog.set_transient_for(parent)

    g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/dim_keyboard" % gconf_key,"DimKeyboardCheckbox", True, widget_tree)
    
    if driver.get_bpp() == 0:
        widget_tree.get_object("MessageFrame").hide()
        
    text_buffer = widget_tree.get_object("TextBuffer")
    text = gconf_client.get_string(gconf_key + "/message_text")
    if text == None:
        text = ""
    text_buffer.set_text(text)
    text_h = text_buffer.connect("changed", changed, gconf_key + "/message_text", gconf_client)
    
    dialog.run()
    dialog.hide()
    text_buffer.disconnect(text_h)
Exemplo n.º 25
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()
Exemplo n.º 26
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__), "g15daemon-server.ui"))
    
    dialog = widget_tree.get_object("G15DaemonServerDialog")
    dialog.set_transient_for(parent)
    
    g15uigconf.configure_adjustment_from_gconf(gconf_client, gconf_key + "/port", "PortAdjustment", 15550, widget_tree)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/keep_aspect_ratio", "KeepAspectRatio", False, widget_tree, True)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/take_over_macro_keys", "TakeOverMacroKeys", True, widget_tree, True)
    
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/use_custom_foreground", "UseCustomForeground", False, widget_tree)
    g15uigconf.configure_colorchooser_from_gconf(gconf_client, gconf_key + "/custom_foreground", "CustomForeground", ( 255, 255, 255 ), widget_tree)
    
    dialog.run()
    dialog.hide()
Exemplo n.º 27
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__), "tweak.ui"))
    dialog = widget_tree.get_object("TweakDialog")
    dialog.set_transient_for(parent)
    g15uigconf.configure_adjustment_from_gconf(gconf_client,
                                               "/apps/gnome15/scroll_delay",
                                               "ScrollDelayAdjustment", 500,
                                               widget_tree)
    g15uigconf.configure_adjustment_from_gconf(gconf_client,
                                               "/apps/gnome15/scroll_amount",
                                               "ScrollAmountAdjustment", 5,
                                               widget_tree)
    g15uigconf.configure_adjustment_from_gconf(
        gconf_client, "/apps/gnome15/animation_delay",
        "AnimationDelayAdjustment", 100, widget_tree)
    g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                             "/apps/gnome15/animated_menus",
                                             "AnimatedMenus", True,
                                             widget_tree)
    g15uigconf.configure_adjustment_from_gconf(
        gconf_client, "/apps/gnome15/key_hold_duration",
        "KeyHoldDurationAdjustment", 2000, widget_tree)
    g15uigconf.configure_adjustment_from_gconf(
        gconf_client, "/apps/gnome15/usb_key_read_timeout",
        "UsbKeyReadTimeoutAdjustment", 100, widget_tree)
    g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                             "/apps/gnome15/use_xtest",
                                             "UseXTest", True, widget_tree)
    g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                             "/apps/gnome15/disable_svg_glow",
                                             "DisableSVGGlow", False,
                                             widget_tree)
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, "/apps/gnome15/fade_screen_on_close",
        "FadeScreenOnClose", True, widget_tree)
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, "/apps/gnome15/fade_keyboard_backlight_on_close",
        "FadeKeyboardBacklightOnClose", True, widget_tree)
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, "/apps/gnome15/all_off_on_disconnect",
        "AllOffOnDisconnect", True, widget_tree)
    g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                             "/apps/gnome15/start_in_threads",
                                             "StartScreensInThreads", False,
                                             widget_tree)
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, "/apps/gnome15/monitor_desktop_session",
        "MonitorDesktopSession", True, widget_tree)
    g15uigconf.configure_text_from_gconf(gconf_client,
                                         "/apps/gnome15/time_format",
                                         "TimeFormat", "", widget_tree)
    g15uigconf.configure_text_from_gconf(gconf_client,
                                         "/apps/gnome15/time_format_24hr",
                                         "TimeFormatTwentyFour", "",
                                         widget_tree)
    g15uigconf.configure_text_from_gconf(gconf_client,
                                         "/apps/gnome15/date_format",
                                         "DateFormat", "", widget_tree)
    g15uigconf.configure_text_from_gconf(gconf_client,
                                         "/apps/gnome15/date_time_format",
                                         "DateTimeFormat", "", widget_tree)

    dialog.run()
    dialog.hide()
Exemplo n.º 28
0
 def __init__(self, parent, driver, gconf_key, gconf_client):
     widget_tree = gtk.Builder()
     widget_tree.add_from_file(os.path.join(os.path.dirname(__file__), "cairo-clock.ui"))
     
     dialog = widget_tree.get_object("ClockDialog")
     dialog.set_transient_for(parent)
     
     g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/display_seconds" % gconf_key, "DisplaySecondsCheckbox", True, widget_tree)
     g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/display_date" % gconf_key, "DisplayDateCheckbox", True, widget_tree)
     g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/twenty_four_hour" % gconf_key, "TwentyFourHourCheckbox", True, widget_tree)
     g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/display_digital_time" % gconf_key, "DisplayDigitalTimeCheckbox", True, widget_tree)
     g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/display_year" % gconf_key, "DisplayYearCheckbox", True, widget_tree)
     g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/second_sweep" % gconf_key, "SecondSweep", False, widget_tree)
     g15uigconf.configure_checkbox_from_gconf(gconf_client, "%s/twenty_four_hour_digital" % gconf_key, "TwentyFourHourDigitalCheckbox", True, widget_tree)
 
     e = gconf_client.get(gconf_key + "/theme")
     theme_name = "default"
     if e != None:
         theme_name = e.get_string()
     theme_model = widget_tree.get_object("ThemeModel")
     theme = widget_tree.get_object("ThemeCombo")
     
     def _theme_changed(widget, key):
         gconf_client.set_string(key, theme_model[widget.get_active()][0])
         
     theme.connect("changed", _theme_changed, gconf_key + "/theme")
     
     theme_dirs = get_theme_dirs(driver.get_model_name(), gconf_key, gconf_client)
     themes = {}
     for d in theme_dirs:
         if os.path.exists(d):
             for fname in os.listdir(d):
                 if os.path.isdir(os.path.join(d, fname)) and not fname in themes and ( driver.get_bpp() == 16 or fname == "default" ) :
                     theme_model.append([fname])
                     themes[fname] = True
                     if fname == theme_name:
                         theme.set_active(len(theme_model) - 1) 
     
     dialog.run()
     dialog.hide()
Exemplo n.º 29
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__), "notify-lcd.ui"))
    dialog = widget_tree.get_object("NotifyLCDDialog")
    dialog.set_transient_for(parent)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/respect_timeout", "RespectTimeout", False, widget_tree, True)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/allow_actions", "AllowActions", False, widget_tree, True)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/allow_cancel", "AllowCancel", True, widget_tree, True)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/on_keyboard_screen", "OnKeyboardScreen", True, widget_tree, True)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/on_desktop", "OnDesktop", True, widget_tree, True)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/blink_keyboard_backlight", "BlinkKeyboardBacklight", True, widget_tree, True)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/blink_memory_bank", "BlinkMemoryBank", True, widget_tree, True)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/change_keyboard_backlight_color", "ChangeKeyboardBacklightColor", False, widget_tree, True)
    g15uigconf.configure_adjustment_from_gconf(gconf_client, gconf_key + "/blink_delay", "DelayAdjustment", 500, widget_tree)
    g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/enable_sounds", "EnableSounds", True, widget_tree, True)
    g15uigconf.configure_colorchooser_from_gconf(gconf_client, gconf_key + "/keyboard_backlight_color", "KeyboardBacklightColor", ( 128, 128, 128 ), widget_tree, None)
    
    set_available(None, widget_tree)
    widget_tree.get_object("ChangeKeyboardBacklightColor").connect("toggled", set_available, widget_tree)
    widget_tree.get_object("BlinkKeyboardBacklight").connect("toggled", set_available, widget_tree)
    
    dialog.run()
    dialog.hide()
Exemplo n.º 30
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__), "tweak.ui"))
    dialog = widget_tree.get_object("TweakDialog")
    dialog.set_transient_for(parent)
    g15uigconf.configure_adjustment_from_gconf(
        gconf_client, "/apps/gnome15/scroll_delay", "ScrollDelayAdjustment", 500, widget_tree
    )
    g15uigconf.configure_adjustment_from_gconf(
        gconf_client, "/apps/gnome15/scroll_amount", "ScrollAmountAdjustment", 5, widget_tree
    )
    g15uigconf.configure_adjustment_from_gconf(
        gconf_client, "/apps/gnome15/animation_delay", "AnimationDelayAdjustment", 100, widget_tree
    )
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, "/apps/gnome15/animated_menus", "AnimatedMenus", True, widget_tree
    )
    g15uigconf.configure_adjustment_from_gconf(
        gconf_client, "/apps/gnome15/key_hold_duration", "KeyHoldDurationAdjustment", 2000, widget_tree
    )
    g15uigconf.configure_adjustment_from_gconf(
        gconf_client, "/apps/gnome15/usb_key_read_timeout", "UsbKeyReadTimeoutAdjustment", 100, widget_tree
    )
    g15uigconf.configure_checkbox_from_gconf(gconf_client, "/apps/gnome15/use_xtest", "UseXTest", True, widget_tree)
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, "/apps/gnome15/disable_svg_glow", "DisableSVGGlow", False, widget_tree
    )
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, "/apps/gnome15/fade_screen_on_close", "FadeScreenOnClose", True, widget_tree
    )
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client,
        "/apps/gnome15/fade_keyboard_backlight_on_close",
        "FadeKeyboardBacklightOnClose",
        True,
        widget_tree,
    )
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, "/apps/gnome15/all_off_on_disconnect", "AllOffOnDisconnect", True, widget_tree
    )
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, "/apps/gnome15/start_in_threads", "StartScreensInThreads", False, widget_tree
    )
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, "/apps/gnome15/monitor_desktop_session", "MonitorDesktopSession", True, widget_tree
    )
    g15uigconf.configure_text_from_gconf(gconf_client, "/apps/gnome15/time_format", "TimeFormat", "", widget_tree)
    g15uigconf.configure_text_from_gconf(
        gconf_client, "/apps/gnome15/time_format_24hr", "TimeFormatTwentyFour", "", widget_tree
    )
    g15uigconf.configure_text_from_gconf(gconf_client, "/apps/gnome15/date_format", "DateFormat", "", widget_tree)
    g15uigconf.configure_text_from_gconf(
        gconf_client, "/apps/gnome15/date_time_format", "DateTimeFormat", "", widget_tree
    )

    dialog.run()
    dialog.hide()
Exemplo n.º 31
0
def show_preferences(parent, gconf_client, gconf_key):
    widget_tree = gtk.Builder()
    widget_tree.add_from_file(
        os.path.join(os.path.dirname(__file__), "notify-lcd.ui"))
    dialog = widget_tree.get_object("NotifyLCDDialog")
    dialog.set_transient_for(parent)
    g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                             gconf_key + "/respect_timeout",
                                             "RespectTimeout", False,
                                             widget_tree, True)
    g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                             gconf_key + "/allow_actions",
                                             "AllowActions", False,
                                             widget_tree, True)
    g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                             gconf_key + "/allow_cancel",
                                             "AllowCancel", False, widget_tree,
                                             True)
    g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                             gconf_key + "/enable_sounds",
                                             "EnableSounds", True, widget_tree,
                                             True)
    g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                             gconf_key + "/lcd_only",
                                             "LCDOnly", False, widget_tree,
                                             True)
    g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                             gconf_key + "/blink_keyboard",
                                             "BlinkKeyboard", False,
                                             widget_tree, True)
    g15uigconf.configure_checkbox_from_gconf(
        gconf_client, gconf_key + "/change_keyboard_color",
        "ChangeKeyboardColor", False, widget_tree, True)
    g15uigconf.configure_adjustment_from_gconf(gconf_client,
                                               gconf_key + "/blink_delay",
                                               "DelayAdjustment", 500,
                                               widget_tree)
    g15uigconf.configure_colorchooser_from_gconf(gconf_client,
                                                 gconf_key + "/color", "Color",
                                                 (128, 128, 128), widget_tree,
                                                 None)

    set_available(None, widget_tree)
    widget_tree.get_object("ChangeKeyboardColor").connect(
        "toggled", set_available, widget_tree)
    widget_tree.get_object("BlinkKeyboard").connect("toggled", set_available,
                                                    widget_tree)

    dialog.run()
    dialog.hide()
Exemplo n.º 32
0
 def create_general_options(self):
     widget_tree = gtk.Builder()
     widget_tree.add_from_file(os.path.join(os.path.dirname(__file__), "cal.ui"))
     g15uigconf.configure_checkbox_from_gconf(self.gconf_client, "%s/twenty_four_hour_times" % self.gconf_key, "TwentyFourHourTimes", True, widget_tree)
     return widget_tree.get_object("OptionPanel")
Exemplo n.º 33
0
    def __init__(self, parent, driver, gconf_key, gconf_client):
        widget_tree = gtk.Builder()
        widget_tree.add_from_file(
            os.path.join(os.path.dirname(__file__), "cairo-clock.ui"))

        dialog = widget_tree.get_object("ClockDialog")
        dialog.set_transient_for(parent)

        g15uigconf.configure_checkbox_from_gconf(
            gconf_client, "%s/display_seconds" % gconf_key,
            "DisplaySecondsCheckbox", True, widget_tree)
        g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                                 "%s/display_date" % gconf_key,
                                                 "DisplayDateCheckbox", True,
                                                 widget_tree)
        g15uigconf.configure_checkbox_from_gconf(
            gconf_client, "%s/twenty_four_hour" % gconf_key,
            "TwentyFourHourCheckbox", True, widget_tree)
        g15uigconf.configure_checkbox_from_gconf(
            gconf_client, "%s/display_digital_time" % gconf_key,
            "DisplayDigitalTimeCheckbox", True, widget_tree)
        g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                                 "%s/display_year" % gconf_key,
                                                 "DisplayYearCheckbox", True,
                                                 widget_tree)
        g15uigconf.configure_checkbox_from_gconf(gconf_client,
                                                 "%s/second_sweep" % gconf_key,
                                                 "SecondSweep", False,
                                                 widget_tree)
        g15uigconf.configure_checkbox_from_gconf(
            gconf_client, "%s/twenty_four_hour_digital" % gconf_key,
            "TwentyFourHourDigitalCheckbox", True, widget_tree)

        e = gconf_client.get(gconf_key + "/theme")
        theme_name = "default"
        if e is not None:
            theme_name = e.get_string()
        theme_model = widget_tree.get_object("ThemeModel")
        theme = widget_tree.get_object("ThemeCombo")

        def _theme_changed(widget, key):
            gconf_client.set_string(key, theme_model[widget.get_active()][0])

        theme.connect("changed", _theme_changed, gconf_key + "/theme")

        theme_dirs = get_theme_dirs(driver.get_model_name(), gconf_key,
                                    gconf_client)
        themes = {}
        for d in theme_dirs:
            if os.path.exists(d):
                for fname in os.listdir(d):
                    if os.path.isdir(os.path.join(
                            d, fname)) and fname not in themes and (
                                driver.get_bpp() == 16 or fname == "default"):
                        theme_model.append([fname])
                        themes[fname] = True
                        if fname == theme_name:
                            theme.set_active(len(theme_model) - 1)

        dialog.run()
        dialog.hide()
Exemplo n.º 34
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__), "stopwatch.ui"))

        self.dialog = widget_tree.get_object("StopwatchDialog")
        self.dialog.set_transient_for(parent)

        # Timer 1 settings
        g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/timer1_enabled",  "cb_timer1_enabled", False, widget_tree, True)

        timer1_label = widget_tree.get_object("e_timer1_label")
        timer1_label.set_text(gconf_client.get_string(gconf_key + "/timer1_label") or "")
        timer1_label.connect("changed", self._label_changed, gconf_key + "/timer1_label", gconf_client)

        g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/timer1_mode_stopwatch", "rb_timer1_stopwatch_mode", True, widget_tree, True)
        rb_timer1_stopwatch = widget_tree.get_object("rb_timer1_stopwatch_mode")
        rb_timer1_stopwatch.connect("clicked", self._timer_timer_mode, widget_tree, "1", False)
        g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/timer1_mode_countdown", "rb_timer1_countdown_mode", False, widget_tree, True)
        rb_timer1_countdown = widget_tree.get_object("rb_timer1_countdown_mode")
        rb_timer1_countdown.connect("clicked", self._timer_timer_mode, widget_tree, "1", True)

        g15uigconf.configure_spinner_from_gconf(gconf_client, gconf_key + "/timer1_hours", "sb_timer1_hours", 0, widget_tree, False)
        g15uigconf.configure_spinner_from_gconf(gconf_client, gconf_key + "/timer1_minutes", "sb_timer1_minutes", 5, widget_tree, False)
        g15uigconf.configure_spinner_from_gconf(gconf_client, gconf_key + "/timer1_seconds", "sb_timer1_seconds", 0, widget_tree, False)

        g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/timer1_loop", "cb_timer1_loop", False, widget_tree, True)

        # Timer 2 settings
        g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/timer2_enabled", "cb_timer2_enabled", False, widget_tree, True)

        timer2_label = widget_tree.get_object("e_timer2_label")
        timer2_label.set_text(gconf_client.get_string(gconf_key + "/timer2_label") or "")
        timer2_label.connect("changed", self._label_changed, gconf_key + "/timer2_label", gconf_client)

        g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/timer2_mode_stopwatch", "rb_timer2_stopwatch_mode", True, widget_tree, True)
        rb_timer2_stopwatch = widget_tree.get_object("rb_timer2_stopwatch_mode")
        rb_timer2_stopwatch.connect("clicked", self._timer_timer_mode, widget_tree, "2", False)

        g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/timer2_mode_countdown", "rb_timer2_countdown_mode", False, widget_tree, True)
        rb_timer2_countdown = widget_tree.get_object("rb_timer2_countdown_mode")
        rb_timer2_countdown.connect("clicked", self._timer_timer_mode, widget_tree, "2", True)

        g15uigconf.configure_spinner_from_gconf(gconf_client, gconf_key + "/timer2_hours", "sb_timer2_hours", 0, widget_tree, False)
        g15uigconf.configure_spinner_from_gconf(gconf_client, gconf_key + "/timer2_minutes", "sb_timer2_minutes", 5, widget_tree, False)
        g15uigconf.configure_spinner_from_gconf(gconf_client, gconf_key + "/timer2_seconds", "sb_timer2_seconds", 0, widget_tree, False)

        g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/timer2_loop", "cb_timer2_loop", False, widget_tree, True)
        g15uigconf.configure_checkbox_from_gconf(gconf_client, gconf_key + "/keep_page_visible", "cb_keep_page_visible", True, widget_tree, True)

        # Refresh UI state
        self._timer_timer_mode(None, widget_tree, "1", rb_timer1_countdown.get_active())
        self._timer_timer_mode(None, widget_tree, "2", rb_timer2_countdown.get_active())