Make handle size and tab position updatable on the fly

This commit is contained in:
Chris Jones 2008-11-19 13:46:37 +00:00
parent 0937aa9620
commit 8decf82577
2 changed files with 39 additions and 22 deletions

View File

@ -49,6 +49,7 @@ class ProfileEditor:
focus = ['click', 'sloppy', 'mouse'] focus = ['click', 'sloppy', 'mouse']
background_type = ['solid', 'image', 'transparent'] background_type = ['solid', 'image', 'transparent']
tab_position = ['top', 'bottom', 'left', 'right'] tab_position = ['top', 'bottom', 'left', 'right']
tab_position_gtk = {'top' : gtk.POS_TOP, 'bottom' : gtk.POS_BOTTOM, 'left' : gtk.POS_LEFT, 'right' : gtk.POS_RIGHT}
def __init__ (self, term): def __init__ (self, term):
self.term = term self.term = term
@ -294,10 +295,23 @@ class ProfileEditor:
elif changer == "borderless": elif changer == "borderless":
self.term.window.set_decorated (not values[changer]) self.term.window.set_decorated (not values[changer])
elif changer == "handle_size": elif changer == "handle_size":
# FIXME: How maek work? self.term.set_handle_size(values[changer])
pass gtk.rc_reset_styles(gtk.settings_get_default())
elif changer == "tab_position": elif changer == "tab_position":
# FIXME: maek work notebook = self.term.window.get_child()
new_pos = self.tab_position_gtk[values[changer]]
angle = 0
if isinstance (notebook, gtk.Notebook):
notebook.set_tab_pos(new_pos)
if new_pos == gtk.POS_LEFT:
angle = 90
elif new_pos == gtk.POS_RIGHT:
angle = 270
num_pages = notebook.get_n_pages()
for i in xrange(0,num_pages):
tab = notebook.get_tab_label(notebook.get_nth_page(i))
label = tab.get_children()[0]
label.set_angle(angle)
pass pass
# FIXME: which others? cycle_term_tab, close_button_on_tab, copy_on_selection, extreme_tabs, try_posix_regexp # FIXME: which others? cycle_term_tab, close_button_on_tab, copy_on_selection, extreme_tabs, try_posix_regexp

View File

@ -184,24 +184,7 @@ class Terminator:
print "full_screen = <Ctrl><Shift>F11" print "full_screen = <Ctrl><Shift>F11"
self.keybindings.configure(self.conf.keybindings) self.keybindings.configure(self.conf.keybindings)
if self.conf.handle_size in xrange (0,6): self.set_handle_size (self.conf.handle_size)
gtk.rc_parse_string("""
style "terminator-paned-style" {
GtkPaned::handle_size = %s
}
class "GtkPaned" style "terminator-paned-style"
""" % self.conf.handle_size)
gtk.rc_parse_string("""
style "terminator-tab-close-button-style" {
GtkWidget::focus-padding = 0
GtkWidget::focus-line-width = 0
xthickness = 0
ythickness = 0
}
widget "*.terminator-tab-close-button" style "terminator-tab-close-button-style"
""")
self.window = gtk.Window () self.window = gtk.Window ()
self.window.set_title (APP_NAME.capitalize()) self.window.set_title (APP_NAME.capitalize())
@ -248,7 +231,27 @@ class Terminator:
self.window.show () self.window.show ()
term.spawn_child () term.spawn_child ()
self.save_yourself () self.save_yourself ()
def set_handle_size (self, size):
if size in xrange (0,6):
gtk.rc_parse_string("""
style "terminator-paned-style" {
GtkPaned::handle_size = %s
}
class "GtkPaned" style "terminator-paned-style"
""" % self.conf.handle_size)
gtk.rc_parse_string("""
style "terminator-tab-close-button-style" {
GtkWidget::focus-padding = 0
GtkWidget::focus-line-width = 0
xthickness = 0
ythickness = 0
}
widget "*.terminator-tab-close-button" style "terminator-tab-close-button-style"
""")
def enable_rgba (self, rgba = False): def enable_rgba (self, rgba = False):
screen = self.window.get_screen() screen = self.window.get_screen()
if rgba: if rgba: