Beispiel #1
0
    def load_configs(self):
        """Load configurations for all widgets in General, Scrolling
        and Appearance tabs from gconf.
        """
        # default_shell

        combo = self.get_widget('default_shell')
        # get the value for defualt shell. If unset, set to USER_SHELL_VALUE.
        value = self.client.get_string(KEY('/general/default_shell')) or \
            USER_SHELL_VALUE
        for i in combo.get_model():
            if i[0] == value:
                combo.set_active_iter(i.iter)

        # login shell
        value = self.client.get_bool(KEY('/general/use_login_shell'))
        self.get_widget('use_login_shell').set_active(value)

        # tray icon
        value = self.client.get_bool(KEY('/general/use_trayicon'))
        self.get_widget('use_trayicon').set_active(value)

        # popup
        value = self.client.get_bool(KEY('/general/use_popup'))
        self.get_widget('use_popup').set_active(value)

        # prompt on quit
        value = self.client.get_bool(KEY('/general/prompt_on_quit'))
        self.get_widget('prompt_on_quit').set_active(value)

        # ontop
        value = self.client.get_bool(KEY('/general/window_ontop'))
        self.get_widget('window_ontop').set_active(value)

        # tab ontop
        value = self.client.get_bool(KEY('/general/tab_ontop'))
        self.get_widget('tab_ontop').set_active(value)

        # losefocus
        value = self.client.get_bool(KEY('/general/window_losefocus'))
        self.get_widget('window_losefocus').set_active(value)

        # use VTE titles
        value = self.client.get_bool(KEY('/general/use_vte_titles'))
        self.get_widget('use_vte_titles').set_active(value)

        value = self.client.get_float(KEY('/general/window_height_f'))
        if not value:
            value = self.client.get_int(KEY('/general/window_height'))
        self.get_widget('window_height').set_value(value)

        value = self.client.get_float(KEY('/general/window_width_f'))
        if not value:
            value = self.client.get_int(KEY('/general/window_width'))
        self.get_widget('window_width').set_value(value)

        value = self.client.get_int(KEY('/general/window_halignment'))
        which_button = {
            ALIGN_RIGHT: 'radiobutton_align_right',
            ALIGN_LEFT: 'radiobutton_align_left',
            ALIGN_CENTER: 'radiobutton_align_center'
        }
        self.get_widget(which_button[value]).set_active(True)

        value = self.client.get_bool(KEY('/general/open_tab_cwd'))
        self.get_widget('open_tab_cwd').set_active(value)

        # tab bar
        value = self.client.get_bool(KEY('/general/window_tabbar'))
        self.get_widget('window_tabbar').set_active(value)

        # start fullscreen
        value = self.client.get_bool(KEY('/general/start_fullscreen'))
        self.get_widget('start_fullscreen').set_active(value)

        # use visible bell
        value = self.client.get_bool(KEY('/general/use_visible_bell'))
        self.get_widget('use_visible_bell').set_active(value)

        # use audible bell
        value = self.client.get_bool(KEY('/general/use_audible_bell'))
        self.get_widget('use_audible_bell').set_active(value)

        # display number / use primary display
        combo = self.get_widget('display_n')
        dest_screen = self.client.get_int(KEY('/general/display_n'))

        value = self.client.get_bool(KEY('/general/quick_open_enable'))
        self.get_widget('quick_open_enable').set_active(value)
        self.get_widget('quick_open_command_line').set_sensitive(value)
        self.get_widget('quick_open_in_current_terminal').set_sensitive(value)
        text = gtk.TextBuffer()
        text = self.get_widget('quick_open_supported_patterns').get_buffer()
        for title, matcher, _useless in QUICK_OPEN_MATCHERS:
            text.insert_at_cursor("%s: %s\n" % (title, matcher))
        self.get_widget('quick_open_supported_patterns').set_buffer(text)

        value = self.client.get_string(KEY('/general/quick_open_command_line'))
        if value is None:
            value = "subl %(file_path)s:%(line_number)s"
        self.get_widget('quick_open_command_line').set_text(value)

        value = self.client.get_bool(
            KEY('/general/quick_open_in_current_terminal'))
        self.get_widget('quick_open_in_current_terminal').set_active(value)

        # If Guake is configured to use a screen that is not currently attached,
        # default to 'primary display' option.
        screen = self.get_widget('config-window').get_screen()
        n_screens = screen.get_n_monitors()
        if dest_screen > n_screens - 1:
            self.client.set_bool(KEY('/general/mouse_display'), False)
            dest_screen = screen.get_primary_monitor()
            self.client.set_int(KEY('/general/display_n'), dest_screen)

        if dest_screen == ALWAYS_ON_PRIMARY:
            first_item = combo.get_model().get_iter_first()
            combo.set_active_iter(first_item)
        else:
            seen_first = False  # first item "always on primary" is special
            for i in combo.get_model():
                if seen_first:
                    i_int = int(
                        i[0].split()
                        [0])  # extracts 1 from '1' or from '1 (primary)'
                    if i_int == dest_screen:
                        combo.set_active_iter(i.iter)
                else:
                    seen_first = True

        # use display where the mouse is currently
        value = self.client.get_bool(KEY('/general/mouse_display'))
        self.get_widget('mouse_display').set_active(value)

        # scrollbar
        value = self.client.get_bool(KEY('/general/use_scrollbar'))
        self.get_widget('use_scrollbar').set_active(value)

        # history size
        value = self.client.get_int(KEY('/general/history_size'))
        self.get_widget('history_size').set_value(value)

        # scroll output
        value = self.client.get_bool(KEY('/general/scroll_output'))
        self.get_widget('scroll_output').set_active(value)

        # scroll keystroke
        value = self.client.get_bool(KEY('/general/scroll_keystroke'))
        self.get_widget('scroll_keystroke').set_active(value)

        # default font
        value = self.client.get_bool(KEY('/general/use_default_font'))
        self.get_widget('use_default_font').set_active(value)
        self.get_widget('font_style').set_sensitive(not value)

        # font
        value = self.client.get_string(KEY('/style/font/style'))
        self.get_widget('font_style').set_font_name(value)

        # font color
        val = self.client.get_string(KEY('/style/font/color'))
        try:
            color = gtk.gdk.color_parse(val)
            self.get_widget('font_color').set_color(color)
        except (ValueError, TypeError):
            warnings.warn('Unable to parse color %s' % val, Warning)

        # background color
        value = self.client.get_string(KEY('/style/background/color'))
        try:
            color = gtk.gdk.color_parse(value)
            self.get_widget('background_color').set_color(color)
        except (ValueError, TypeError):
            warnings.warn('Unable to parse color %s' % val, Warning)

        # palette
        value = self.client.get_string(KEY('/style/font/palette'))
        self.set_palette_name(value)
        self.set_palette_colors(value)

        # background image
        value = self.client.get_string(KEY('/style/background/image'))
        if os.path.isfile(value or ''):
            self.get_widget('background_image').set_filename(value)

        value = self.client.get_int(KEY('/style/background/transparency'))
        self.get_widget('background_transparency').set_value(value)

        value = self.client.get_int(KEY('/general/window_valignment'))
        self.get_widget('top_align').set_active(value)

        # it's a separated method, to be reused.
        self.reload_erase_combos()
Beispiel #2
0
 def on_primary_display_toggled(self, chk):
     """Set the 'appear on primary display' preference in gconf. This
     property supercedes any value stored in display_n.
     """
     self.client.set_bool(KEY('/general/primary_display'), chk.get_active())
Beispiel #3
0
 def on_use_scrollbar_toggled(self, chk):
     """Changes the activity of use_scrollbar in gconf
     """
     self.client.set_bool(KEY('/general/use_scrollbar'), chk.get_active())
Beispiel #4
0
 def on_quick_open_enable_toggled(self, chk):
     """Changes the activity of window_ontop in gconf
     """
     self.client.set_bool(KEY('/general/quick_open_enable'),
                          chk.get_active())
Beispiel #5
0
 def on_window_tabbar_toggled(self, chk):
     """Changes the activity of window_tabbar in gconf
     """
     self.client.set_bool(KEY('/general/window_tabbar'), chk.get_active())
Beispiel #6
0
 def on_use_login_shell_toggled(self, chk):
     """Changes the activity of use_login_shell in gconf
     """
     self.client.set_bool(KEY('/general/use_login_shell'), chk.get_active())
Beispiel #7
0
 def on_use_trayicon_toggled(self, chk):
     """Changes the activity of use_trayicon in gconf
     """
     self.client.set_bool(KEY('/general/use_trayicon'), chk.get_active())
Beispiel #8
0
 def on_scroll_output_toggled(self, chk):
     """Changes the activity of scroll_output in gconf
     """
     self.client.set_bool(KEY('/general/scroll_output'), chk.get_active())
Beispiel #9
0
 def on_scroll_keystroke_toggled(self, chk):
     """Changes the activity of scroll_keystroke in gconf
     """
     self.client.set_bool(KEY('/general/scroll_keystroke'),
                          chk.get_active())
Beispiel #10
0
    def set_final_window_rect(self):
        """Sets the final size and location of the main window of guake. The height
        is the window_height property, width is window_width and the
        horizontal alignment is given by window_alignment.
        """

        # fetch settings
        height_percents = self.client.get_float(
            KEY('/general/window_height_f'))
        if not height_percents:
            height_percents = self.client.get_int(
                KEY('/general/window_height'))

        width_percents = self.client.get_float(KEY('/general/window_width_f'))
        if not width_percents:
            width_percents = self.client.get_int(KEY('/general/window_width'))
        halignment = self.client.get_int(KEY('/general/window_halignment'))
        valignment = self.client.get_int(KEY('/general/window_valignment'))

        # print "height_percents", height_percents
        # print "width_percents", width_percents
        # print "halignment", halignment
        # print "valignment", valignment

        # get the rectangle just from the destination monitor
        screen = self.window.get_screen()
        monitor = self.get_final_window_monitor()
        window_rect = screen.get_monitor_geometry(monitor)

        if os.environ.get('DESKTOP_SESSION') == "ubuntu":
            unity_hide = self.client.get_int(
                KEY('/apps/compiz-1/plugins/'
                    'unityshell/screen0/options/launcher_hide_mode'))
            # launcher_hide_mode = 1 => autohide
            if unity_hide != 1:
                # Size of the icons for Unity in Ubuntu <= 12.04
                # TODO Ubuntu 12.10 use dconf :
                # /org/compiz/profiles/unity/plugins/unityshell/icon-size
                unity_icon_size = self.client.get_int(
                    KEY('/apps/compiz-1/plugins/unityshell/screen0/options/icon_size'
                        ))
                if not unity_icon_size:
                    # If not found, it should be because of newer implementation of unity.
                    # Dock is 64 pixel of width on my system, hope this is so on others...
                    unity_dock = 64
                else:
                    unity_dock = unity_icon_size + 17
                print(
                    "correcting window width because of launcher width {} "
                    "(from {} to {})".format(unity_dock, window_rect.width,
                                             window_rect.width - unity_dock))

                window_rect.width = window_rect.width - unity_dock

        total_width = window_rect.width
        total_height = window_rect.height

        # print "total_width", total_width
        # print "total_height", total_height

        window_rect.height = window_rect.height * height_percents / 100
        window_rect.width = window_rect.width * width_percents / 100

        # print "window_rect.x", window_rect.x
        # print "window_rect.y", window_rect.y
        # print "window_rect.height", window_rect.height
        # print "window_rect.width", window_rect.width

        if window_rect.width < total_width:
            if halignment == ALIGN_CENTER:
                # print "aligning to center!"
                window_rect.x += (total_width - window_rect.width) / 2
            elif halignment == ALIGN_LEFT:
                # print "aligning to left!"
                window_rect.x += 0
            elif halignment == ALIGN_RIGHT:
                # print "aligning to right!"
                window_rect.x += total_width - window_rect.width
        if window_rect.height < total_height:
            if valignment == ALIGN_BOTTOM:
                window_rect.y += (total_height - window_rect.height)

        self.window.resize(window_rect.width, window_rect.height)
        self.window.move(window_rect.x, window_rect.y)
        # print "Moving/Resizing to: window_rect", window_rect

        return window_rect
