Add keyword arguments to Window.__init__() for command line options

This commit is contained in:
Chris Jones 2010-01-05 12:49:57 +00:00
parent 58fd86486d
commit 9744f3ebb6
2 changed files with 7 additions and 4 deletions

View File

@ -51,7 +51,8 @@ if __name__ == '__main__':
MAKER = Factory()
TERMINATOR = Terminator()
WINDOW = MAKER.make('Window')
WINDOW = MAKER.make('Window', geometry=OPTIONS.geometry,
forcedtitle=OPTIONS.forcedtitle, role=OPTIONS.role)
TERMINAL = MAKER.make('Terminal')
WINDOW.add(TERMINAL)

View File

@ -35,7 +35,7 @@ class Window(Container, gtk.Window):
zoom_data = None
term_zoomed = gobject.property(type=bool, default=False)
def __init__(self):
def __init__(self, geometry=None, forcedtitle=None, role=None):
"""Class initialiser"""
self.terminator = Terminator()
self.terminator.register_window(self)
@ -53,6 +53,8 @@ class Window(Container, gtk.Window):
self.title = WindowTitle(self)
self.title.update()
if forcedtitle is not None:
self.title.force_title(forcedtitle)
def register_callbacks(self):
"""Connect the GTK+ signals we care about"""
@ -125,7 +127,7 @@ class Window(Container, gtk.Window):
"""Make a new tab"""
maker = Factory()
if not maker.isinstance(self.get_child(), 'Notebook'):
notebook = maker.make('Notebook', self)
notebook = maker.make('Notebook', window=self)
self.get_child().newtab()
def on_delete_event(self, window, event, data=None):
@ -310,7 +312,7 @@ class WindowTitle(object):
def force_title(self, newtext):
"""Force a specific title"""
if newtext:
self.set_title(newtext)
self.set_title(None, newtext)
self.forced = True
else:
self.forced = False