コード例 #1
0
ファイル: trafficstats.py プロジェクト: 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__), "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()
コード例 #2
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()
コード例 #3
0
ファイル: g15daemon-server.py プロジェクト: AgenttiX/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__), "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()
コード例 #4
0
ファイル: tweak.py プロジェクト: mvivaldi/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__), "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()
コード例 #5
0
ファイル: background.py プロジェクト: FPar/gnome15
 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()
コード例 #6
0
ファイル: fx.py プロジェクト: 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()
コード例 #7
0
ファイル: notify-lcd.py プロジェクト: tanktarta/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__), "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()
コード例 #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()
コード例 #9
0
ファイル: panel.py プロジェクト: 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__), "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()
コード例 #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__), "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()
コード例 #11
0
ファイル: g15daemon-server.py プロジェクト: 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__), "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()
コード例 #12
0
ファイル: impulse15.py プロジェクト: semancik/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__), "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() 
コード例 #13
0
ファイル: notify-lcd2.py プロジェクト: FPar/gnome15
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()
コード例 #14
0
ファイル: trafficstats.py プロジェクト: AgenttiX/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__), "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()
コード例 #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__), "pommodoro.ui"))

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

    g15uigconf.configure_adjustment_from_gconf(
        gconf_client, "{0}/work_duration".format(gconf_key), "WorkDuration",
        DEFAULT_WORK_DURATION, widget_tree)
    g15uigconf.configure_adjustment_from_gconf(
        gconf_client, "{0}/shortbreak_duration".format(gconf_key),
        "ShortBreakDuration", DEFAULT_SHORTBREAK_DURATION, widget_tree)
    g15uigconf.configure_adjustment_from_gconf(
        gconf_client, "{0}/longbreak_duration".format(gconf_key),
        "LongBreakDuration", DEFAULT_LONGBREAK_DURATION, widget_tree)
    dialog.run()
    dialog.hide()
コード例 #16
0
ファイル: pommodoro.py プロジェクト: 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__), "pommodoro.ui"))

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

    g15uigconf.configure_adjustment_from_gconf(gconf_client,
                                            "{0}/work_duration".format(gconf_key),
                                            "WorkDuration",
                                            DEFAULT_WORK_DURATION,
                                            widget_tree)
    g15uigconf.configure_adjustment_from_gconf(gconf_client,
                                            "{0}/shortbreak_duration".format(gconf_key),
                                            "ShortBreakDuration",
                                            DEFAULT_SHORTBREAK_DURATION,
                                            widget_tree)
    g15uigconf.configure_adjustment_from_gconf(gconf_client,
                                            "{0}/longbreak_duration".format(gconf_key),
                                            "LongBreakDuration",
                                            DEFAULT_LONGBREAK_DURATION,
                                            widget_tree)
    dialog.run()
    dialog.hide()
コード例 #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__), "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()