Add layout save and load of last active term for windows without tabs
This commit is contained in:
parent
e66a522555
commit
0272c78739
@ -281,7 +281,10 @@ the %s will also close all terminals within it.') % (reqtype, reqtype))
|
||||
labels.append(label.get_custom_label())
|
||||
layout['labels'] = labels
|
||||
layout['active_page'] = self.get_current_page()
|
||||
|
||||
else:
|
||||
if hasattr(self, 'last_active_term') and self.last_active_term is not None:
|
||||
layout['last_active_term'] = self.last_active_term
|
||||
|
||||
if mytype == 'Window':
|
||||
if self.uuid == self.terminator.last_active_window:
|
||||
layout['last_active_window'] = True
|
||||
|
@ -1088,7 +1088,13 @@ class Terminal(gtk.VBox):
|
||||
self.vte.set_colors(self.fgcolor_active, self.bgcolor,
|
||||
self.palette_active)
|
||||
self.set_cursor_color()
|
||||
self.terminator.last_focused_term = self
|
||||
if not self.terminator.doing_layout:
|
||||
self.terminator.last_focused_term = self
|
||||
if self.get_toplevel().is_child_notebook():
|
||||
# TODO: Will need some code for the tabs active terms to work
|
||||
self.get_toplevel().last_active_term = None
|
||||
else:
|
||||
self.get_toplevel().last_active_term = self.uuid
|
||||
self.emit('focus-in')
|
||||
|
||||
def on_vte_focus_out(self, _widget, _event):
|
||||
|
@ -293,14 +293,25 @@ class Terminator(Borg):
|
||||
"""Layout operations have finished, record that fact"""
|
||||
self.doing_layout = False
|
||||
|
||||
window_last_active_term_mapping={}
|
||||
for window in self.windows:
|
||||
if window.uuid == self.last_active_window:
|
||||
window.show()
|
||||
# TODO: Will need some code for the tabs active terms to work
|
||||
window_last_active_term_mapping[window]=copy.deepcopy(window.last_active_term)
|
||||
|
||||
for terminal in self.terminals:
|
||||
if not terminal.pid:
|
||||
terminal.spawn_child()
|
||||
|
||||
for window in self.windows:
|
||||
if window.last_active_term:
|
||||
# TODO: Will need some code for the tabs active terms to work
|
||||
term = self.find_terminal_by_uuid(window_last_active_term_mapping[window].urn)
|
||||
term.ensure_visible_and_focussed()
|
||||
|
||||
for window in self.windows:
|
||||
if window.uuid == self.last_active_window:
|
||||
window.show()
|
||||
|
||||
def reconfigure(self):
|
||||
"""Update configuration for the whole application"""
|
||||
|
||||
|
@ -5,12 +5,13 @@
|
||||
|
||||
import copy
|
||||
import time
|
||||
import uuid
|
||||
import pygtk
|
||||
pygtk.require('2.0')
|
||||
import gobject
|
||||
import gtk
|
||||
|
||||
from util import dbg, err
|
||||
from util import dbg, err, make_uuid
|
||||
import util
|
||||
from translation import _
|
||||
from version import APP_NAME
|
||||
@ -38,6 +39,7 @@ class Window(Container, gtk.Window):
|
||||
position = None
|
||||
ignore_startup_show = None
|
||||
set_pos_by_ratio = None
|
||||
last_active_term = None
|
||||
|
||||
zoom_data = None
|
||||
|
||||
@ -239,7 +241,17 @@ class Window(Container, gtk.Window):
|
||||
def on_focus_in(self, window, event):
|
||||
"""Focus has entered the window"""
|
||||
self.set_urgency_hint(False)
|
||||
self.terminator.last_active_window = self.uuid
|
||||
term = None
|
||||
if self.is_child_notebook():
|
||||
# TODO: Will need some code for the tabs active terms to work
|
||||
pass
|
||||
else:
|
||||
if isinstance(self.last_active_term, uuid.UUID):
|
||||
term = self.terminator.find_terminal_by_uuid(self.last_active_term.urn)
|
||||
if term:
|
||||
gobject.idle_add(term.ensure_visible_and_focussed)
|
||||
if not self.terminator.doing_layout:
|
||||
self.terminator.last_active_window = self.uuid
|
||||
# FIXME: Cause the terminal titlebars to update here
|
||||
|
||||
def is_child_notebook(self):
|
||||
@ -866,6 +878,9 @@ class Window(Container, gtk.Window):
|
||||
|
||||
self.get_children()[0].create_layout(child)
|
||||
|
||||
if layout.has_key('last_active_term') and layout['last_active_term'] not in ['', None]:
|
||||
self.last_active_term = make_uuid(layout['last_active_term'])
|
||||
|
||||
if layout.has_key('last_active_window') and layout['last_active_window'] == 'True':
|
||||
self.terminator.last_active_window = self.uuid
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user