def on_reset_compat_defaults_clicked(self, bnt): """Reset default values to compat_{backspace,delete} gconf keys. The default values are retrivied from the guake.schemas file. """ self.client.unset(KEY('/general/compat_backspace')) self.client.unset(KEY('/general/compat_delete')) self.reload_erase_combos()
def on_default_shell_changed(self, combo): """Changes the activity of default_shell in gconf """ citer = combo.get_active_iter() if not citer: return shell = combo.get_model().get_value(citer, 0) # we unset the value (restore to default) when user chooses to use # user shell as guake shell interpreter. if shell == USER_SHELL_VALUE: self.client.unset(KEY('/general/default_shell')) else: self.client.set_string(KEY('/general/default_shell'), shell)
def reload_erase_combos(self, btn=None): """Read from gconf the value of compat_{backspace,delete} vars and select the right option in combos. """ # backspace erase binding combo = self.get_widget('backspace-binding-combobox') binding = self.client.get_string(KEY('/general/compat_backspace')) for i in combo.get_model(): if ERASE_BINDINGS.get(i[0]) == binding: combo.set_active_iter(i.iter) # delete erase binding combo = self.get_widget('delete-binding-combobox') binding = self.client.get_string(KEY('/general/compat_delete')) for i in combo.get_model(): if ERASE_BINDINGS.get(i[0]) == binding: combo.set_active_iter(i.iter)
def on_palette_name_changed(self, combo): """Changes the value of palette in gconf """ palette_index = combo.get_active() if palette_index == 4: return self.client.set_string(KEY('/style/font/palette'), PALETTES[palette_index]) self.set_palette_colors(PALETTES[palette_index])
def on_palette_color_set(self, btn): """Changes the value of palette in gconf """ palette = [] for i in range(16): palette.append( hexify_color(self.get_widget('palette_%d' % i).get_color())) palette = ':'.join(palette) self.client.set_string(KEY('/style/font/palette'), palette) self.set_palette_name(palette)
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()
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())
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))
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])
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)
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)
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())
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())
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())
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())
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())
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)
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())
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())
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)
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())
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))
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) # 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()
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())