Beispiel #11
0
 def load_config(self):
     """"Just a proxy for all the configuration stuff.
     """
     self.client.notify(KEY('/general/use_trayicon'))
     self.client.notify(KEY('/general/prompt_on_quit'))
     self.client.notify(KEY('/general/window_tabbar'))
     self.client.notify(KEY('/general/mouse_display'))
     self.client.notify(KEY('/general/display_n'))
     self.client.notify(KEY('/general/window_ontop'))
     self.client.notify(KEY('/general/window_height'))
     self.client.notify(KEY('/general/window_width'))
     self.client.notify(KEY('/general/use_scrollbar'))
     self.client.notify(KEY('/general/history_size'))
     self.client.notify(KEY('/general/show_resizer'))
     self.client.notify(KEY('/general/use_vte_titles'))
     self.client.notify(KEY('/general/quick_open_enable'))
     self.client.notify(KEY('/general/quick_open_command_line'))
     self.client.notify(KEY('/style/cursor_shape'))
     self.client.notify(KEY('/style/font/style'))
     self.client.notify(KEY('/style/font/color'))
     self.client.notify(KEY('/style/font/palette'))
     self.client.notify(KEY('/style/background/color'))
     self.client.notify(KEY('/style/background/image'))
     self.client.notify(KEY('/style/background/transparency'))
     self.client.notify(KEY('/general/use_default_font'))
     self.client.notify(KEY('/general/compat_backspace'))
     self.client.notify(KEY('/general/compat_delete'))
Beispiel #12
0
 def composited_changed(screen):
     self.has_argb = screen.is_composited()
     self.set_background_transparency(
         self.client.get_int(KEY('/style/background/transparency')))
     self.set_background_image(
         self.client.get_string(KEY('/style/background/image')))
Beispiel #13
0
    def __init__(self):
        super(Guake, self).__init__(gladefile('guake.glade'))
        self.client = gconf.client_get_default()

        # setting global hotkey and showing a pretty notification =)
        guake.globalhotkeys.init()

        # Cannot use "getattr(gtk.Window().get_style(), "base")[int(gtk.STATE_SELECTED)]"
        # since theme has not been applied before first show_all
        self.selected_color = None

        self.isPromptQuitDialogOpened = False
        self.hidden = True
        self.forceHide = False

        # trayicon!
        try:
            import appindicator
        except ImportError:
            img = pixmapfile('guake-tray.png')
            self.tray_icon = gtk.status_icon_new_from_file(img)
            self.tray_icon.set_tooltip(_('Guake Terminal'))
            self.tray_icon.connect('popup-menu', self.show_menu)
            self.tray_icon.connect('activate', self.show_hide)
        else:
            self.tray_icon = appindicator.Indicator(
                _("guake-indicator"), _("guake-tray"),
                appindicator.CATEGORY_OTHER)
            self.tray_icon.set_icon("guake-tray")
            self.tray_icon.set_status(appindicator.STATUS_ACTIVE)
            menu = self.get_widget('tray-menu')
            show = gtk.MenuItem(_('Show'))
            show.set_sensitive(True)
            show.connect('activate', self.show_hide)
            show.show()
            menu.prepend(show)
            self.tray_icon.set_menu(menu)

        # adding images from a different path.
        ipath = pixmapfile('guake.png')
        self.get_widget('image1').set_from_file(ipath)
        ipath = pixmapfile('add_tab.png')
        self.get_widget('image2').set_from_file(ipath)

        # important widgets
        self.window = self.get_widget('window-root')
        self.mainframe = self.get_widget('mainframe')
        self.mainframe.remove(self.get_widget('notebook-teminals'))
        self.notebook = GuakeNotebook()
        self.notebook.set_name("notebook-teminals")
        self.notebook.set_property("tab_pos", "bottom")
        self.notebook.set_property("show_tabs", False)
        self.notebook.set_property("show_border", False)
        self.notebook.set_property("visible", True)
        self.notebook.set_property("has_focus", True)
        self.notebook.set_property("can_focus", True)
        self.notebook.set_property("is_focus", True)
        self.notebook.set_property("enable_popup", True)
        self.notebook.connect("switch_page", self.select_current_tab)
        self.mainframe.add(self.notebook)
        self.set_tab_position()

        self.tabs = self.get_widget('hbox-tabs')
        self.toolbar = self.get_widget('toolbar')
        self.mainframe = self.get_widget('mainframe')
        self.resizer = self.get_widget('resizer')

        # check and set ARGB for real transparency
        screen = self.window.get_screen()
        colormap = screen.get_rgba_colormap()
        if colormap is None:
            self.has_argb = False
        else:
            self.window.set_colormap(colormap)
            self.has_argb = self.window.get_screen().is_composited()

            def composited_changed(screen):
                self.has_argb = screen.is_composited()
                self.set_background_transparency(
                    self.client.get_int(KEY('/style/background/transparency')))
                self.set_background_image(
                    self.client.get_string(KEY('/style/background/image')))

            self.window.get_screen().connect("composited-changed",
                                             composited_changed)

        # It's intended to know which tab was selected to
        # close/rename. This attribute will be set in
        # self.show_tab_menu
        self.selected_tab = None

        # holds fullscreen status
        self.is_fullscreen = False

        # holds the timestamp of the losefocus event
        self.losefocus_time = 0

        # holds the timestamp of the previous show/hide action
        self.prev_showhide_time = 0

        # double click stuff
        def double_click(hbox, event):
            """Handles double clicks on tabs area and when receive
            one, calls add_tab.
            """
            if event.button == 1 and event.type == gtk.gdk._2BUTTON_PRESS:
                self.add_tab()

        evtbox = self.get_widget('event-tabs')
        evtbox.connect('button-press-event', double_click)

        # Flag to prevent guake hide when window_losefocus is true and
        # user tries to use the context menu.
        self.showing_context_menu = False

        def hide_context_menu(menu):
            """Turn context menu flag off to make sure it is not being
            shown.
            """
            self.showing_context_menu = False

        self.get_widget('context-menu').connect('hide', hide_context_menu)
        self.get_widget('tab-menu').connect('hide', hide_context_menu)
        self.window.connect('focus-out-event', self.on_window_losefocus)

        # Handling the delete-event of the main window to avoid
        # problems when closing it.
        def destroy(*args):
            self.hide()
            return True

        self.window.connect('delete-event', destroy)

        # Flag to completely disable losefocus hiding
        self.disable_losefocus_hiding = False

        # this line is important to resize the main window and make it
        # smaller.
        self.window.set_geometry_hints(min_width=1, min_height=1)

        # special trick to avoid the "lost guake on Ubuntu 'Show Desktop'" problem.
        # DOCK makes the window foundable after having being "lost" after "Show Desktop"
        self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_DOCK)
        # Restore back to normal behavior
        self.window.set_type_hint(gtk.gdk.WINDOW_TYPE_HINT_NORMAL)

        # resizer stuff
        self.resizer.connect('motion-notify-event', self.on_resizer_drag)

        # adding the first tab on guake
        self.add_tab()

        # loading and setting up configuration stuff
        GConfHandler(self)
        GConfKeyHandler(self)
        self.hotkeys = guake.globalhotkeys.GlobalHotkey()
        self.load_config()

        key = self.client.get_string(GKEY('show_hide'))
        keyval, mask = gtk.accelerator_parse(key)
        label = gtk.accelerator_get_label(keyval, mask)
        filename = pixmapfile('guake-notification.png')

        if self.client.get_bool(KEY('/general/start_fullscreen')):
            self.fullscreen()

        if not self.hotkeys.bind(key, self.show_hide):
            guake.notifier.show_message(
                _('Guake!'),
                _('A problem happened when binding <b>%s</b> key.\n'
                  'Please use Guake Preferences dialog to choose another '
                  'key') % xml_escape(label), filename)
            self.client.set_bool(KEY('/general/use_trayicon'), True)

        elif self.client.get_bool(KEY('/general/use_popup')):
            # Pop-up that shows that guake is working properly (if not
            # unset in the preferences windows)
            guake.notifier.show_message(
                _('Guake!'),
                _('Guake is now running,\n'
                  'press <b>%s</b> to use it.') % xml_escape(label), filename)
