Always set some sort of title; if vte's title is None, use the command the terminal is running.
Add an option to spawn a telnet instance to the local debug server in a tab. newtab() and splitaxis() now support a command argument for this.
This commit is contained in:
parent
6a14445c74
commit
4c0e500c7b
|
@ -152,7 +152,8 @@ See the following bug report for more details:
|
|||
import threading
|
||||
|
||||
gtk.gdk.threads_init()
|
||||
debugserver.spawn(locals())
|
||||
(debugthread, debugsvr) = debugserver.spawn(locals())
|
||||
term.debugaddress = debugsvr.server_address
|
||||
|
||||
gtk.main()
|
||||
|
||||
|
|
|
@ -139,7 +139,7 @@ class TerminatorConsole(code.InteractiveConsole):
|
|||
data = self.server.socketio.read(1)
|
||||
ddbg('raw_input: char=%s' % repr(data))
|
||||
if data == LF or data == '\006':
|
||||
buf = self.parse_telnet(buf + data).lstrip()
|
||||
buf = self.parse_telnet(buf + data)
|
||||
if buf != '':
|
||||
return buf
|
||||
elif data == '\004' or data == '': # ^D
|
||||
|
|
|
@ -95,6 +95,7 @@ class Terminator:
|
|||
self._maximised = False
|
||||
self._fullscreen = False
|
||||
self._f11_modifier = False
|
||||
self.debugaddress = None
|
||||
self.term_list = []
|
||||
stores = []
|
||||
stores.append (config.TerminatorConfValuestoreRC ())
|
||||
|
@ -448,13 +449,13 @@ class Terminator:
|
|||
dbg("[ERROR] unsupported class %s in _notebook_last_term" % child.__class__.__name__)
|
||||
return None
|
||||
|
||||
def newtab(self,widget, toplevel = False):
|
||||
def newtab(self,widget, toplevel = False, command = None):
|
||||
if self._zoomed:
|
||||
# We don't want to add a new tab while we are zoomed in on a terminal
|
||||
dbg ("newtab function called, but Terminator was in zoomed terminal mode.")
|
||||
return
|
||||
|
||||
terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd())
|
||||
terminal = TerminatorTerm (self, self.profile, command, widget.get_cwd())
|
||||
#only one term, we don't show the title
|
||||
terminal._titlebox.hide()
|
||||
if self.conf.extreme_tabs and not toplevel:
|
||||
|
@ -537,7 +538,7 @@ class Terminator:
|
|||
self.term_list.insert (index + 1, terminal)
|
||||
return (True)
|
||||
|
||||
def splitaxis (self, widget, vertical=True):
|
||||
def splitaxis (self, widget, vertical=True, command=None):
|
||||
""" Split the provided widget on the horizontal or vertical axis. """
|
||||
if self._zoomed:
|
||||
# We don't want to split the terminal while we are in zoomed mode
|
||||
|
@ -546,7 +547,7 @@ class Terminator:
|
|||
|
||||
# create a new terminal and parent pane.
|
||||
dbg ('SEGBUG: Creating TerminatorTerm')
|
||||
terminal = TerminatorTerm (self, self.profile, None, widget.get_cwd())
|
||||
terminal = TerminatorTerm (self, self.profile, command, widget.get_cwd())
|
||||
dbg ('SEGBUG: Created TerminatorTerm')
|
||||
pos = vertical and "right" or "bottom"
|
||||
dbg ('SEGBUG: Position is: %s'%pos)
|
||||
|
|
|
@ -477,7 +477,10 @@ text/plain
|
|||
envv = [], loglastlog = login, logwtmp = update_records,
|
||||
logutmp = update_records, directory=self.cwd)
|
||||
|
||||
dbg ('SEGBUG: Forked command')
|
||||
dbg ('SEGBUG: Forked command')
|
||||
|
||||
self.on_vte_title_change(self._vte) # Force an initial update of our titles
|
||||
|
||||
if self._pid == -1:
|
||||
err (_('Unable to start shell: ') + shell)
|
||||
return (-1)
|
||||
|
@ -852,7 +855,6 @@ text/plain
|
|||
|
||||
item.connect ("activate", lambda menu_item: self.terminator.splitaxis (self, False))
|
||||
menu.append (item)
|
||||
|
||||
item = gtk.ImageMenuItem (str_vert)
|
||||
item_image = gtk.Image ()
|
||||
item_image.set_from_icon_name (APP_NAME + '_vert', gtk.ICON_SIZE_MENU)
|
||||
|
@ -860,11 +862,17 @@ text/plain
|
|||
|
||||
item.connect ("activate", lambda menu_item: self.terminator.splitaxis (self, True))
|
||||
menu.append (item)
|
||||
|
||||
|
||||
item = gtk.MenuItem (_("Open _Tab"))
|
||||
item.connect ("activate", lambda menu_item: self.terminator.newtab (self))
|
||||
menu.append (item)
|
||||
|
||||
if self.terminator.debugaddress:
|
||||
item = gtk.MenuItem (_("Open _Debug Tab"))
|
||||
item.connect ("activate", lambda menu_item: self.terminator.newtab (self, command = "telnet %s" % ' '.join([str(x) for x in self.terminator.debugaddress])))
|
||||
menu.append (item)
|
||||
|
||||
|
||||
if self.conf.extreme_tabs:
|
||||
item = gtk.MenuItem (_("Open Top Level Tab"))
|
||||
item.connect ("activate", lambda menu_item: self.terminator.newtab (self, True))
|
||||
|
@ -960,18 +968,25 @@ text/plain
|
|||
radioitem.connect ('activate', self.on_encoding_change, encoding[1])
|
||||
submenu.append (radioitem)
|
||||
|
||||
def get_vte_window_title(self, vte):
|
||||
title = vte.get_window_title ()
|
||||
if title is None:
|
||||
title = str(self.command)
|
||||
return title
|
||||
|
||||
def on_vte_title_change(self, vte):
|
||||
title = self.get_vte_window_title(vte)
|
||||
if self.conf.titletips:
|
||||
vte.set_property ("has-tooltip", True)
|
||||
vte.set_property ("tooltip-text", vte.get_window_title ())
|
||||
vte.set_property ("tooltip-text", title)
|
||||
#set the title anyhow, titlebars setting only show/hide the label
|
||||
self._title.set_text(vte.get_window_title ())
|
||||
self.terminator.set_window_title("%s - %s" % (vte.get_window_title(), APP_NAME.capitalize()))
|
||||
self._title.set_text(title)
|
||||
self.terminator.set_window_title("%s - %s" % (title, APP_NAME.capitalize()))
|
||||
notebookpage = self.terminator.get_first_notebook_page(vte)
|
||||
while notebookpage != None:
|
||||
if notebookpage[0].get_tab_label(notebookpage[1]):
|
||||
label = notebookpage[0].get_tab_label(notebookpage[1])
|
||||
label.set_title(vte.get_window_title ())
|
||||
label.set_title(title)
|
||||
notebookpage[0].set_tab_label(notebookpage[1], label)
|
||||
notebookpage = self.terminator.get_first_notebook_page(notebookpage[0])
|
||||
|
||||
|
@ -986,15 +1001,15 @@ text/plain
|
|||
return
|
||||
|
||||
def on_vte_focus(self, vte):
|
||||
if vte.get_window_title ():
|
||||
self.terminator.set_window_title("%s - %s" % (vte.get_window_title(), APP_NAME.capitalize()))
|
||||
notebookpage = self.terminator.get_first_notebook_page(vte)
|
||||
while notebookpage != None:
|
||||
if notebookpage[0].get_tab_label(notebookpage[1]):
|
||||
label = notebookpage[0].get_tab_label(notebookpage[1])
|
||||
label.set_title(vte.get_window_title ())
|
||||
notebookpage[0].set_tab_label(notebookpage[1], label)
|
||||
notebookpage = self.terminator.get_first_notebook_page(notebookpage[0])
|
||||
title = self.get_vte_window_title(vte)
|
||||
self.terminator.set_window_title("%s - %s" % (title, APP_NAME.capitalize()))
|
||||
notebookpage = self.terminator.get_first_notebook_page(vte)
|
||||
while notebookpage != None:
|
||||
if notebookpage[0].get_tab_label(notebookpage[1]):
|
||||
label = notebookpage[0].get_tab_label(notebookpage[1])
|
||||
label.set_title(title)
|
||||
notebookpage[0].set_tab_label(notebookpage[1], label)
|
||||
notebookpage = self.terminator.get_first_notebook_page(notebookpage[0])
|
||||
|
||||
def destroy(self):
|
||||
self._vte.destroy()
|
||||
|
|
Loading…
Reference in New Issue