Refactor the creation of a new Window/Terminal pair and joining them, into Terminator, and call it from the top level terminator script

This commit is contained in:
Chris Jones 2010-01-29 23:41:18 +00:00
parent 1236a85370
commit ece0cfdde0
2 changed files with 14 additions and 8 deletions

View File

@ -51,12 +51,7 @@ if __name__ == '__main__':
MAKER = Factory()
TERMINATOR = Terminator()
TERMINATOR.reconfigure()
WINDOW = MAKER.make('Window')
TERMINAL = MAKER.make('Terminal')
WINDOW.add(TERMINAL)
WINDOW.show()
TERMINAL.spawn_child()
TERMINATOR.new_window()
if OPTIONS.debug > 2:
import terminatorlib.debugserver as debugserver

View File

@ -8,8 +8,8 @@ import gtk
from borg import Borg
from config import Config
from keybindings import Keybindings
from util import dbg, err, get_top_window
import util
from util import dbg, err
from factory import Factory
class Terminator(Borg):
"""master object for the application"""
@ -90,6 +90,17 @@ class Terminator(Borg):
dbg('Terminator::deregister_terminal: %d terminals remain' %
len(self.terminals))
def new_window(self):
"""Create a window with a Terminal in it"""
maker = Factory()
window = maker.make('Window')
terminal = maker.make('Terminal')
window.add(terminal)
window.show()
terminal.spawn_child()
return(window, terminal)
def reconfigure(self):
"""Update configuration for the whole application"""