From 3b9bff2ef1826987d95815ff03c235052cea9aae Mon Sep 17 00:00:00 2001 From: mike Date: Sat, 17 Oct 2009 17:47:58 +0000 Subject: LP 439980 : Code review changes : renamed is_identical to __eq__, relaxed action insertion constraints, added fixed meta-props for addons --- (limited to 'addons') diff --git a/addons/clickaction.py b/addons/clickaction.py index 0018c1c..828dd75 100644 --- a/addons/clickaction.py +++ b/addons/clickaction.py @@ -48,5 +48,5 @@ __action__ = { 'display_name' : 'Click', 'icon' : 'format-justify-center', 'class' : ClickAction, - 'mandatoryprops' : ['widget'] + 'mandatory_props' : ['widget'] } diff --git a/addons/disablewidget.py b/addons/disablewidget.py index 210d1eb..ce3f235 100644 --- a/addons/disablewidget.py +++ b/addons/disablewidget.py @@ -36,12 +36,19 @@ class DisableWidgetAction(Action): if os.activity: self._widget = gtkutils.find_widget(os.activity, self.target) if self._widget: + # If we have an object whose sensitivity we can query, we will + # keep it to reset it in the undo() method + if hasattr(self._widget, 'get_sensitive') and callable(self._widget.get_sensitive): + self._previous_sensitivity = self._widget.get_sensitive() self._widget.set_sensitive(False) def undo(self): """Action undo""" if self._widget: - self._widget.set_sensitive(True) + if hasattr(self, '_previous_sensitivity'): + self._widget.set_sensitive(self._previous_sensitivity) + else: + self._widget.set_sensitive(True) __action__ = { 'name' : 'DisableWidgetAction', diff --git a/addons/oncewrapper.py b/addons/oncewrapper.py index fb0196f..97f4752 100644 --- a/addons/oncewrapper.py +++ b/addons/oncewrapper.py @@ -55,5 +55,5 @@ __action__ = { 'display_name' : 'Execute an action only once', 'icon' : 'once_wrapper', 'class' : OnceWrapper, - 'mandatoryprops' : ['action'] + 'mandatory_props' : ['action'] } diff --git a/addons/triggereventfilter.py b/addons/triggereventfilter.py index ea2107b..06c0995 100644 --- a/addons/triggereventfilter.py +++ b/addons/triggereventfilter.py @@ -41,5 +41,6 @@ __event__ = { 'display_name' : 'Triggerable event filter (test only)', 'icon' : '', 'class' : TriggerEventFilter, - 'mandatory_props' : ['next_state'] + 'mandatory_props' : ['next_state'], + 'test' : True } diff --git a/addons/typetextaction.py b/addons/typetextaction.py index 251dea2..fee66e5 100644 --- a/addons/typetextaction.py +++ b/addons/typetextaction.py @@ -15,7 +15,7 @@ # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA from sugar.tutorius.actions import * - +from sugar.tutorius import gtkutils class TypeTextAction(Action): """ @@ -53,5 +53,5 @@ __action__ = { 'display_name' : 'Type text', 'icon' : 'format-justify-center', 'class' : TypeTextAction, - 'mandatoryprops' : ['widgetUAM', 'text'] + 'mandatory_props' : ['widgetUAM', 'text'] } diff --git a/addons/widgetidentifyaction.py b/addons/widgetidentifyaction.py index 65edf62..3c66211 100644 --- a/addons/widgetidentifyaction.py +++ b/addons/widgetidentifyaction.py @@ -13,8 +13,11 @@ # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + from sugar.tutorius.actions import * +from sugar.tutorius.editor import WidgetIdentifier + class WidgetIdentifyAction(Action): def __init__(self): Action.__init__(self) @@ -39,5 +42,6 @@ __action__ = { "display_name" : 'Widget Identifier', "icon" : 'viewmag1', "class" : WidgetIdentifyAction, - "mandatory_props" : [] + "mandatory_props" : [], + 'test' : True } -- cgit v0.9.1