diff --git a/terminatorlib/container.py b/terminatorlib/container.py index 979f06a0..39a40b5a 100755 --- a/terminatorlib/container.py +++ b/terminatorlib/container.py @@ -6,6 +6,7 @@ import gobject from config import Config +from util import dbg # pylint: disable-msg=R0921 class Container(object): @@ -31,6 +32,7 @@ class Container(object): """Class initialiser""" self.children = [] self.config = Config() + self.state_zoomed = self.states_zoom['none'] def register_signals(self, widget): """Register gobject signals in a way that avoids multiple inheritance""" @@ -65,13 +67,18 @@ class Container(object): """Default unsplitter. This should be implemented by subclasses""" raise NotImplementedError('unsplit') + def add(self, widget): + """Add a widget to the container""" + raise NotImplementedError('add') + def remove(self, widget): """Remove a widget from the container""" raise NotImplementedError('remove') def closeterm(self, widget): """Handle the closure of a terminal""" - if self.state_zoomed != self.states_zoom['normal']: + if self.state_zoomed != self.states_zoom['none']: + dbg('closeterm: current zoomed state is: %s' % self.state_zoomed) self.unzoom(widget) if not self.remove(widget): @@ -86,7 +93,7 @@ class Container(object): def toggle_zoom(self, widget, fontscale = False): """Toggle the existing zoom state""" - if self.state_zoomed != self.states_zoom['normal']: + if self.state_zoomed != self.states_zoom['none']: self.unzoom(widget) else: self.zoom(widget, fontscale) diff --git a/terminatorlib/window.py b/terminatorlib/window.py index 1512ec72..bb787ba1 100755 --- a/terminatorlib/window.py +++ b/terminatorlib/window.py @@ -155,6 +155,16 @@ class Window(Container, gtk.Window): if colormap: self.set_colormap(colormap) + def add(self, widget): + """Add a widget to the window by way of gtk.Window.add()""" + widget.connect('close-term', self.closeterm) + gtk.Window.add(self, widget) + + def remove(self, widget): + """Remove our child widget by way of gtk.Window.remove()""" + gtk.Window.remove(self, widget) + self.destroy() + class WindowTitle(object): """Class to handle the setting of the window title"""