[pitivi/1.0] preset: Leave the combo empty when removing one



commit 1677eb2a4dbf50912befeda62212d02e6aaa7ba9
Author: Alexandru Băluț <alexandru balut gmail com>
Date:   Tue Dec 19 02:47:25 2017 +0100

    preset: Leave the combo empty when removing one
    
    It's confusing to have "new-preset" appear in the combo when removing a
    preset. The expectation is to have no preset.
    
    Reviewed-by: Thibault Saunier <tsaunier gnome org>
    Differential Revision: https://phabricator.freedesktop.org/D1922

 pitivi/preset.py     |    7 ++-----
 tests/test_render.py |    1 +
 2 files changed, 3 insertions(+), 5 deletions(-)
---
diff --git a/pitivi/preset.py b/pitivi/preset.py
index 065ceaa..1dfd009 100644
--- a/pitivi/preset.py
+++ b/pitivi/preset.py
@@ -141,6 +141,8 @@ class PresetManager(GObject.Object, Loggable):
 
     def _removePresetCb(self, unused_action, unused_param):
         self.removeCurrentPreset()
+        entry = self.combo.get_child()
+        entry.set_text("")
         self.updateMenuActions()
 
     def _savePresetCb(self, unused_action, unused_param):
@@ -285,10 +287,6 @@ class PresetManager(GObject.Object, Loggable):
     def getPresetNames(self):
         return (row[0] for row in self.ordered)
 
-    def getModel(self):
-        """Gets the GtkModel used by the UI."""
-        return self.ordered
-
     def updateValue(self, name, value):
         """Updates a value in the current preset, if any."""
         if self.ignore_update_requests:
@@ -596,7 +594,6 @@ class EncodingTargetManager(PresetManager):
         self._removed_profiles.append(self.cur_preset)
         self._save_removed_profiles()
         self._forgetPreset(self.cur_preset)
-        self.combo.get_parent().setWidgetValue(self.getNewPresetName())
         self.cur_preset = None
 
     def restorePreset(self, values):
diff --git a/tests/test_render.py b/tests/test_render.py
index 2997aad..2c9fac2 100644
--- a/tests/test_render.py
+++ b/tests/test_render.py
@@ -250,6 +250,7 @@ class TestRender(common.TestCase):
         profile_names = [i[0] for i in preset_combo.props.model]
         active_iter = preset_combo.get_active_iter()
         self.assertEqual(active_iter, None)
+        self.assertEqual(preset_combo.get_child().props.text, "")
 
         # Re save the current EncodingProfile calling it the same as before.
         preset_combo.get_child().set_text("test")


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]