Beispiel #14
0
    def __init__(self, guake):
        """Constructor of GConfHandler, just add the guake dir to the
        gconf client and bind the keys to its handler methods.
        """
        self.guake = guake

        client = gconf.client_get_default()
        client.add_dir(GCONF_PATH, gconf.CLIENT_PRELOAD_RECURSIVE)

        notify_add = client.notify_add

        # these keys does not need to be watched.
        # notify_add(KEY('/general/default_shell'), self.shell_changed)
        # notify_add(KEY('/general/use_login_shell'), self.login_shell_toggled)
        # notify_add(KEY('/general/use_popup'), self.popup_toggled)
        # notify_add(KEY('/general/window_losefocus'), self.losefocus_toggled)
        # notify_add(KEY('/general/use_vte_titles'), self.use_vte_titles_changed)
        # notify_add(KEY('/general/quick_open_enable'), self.on_quick_open_enable_changed)
        # notify_add(KEY('/general/quick_open_in_current_terminal'),
        #   self.on_quick_open_in_current_terminal_changed)

        # Notification is not required for mouse_display/display_n because
        # set_final_window_rect polls gconf and is called whenever Guake is
        # shown or resized

        notify_add(KEY('/general/show_resizer'), self.show_resizer_toggled)

        notify_add(KEY('/general/use_trayicon'), self.trayicon_toggled)
        notify_add(KEY('/general/window_ontop'), self.ontop_toggled)
        notify_add(KEY('/general/tab_ontop'), self.tab_ontop_toggled)
        notify_add(KEY('/general/window_tabbar'), self.tabbar_toggled)
        notify_add(KEY('/general/window_height'), self.size_changed)
        notify_add(KEY('/general/window_width'), self.size_changed)
        notify_add(KEY('/general/window_height_f'), self.size_changed)
        notify_add(KEY('/general/window_width_f'), self.size_changed)
        notify_add(KEY('/general/window_valignment'), self.alignment_changed)
        notify_add(KEY('/general/window_halignment'), self.alignment_changed)
        notify_add(KEY('/style/cursor_blink_mode'),
                   self.cursor_blink_mode_changed)
        notify_add(KEY('/style/cursor_shape'), self.cursor_shape_changed)

        notify_add(KEY('/general/use_scrollbar'), self.scrollbar_toggled)
        notify_add(KEY('/general/history_size'), self.history_size_changed)
        notify_add(KEY('/general/scroll_output'), self.keystroke_output)
        notify_add(KEY('/general/scroll_keystroke'), self.keystroke_toggled)

        notify_add(KEY('/general/use_default_font'), self.default_font_toggled)
        notify_add(KEY('/general/use_palette_font_and_background_color'),
                   self.palette_font_and_background_color_toggled)
        notify_add(KEY('/style/font/style'), self.fstyle_changed)
        notify_add(KEY('/style/font/color'), self.fcolor_changed)
        notify_add(KEY('/style/font/palette'), self.fpalette_changed)
        # notify_add(KEY('/style/font/palette_name'), self.fpalette_changed)
        notify_add(KEY('/style/font/allow_bold'), self.allow_bold_toggled)
        notify_add(KEY('/style/background/color'), self.bgcolor_changed)
        notify_add(KEY('/style/background/image'), self.bgimage_changed)
        notify_add(KEY('/style/background/transparency'),
                   self.bgtransparency_changed)

        notify_add(KEY('/general/compat_backspace'), self.backspace_changed)
        notify_add(KEY('/general/compat_delete'), self.delete_changed)
        notify_add(KEY('/general/custom_command_file'),
                   self.custom_command_file_changed)
        notify_add(KEY('/general/max_tab_name_length'),
                   self.max_tab_name_length_changed)
