[pitivi: 1/6] ui: Let user reset default codec settings values
- From: Thibault Saunier <tsaunier src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi: 1/6] ui: Let user reset default codec settings values
- Date: Mon, 1 Aug 2011 17:18:44 +0000 (UTC)
commit 98b84fc89c34038e65d2592bf000270452e17371
Author: Thibault Saunier <thibault saunier collabora com>
Date: Sun Jul 24 20:26:00 2011 +0200
ui: Let user reset default codec settings values
https://bugzilla.gnome.org/show_bug.cgi?id=655188
data/ui/elementsettingsdialog.ui | 16 ++++++----------
pitivi/ui/encodingdialog.py | 14 ++++++++------
pitivi/ui/gstwidget.py | 8 ++++++++
3 files changed, 22 insertions(+), 16 deletions(-)
---
diff --git a/data/ui/elementsettingsdialog.ui b/data/ui/elementsettingsdialog.ui
index 1abdbba..a90978b 100644
--- a/data/ui/elementsettingsdialog.ui
+++ b/data/ui/elementsettingsdialog.ui
@@ -19,24 +19,24 @@
<property name="can_focus">False</property>
<property name="layout_style">end</property>
<child>
- <object class="GtkButton" id="cancelbutton1">
- <property name="label">gtk-cancel</property>
+ <object class="GtkButton" id="reset">
+ <property name="label">gtk-clear</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
- <property name="can_default">True</property>
- <property name="receives_default">False</property>
+ <property name="receives_default">True</property>
<property name="use_action_appearance">False</property>
<property name="use_stock">True</property>
+ <signal name="clicked" handler="_resetValuesClickedCb" swapped="no"/>
</object>
<packing>
<property name="expand">False</property>
- <property name="fill">False</property>
+ <property name="fill">True</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="okbutton1">
- <property name="label">gtk-ok</property>
+ <property name="label">gtk-close</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="can_default">True</property>
@@ -81,9 +81,5 @@
</child>
</object>
</child>
- <action-widgets>
- <action-widget response="-6">cancelbutton1</action-widget>
- <action-widget response="-5">okbutton1</action-widget>
- </action-widgets>
</object>
</interface>
diff --git a/pitivi/ui/encodingdialog.py b/pitivi/ui/encodingdialog.py
index 9421e27..744a900 100644
--- a/pitivi/ui/encodingdialog.py
+++ b/pitivi/ui/encodingdialog.py
@@ -361,12 +361,14 @@ class EncodingDialog(Renderer, Loggable):
@type settings_attr: str
"""
properties = getattr(self.settings, settings_attr)
- dialog = GstElementSettingsDialog(factory, properties=properties)
- dialog.window.set_transient_for(self.window)
- response = dialog.window.run()
- if response == gtk.RESPONSE_OK:
- setattr(self.settings, settings_attr, dialog.getSettings())
- dialog.window.destroy()
+ self.dialog = GstElementSettingsDialog(factory, properties=properties)
+ self.dialog.window.set_transient_for(self.window)
+ self.dialog.ok_btn.connect("clicked", self._okButtonClickedCb, settings_attr)
+ self.dialog.window.run()
+
+ def _okButtonClickedCb(self, unused_button, settings_attr):
+ setattr(self.settings, settings_attr, self.dialog.getSettings())
+ self.dialog.window.destroy()
def _renderButtonClickedCb(self, unused_button):
self.outfile = os.path.join(self.filebutton.get_uri(),
diff --git a/pitivi/ui/gstwidget.py b/pitivi/ui/gstwidget.py
index 76d0b1d..de47d2a 100644
--- a/pitivi/ui/gstwidget.py
+++ b/pitivi/ui/gstwidget.py
@@ -187,6 +187,7 @@ class GstElementSettingsDialog(Loggable):
self.builder.add_from_file(os.path.join(get_ui_dir(),
"elementsettingsdialog.ui"))
self.builder.connect_signals(self)
+ self.ok_btn = self.builder.get_object("okbutton1")
self.window = self.builder.get_object("dialog1")
self.elementsettings = GstElementSettingsWidget()
@@ -224,3 +225,10 @@ class GstElementSettingsDialog(Loggable):
def getSettings(self):
""" returns the property/value dictionnary of the selected settings """
return self.elementsettings.getSettings()
+
+ def _resetValuesClickedCb(self, unused_button):
+ self.resetAll()
+
+ def resetAll(self):
+ for prop, widget in self.elementsettings.properties.iteritems():
+ widget.setWidgetToDefault()
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]