[pitivi] ui.prefs, ui.dynamic: preference widgets now actually set associated settings, restart warning shown
- From: Edward Hervey <edwardrv src gnome org>
- To: svn-commits-list gnome org
- Subject: [pitivi] ui.prefs, ui.dynamic: preference widgets now actually set associated settings, restart warning shown
- Date: Thu, 30 Apr 2009 12:19:25 -0400 (EDT)
commit 51b58e6995203857c868ce62833bc1629110ec5b
Author: Brandon Lewis <brandon_lewis berkeley edu>
Date: Thu Apr 16 12:26:58 2009 -0700
ui.prefs, ui.dynamic: preference widgets now actually set associated settings, restart warning shown for non-live properties
---
pitivi/ui/dynamic.py | 2 +-
pitivi/ui/prefs.py | 32 +++++++++++++++++++++++++-------
2 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/pitivi/ui/dynamic.py b/pitivi/ui/dynamic.py
index d29451e..4c470eb 100644
--- a/pitivi/ui/dynamic.py
+++ b/pitivi/ui/dynamic.py
@@ -87,8 +87,8 @@ class TextWidget(gtk.HBox):
self.image.set_from_stock(gtk.STOCK_DIALOG_WARNING,
gtk.ICON_SIZE_BUTTON)
self.pack_start(self.image)
+ self.text.connect("changed", self._filter)
if matches:
- self.text.connect("changed", self._filter)
self.matches = re.compile(matches)
self._filter(None)
diff --git a/pitivi/ui/prefs.py b/pitivi/ui/prefs.py
index c4634d9..e994d1b 100644
--- a/pitivi/ui/prefs.py
+++ b/pitivi/ui/prefs.py
@@ -30,6 +30,8 @@ import pitivi.ui.dynamic as dynamic
class PreferencesDialog(gtk.Window):
prefs = {}
+ original_values = {}
+ widgets = {}
def __init__(self, instance):
gtk.Window.__init__(self)
@@ -87,18 +89,25 @@ class PreferencesDialog(gtk.Window):
factory_settings.connect("clicked", self._factorySettingsButtonCb)
factory_settings.set_sensitive(False)
factory_settings.show()
- revert_button = gtk.Button(_("Revert"))
- revert_button.connect("clicked", self._revertButtonCb)
- revert_button.set_sensitive(False)
- revert_button.show()
+ self.revert_button = gtk.Button(_("Revert"))
+ self.revert_button.connect("clicked", self._revertButtonCb)
+ self.revert_button.show()
+ self.revert_button.set_sensitive(False)
accept_button = gtk.Button(stock=gtk.STOCK_CLOSE)
accept_button.connect("clicked", self._acceptButtonCb)
accept_button.show()
button_box.pack_start(factory_settings, False, True)
button_box.pack_end(accept_button, False, True)
- button_box.pack_end(revert_button, False, True)
+ button_box.pack_end(self.revert_button, False, True)
button_box.show()
+ # restart warning
+ self.restart_warning = gtk.Label()
+ self.restart_warning.set_markup(
+ _("<b>Some changes will not take effect until you restart "
+ "PiTiVi</b>"))
+ vbox.pack_end(self.restart_warning, False, False)
+
## Public API
@classmethod
@@ -249,6 +258,7 @@ class PreferencesDialog(gtk.Window):
widget.setWidgetValue(getattr(self.settings, attrname))
widget.connectValueChanged(self._valueChanged, widget,
attrname)
+ self.widgets[attrname] = widget
label.show()
widget.show()
self.contents.pack_start(widgets, True, True)
@@ -264,19 +274,27 @@ class PreferencesDialog(gtk.Window):
self._current = new
def _clearHistory(self):
- pass
+ self.original_values = {}
+ self.revert_button.set_sensitive(False)
def _factorySettingsButtonCb(self, unused_button):
pass
def _revertButtonCb(self, unused_button):
- pass
+ for attrname, value in self.original_values.iteritems():
+ self.widgets[attrname].setWidgetValue(value)
+ self._clearHistory()
def _acceptButtonCb(self, unused_button):
self._clearHistory()
self.hide()
def _valueChanged(self, fake_widget, real_widget, attrname):
+ if attrname not in self.original_values:
+ self.original_values[attrname] = getattr(self.settings, attrname)
+ if attrname + "Changed" not in GlobalSettings.get_signals():
+ self.restart_warning.show()
+ self.revert_button.set_sensitive(True)
setattr(self.settings, attrname, real_widget.getWidgetValue())
## Preference Test Cases
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]