[pitivi] widgets: Remove "PresetChoiceWidget" as it is not used anywhere.
- From: Jean-François Fortin Tam <jfft src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [pitivi] widgets: Remove "PresetChoiceWidget" as it is not used anywhere.
- Date: Tue, 17 Dec 2013 01:42:27 +0000 (UTC)
commit 6c463251b03d36a61e8e969f9c2cd350acbc7ff4
Author: Mathieu Duponchelle <mduponchelle1 gmail com>
Date: Mon Dec 2 18:25:29 2013 +0100
widgets: Remove "PresetChoiceWidget" as it is not used anywhere.
pitivi/utils/widgets.py | 126 -----------------------------------------------
1 files changed, 0 insertions(+), 126 deletions(-)
---
diff --git a/pitivi/utils/widgets.py b/pitivi/utils/widgets.py
index 1fc70e8..8cc4aa9 100644
--- a/pitivi/utils/widgets.py
+++ b/pitivi/utils/widgets.py
@@ -473,132 +473,6 @@ class ChoiceWidget(Gtk.HBox, DynamicWidget):
self.contents.set_sensitive(True)
-class PresetChoiceWidget(Gtk.HBox, DynamicWidget):
-
- """A popup which manages preset settings on a group of widgets supporting
- the dynamic interface"""
-
- class WidgetMap(object):
-
- """A helper class for mapping data from a preset to a set of
- widgets"""
-
- def __init__(self):
- raise NotImplementedError
-
- def getWidgets(self):
- raise NotImplementedError
-
- def map(self, preset):
- raise NotImplementedError
-
- class SeqWidgetMap(WidgetMap):
-
- """Maps widgets positionally to a sequence of values. None can be used
- if the given position should not map to a widget"""
-
- def __init__(self, *widgets):
- self.widgets = widgets
-
- def getWidgets(self):
- return (w for w in self.widgets if w)
-
- def map(self, preset):
- for w, p in zip(self.widgets, preset):
- if w:
- w.setWidgetValue(p)
-
- def unmap(self):
- return [w.getWidgetValue() for w in self.widgets if w]
-
- def __init__(self, presets, default=None):
- Gtk.HBox.__init__(self)
- DynamicWidget.__init__(self, default)
- self._block_update = False
- self._widget_map = None
-
- self.presets = presets
- presets.connect("preset-added", self._presetAdded)
- presets.connect("preset-removed", self._presetRemoved)
-
- self.combo = Gtk.ComboBoxText()
- self.combo.set_row_separator_func(self._sep_func)
- for preset in presets:
- self.combo.append_text(preset[0])
- self.combo.append_text("-")
- self.combo.append_text(_("Custom"))
- self.pack_start(self.combo, True, True, 0)
- self._custom_row = len(presets) + 1
-
- save_button = Gtk.Button(stock=Gtk.STOCK_SAVE)
- self._save_button = save_button
- self.pack_start(save_button, False, False, 0)
- save_button.connect("clicked", self._savePreset)
- self.show_all()
-
- def _sep_func(self, model, iter):
- return model[iter][0] == "-"
-
- def _presetAdded(self, presetlist, preset):
- row = self._custom_row - 1
- self._custom_row += 1
- self.combo.insert_text(row, preset[0])
- self.combo.set_active(row)
-
- def _presetRemoved(self, presetlist, preset, index):
- self.combo.remove_text(index)
- self._custom_row -= 1
-
- def _savePreset(self, unused_button):
- d = Gtk.Dialog(_("Save Preset"), None, Gtk.DialogFlags.MODAL,
- buttons=(Gtk.STOCK_CANCEL, Gtk.ResponseType.CANCEL, Gtk.STOCK_SAVE,
- Gtk.ResponseType.OK))
- input = Gtk.Entry()
- ca = d.get_content_area()
- ca.pack_start(input, True, True, 0)
- input.show()
- response = d.run()
-
- if response == Gtk.ResponseType.OK:
- name = input.get_text()
- values = self._widget_map.unmap()
- self.presets.addPreset(name, values)
- d.destroy()
-
- def setWidgetMap(self, map):
- self._widget_map = map
- for widget in self._widget_map.getWidgets():
- widget.connectValueChanged(self._slaveWidgetValueChanged)
- self.combo.connect("changed", self._comboChanged)
-
- def mapWidgetsToSeq(self, *args):
- self.setWidgetMap(self.SeqWidgetMap(*args))
-
- def _slaveWidgetValueChanged(self, unused_widget):
- # gtk isn't very friendly to this sort of thing
- if not self._block_update:
- self.combo.set_active(self._custom_row)
-
- def _comboChanged(self, combo):
- active = combo.get_active()
- if active > len(self.presets):
- self._save_button.set_sensitive(True)
- return
- preset = self.presets[active][1]
-
- self._save_button.set_sensitive(False)
-
- self._block_update = True
- self._widget_map.map(preset)
- self._block_update = False
-
- def connectValueChanged(self, callback, *args):
- self.combo.connect("changed", callback, *args)
-
- def setWidgetValue(self, preset_index):
- self.combo.set_active(preset_index)
-
-
class PathWidget(Gtk.FileChooserButton, DynamicWidget):
"""A Gtk.FileChooserButton which supports the DynamicWidget interface."""
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]