Beispiel #15
0
 def clear_background_image(self, btn):
     """Unset the gconf variable that holds the name of the
     background image of all terminals.
     """
     self.client.unset(KEY('/style/background/image'))
     self.bgfilechooser.unselect_all()
Beispiel #16
0
 def on_use_default_font_toggled(self, chk):
     """Changes the activity of use_default_font in gconf
     """
     self.client.set_bool(KEY('/general/use_default_font'),
                          chk.get_active())
Beispiel #17
0
    def load_configs(self):
        """Load configurations for all widgets in General, Scrolling
        and Appearance tabs from gconf.
        """
        # default_shell
        combo = self.get_widget('default_shell')
        # get the value for defualt shell. If unset, set to USER_SHELL_VALUE.
        value = self.client.get_string(KEY('/general/default_shell')) or \
                USER_SHELL_VALUE
        for i in combo.get_model():
            if i[0] == value:
                combo.set_active_iter(i.iter)

        # login shell
        value = self.client.get_bool(KEY('/general/use_login_shell'))
        self.get_widget('use_login_shell').set_active(value)

        # tray icon
        value = self.client.get_bool(KEY('/general/use_trayicon'))
        self.get_widget('use_trayicon').set_active(value)

        # popup
        value = self.client.get_bool(KEY('/general/use_popup'))
        self.get_widget('use_popup').set_active(value)

        # prompt on quit
        value = self.client.get_bool(KEY('/general/prompt_on_quit'))
        self.get_widget('prompt_on_quit').set_active(value)

        # ontop
        value = self.client.get_bool(KEY('/general/window_ontop'))
        self.get_widget('window_ontop').set_active(value)

        # losefocus
        value = self.client.get_bool(KEY('/general/window_losefocus'))
        self.get_widget('window_losefocus').set_active(value)

        # tabbar
        value = self.client.get_bool(KEY('/general/window_tabbar'))
        self.get_widget('window_tabbar').set_active(value)

        # start fullscreen
        value = self.client.get_bool(KEY('/general/start_fullscreen'))
        self.get_widget('start_fullscreen').set_active(value)

        # scrollbar
        value = self.client.get_bool(KEY('/general/use_scrollbar'))
        self.get_widget('use_scrollbar').set_active(value)

        # history size
        value = self.client.get_int(KEY('/general/history_size'))
        self.get_widget('history_size').set_value(value)

        # scroll output
        value = self.client.get_bool(KEY('/general/scroll_output'))
        self.get_widget('scroll_output').set_active(value)

        # scroll keystroke
        value = self.client.get_bool(KEY('/general/scroll_keystroke'))
        self.get_widget('scroll_keystroke').set_active(value)

        # default font
        value = self.client.get_bool(KEY('/general/use_default_font'))
        self.get_widget('use_default_font').set_active(value)
        self.get_widget('font_style').set_sensitive(not value)

        # font
        value = self.client.get_string(KEY('/style/font/style'))
        self.get_widget('font_style').set_font_name(value)

        # font color
        val = self.client.get_string(KEY('/style/font/color'))
        try:
            color = gtk.gdk.color_parse(val)
            self.get_widget('font_color').set_color(color)
        except (ValueError, TypeError):
            warnings.warn('Unable to parse color %s' % val, Warning)

        # background color
        value = self.client.get_string(KEY('/style/background/color'))
        try:
            color = gtk.gdk.color_parse(value)
            self.get_widget('background_color').set_color(color)
        except (ValueError, TypeError):
            warnings.warn('Unable to parse color %s' % val, Warning)

        # palette
        value = self.client.get_string(KEY('/style/font/palette'))
        self.set_palette_name(value)
        self.set_palette_colors(value)

        # background image
        value = self.client.get_string(KEY('/style/background/image'))
        if os.path.isfile(value or ''):
            self.get_widget('background_image').set_filename(value)

        value = self.client.get_int(KEY('/style/background/transparency'))
        self.get_widget('background_transparency').set_value(value)

        # it's a separated method, to be reused.
        self.reload_erase_combos()
Beispiel #18
0
 def on_font_style_font_set(self, fbtn):
     """Changes the value of font_style in gconf
     """
     self.client.set_string(KEY('/style/font/style'), fbtn.get_font_name())
Beispiel #19
0
 def on_open_tab_cwd_toggled(self, chk):
     """Changes the activity of open_tab_cwd in gconf
     """
     self.client.set_bool(KEY('/general/open_tab_cwd'), chk.get_active())
Beispiel #20
0
 def on_font_color_color_set(self, btn):
     """Changes the value of font_color in gconf
     """
     color = hexify_color(btn.get_color())
     self.client.set_string(KEY('/style/font/color'), color)
Beispiel #21
0
 def on_prompt_on_quit_toggled(self, chk):
     """Set the `prompt on quit' property in gconf
     """
     self.client.set_bool(KEY('/general/prompt_on_quit'), chk.get_active())
Beispiel #22
0
 def on_background_color_color_set(self, btn):
     """Changes the value of background_color in gconf
     """
     color = hexify_color(btn.get_color())
     self.client.set_string(KEY('/style/background/color'), color)
Beispiel #23
0
 def on_quick_open_command_line_changed(self, edt):
     self.client.set_string(KEY('/general/quick_open_command_line'),
                            edt.get_text())
Beispiel #24
0
 def on_background_image_changed(self, btn):
     """Changes the value of background_image in gconf
     """
     filename = btn.get_filename()
     if os.path.isfile(filename or ''):
         self.client.set_string(KEY('/style/background/image'), filename)
Beispiel #25
0
 def on_start_fullscreen_toggled(self, chk):
     """Changes the activity of start_fullscreen in gconf
     """
     self.client.set_bool(KEY('/general/start_fullscreen'),
                          chk.get_active())
Beispiel #26
0
 def on_transparency_value_changed(self, hscale):
     """Changes the value of background_transparency in gconf
     """
     value = hscale.get_value()
     self.client.set_int(KEY('/style/background/transparency'), int(value))
Beispiel #27
0
 def on_window_height_value_changed(self, hscale):
     """Changes the value of window_height in gconf
     """
     val = hscale.get_value()
     self.client.set_int(KEY('/general/window_height'), int(val))
Beispiel #28
0
 def on_delete_binding_changed(self, combo):
     """Changes the value of compat_delete in gconf
     """
     val = combo.get_active_text()
     self.client.set_string(KEY('/general/compat_delete'),
                            ERASE_BINDINGS[val])
Beispiel #29
0
 def on_history_size_value_changed(self, spin):
     """Changes the value of history_size in gconf
     """
     val = int(spin.get_value())
     self.client.set_int(KEY('/general/history_size'), val)
Beispiel #30
0
 def on_use_audible_bell_toggled(self, chk):
     """Changes the value of use_audible_bell in gconf
     """
     self.client.set_bool(KEY('/general/use_audible_bell'),
                          chk.get_active())