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:
parent
1236a85370
commit
ece0cfdde0
|
@ -51,12 +51,7 @@ if __name__ == '__main__':
|
||||||
MAKER = Factory()
|
MAKER = Factory()
|
||||||
TERMINATOR = Terminator()
|
TERMINATOR = Terminator()
|
||||||
TERMINATOR.reconfigure()
|
TERMINATOR.reconfigure()
|
||||||
WINDOW = MAKER.make('Window')
|
TERMINATOR.new_window()
|
||||||
TERMINAL = MAKER.make('Terminal')
|
|
||||||
|
|
||||||
WINDOW.add(TERMINAL)
|
|
||||||
WINDOW.show()
|
|
||||||
TERMINAL.spawn_child()
|
|
||||||
|
|
||||||
if OPTIONS.debug > 2:
|
if OPTIONS.debug > 2:
|
||||||
import terminatorlib.debugserver as debugserver
|
import terminatorlib.debugserver as debugserver
|
||||||
|
|
|
@ -8,8 +8,8 @@ import gtk
|
||||||
from borg import Borg
|
from borg import Borg
|
||||||
from config import Config
|
from config import Config
|
||||||
from keybindings import Keybindings
|
from keybindings import Keybindings
|
||||||
from util import dbg, err, get_top_window
|
from util import dbg, err
|
||||||
import util
|
from factory import Factory
|
||||||
|
|
||||||
class Terminator(Borg):
|
class Terminator(Borg):
|
||||||
"""master object for the application"""
|
"""master object for the application"""
|
||||||
|
@ -90,6 +90,17 @@ class Terminator(Borg):
|
||||||
dbg('Terminator::deregister_terminal: %d terminals remain' %
|
dbg('Terminator::deregister_terminal: %d terminals remain' %
|
||||||
len(self.terminals))
|
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):
|
def reconfigure(self):
|
||||||
"""Update configuration for the whole application"""
|
"""Update configuration for the whole application"""
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue