From d205c35a243d16aa1d06a2a6167e2a23de3529c6 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Wed, 7 Jan 2009 19:37:59 +0100 Subject: [PATCH 01/26] Make the colours of the titlebars like clusterm (much clearer) and configurable --- terminatorlib/config.py | 6 ++++++ terminatorlib/prefs_profile.py | 10 +++++++++- terminatorlib/terminatorterm.py | 18 ++++++++++++++++-- 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/terminatorlib/config.py b/terminatorlib/config.py index 8d10906e..e0b1508f 100755 --- a/terminatorlib/config.py +++ b/terminatorlib/config.py @@ -100,6 +100,12 @@ Defaults = { 'close_button_on_tab' : True, 'tab_position' : 'top', 'enable_real_transparency' : False, + 'title_tx_txt_color' : '#FFFFFF', + 'title_tx_bg_color' : '#C80003', + 'title_rx_txt_color' : '#FFFFFF', + 'title_rx_bg_color' : '#0076C9', + 'title_ia_txt_color' : '#000000', + 'title_ia_bg_color' : '#C0BEBF', 'try_posix_regexp' : platform.system() != 'Linux', 'keybindings' : { 'zoom_in' : 'plus', diff --git a/terminatorlib/prefs_profile.py b/terminatorlib/prefs_profile.py index ff56e8ff..546a4d39 100644 --- a/terminatorlib/prefs_profile.py +++ b/terminatorlib/prefs_profile.py @@ -9,7 +9,7 @@ import gtk, gobject class ProfileEditor: # lists of which settings to put in which tabs appearance = ['titlebars', 'titletips', 'allow_bold', 'silent_bell', 'force_no_bell', 'background_darkness', 'background_type', 'background_image', 'cursor_blink', 'font', 'scrollbar_position', 'scroll_background', 'use_system_font', 'use_theme_colors', 'enable_real_transparency'] - colours = ['foreground_color','background_color', 'palette'] + colours = ['foreground_color','background_color', 'palette', 'title_tx_txt_color', 'title_tx_bg_color', 'title_rx_txt_color', 'title_rx_bg_color', 'title_ia_txt_color', 'title_ia_bg_color'] behaviour = ['backspace_binding', 'delete_binding', 'emulation', 'scroll_on_keystroke', 'scroll_on_output', 'scrollback_lines', 'focus', 'focus_on_close', 'exit_action', 'word_chars', 'mouse_autohide', 'use_custom_command', 'custom_command', 'http_proxy', 'encoding'] globals = ['fullscreen', 'maximise', 'borderless', 'handle_size', 'cycle_term_tab', 'close_button_on_tab', 'tab_position', 'copy_on_selection', 'extreme_tabs', 'try_posix_regexp'] @@ -38,6 +38,12 @@ class ProfileEditor: 'zoom_normal': ['Zoom reset', ''], 'reset': ['Reset terminal state', ''], 'reset_clear': ['Reset and clear terminal', ''], + 'title_tx_txt_color': ['Tx Title Foreground Color', ''], + 'title_tx_bg_color': ['Tx Title Background Color', ''], + 'title_rx_txt_color': ['Rx Title Foreground Color', ''], + 'title_rx_bg_color': ['Rx Title Background Color', ''], + 'title_ia_txt_color': ['Inactive Title Foreground Color', ''], + 'title_ia_bg_color': ['Inactive Title Background Color', ''], } # dictionary for results after setting @@ -183,6 +189,8 @@ class ProfileEditor: x = 0 widget.attach (gtk.ColorButton (gtk.gdk.color_parse (thing)), x, x + 1, y, y + 1) x += 1 + elif key in ['title_tx_txt_color', 'title_tx_bg_color', 'title_rx_txt_color', 'title_rx_bg_color', 'title_ia_txt_color', 'title_ia_bg_color']: + widget = gtk.ColorButton (gtk.gdk.color_parse (value)) elif key == 'background_image': widget = gtk.FileChooserButton('Select a File') filter = gtk.FileFilter() diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 2d368c75..315d5ccc 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1282,11 +1282,25 @@ text/plain notebookpage = self.terminator.get_first_notebook_page(notebookpage[0]) def on_vte_focus_in(self, vte, event): - self._titlebox.modify_bg(gtk.STATE_NORMAL,self.terminator.window.get_style().bg[gtk.STATE_SELECTED]) + for term in self.terminator.term_list: + if term != self and term._group != None and term._group == self._group: + term._title.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_rx_txt_color)) + term._titlegroup.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_rx_txt_color)) + term._titlebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_rx_bg_color)) + # set text to white + elif term != self and term._group == None or term._group != self._group: + term._title.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_ia_txt_color)) + term._titlegroup.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_ia_txt_color)) + term._titlebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_ia_bg_color)) + # set text to black + else: + term._title.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_tx_txt_color)) + term._titlegroup.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_tx_txt_color)) + term._titlebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_tx_bg_color)) + # set text to white return def on_vte_focus_out(self, vte, event): - self._titlebox.modify_bg(gtk.STATE_NORMAL, self.terminator.window.get_style().bg[gtk.STATE_NORMAL]) return def on_vte_focus(self, vte): From b356cfc9eef2b04910bc3da127aaf3bc87e89a5b Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Wed, 7 Jan 2009 19:39:12 +0100 Subject: [PATCH 02/26] Enumerate the terminals with/without padding (very useful when accessing many sequentially numbered systems.) --- terminatorlib/terminatorterm.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 315d5ccc..22217c87 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -710,6 +710,16 @@ text/plain self._vte.paste_clipboard () self._vte.grab_focus() + def do_enumerate(self, pad=False): + for idx in range(len(self.terminator.term_list)): + term = self.terminator.term_list[idx] + if term == self or term._group != None and term._group == self._group: + if pad == True: + numstr = '%0'+str(len(str(len(self.terminator.term_list))))+'d' + else: + numstr = '%d' + term._vte.feed_child(numstr % (idx+1)) + #keybindings for the individual splited terminals (affects only the #the selected terminal) UnhandledKeybindings = ('close_window', 'full_screen') @@ -985,6 +995,14 @@ text/plain item.connect ("activate", lambda menu_item: self.paste_clipboard ()) menu.append (item) + item = gtk.MenuItem (_("Enumerate")) + item.connect ("activate", lambda menu_item: self.do_enumerate ()) + menu.append (item) + + item = gtk.MenuItem (_("Enumerate with pad")) + item.connect ("activate", lambda menu_item: self.do_enumerate (pad=True)) + menu.append (item) + item = gtk.MenuItem () menu.append (item) From a30755e67026ae4f7b5c9c71f8073de1c8a7bc7c Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sat, 10 Jan 2009 07:34:50 +0100 Subject: [PATCH 03/26] Fix list of groups in context menu to prevent duplicates --- terminatorlib/terminatorterm.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 22217c87..6de1f9c1 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1171,7 +1171,8 @@ text/plain def do_create_group (self, widget, window, entry): name = entry.get_text () - self.terminator.groupings.append (name) + if name not in self.terminator.groupings: + self.terminator.groupings.append (name) self.set_group (None, name) window.destroy () From 895226aaa99884885e264a1f3757cae8fe74c89d Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sat, 10 Jan 2009 17:00:05 +0100 Subject: [PATCH 04/26] Two minor fixes to prevent unused groups lingering in the submenu when a terminal is close/ungrouped. --- terminatorlib/terminator.py | 1 + terminatorlib/terminatorterm.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 457690fa..4da92ccf 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -824,6 +824,7 @@ class Terminator: self.toggle_zoom(widget, not self._maximised) if self.remove(widget): + self.group_hoover() return True return False diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 6de1f9c1..36995cce 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1201,7 +1201,7 @@ text/plain # We have been removed from a group if not self.conf.titlebars and not self._want_titlebar: self._titlebox.hide () - self.terminator.group_hoover () + self.terminator.group_hoover () def group_all (self, widget): allname = _("All") From b69a54b53f511387a4e176b9063ff65a28c00aea Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Sat, 10 Jan 2009 17:13:49 +0100 Subject: [PATCH 05/26] Significant grouping improvements. Nearly everything there and works great. Still require 2 GUI related things before done. --- terminatorlib/terminator.py | 44 ++++++++--- terminatorlib/terminatorterm.py | 131 +++++++++++++++++++++++--------- 2 files changed, 128 insertions(+), 47 deletions(-) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 4da92ccf..78f89d41 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -133,6 +133,9 @@ class Terminator: self.start_cwd = os.getcwd() self.term_list = [] self.gnome_client = None + self.groupsend = 1 # 0 off, 1 group (d), 2 all + self.splittogroup = 1 # 0 no group, 1 new takes orginators group (d) + self.autocleangroups = 1 # 0 off, 1 on (d) stores = [] store = config.TerminatorConfValuestoreRC () @@ -709,6 +712,8 @@ class Terminator: # create a new terminal and parent pane. dbg ('SEGBUG: Creating TerminatorTerm') terminal = TerminatorTerm (self, self.profile, command, widget.get_cwd()) + if self.splittogroup: + terminal.set_group (None, widget._group) dbg ('SEGBUG: Created TerminatorTerm') pos = vertical and "right" or "bottom" dbg ('SEGBUG: Position is: %s'%pos) @@ -828,6 +833,19 @@ class Terminator: return True return False + def closegroupedterms (self, widget): + if self._zoomed: + # We are zoomed, pop back out to normal layout before closing + dbg ("closeterm function called while in zoomed mode. Restoring previous layout before closing.") + self.toggle_zoom(widget, not self._maximised) + + widget_group = widget._group + for term in self.term_list: + if term._group == widget_group and not self.remove(term): + return False + self.group_hoover() + return True + def go_to (self, term, selector): current = self.term_list.index (term) target = selector (term) @@ -1285,16 +1303,22 @@ class Terminator: if term != terminatorterm and term._group == group: term._vte.emit (type, event) + def all_emit (self, terminatorterm, type, event): + for term in self.term_list: + if term != terminatorterm: + term._vte.emit (type, event) + def group_hoover (self): - destroy = [] - for group in self.groupings: - save = False - for term in self.term_list: - if term._group == group: - save = True + if self.autocleangroups: + destroy = [] + for group in self.groupings: + save = False + for term in self.term_list: + if term._group == group: + save = True - if not save: - destroy.append (group) + if not save: + destroy.append (group) - for group in destroy: - self.groupings.remove (group) + for group in destroy: + self.groupings.remove (group) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 36995cce..ef558dbb 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -311,6 +311,19 @@ text/plain parent = widget.get_parent() dbg ('Drag drop on %s'%parent) + def get_target_terms(self): + if self.terminator.groupsend == 0: + return [self] + if self.terminator.groupsend == 2: + return self.terminator.term_list + if self.terminator.groupsend == 1: + term_subset = [] + for term in self.terminator.term_list: + if term == self or (term._group != None and term._group == self._group): + term_subset.append(term) + return term_subset + return None + def on_drag_data_received(self, widget, drag_context, x, y, selection_data, info, time, data): dbg ("Drag Data Received") if selection_data.type == 'text/plain': @@ -319,8 +332,7 @@ text/plain txt = selection_data.data.strip() if txt[0:7] == "file://": txt = "'%s'" % txt[7:] - for term in self.terminator.term_list: - if term == self or term._group != None and term._group == self._group: + for term in self.get_target_terms(): term._vte.feed_child(txt) return @@ -679,9 +691,15 @@ text/plain term.grab_focus () return False + def do_autocleangroups_toggle (self): + self.terminator.autocleangroups = not self.terminator.autocleangroups + def do_scrollbar_toggle (self): self.toggle_widget_visibility (self._scrollbar) + def do_splittogroup_toggle (self): + self.terminator.splittogroup = not self.terminator.splittogroup + def do_title_toggle (self): self._want_titlebar = not self._titlebox.get_property ('visible') self.toggle_widget_visibility (self._titlebox) @@ -696,29 +714,21 @@ text/plain widget.show () def paste_clipboard(self, primary = False): - if self._group: - for term in self.terminator.term_list: - if term._group == self._group: - if primary: - term._vte.paste_primary () - else: - term._vte.paste_clipboard () - else: + for term in self.get_target_terms(): if primary: - self._vte.paste_primary () + term._vte.paste_primary () else: - self._vte.paste_clipboard () + term._vte.paste_clipboard () self._vte.grab_focus() def do_enumerate(self, pad=False): - for idx in range(len(self.terminator.term_list)): - term = self.terminator.term_list[idx] - if term == self or term._group != None and term._group == self._group: - if pad == True: - numstr = '%0'+str(len(str(len(self.terminator.term_list))))+'d' - else: - numstr = '%d' - term._vte.feed_child(numstr % (idx+1)) + if pad: + numstr='%0'+str(len(str(len(self.terminator.term_list))))+'d' + else: + numstr='%d' + for term in self.get_target_terms(): + idx=self.terminator.term_list.index(term) + term._vte.feed_child(numstr % (idx+1)) #keybindings for the individual splited terminals (affects only the #the selected terminal) @@ -734,8 +744,11 @@ text/plain getattr(self, "key_" + mapping)() return True - if self._group and self._vte.is_focus (): - self.terminator.group_emit (self, self._group, 'key-press-event', event) + if self.terminator.groupsend != 0 and self._vte.is_focus (): + if self._group and self.terminator.groupsend == 1: + self.terminator.group_emit (self, self._group, 'key-press-event', event) + if self.terminator.groupsend == 2: + self.terminator.all_emit (self, 'key-press-event', event) return False # Key events @@ -1113,6 +1126,10 @@ text/plain def populate_grouping_menu (self, widget): groupitem = None + item = gtk.MenuItem (_("Assign to...")) + item.connect ("activate", self.create_group) + widget.append (item) + if len (self.terminator.groupings) > 0: groupitem = gtk.RadioMenuItem (groupitem, _("None")) groupitem.set_active (self._group == None) @@ -1126,24 +1143,63 @@ text/plain widget.append (item) groupitem = item + if self._group != None or len (self.terminator.groupings) > 0: item = gtk.MenuItem () widget.append (item) - - item = gtk.MenuItem (_("_New group")) - item.connect ("activate", self.create_group) - widget.append (item) - item = gtk.MenuItem () - widget.append (item) - - item = gtk.MenuItem (_("_Group all")) - item.connect ("activate", self.group_all) - widget.append (item) + if self._group != None: + item = gtk.MenuItem (_("Ungroup ") + self._group) + item.connect ("activate", self.ungroup, self._group) + widget.append (item) if len (self.terminator.groupings) > 0: item = gtk.MenuItem (_("_Ungroup all")) item.connect ("activate", self.ungroup_all) widget.append (item) + + if self._group != None: + item = gtk.MenuItem () + widget.append (item) + + item = gtk.ImageMenuItem (_("Close Group")) + grp_close_img = gtk.Image() + grp_close_img.set_from_stock(gtk.STOCK_CLOSE, 1) + item.set_image (grp_close_img) + item.connect ("activate", lambda menu_item: self.terminator.closegroupedterms (self)) + widget.append (item) + + item = gtk.MenuItem () + widget.append (item) + + groupitem = None + + groupitem = gtk.RadioMenuItem (groupitem, _("Broadcast off")) + groupitem.set_active (self.terminator.groupsend == 0) + groupitem.connect ("activate", self.set_groupsend, 0) + widget.append (groupitem) + + groupitem = gtk.RadioMenuItem (groupitem, _("Broadcast to group")) + groupitem.set_active (self.terminator.groupsend == 1) + groupitem.connect ("activate", self.set_groupsend, 1) + widget.append (groupitem) + + groupitem = gtk.RadioMenuItem (groupitem, _("Broadcast to all")) + groupitem.set_active (self.terminator.groupsend == 2) + groupitem.connect ("activate", self.set_groupsend, 2) + widget.append (groupitem) + + item = gtk.MenuItem () + widget.append (item) + + item = gtk.CheckMenuItem (_("Split to this group")) + item.set_active (self.terminator.splittogroup) + item.connect ("toggled", lambda menu_item: self.do_splittogroup_toggle ()) + widget.append (item) + + item = gtk.CheckMenuItem (_("Autoclean groups")) + item.set_active (self.terminator.autocleangroups) + item.connect ("toggled", lambda menu_item: self.do_autocleangroups_toggle ()) + widget.append (item) def create_group (self, item): win = gtk.Window () @@ -1203,12 +1259,13 @@ text/plain self._titlebox.hide () self.terminator.group_hoover () - def group_all (self, widget): - allname = _("All") - if not allname in self.terminator.groupings: - self.terminator.groupings.append (allname) + def set_groupsend (self, item, data): + self.terminator.groupsend = data + + def ungroup (self, widget, data): for term in self.terminator.term_list: - term.set_group (None, allname) + if term._group == data: + term.set_group (None, None) self.terminator.group_hoover () def ungroup_all (self, widget): From de9451347835b9633f3f85efd38f9a80597f1477 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Mon, 12 Jan 2009 12:13:22 +0100 Subject: [PATCH 06/26] First (and major) part of the GUI stuff. We now have a clickable button that pops up the group menu. --- terminatorlib/terminatorterm.py | 83 +++++++++++++++++++++++++++++---- 1 file changed, 73 insertions(+), 10 deletions(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index ef558dbb..f5f7f2fe 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -74,15 +74,27 @@ class TerminatorTerm (gtk.VBox): self._termbox = gtk.HBox () self._termbox.show() + self._titlegroupimg = gtk.Image() + self._titlegroupimg.set_from_icon_name (APP_NAME + '_groups', gtk.ICON_SIZE_MENU) self._title = gtk.Label() self._title.show() self._titlegroup = gtk.Label() + self._titlegroup.show() + self._titlegroupbox = gtk.EventBox () + self._titlegroupbox.set_visible_window(True) + self._titlegrouphbox = gtk.HBox() + self._titlegrouphbox.pack_start (self._titlegroupimg, False, True, 2) + self._titlegrouphbox.pack_start (self._titlegroup, True, True, 2) + self._titlegrouphbox.show () + self._titlegroupbox.add (self._titlegrouphbox) + self._titlegroupbox.show_all() self._titlesep = gtk.VSeparator () + self._titlesep.show() self._titlebox = gtk.EventBox () self._titlehbox = gtk.HBox() - self._titlehbox.pack_start (self._titlegroup, False, True) - self._titlehbox.pack_start (self._titlesep, False, True, 2) - self._titlehbox.pack_start (self._title, True, True) + self._titlehbox.pack_start (self._titlegroupbox, False, True) + self._titlehbox.pack_start (self._titlesep, False, True) + self._titlehbox.pack_start (self._title, True, True, 2) self._titlehbox.show () self._titlebox.add (self._titlehbox) @@ -176,6 +188,8 @@ class TerminatorTerm (gtk.VBox): self._vte.connect ("focus-in-event", self.on_vte_focus_in) self._vte.connect ("resize-window", self.on_resize_window) + self._titlegroupbox.connect ("button-release-event", self.on_group_button_press) + exit_action = self.conf.exit_action if exit_action == "restart": self._vte.connect ("child-exited", self.spawn_child) @@ -1123,6 +1137,25 @@ text/plain return True + def create_popup_group_menu (self, widget, event = None): + menu = gtk.Menu () + url = None + + if event: + url = self._vte.match_check (int (event.x / self._vte.get_char_width ()), int (event.y / self._vte.get_char_height ())) + button = event.button + time = event.time + else: + button = 0 + time = 0 + + self.populate_grouping_menu (menu) + + menu.show_all () + menu.popup (None, None, self.position_popup_group_menu, button, time, widget) + + return True + def populate_grouping_menu (self, widget): groupitem = None @@ -1161,7 +1194,7 @@ text/plain item = gtk.MenuItem () widget.append (item) - item = gtk.ImageMenuItem (_("Close Group")) + item = gtk.ImageMenuItem (_("Close %s group") % (self._group)) grp_close_img = gtk.Image() grp_close_img.set_from_stock(gtk.STOCK_CLOSE, 1) item.set_image (grp_close_img) @@ -1201,6 +1234,23 @@ text/plain item.connect ("toggled", lambda menu_item: self.do_autocleangroups_toggle ()) widget.append (item) + def position_popup_group_menu(self, menu, widget): + screen_w = gtk.gdk.screen_width() + screen_h = gtk.gdk.screen_height() + + widget_win = widget.get_window() + widget_x, widget_y = widget_win.get_origin() + widget_w, widget_h = widget_win.get_size() + + menu_w, menu_h = menu.size_request() + + if widget_y + widget_h + menu_h > screen_h: + menu_y = max(widget_y - menu_h, 0) + else: + menu_y = widget_y + widget_h + + return (widget_x, menu_y, 1) + def create_group (self, item): win = gtk.Window () vbox = gtk.VBox () @@ -1241,10 +1291,8 @@ text/plain if data: self._titlegroup.set_text (data) self._titlegroup.show() - self._titlesep.show () else: self._titlegroup.hide() - self._titlesep.hide () if not self._group: # We were not previously in a group @@ -1360,19 +1408,30 @@ text/plain def on_vte_focus_in(self, vte, event): for term in self.terminator.term_list: if term != self and term._group != None and term._group == self._group: - term._title.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_rx_txt_color)) + if self.terminator.groupsend == 0: + term._title.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_ia_txt_color)) + term._titlebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_ia_bg_color)) + else: + term._title.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_rx_txt_color)) + term._titlebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_rx_bg_color)) term._titlegroup.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_rx_txt_color)) - term._titlebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_rx_bg_color)) + term._titlegroupbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_rx_bg_color)) # set text to white elif term != self and term._group == None or term._group != self._group: - term._title.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_ia_txt_color)) + if self.terminator.groupsend == 2: + term._title.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_rx_txt_color)) + term._titlebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_rx_bg_color)) + else: + term._title.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_ia_txt_color)) + term._titlebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_ia_bg_color)) term._titlegroup.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_ia_txt_color)) - term._titlebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_ia_bg_color)) + term._titlegroupbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_ia_bg_color)) # set text to black else: term._title.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_tx_txt_color)) term._titlegroup.modify_fg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_tx_txt_color)) term._titlebox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_tx_bg_color)) + term._titlegroupbox.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse (self.conf.title_tx_bg_color)) # set text to white return @@ -1390,3 +1449,7 @@ text/plain notebookpage[0].set_tab_label(notebookpage[1], label) notebookpage = self.terminator.get_first_notebook_page(notebookpage[0]) + def on_group_button_press(self, term, event): + if event.button == 1: + self.create_popup_group_menu(term, event) + return False From b9b5416d8ddaa0b5bad1e74e5eafbb1d5e832d52 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Mon, 12 Jan 2009 12:32:22 +0100 Subject: [PATCH 07/26] Bugger, missed off adding the icon. --- data/icons/16x16/actions/terminator_groups.png | Bin 0 -> 277 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 data/icons/16x16/actions/terminator_groups.png diff --git a/data/icons/16x16/actions/terminator_groups.png b/data/icons/16x16/actions/terminator_groups.png new file mode 100644 index 0000000000000000000000000000000000000000..7a7da94a6fc72c72bd96473ae0c2f533d6f809b3 GIT binary patch literal 277 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPggaMs86vBacNdW&njGOI#yLobz*Y zQ}ap~oQqNuOHxx5$}>wc6x=<11Hv2m#DR(mJY5_^EKVoeY{<7~R&D5PbUMJ4Y++&f zPd)T=W9@Ir$O)`|1_sF*n-YGUJ`hkQ6kI;tvUHCD4^P5D4uc#9sRS0@1JhQ>%#o4g zdvp7|hrIp+<{Lt{Kssl7c$VJy;j=_7w&ZZc1?HZR=>|cw<}&(MD_;`$`eqZ*ZU#?R KKbLh*2~7Z?K3O3E literal 0 HcmV?d00001 From 29ef91225065f66528bd4a9003f89f7790d71246 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Mon, 12 Jan 2009 17:08:12 +0100 Subject: [PATCH 08/26] Some small fixes after discussion and testing over irc --- terminatorlib/terminator.py | 9 +++++---- terminatorlib/terminatorterm.py | 10 ++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/terminatorlib/terminator.py b/terminatorlib/terminator.py index 78f89d41..5618404d 100755 --- a/terminatorlib/terminator.py +++ b/terminatorlib/terminator.py @@ -134,7 +134,7 @@ class Terminator: self.term_list = [] self.gnome_client = None self.groupsend = 1 # 0 off, 1 group (d), 2 all - self.splittogroup = 1 # 0 no group, 1 new takes orginators group (d) + self.splittogroup = 0 # 0 no group (d), 1 new takes orginators group self.autocleangroups = 1 # 0 off, 1 on (d) stores = [] @@ -840,11 +840,12 @@ class Terminator: self.toggle_zoom(widget, not self._maximised) widget_group = widget._group - for term in self.term_list: + all_closed = True + for term in self.term_list[:]: if term._group == widget_group and not self.remove(term): - return False + all_closed = False self.group_hoover() - return True + return all_closed def go_to (self, term, selector): current = self.term_list.index (term) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index f5f7f2fe..dc8e437f 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -79,7 +79,6 @@ class TerminatorTerm (gtk.VBox): self._title = gtk.Label() self._title.show() self._titlegroup = gtk.Label() - self._titlegroup.show() self._titlegroupbox = gtk.EventBox () self._titlegroupbox.set_visible_window(True) self._titlegrouphbox = gtk.HBox() @@ -88,6 +87,7 @@ class TerminatorTerm (gtk.VBox): self._titlegrouphbox.show () self._titlegroupbox.add (self._titlegrouphbox) self._titlegroupbox.show_all() + self._titlegroup.hide() self._titlesep = gtk.VSeparator () self._titlesep.show() self._titlebox = gtk.EventBox () @@ -1042,7 +1042,7 @@ text/plain item.set_active (self._titlebox.get_property ('visible')) item.connect ("toggled", lambda menu_item: self.do_title_toggle ()) if self._group: - item.set_sensitive (False) + item.set_sensitive (True) menu.append (item) self._do_encoding_items (menu) @@ -1181,12 +1181,12 @@ text/plain widget.append (item) if self._group != None: - item = gtk.MenuItem (_("Ungroup ") + self._group) + item = gtk.MenuItem (_("Remove %s group ") % (self._group)) item.connect ("activate", self.ungroup, self._group) widget.append (item) if len (self.terminator.groupings) > 0: - item = gtk.MenuItem (_("_Ungroup all")) + item = gtk.MenuItem (_("Remove all groups")) item.connect ("activate", self.ungroup_all) widget.append (item) @@ -1227,6 +1227,8 @@ text/plain item = gtk.CheckMenuItem (_("Split to this group")) item.set_active (self.terminator.splittogroup) item.connect ("toggled", lambda menu_item: self.do_splittogroup_toggle ()) + if self._group == None: + item.set_sensitive(False) widget.append (item) item = gtk.CheckMenuItem (_("Autoclean groups")) From eab9cb37570db9510f776ff60cc939135603bbe5 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Mon, 12 Jan 2009 22:53:42 +0100 Subject: [PATCH 09/26] Remove the noe redundant group menu, plus unique titlebar icons. --- .../terminator_active_broadcast_all.png | Bin 0 -> 273 bytes .../terminator_active_broadcast_group.png | Bin 0 -> 277 bytes .../terminator_active_broadcast_off.png | Bin 0 -> 272 bytes .../16x16/actions/terminator_receive_off.png | Bin 0 -> 259 bytes .../16x16/actions/terminator_receive_on.png | Bin 0 -> 270 bytes terminatorlib/terminatorterm.py | 27 +++++++++--------- 6 files changed, 13 insertions(+), 14 deletions(-) create mode 100644 data/icons/16x16/actions/terminator_active_broadcast_all.png create mode 100644 data/icons/16x16/actions/terminator_active_broadcast_group.png create mode 100644 data/icons/16x16/actions/terminator_active_broadcast_off.png create mode 100644 data/icons/16x16/actions/terminator_receive_off.png create mode 100644 data/icons/16x16/actions/terminator_receive_on.png diff --git a/data/icons/16x16/actions/terminator_active_broadcast_all.png b/data/icons/16x16/actions/terminator_active_broadcast_all.png new file mode 100644 index 0000000000000000000000000000000000000000..95d420c4f8dd73ff01200c80f9435d35f5e9dbf7 GIT binary patch literal 273 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPggaMjjDe#h>;DAaf;4Tq8=H^K)}k z^GX<;i&7IyQd1PlGfOfQ+&z5*!W;R-fr@fGT^vI!PAA)J$hT)!ZRl)tI>3}{VPW}C zJ@j*9?QhA*39Nnw2FV(m5`LUM5Ktx*Tt3~hbdLcKPr^YCgB%8_1Qy-{qPN(;y-i=z zFaCishx6@$eSdp=mMpQ#sZk4>thXys=SZ8G-gJYYS#ueuq$^#R@o;Sw&|U^lS3j3^ HP6QL70(Y)*K0-AbW|YuPggaMjjDuGo5WhKsg4<64!_l=ltB< z)VvY~=c3falGGH1^30M91$R&1fbd2>aiF3CPZ!4!i_^(A8}jX$RU0}RoenT1TUc2B zQxE;zSo>QtassQLfkCpyri34-4+NA61(#2^EZt+k!;^53!yt!2DuIRfz_b-Ib7Um> z-rPR#A+P^{`G(Lfkj|MNo~1W__$*P2Ejb)QL70(Y)*K0-AbW|YuPggaMjjDersxPq1)z{*iEBiObAE1a zYF-J0b5UwyNotBhd1gt5g1e`0KzJjcI8afxr;B5V#pz_54f*!WstuiuP6wEhEi5em zsfT`UtoQL70(Y)*K0-AbW|YuPggaMjjD;BmeEfd_W<|64!_l=ltB< z)VvY~=c3falGGH1^30M91$R&1fbd2>aiF3&PZ!4!i_^(A8}jX$RU0}RoenT1TUc2B zQxE;zSo>Qt@&b#2h^2+)Ba!7@;%$wLIyacu!W#rl82oh%E*A~-24YFh($l>qG|!%6c=SOv>B`Ei6rfEEp00i_>zopr02o|MSO5S3 literal 0 HcmV?d00001 diff --git a/data/icons/16x16/actions/terminator_receive_on.png b/data/icons/16x16/actions/terminator_receive_on.png new file mode 100644 index 0000000000000000000000000000000000000000..98517c892f824359749cb779dea5d752302cc3bd GIT binary patch literal 270 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPggaMjjD;d9DoqYM_v0iEBiObAE1a zYF-J0b5UwyNotBhd1gt5g1e`0KzJjcI8afhr;B5V#pz_54f*!WstuiuP6wEhEi5em zsfT`Uto Date: Tue, 13 Jan 2009 17:20:43 +0100 Subject: [PATCH 10/26] Small cosmetic oneliner for non-centered titles on splitting. --- terminatorlib/terminatorterm.py | 1 + 1 file changed, 1 insertion(+) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index a81d86ae..ac87ade6 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -524,6 +524,7 @@ text/plain dbg ('SEGBUG: Forked command') self.on_vte_title_change(self._vte) # Force an initial update of our titles + self._title.show() if self._pid == -1: err (_('Unable to start shell: ') + shell) From f405a2c87f8f3777f7335433da2563459ccf6f1b Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Tue, 13 Jan 2009 22:05:04 +0100 Subject: [PATCH 11/26] Final part of the GUI rework for the group stuff. --- terminatorlib/terminatorterm.py | 132 +++++++++++++++++++++++++++----- 1 file changed, 111 insertions(+), 21 deletions(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index ac87ade6..2065468a 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1244,35 +1244,125 @@ text/plain return (widget_x, menu_y, 1) def create_group (self, item): + self.groupingscope = 0 + grplist=self.terminator.groupings[:] + grplist.sort() + win = gtk.Window () - vbox = gtk.VBox () - hbox = gtk.HBox () - entrybox = gtk.HBox () + vbox = gtk.VBox (False, 6) + vbox.set_border_width(5) win.add (vbox) - label = gtk.Label (_("Group name:")) - entry = gtk.Entry () + + # Populate the "Assign..." Section + contentvbox = gtk.VBox (False, 6) + selframe = gtk.Frame() + selframe_label = gtk.Label() + selframe_label.set_markup(_("Assign...")) + selframe.set_shadow_type(gtk.SHADOW_NONE) + selframe.set_label_widget(selframe_label) + selframe_align = gtk.Alignment(0, 0, 1, 1) + selframe_align.set_padding(0, 0, 12, 0) + selframevbox = gtk.VBox () + selframehbox = gtk.HBox () + + # Populate the Combo with existing group names (None at the top) + sel_combo = gtk.combo_box_new_text() + sel_combo.append_text("*No Group*") + for grp in grplist: + sel_combo.append_text(grp) + sel_combo.set_sensitive(False) + + # Here are the radio buttons + groupitem = None + + groupitem = gtk.RadioButton (groupitem, _("Terminal")) + groupitem.set_active (True) + groupitem.connect ("toggled", self.set_groupingscope, 0, sel_combo) + selframehbox.pack_start (groupitem) + + groupitem = gtk.RadioButton (groupitem, _("Group")) + groupitem.connect ("toggled", self.set_groupingscope, 1, sel_combo) + selframehbox.pack_start (groupitem) + + groupitem = gtk.RadioButton (groupitem, _("All")) + groupitem.connect ("toggled", self.set_groupingscope, 2, sel_combo) + selframehbox.pack_start (groupitem) + + selframevbox.pack_start(selframehbox, True, True) + selframevbox.pack_start(sel_combo, True, True) + selframe_align.add(selframevbox) + selframe.add(selframe_align) + contentvbox.pack_start(selframe) + + # Populate the "To..." Section + tgtframe = gtk.Frame() + tgtframe_label = gtk.Label() + tgtframe_label.set_markup(_("To...")) + tgtframe.set_shadow_type(gtk.SHADOW_NONE) + tgtframe.set_label_widget(tgtframe_label) + tgtframe_align = gtk.Alignment(0, 0, 1, 1) + tgtframe_align.set_padding(0, 0, 12, 0) + tgtframevbox = gtk.VBox () + + # Populate the Combo with existing group names (None not needed) + tgt_comboentry = gtk.combo_box_entry_new_text() + for grp in grplist: + tgt_comboentry.append_text(grp) + + tgtframevbox.pack_start(tgt_comboentry, True, True) + + tgtframe_align.add(tgtframevbox) + tgtframe.add(tgtframe_align) + contentvbox.pack_start(tgtframe) + okbut = gtk.Button (stock=gtk.STOCK_OK) canbut = gtk.Button (stock=gtk.STOCK_CANCEL) - - entrybox.pack_start (label, False, True) - entrybox.pack_start (entry, True, True) - hbox.pack_end (okbut, False, False) - hbox.pack_end (canbut, False, False) - vbox.pack_start (entrybox, False, True) - vbox.pack_start (hbox, False, True) - + hbuttonbox = gtk.HButtonBox() + hbuttonbox.set_layout(gtk.BUTTONBOX_END) + hbuttonbox.pack_start (canbut, True, True) + hbuttonbox.pack_start (okbut, True, True) + + vbox.pack_start (contentvbox, False, True) + vbox.pack_end (hbuttonbox, False, True) + canbut.connect ("clicked", lambda kill: win.destroy()) - okbut.connect ("clicked", self.do_create_group, win, entry) - entry.connect ("activate", self.do_create_group, win, entry) - + okbut.connect ("clicked", self.do_create_group, win, sel_combo, tgt_comboentry) + tgt_comboentry.child.connect ("activate", self.do_create_group, win, sel_combo, tgt_comboentry) + + tgt_comboentry.grab_focus() win.show_all () - def do_create_group (self, widget, window, entry): - name = entry.get_text () - if name not in self.terminator.groupings: - self.terminator.groupings.append (name) - self.set_group (None, name) + def set_groupingscope(self, widget, scope=None, sel_combo=None): + if widget.get_active(): + self.groupingscope = scope + if self.groupingscope == 1: + sel_combo.set_sensitive(True) + else: + sel_combo.set_sensitive(False) + def do_create_group (self, widget, window, src, tgt): + tgt_name = tgt.child.get_text() + try: + src_name = src.get_active_text() + except: + src_name = None + + if tgt_name == "" or (self.groupingscope == 1 and src_name == None): + return False + + if tgt_name not in self.terminator.groupings: + self.terminator.groupings.append (tgt_name) + + if self.groupingscope == 2: + for term in self.terminator.term_list: + term.set_group (None, tgt_name) + elif self.groupingscope == 1: + for term in self.terminator.term_list: + if term._group == src_name or (src_name == "*No Group*" and term._group == None): + term.set_group (None, tgt_name) + else: + self.set_group (None, tgt_name) + window.destroy () def set_group (self, item, data): From 6cc744dc19eabd73d696eb1c0db9015e3675a6a9 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Tue, 13 Jan 2009 22:10:28 +0100 Subject: [PATCH 12/26] Tiny additional run of group_hoover, when tickbox is activated. --- terminatorlib/terminatorterm.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 2065468a..d1a8e8ff 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -708,6 +708,8 @@ text/plain def do_autocleangroups_toggle (self): self.terminator.autocleangroups = not self.terminator.autocleangroups + if self.terminator.autocleangroups: + self.terminator.group_hoover() def do_scrollbar_toggle (self): self.toggle_widget_visibility (self._scrollbar) From 7fa0ddede099a62e3dc2f166cd9e18baaba4281c Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Wed, 14 Jan 2009 01:55:46 +0100 Subject: [PATCH 13/26] Slightly fudge-flavoured fix for the positioning of the 'Assign to' window. Stops it appear all over. Prob. better as proper dialog. --- terminatorlib/terminatorterm.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index d1a8e8ff..05c1cd26 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1332,6 +1332,22 @@ text/plain tgt_comboentry.child.connect ("activate", self.do_create_group, win, sel_combo, tgt_comboentry) tgt_comboentry.grab_focus() + + # Center it over the current terminal (not perfect?!?) + # This could be replaced by a less bothersome dialog, but then that would + # center over the window, not the terminal + screen_w = gtk.gdk.screen_width() + screen_h = gtk.gdk.screen_height() + local_x, local_y = self.allocation.x, self.allocation.y + local_w, local_h = self.allocation.width, self.allocation.height + window_x, window_y = self.get_window().get_origin() + x = window_x + local_x + y = window_y + local_y + win.realize() + new_x = min(max(0, x+(local_w/2)-(win.allocation.width/2)), screen_w-win.allocation.width) + new_y = min(max(0, y+(local_h/2)-(win.allocation.height/2)), screen_h-win.allocation.height) + win.move(new_x, new_y) + win.show_all () def set_groupingscope(self, widget, scope=None, sel_combo=None): From a55fb5c70ecfaab7e03b90381629f66ceb9e65c9 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Wed, 14 Jan 2009 01:59:09 +0100 Subject: [PATCH 14/26] Small change to stop the radio buttons of the 'Assign to' window flying about on resize. It just looks silly\! --- terminatorlib/terminatorterm.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 05c1cd26..1c87aa3e 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1280,15 +1280,15 @@ text/plain groupitem = gtk.RadioButton (groupitem, _("Terminal")) groupitem.set_active (True) groupitem.connect ("toggled", self.set_groupingscope, 0, sel_combo) - selframehbox.pack_start (groupitem) + selframehbox.pack_start (groupitem, False) groupitem = gtk.RadioButton (groupitem, _("Group")) groupitem.connect ("toggled", self.set_groupingscope, 1, sel_combo) - selframehbox.pack_start (groupitem) + selframehbox.pack_start (groupitem, False) groupitem = gtk.RadioButton (groupitem, _("All")) groupitem.connect ("toggled", self.set_groupingscope, 2, sel_combo) - selframehbox.pack_start (groupitem) + selframehbox.pack_start (groupitem, False) selframevbox.pack_start(selframehbox, True, True) selframevbox.pack_start(sel_combo, True, True) From 2c50a3b326e9027b4422b255a6d1fd7d8f9b1626 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Wed, 14 Jan 2009 12:21:31 +0100 Subject: [PATCH 15/26] Update the config man page with parameters for titlebar colours. --- doc/terminator_config.5 | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/doc/terminator_config.5 b/doc/terminator_config.5 index 3ee09be8..c102a244 100644 --- a/doc/terminator_config.5 +++ b/doc/terminator_config.5 @@ -93,6 +93,30 @@ Default value: \fBright\fR If true, a titlebar will be drawn for each terminal which shows the current title of that terminal. Default value: \fBTrue\fR .TP +.B title_tx_txt_color +Sets the colour of the text shown in the titlebar of the active terminal. +Default value: \fB#FFFFFF\fR +.TP +.B title_tx_bg_color +Sets the colour of the background of the titlebar in the active terminal. +Default value: \fB#C80003\fR +.TP +.B title_rx_txt_color +Sets the colour of the text shown in the titlebar of any terminal that \fBwill\fR receive input from the active terminal. +Default value: \fB#FFFFFF\fR +.TP +.B title_rx_bg_color +Sets the colour of the background of the titlebar of any terminal that \fBwill\fR receive input from the active terminal. +Default value: \fB#0076C9\fR +.TP +.B title_ia_txt_color +Sets the colour of the text shown in the titlebar of any terminal that will \fBnot\fR receive input from the active terminal. +Default value: \fB#000000\fR +.TP +.B title_ia_bg_color +Sets the colour of the background of the titlebar of any terminal that will \fBnot\fR receive input from the active terminal. +Default value: \fB#C0BEBF\fR +.TP .B titletips If true, a tooltip will be available for each terminal which shows the current title of that terminal. Default value: \fBFalse\fR From f97d1c49f80bb178b28be6aa21616c24cdd4cd1d Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Wed, 14 Jan 2009 13:36:32 +0100 Subject: [PATCH 16/26] Fix middle-click paste in broadcast mode into terminal with no group. Wasn't sent to other terms. Plus: slight reorg of get_target_terms --- terminatorlib/terminatorterm.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 1c87aa3e..dd6c1bef 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -326,17 +326,16 @@ text/plain dbg ('Drag drop on %s'%parent) def get_target_terms(self): - if self.terminator.groupsend == 0: - return [self] if self.terminator.groupsend == 2: return self.terminator.term_list - if self.terminator.groupsend == 1: + elif self.terminator.groupsend == 1: term_subset = [] for term in self.terminator.term_list: if term == self or (term._group != None and term._group == self._group): term_subset.append(term) return term_subset - return None + else: + return [self] def on_drag_data_received(self, widget, drag_context, x, y, selection_data, info, time, data): dbg ("Drag Data Received") @@ -690,7 +689,7 @@ text/plain # Left mouse button should transfer focus to this vte widget # we also need to give focus on the widget where the paste occured if event.button in (1 ,2): - if event.button == 2 and self._group: + if event.button == 2: self.paste_clipboard (True) return True self._vte.grab_focus () From 775030ba8586297d6e7a314d99bc32c8b5653f93 Mon Sep 17 00:00:00 2001 From: Stephen Boddy Date: Wed, 14 Jan 2009 16:16:01 +0100 Subject: [PATCH 17/26] Kill last vestage of the single group icon. --- data/icons/16x16/actions/terminator_groups.png | Bin 277 -> 0 bytes terminatorlib/terminatorterm.py | 7 ++++++- 2 files changed, 6 insertions(+), 1 deletion(-) delete mode 100644 data/icons/16x16/actions/terminator_groups.png diff --git a/data/icons/16x16/actions/terminator_groups.png b/data/icons/16x16/actions/terminator_groups.png deleted file mode 100644 index 7a7da94a6fc72c72bd96473ae0c2f533d6f809b3..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 277 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPggaMs86vBacNdW&njGOI#yLobz*Y zQ}ap~oQqNuOHxx5$}>wc6x=<11Hv2m#DR(mJY5_^EKVoeY{<7~R&D5PbUMJ4Y++&f zPd)T=W9@Ir$O)`|1_sF*n-YGUJ`hkQ6kI;tvUHCD4^P5D4uc#9sRS0@1JhQ>%#o4g zdvp7|hrIp+<{Lt{Kssl7c$VJy;j=_7w&ZZc1?HZR=>|cw<}&(MD_;`$`eqZ*ZU#?R KKbLh*2~7Z?K3O3E diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index dd6c1bef..fe8789af 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -75,7 +75,12 @@ class TerminatorTerm (gtk.VBox): self._termbox = gtk.HBox () self._termbox.show() self._titlegroupimg = gtk.Image() - self._titlegroupimg.set_from_icon_name (APP_NAME + '_groups', gtk.ICON_SIZE_MENU) + if self.terminator.groupsend == 2: + self._titlegroupimg.set_from_icon_name (APP_NAME + '_active_broadcast_all', gtk.ICON_SIZE_MENU) + elif self.terminator.groupsend == 1: + self._titlegroupimg.set_from_icon_name (APP_NAME + '_active_broadcast_group', gtk.ICON_SIZE_MENU) + else: + self._titlegroupimg.set_from_icon_name (APP_NAME + '_active_broadcast_off', gtk.ICON_SIZE_MENU) self._title = gtk.Label() self._title.show() self._titlegroup = gtk.Label() From 2a5cffb63f0e9a741eda9ba41444b00b95675fcc Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 13 Jul 2009 23:37:23 +0100 Subject: [PATCH 18/26] remove the Group context menu --- terminatorlib/terminatorterm.py | 8 -------- 1 file changed, 8 deletions(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 50b46ee9..11f4457e 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1342,14 +1342,6 @@ text/plain item = gtk.MenuItem () menu.append (item) - item = gtk.MenuItem (_("_Group")) - menu.append (item) - submenu = gtk.Menu () - item.set_submenu (submenu) - self.populate_grouping_menu (submenu) - if len (self.terminator.term_list) == 1: - item.set_sensitive (False) - menu.show_all () menu.popup (None, None, None, button, time) From 715bb639e2648ec31c65e595634d42ce14423495 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 13 Jul 2009 23:53:57 +0100 Subject: [PATCH 19/26] put the group image and label into sufficient gtk boxes that they can match the styling of the rest of the titlebar --- terminatorlib/terminatorterm.py | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 11f4457e..60347d4c 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -51,6 +51,8 @@ class TerminatorTermTitle (gtk.EventBox): _group = None _separator = None _hbox = None + _ebox = None + _grouphbox = None _icon = None _parent = None _unzoomed_title = None @@ -62,6 +64,8 @@ class TerminatorTermTitle (gtk.EventBox): self._title = gtk.Label () self._group = gtk.Label () self._separator = gtk.VSeparator () + self._ebox = gtk.EventBox () + self._grouphbox = gtk.HBox () self._icon = gtk.Image () self._hbox = gtk.HBox () @@ -76,8 +80,12 @@ class TerminatorTermTitle (gtk.EventBox): self.set_from_icon_name (APP_NAME + \ '_active_broadcast_off', gtk.ICON_SIZE_MENU) - self._hbox.pack_start (self._icon, False, True, 2) - self._hbox.pack_start (self._group, False, True, 2) + self._grouphbox.pack_start (self._icon, False, True, 2) + self._grouphbox.pack_start (self._group, False, True, 2) + self._ebox.add (self._grouphbox) + self._ebox.show_all () + + self._hbox.pack_start (self._ebox, False, True, 2) self._hbox.pack_start (self._separator, False, True, 2) self._hbox.pack_start (self._title, True, True) self.add (self._hbox) @@ -89,6 +97,9 @@ class TerminatorTermTitle (gtk.EventBox): self.connect ("button-release-event", self.on_clicked) + def connect_icon (self, func): + self._ebox.connect ("button-release-event", func) + def on_clicked (self, widget, event): if self._parent is not None: self._parent._vte.grab_focus () @@ -124,6 +135,7 @@ class TerminatorTermTitle (gtk.EventBox): def set_background_color (self, color): """Set the background color of the titlebar""" self.modify_bg (gtk.STATE_NORMAL, color) + self._ebox.modify_bg (gtk.STATE_NORMAL, color) def set_foreground_color (self, color): """Set the foreground color of the titlebar""" @@ -297,7 +309,7 @@ class TerminatorTerm (gtk.VBox): self._vte.connect ("resize-window", self.on_resize_window) self._vte.connect ("size-allocate", self.on_vte_size_allocate) - self._titlebox.connect ("button-release-event", self.on_group_button_press) + self._titlebox.connect_icon (self.on_group_button_press) exit_action = self.conf.exit_action if exit_action == "restart": From f8dcd9d8460760c2fb269e21a52d02ec30899396 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 13 Jul 2009 23:54:18 +0100 Subject: [PATCH 20/26] Rewording --- terminatorlib/terminatorterm.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 60347d4c..043f3b5f 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1512,7 +1512,7 @@ text/plain # Populate the Combo with existing group names (None at the top) sel_combo = gtk.combo_box_new_text() - sel_combo.append_text("*No Group*") + sel_combo.append_text(_("Terminals with no group")) for grp in grplist: sel_combo.append_text(grp) sel_combo.set_sensitive(False) From 08775aececd0063e41ab170ac26389be37bfca10 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 13 Jul 2009 23:54:31 +0100 Subject: [PATCH 21/26] remove spurious menu separator --- terminatorlib/terminatorterm.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 043f3b5f..b834e3ba 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1351,9 +1351,6 @@ text/plain self._do_encoding_items (menu) - item = gtk.MenuItem () - menu.append (item) - menu.show_all () menu.popup (None, None, None, button, time) From 73cd0bb2bcb771c61e085af6320336531f3b8920 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Mon, 13 Jul 2009 23:55:23 +0100 Subject: [PATCH 22/26] remove superfluous colour setting code since the titlebar is integrated --- terminatorlib/terminatorterm.py | 6 ------ 1 file changed, 6 deletions(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index b834e3ba..dbb98b1b 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1812,8 +1812,6 @@ text/plain term._titlebox.set_foreground_color(gtk.gdk.color_parse (self.conf.title_rx_txt_color)) term._titlebox.set_background_color(gtk.gdk.color_parse (self.conf.title_rx_bg_color)) term._titlebox.set_from_icon_name(APP_NAME + '_receive_on', gtk.ICON_SIZE_MENU) - term._titlebox.set_foreground_color(gtk.gdk.color_parse (self.conf.title_rx_txt_color)) - term._titlebox.set_background_color(gtk.gdk.color_parse (self.conf.title_rx_bg_color)) elif term != self and term._group == None or term._group != self._group: # Not active, group is not none, not in active's group if self.terminator.groupsend == 2: @@ -1824,12 +1822,8 @@ text/plain term._titlebox.set_foreground_color(gtk.gdk.color_parse (self.conf.title_ia_txt_color)) term._titlebox.set_background_color(gtk.gdk.color_parse (self.conf.title_ia_bg_color)) term._titlebox.set_from_icon_name(APP_NAME + '_receive_off', gtk.ICON_SIZE_MENU) - term._titlebox.set_foreground_color(gtk.gdk.color_parse (self.conf.title_ia_txt_color)) - term._titlebox.set_background_color(gtk.gdk.color_parse (self.conf.title_ia_bg_color)) else: term._titlebox.set_foreground_color(gtk.gdk.color_parse (self.conf.title_tx_txt_color)) - term._titlebox.set_foreground_color(gtk.gdk.color_parse (self.conf.title_tx_txt_color)) - term._titlebox.set_background_color(gtk.gdk.color_parse (self.conf.title_tx_bg_color)) term._titlebox.set_background_color(gtk.gdk.color_parse (self.conf.title_tx_bg_color)) if self.terminator.groupsend == 2: term._titlebox.set_from_icon_name(APP_NAME + '_active_broadcast_all', gtk.ICON_SIZE_MENU) From dc9fc3c7cac81997a6fb3ae7c58080c37c2a1dac Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 14 Jul 2009 00:04:30 +0100 Subject: [PATCH 23/26] improve some wording and fix the grouping of ungrouped terminals --- terminatorlib/terminatorterm.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index dbb98b1b..aefaff94 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1378,7 +1378,7 @@ text/plain def populate_grouping_menu (self, widget): groupitem = None - item = gtk.MenuItem (_("Assign to...")) + item = gtk.MenuItem (_("Assign to group...")) item.connect ("activate", self.create_group) widget.append (item) @@ -1400,7 +1400,7 @@ text/plain widget.append (item) if self._group != None: - item = gtk.MenuItem (_("Remove %s group ") % (self._group)) + item = gtk.MenuItem (_("Remove group %s")) % (self._group) item.connect ("activate", self.ungroup, self._group) widget.append (item) @@ -1602,6 +1602,7 @@ text/plain tgt_name = tgt.child.get_text() try: src_name = src.get_active_text() + src_id = src.get_active() except: src_name = None @@ -1616,7 +1617,7 @@ text/plain term.set_group (None, tgt_name) elif self.groupingscope == 1: for term in self.terminator.term_list: - if term._group == src_name or (src_name == "*No Group*" and term._group == None): + if term._group == src_name or (src_id == 0 and term._group == None): term.set_group (None, tgt_name) else: self.set_group (None, tgt_name) From b044cd385c8aec37f0184c05ab3c6d27d34530a4 Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 14 Jul 2009 00:14:21 +0100 Subject: [PATCH 24/26] fix wording harder. fix group removal and grouping all --- terminatorlib/terminatorterm.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index aefaff94..6791b448 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1400,7 +1400,7 @@ text/plain widget.append (item) if self._group != None: - item = gtk.MenuItem (_("Remove group %s")) % (self._group) + item = gtk.MenuItem (_("Remove group %s") % (self._group)) item.connect ("activate", self.ungroup, self._group) widget.append (item) @@ -1426,7 +1426,7 @@ text/plain item = gtk.MenuItem () widget.append (item) - item = gtk.ImageMenuItem (_("Close %s group") % (self._group)) + item = gtk.ImageMenuItem (_("Close group %s") % (self._group)) grp_close_img = gtk.Image() grp_close_img.set_from_stock(gtk.STOCK_CLOSE, 1) item.set_image (grp_close_img) @@ -1645,7 +1645,7 @@ text/plain else: # We were previously in a group self._group = data - if data == None: + if data is None: # We have been removed from a group if not self.conf.titlebars and not self._want_titlebar: self._titlebox.hide () @@ -1655,16 +1655,17 @@ text/plain self.terminator.groupsend = data def ungroup (self, widget, data): - print "UNGROUP HALP" - # ??.set_group (None, None) + for term in self.terminator.term_list: + if term._group == data: + term.set_group (None, None) self.terminator.group_hoover () def group_all (self, widget): allname = _("All") self.add_group(allname) for term in self.terminator.term_list: - if term._group == data: - term.set_group (None, None) + if term._group is None: + term.set_group (None, allname) self.terminator.group_hoover () def ungroup_all (self, widget): From 05e532309777f4d6ddc922e8fca6b66c388e2dbd Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 14 Jul 2009 00:15:34 +0100 Subject: [PATCH 25/26] fix the group_all hotkey --- terminatorlib/terminatorterm.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index 6791b448..c7987bdf 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1664,8 +1664,7 @@ text/plain allname = _("All") self.add_group(allname) for term in self.terminator.term_list: - if term._group is None: - term.set_group (None, allname) + term.set_group (None, allname) self.terminator.group_hoover () def ungroup_all (self, widget): From d9e51741406351fbb0ac7ae79c07a4932e3e631d Mon Sep 17 00:00:00 2001 From: Chris Jones Date: Tue, 14 Jul 2009 00:25:07 +0100 Subject: [PATCH 26/26] fix icons --- terminatorlib/terminatorterm.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/terminatorlib/terminatorterm.py b/terminatorlib/terminatorterm.py index c7987bdf..c8d1d48b 100755 --- a/terminatorlib/terminatorterm.py +++ b/terminatorlib/terminatorterm.py @@ -1808,30 +1808,30 @@ text/plain if self.terminator.groupsend == 0: term._titlebox.set_foreground_color(gtk.gdk.color_parse (self.conf.title_ia_txt_color)) term._titlebox.set_background_color(gtk.gdk.color_parse (self.conf.title_ia_bg_color)) - term._titlebox.set_from_icon_name(APP_NAME + '_receive_off', gtk.ICON_SIZE_MENU) + term._titlebox.set_from_icon_name('_receive_off', gtk.ICON_SIZE_MENU) else: term._titlebox.set_foreground_color(gtk.gdk.color_parse (self.conf.title_rx_txt_color)) term._titlebox.set_background_color(gtk.gdk.color_parse (self.conf.title_rx_bg_color)) - term._titlebox.set_from_icon_name(APP_NAME + '_receive_on', gtk.ICON_SIZE_MENU) + term._titlebox.set_from_icon_name('_receive_on', gtk.ICON_SIZE_MENU) elif term != self and term._group == None or term._group != self._group: # Not active, group is not none, not in active's group if self.terminator.groupsend == 2: term._titlebox.set_foreground_color(gtk.gdk.color_parse (self.conf.title_rx_txt_color)) term._titlebox.set_background_color(gtk.gdk.color_parse (self.conf.title_rx_bg_color)) - term._titlebox.set_from_icon_name(APP_NAME + '_receive_on', gtk.ICON_SIZE_MENU) + term._titlebox.set_from_icon_name('_receive_on', gtk.ICON_SIZE_MENU) else: term._titlebox.set_foreground_color(gtk.gdk.color_parse (self.conf.title_ia_txt_color)) term._titlebox.set_background_color(gtk.gdk.color_parse (self.conf.title_ia_bg_color)) - term._titlebox.set_from_icon_name(APP_NAME + '_receive_off', gtk.ICON_SIZE_MENU) + term._titlebox.set_from_icon_name('_receive_off', gtk.ICON_SIZE_MENU) else: term._titlebox.set_foreground_color(gtk.gdk.color_parse (self.conf.title_tx_txt_color)) term._titlebox.set_background_color(gtk.gdk.color_parse (self.conf.title_tx_bg_color)) if self.terminator.groupsend == 2: - term._titlebox.set_from_icon_name(APP_NAME + '_active_broadcast_all', gtk.ICON_SIZE_MENU) + term._titlebox.set_from_icon_name('_active_broadcast_all', gtk.ICON_SIZE_MENU) elif self.terminator.groupsend == 1: - term._titlebox.set_from_icon_name(APP_NAME + '_active_broadcast_group', gtk.ICON_SIZE_MENU) + term._titlebox.set_from_icon_name('_active_broadcast_group', gtk.ICON_SIZE_MENU) else: - term._titlebox.set_from_icon_name(APP_NAME + '_active_broadcast_off', gtk.ICON_SIZE_MENU) + term._titlebox.set_from_icon_name('_active_broadcast_off', gtk.ICON_SIZE_MENU) return def on_vte_focus_out(self, vte, event):