Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/addons
diff options
context:
space:
mode:
Diffstat (limited to 'addons')
-rw-r--r--addons/bubblemessage.py27
-rw-r--r--addons/bubblemessagewimg.py14
-rw-r--r--addons/chainaction.py7
-rw-r--r--addons/changecolor.py9
-rw-r--r--addons/clickaction.py3
-rw-r--r--addons/dialogmessage.py9
-rw-r--r--addons/disablewidget.py7
-rw-r--r--addons/gtkwidgeteventfilter.py7
-rw-r--r--addons/gtkwidgettypefilter.py9
-rw-r--r--addons/messagebuttonnext.py13
-rw-r--r--addons/oncewrapper.py5
-rw-r--r--addons/readfile.py16
-rw-r--r--addons/timerevent.py8
-rw-r--r--addons/triggereventfilter.py4
-rw-r--r--addons/typetextaction.py6
-rw-r--r--addons/widgetidentifyaction.py4
16 files changed, 46 insertions, 102 deletions
diff --git a/addons/bubblemessage.py b/addons/bubblemessage.py
index 53387bf..4e37274 100644
--- a/addons/bubblemessage.py
+++ b/addons/bubblemessage.py
@@ -25,42 +25,33 @@ class BubbleMessage(Action):
# Do the same for the tail position
tail_pos = TArrayProperty((0,0), 2, 2)
- def __init__(self, message=None, position=None, speaker=None, tail_pos=None):
+ def __init__(self, **kwargs):
"""
Shows a dialog with a given text, at the given position on the screen.
+ Accepted keyword args:
@param message A string to display to the user
@param position A list of the form [x, y]
@param speaker treeish representation of the speaking widget
@param tail_pos The position of the tail of the bubble; useful to point to
specific elements of the interface
"""
- Action.__init__(self)
-
- if position:
- self.position = position
- if tail_pos:
- self.tail_pos = tail_pos
- if message:
- self.message = message
+ super(BubbleMessage, self).__init__(**kwargs)
self.overlay = None
self._bubble = None
self._speaker = None
- def do(self, **kwargs):
+ def do(self, activity=None, **kwargs):
"""
Show the dialog
"""
- # get or inject overlayer
- self.overlay = ObjectStore().activity._overlayer
- # FIXME: subwindows, are left to overlap this. This behaviour is
- # undesirable. subwindows (i.e. child of top level windows) should be
- # handled either by rendering over them, or by finding different way to
- # draw the overlay.
+ if activity is None:
+ raise TypeError("Missing argument activity")
+
+ # get overlayer
+ self.overlay = activity._overlayer
- if not self.overlay:
- self.overlay = ObjectStore().activity._overlayer
if not self._bubble:
x, y = self.position
# TODO: tails are relative to tailpos. They should be relative to
diff --git a/addons/bubblemessagewimg.py b/addons/bubblemessagewimg.py
index 514a311..9fe9512 100644
--- a/addons/bubblemessagewimg.py
+++ b/addons/bubblemessagewimg.py
@@ -26,26 +26,18 @@ class BubbleMessageWImg(Action):
tail_pos = TArrayProperty((0,0), 2, 2)
imgpath = TResourceProperty("")
- def __init__(self, message=None, position=None, speaker=None, tail_pos=None, imgpath=None):
+ def __init__(self, **kwargs):
"""
Shows a dialog with a given text, at the given position on the screen.
+ Accepted keyword args:
@param message A string to display to the user
@param position A list of the form [x, y]
@param speaker treeish representation of the speaking widget
@param tail_pos The position of the tail of the bubble; useful to point to
specific elements of the interface
"""
- Action.__init__(self)
-
- if position:
- self.position = position
- if tail_pos:
- self.tail_pos = tail_pos
- if message:
- self.message = message
- if imgpath:
- self.imgpath = imgpath
+ super(BubbleMessageWImg, self).__init__(**kwargs)
self.overlay = None
self._bubble = None
diff --git a/addons/chainaction.py b/addons/chainaction.py
index 9e8b6c8..cc610d6 100644
--- a/addons/chainaction.py
+++ b/addons/chainaction.py
@@ -17,13 +17,8 @@
from ..actions import *
class ChainAction(Action):
- actions = TAddonListProperty()
-
"""Utility class to allow executing actions in a specific order"""
- def __init__(self, actions=[]):
- """ChainAction(action1, ... ) builds a chain of actions"""
- Action.__init__(self)
- self.actions = actions
+ actions = TAddonListProperty()
def do(self,**kwargs):
"""do() each action in the chain"""
diff --git a/addons/changecolor.py b/addons/changecolor.py
index eac891a..53e6c53 100644
--- a/addons/changecolor.py
+++ b/addons/changecolor.py
@@ -14,8 +14,6 @@
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-import time
-
import gobject
import gtk, gtk.gdk
@@ -40,13 +38,12 @@ class ChangeColor(Action):
# set timeout
timeout = 500
- def __init__(self, widaddr=None):
+ def __init__(self, **kwargs):
"""Constructor - Change a widget color
+ Accepted keyword arguments:
@param widaddr: the widget for which you want to change the color (UAM)
"""
- Action.__init__(self)
-
- if widaddr: self.widaddr = widaddr
+ super(ChangeColor, self).__init__(**kwargs)
self.init_style = None
self._new_color = None
diff --git a/addons/clickaction.py b/addons/clickaction.py
index 2821541..eae713e 100644
--- a/addons/clickaction.py
+++ b/addons/clickaction.py
@@ -25,9 +25,6 @@ class ClickAction(Action):
@param widget The threehish representation of the widget
"""
widget = TStringProperty("")
- def __init__(self, widget):
- Action.__init__(self)
- self.widget = widget
def do(self, **kwargs):
"""
diff --git a/addons/dialogmessage.py b/addons/dialogmessage.py
index fad6d2c..24646f8 100644
--- a/addons/dialogmessage.py
+++ b/addons/dialogmessage.py
@@ -22,20 +22,17 @@ class DialogMessage(Action):
message = TStringProperty("Message")
position = TArrayProperty((0, 0), 2, 2)
- def __init__(self, message=None, position=None):
+ def __init__(self, **kwargs):
"""
Shows a dialog with a given text, at the given position on the screen.
+ Accepted keyword args:
@param message A string to display to the user
@param position A list of the form [x, y]
"""
- super(DialogMessage, self).__init__()
+ super(DialogMessage, self).__init__(**kwargs)
self._dialog = None
- if message:
- self.message = message
- if position: self.position = position
-
def do(self, **kwargs):
"""
Show the dialog
diff --git a/addons/disablewidget.py b/addons/disablewidget.py
index 8b34254..15e07f2 100644
--- a/addons/disablewidget.py
+++ b/addons/disablewidget.py
@@ -21,13 +21,12 @@ from ..services import ObjectStore
class DisableWidgetAction(Action):
target = TStringProperty("0")
- def __init__(self, target):
+ def __init__(self, **kwargs):
"""Constructor
+ Accepted keyword args:
@param target target treeish
"""
- Action.__init__(self)
- if target is not None:
- self.target = target
+ super(DisableWidgetAction, self).__init__(**kwargs)
self._widget = None
def do(self, **kwargs):
diff --git a/addons/gtkwidgeteventfilter.py b/addons/gtkwidgeteventfilter.py
index f6ecf86..61a9d16 100644
--- a/addons/gtkwidgeteventfilter.py
+++ b/addons/gtkwidgeteventfilter.py
@@ -24,15 +24,14 @@ class GtkWidgetEventFilter(EventFilter):
object_id = TUAMProperty()
event_name = TEventType('clicked')
- def __init__(self, object_id=None, event_name=None):
+ def __init__(self, **kwargs):
"""Constructor
+ Accepted keyword args:
@param object_id object fqdn-style identifier
@param event_name event to attach to
"""
- super(GtkWidgetEventFilter,self).__init__()
+ super(GtkWidgetEventFilter,self).__init__(**kwargs)
self._callback = None
- self.object_id = object_id
- self.event_name = event_name
self._widget = None
self._handler_id = None
diff --git a/addons/gtkwidgettypefilter.py b/addons/gtkwidgettypefilter.py
index 0339e74..7b2e15e 100644
--- a/addons/gtkwidgettypefilter.py
+++ b/addons/gtkwidgettypefilter.py
@@ -30,20 +30,17 @@ class GtkWidgetTypeFilter(EventFilter):
text = TStringProperty("")
strokes = TSequenceProperty("")
- def __init__(self, object_id, text=None, strokes=None):
+ def __init__(self, **kwargs):
"""Constructor
- @param next_state default EventFilter param, passed on to EventFilter
+ Accepted keyword args:
@param object_id object tree-ish identifier
@param text resulting text expected
@param strokes list of strokes expected
At least one of text or strokes must be supplied
"""
- super(GtkWidgetTypeFilter, self).__init__()
- self.object_id = object_id
- self.text = text or ""
+ super(GtkWidgetTypeFilter, self).__init__(**kwargs)
self._captext = ""
- self.strokes = strokes or []
self._capstrokes = []
self._widget = None
self._handler_id = None
diff --git a/addons/messagebuttonnext.py b/addons/messagebuttonnext.py
index 74ce1bb..058ef41 100644
--- a/addons/messagebuttonnext.py
+++ b/addons/messagebuttonnext.py
@@ -38,23 +38,18 @@ class MessageButtonNext(EventFilter):
# set padding
padding = 40
- def __init__(self, message=None, position=None, center_pos=False):
+ def __init__(self, **kwargs):
"""Constructor.
-
+ Accepted keyword arguments:
@param message message to display
@param position message position
"""
- super(MessageButtonNext,self).__init__()
+ super(MessageButtonNext,self).__init__(**kwargs)
- if position:
- self.position = position
- else:
+ if not self.position:
# TODO: to be removed when creator supports editing properties on events
self.position = (300, 200)
- if message:
- self.message = message
-
self.overlay = None
self.msgnext = None
diff --git a/addons/oncewrapper.py b/addons/oncewrapper.py
index 3f6b2d0..f263dd7 100644
--- a/addons/oncewrapper.py
+++ b/addons/oncewrapper.py
@@ -26,11 +26,10 @@ class OnceWrapper(Action):
action = TAddonProperty()
- def __init__(self, action):
- Action.__init__(self)
+ def __init__(self, **kwargs):
+ super(OnceWrapper, self).__init__(**kwargs)
self._called = False
self._need_undo = False
- self.action = action
def do(self, **kwargs):
"""
diff --git a/addons/readfile.py b/addons/readfile.py
index 4a6c54d..81385ba 100644
--- a/addons/readfile.py
+++ b/addons/readfile.py
@@ -21,19 +21,13 @@ from ..properties import TFileProperty
from ..services import ObjectStore
class ReadFile(Action):
+ """
+ Calls activity.read_file to restore a specified state to an activity
+ like when restored from the journal.
+ @param filename Path to the file to read
+ """
filename = TFileProperty(None)
- def __init__(self, filename=None):
- """
- Calls activity.read_file to restore a specified state to an activity
- like when restored from the journal.
- @param filename Path to the file to read
- """
- Action.__init__(self)
-
- if filename:
- self.filename=filename
-
def do(self, **kwargs):
"""
Perform the action, call read_file on the activity
diff --git a/addons/timerevent.py b/addons/timerevent.py
index a986fa0..9896075 100644
--- a/addons/timerevent.py
+++ b/addons/timerevent.py
@@ -27,14 +27,12 @@ class TimerEvent(EventFilter):
"""
timeout = TIntProperty(15, 0)
- def __init__(self, timeout=None):
+ def __init__(self, **kwargs):
"""Constructor.
-
+ Accepted keyword args:
@param timeout timeout in seconds
"""
- super(TimerEvent,self).__init__()
- if timeout:
- self.timeout = timeout
+ super(TimerEvent,self).__init__(**kwargs)
self._handler_id = None
def install_handlers(self, callback, **kwargs):
diff --git a/addons/triggereventfilter.py b/addons/triggereventfilter.py
index 19544b0..3fc48b7 100644
--- a/addons/triggereventfilter.py
+++ b/addons/triggereventfilter.py
@@ -23,8 +23,8 @@ class TriggerEventFilter(EventFilter):
Used to fake events and see the effect on the FSM.
"""
- def __init__(self):
- EventFilter.__init__(self)
+ def __init__(self, **kwargs):
+ super(EventFilter, self).__init__(**kwargs)
self.toggle_on_callback = False
def install_handlers(self, callback, **kwargs):
diff --git a/addons/typetextaction.py b/addons/typetextaction.py
index 8c794d9..8a09ff9 100644
--- a/addons/typetextaction.py
+++ b/addons/typetextaction.py
@@ -27,12 +27,6 @@ class TypeTextAction(Action):
"""
widget = TStringProperty("")
text = TStringProperty("")
-
- def __init__(self, widget, text):
- Action.__init__(self)
-
- self.widget = widget
- self.text = text
def do(self, **kwargs):
"""
diff --git a/addons/widgetidentifyaction.py b/addons/widgetidentifyaction.py
index c44964b..b59c94a 100644
--- a/addons/widgetidentifyaction.py
+++ b/addons/widgetidentifyaction.py
@@ -19,8 +19,8 @@ from ..actions import *
from ..editor import WidgetIdentifier
class WidgetIdentifyAction(Action):
- def __init__(self):
- Action.__init__(self)
+ def __init__(self, **kwargs):
+ super(WidgetIdentifyAction, self).__init__(**kwargs)
self.activity = None
self._dialog = None