Demonstrate how we can change a global property without a restart

This commit is contained in:
Chris Jones 2008-11-12 11:36:18 +00:00
parent a068372228
commit e01d69346f
2 changed files with 13 additions and 1 deletions

View File

@ -245,11 +245,12 @@ class ProfileEditor:
value = ':'.join (valuebits) value = ':'.join (valuebits)
else: else:
value = None value = None
err("skipping unknown thingy: %s" % property) err("skipping unknown property: %s" % property)
values[property] = value values[property] = value
has_changed = False has_changed = False
changed = []
for source in self.term.conf.sources: for source in self.term.conf.sources:
if isinstance (source, TerminatorConfValuestoreRC): if isinstance (source, TerminatorConfValuestoreRC):
for property in values: for property in values:
@ -258,9 +259,14 @@ class ProfileEditor:
print "%s changed from %s to %s" % (property, self.source_get_value(property), values[property]) print "%s changed from %s to %s" % (property, self.source_get_value(property), values[property])
source.values[property] = values[property] source.values[property] = values[property]
has_changed = True has_changed = True
changed.append(property)
except KeyError: except KeyError:
pass pass
if has_changed: if has_changed:
for changer in changed:
if changer == "fullscreen":
self.term.fullscreen_absolute(values[changer])
self.term.reconfigure_vtes() self.term.reconfigure_vtes()
def cancel (self, data): def cancel (self, data):

View File

@ -315,6 +315,12 @@ class Terminator:
else: else:
self.window.fullscreen () self.window.fullscreen ()
def fullscreen_absolute (self, fullscreen):
""" Explicitly set the fullscreen state of the window.
"""
if self._fullscreen != fullscreen:
self.fullscreen_toggle ()
def on_window_state_changed (self, window, event): def on_window_state_changed (self, window, event):
self._fullscreen = bool (event.new_window_state & gtk.gdk.WINDOW_STATE_FULLSCREEN) self._fullscreen = bool (event.new_window_state & gtk.gdk.WINDOW_STATE_FULLSCREEN)
self._maximised = bool (event.new_window_state & gtk.gdk.WINDOW_STATE_MAXIMIZED) self._maximised = bool (event.new_window_state & gtk.gdk.WINDOW_STATE_MAXIMIZED)