From 14b57266df2381c9cb8b98c1d6ecd5d5d91697c4 Mon Sep 17 00:00:00 2001
From: Johnathan Corgan <johnathan@corganlabs.com>
Date: Thu, 2 Apr 2015 15:28:55 -0700
Subject: Revert "grc: PropsDialog: apply button and hotkey (Ctrl+Enter)"

This reverts commit 9b57c33393dda48933fd5968070a4a7cac1290ca.
---
 grc/gui/Param.py | 30 ++++++++----------------------
 1 file changed, 8 insertions(+), 22 deletions(-)

(limited to 'grc/gui/Param.py')

diff --git a/grc/gui/Param.py b/grc/gui/Param.py
index 1efa56326e..2ef8603a83 100644
--- a/grc/gui/Param.py
+++ b/grc/gui/Param.py
@@ -72,31 +72,20 @@ class InputParam(gtk.HBox):
         self._changed_but_unchecked = True
         self._update_gui()
 
-    def apply_change(self, *args):
+    def _apply_change(self, *args):
         """
         Handle a gui change by setting the new param value,
         calling the callback (if applicable), and updating.
         """
-        if not self._changed_but_unchecked:
-            return
         #set the new value
         self.param.set_value(self.get_text())
         #call the callback
-        if self._callback:
-            self._callback(*args)
-        else:
-            self.param.validate()
+        if self._callback: self._callback(*args)
+        else: self.param.validate()
         #gui update
         self._changed_but_unchecked = False
         self._update_gui()
 
-    def _handle_key_press(self, widget, event):
-        if event.keyval == gtk.keysyms.Return and event.state & gtk.gdk.CONTROL_MASK:
-            self.apply_change()
-            return True
-        return False
-
-
 class EntryParam(InputParam):
     """Provide an entry box for strings and numbers."""
 
@@ -105,8 +94,7 @@ class EntryParam(InputParam):
         self._input = gtk.Entry()
         self._input.set_text(self.param.get_value())
         self._input.connect('changed', self._mark_changed)
-        self._input.connect('focus-out-event', self.apply_change)
-        self._input.connect('key-press-event', self._handle_key_press)
+        self._input.connect('focus-out-event', self._apply_change)
         self.pack_start(self._input, True)
     def get_text(self): return self._input.get_text()
     def set_color(self, color):
@@ -126,7 +114,7 @@ class EnumParam(InputParam):
         self._input = gtk.combo_box_new_text()
         for option in self.param.get_options(): self._input.append_text(option.get_name())
         self._input.set_active(self.param.get_option_keys().index(self.param.get_value()))
-        self._input.connect('changed', self.apply_change)
+        self._input.connect('changed', self._apply_change)
         self.pack_start(self._input, False)
     def get_text(self): return self.param.get_option_keys()[self._input.get_active()]
     def set_tooltip_text(self, text):
@@ -135,7 +123,6 @@ class EnumParam(InputParam):
         except AttributeError:
             pass  # no tooltips for old GTK
 
-
 class EnumEntryParam(InputParam):
     """Provide an entry box and drop down menu for Raw Enum types."""
 
@@ -147,10 +134,9 @@ class EnumEntryParam(InputParam):
         except:
             self._input.set_active(-1)
             self._input.get_child().set_text(self.param.get_value())
-        self._input.connect('changed', self.apply_change)
+        self._input.connect('changed', self._apply_change)
         self._input.get_child().connect('changed', self._mark_changed)
-        self._input.get_child().connect('focus-out-event', self.apply_change)
-        self._input.get_child().connect('key-press-event', self._handle_key_press)
+        self._input.get_child().connect('focus-out-event', self._apply_change)
         self.pack_start(self._input, False)
     def get_text(self):
         if self._input.get_active() == -1: return self._input.get_child().get_text()
@@ -205,7 +191,7 @@ class FileParam(EntryParam):
         if gtk.RESPONSE_OK == file_dialog.run(): #run the dialog
             file_path = file_dialog.get_filename() #get the file path
             self._input.set_text(file_path)
-            self.apply_change()
+            self._apply_change()
         file_dialog.destroy() #destroy the dialog
 
 
-- 
cgit v1.2.3