Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/src/sugar/tutorius/addons
diff options
context:
space:
mode:
Diffstat (limited to 'src/sugar/tutorius/addons')
-rw-r--r--src/sugar/tutorius/addons/Makefile.am6
-rw-r--r--src/sugar/tutorius/addons/__init__.py0
-rw-r--r--src/sugar/tutorius/addons/bubblemessage.py113
-rw-r--r--src/sugar/tutorius/addons/dialogmessage.py66
-rw-r--r--src/sugar/tutorius/addons/gtkwidgeteventfilter.py69
5 files changed, 0 insertions, 254 deletions
diff --git a/src/sugar/tutorius/addons/Makefile.am b/src/sugar/tutorius/addons/Makefile.am
deleted file mode 100644
index 3d1d18a..0000000
--- a/src/sugar/tutorius/addons/Makefile.am
+++ /dev/null
@@ -1,6 +0,0 @@
-sugardir = $(pythondir)/sugar/tutorius/addons
-sugar_PYTHON = \
- __init__.py \
- bubblemessage.py \
- gtkwidgeteventfilter.py \
- dialogmessage.py
diff --git a/src/sugar/tutorius/addons/__init__.py b/src/sugar/tutorius/addons/__init__.py
deleted file mode 100644
index e69de29..0000000
--- a/src/sugar/tutorius/addons/__init__.py
+++ /dev/null
diff --git a/src/sugar/tutorius/addons/bubblemessage.py b/src/sugar/tutorius/addons/bubblemessage.py
deleted file mode 100644
index a859ef8..0000000
--- a/src/sugar/tutorius/addons/bubblemessage.py
+++ /dev/null
@@ -1,113 +0,0 @@
-# Copyright (C) 2009, Tutorius.org
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# 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 *
-
-class BubbleMessage(Action):
- message = TStringProperty("Message")
- # Create the position as an array of fixed-size 2
- position = TArrayProperty([0,0], 2, 2)
- # Do the same for the tail position
- tail_pos = TArrayProperty([0,0], 2, 2)
-
- def __init__(self, message=None, pos=None, speaker=None, tailpos=None):
- """
- Shows a dialog with a given text, at the given position on the screen.
-
- @param message A string to display to the user
- @param pos A list of the form [x, y]
- @param speaker treeish representation of the speaking widget
- @param tailpos The position of the tail of the bubble; useful to point to
- specific elements of the interface
- """
- Action.__init__(self)
-
- if pos:
- self.position = pos
- if tailpos:
- self.tail_pos = tailpos
- if message:
- self.message = message
-
- self.overlay = None
- self._bubble = None
- self._speaker = None
-
- def do(self):
- """
- 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 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
- # the speaking widget. Same of the bubble position.
- self._bubble = overlayer.TextBubble(text=self.message,
- tailpos=self.tail_pos)
- self._bubble.show()
- self.overlay.put(self._bubble, x, y)
- self.overlay.queue_draw()
-
- def undo(self):
- """
- Destroy the dialog
- """
- if self._bubble:
- self._bubble.destroy()
- self._bubble = None
-
- def enter_editmode(self, *args):
- """
- Enters edit mode. The action should display itself in some way,
- without affecting the currently running application.
- """
- if not self.overlay:
- self.overlay = ObjectStore().activity._overlayer
- assert not self._drag, "bubble action set to editmode twice"
- x, y = self.position
- self._bubble = overlayer.TextBubble(text=self.message,
- tailpos=self.tail_pos)
- self.overlay.put(self._bubble, x, y)
- self._bubble.show()
-
- self._drag = DragWrapper(self._bubble, self.position, True)
-
- def exit_editmode(self, *args):
- x,y = self._drag.position
- self.position = [int(x), int(y)]
- if self._drag:
- self._drag.draggable = False
- self._drag = None
- if self._bubble:
- self.overlay.remove(self._bubble)
- self._bubble = None
- self.overlay = None
-
-__action__ = {
- "name" : "BubbleMessage",
- "display_name" : "Message Bubble",
- "icon" : "message-bubble",
- "class" : BubbleMessage,
- "mandatory_props" : ["message"]
-}
-
diff --git a/src/sugar/tutorius/addons/dialogmessage.py b/src/sugar/tutorius/addons/dialogmessage.py
deleted file mode 100644
index 22a223b..0000000
--- a/src/sugar/tutorius/addons/dialogmessage.py
+++ /dev/null
@@ -1,66 +0,0 @@
-# Copyright (C) 2009, Tutorius.org
-# Copyright (C) 2009, Simon Poirier <simpoir@gmail.com>
-#
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# 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 *
-
-class DialogMessage(Action):
- message = TStringProperty("Message")
- position = TArrayProperty([0, 0], 2, 2)
-
- def __init__(self, message=None, pos=None):
- """
- Shows a dialog with a given text, at the given position on the screen.
-
- @param message A string to display to the user
- @param pos A list of the form [x, y]
- """
- super(DialogMessage, self).__init__()
- self._dialog = None
-
- if message:
- self.message = message
- if pos: self.position = pos
-
- def do(self):
- """
- Show the dialog
- """
- self._dialog = TutoriusDialog(self.message)
- self._dialog.set_button_clicked_cb(self._dialog.close_self)
- self._dialog.set_modal(False)
- self._dialog.move(self.position[0], self.position[1])
- self._dialog.show()
-
- def undo(self):
- """
- Destroy the dialog
- """
- if self._dialog:
- self._dialog.destroy()
- self._dialog = None
-
-__action__ = {
- "name" : "DialogMessage",
- "display_name" : "Message Dialog",
- "icon" : "window_fullscreen",
- "class" : DialogMessage,
- "mandatory_props" : ["message"]
-}
-
-# vim:set ts=4 sts=4 sw=4 et:
-
diff --git a/src/sugar/tutorius/addons/gtkwidgeteventfilter.py b/src/sugar/tutorius/addons/gtkwidgeteventfilter.py
deleted file mode 100644
index cbfb00c..0000000
--- a/src/sugar/tutorius/addons/gtkwidgeteventfilter.py
+++ /dev/null
@@ -1,69 +0,0 @@
-# Copyright (C) 2009, Tutorius.org
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# 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.filters import *
-from sugar.tutorius.properties import *
-
-class GtkWidgetEventFilter(EventFilter):
- """
- Basic Event filter for Gtk widget events
- """
- object_id = TUAMProperty()
- event_name = TStringProperty("clicked")
-
- def __init__(self, next_state=None, object_id=None, event_name=None):
- """Constructor
- @param next_state default EventFilter param, passed on to EventFilter
- @param object_id object fqdn-style identifier
- @param event_name event to attach to
- """
- super(GtkWidgetEventFilter,self).__init__(next_state)
- self._callback = None
- self.object_id = object_id
- self.event_name = event_name
- self._widget = None
- self._handler_id = None
-
- def install_handlers(self, callback, **kwargs):
- """install handlers
- @param callback default EventFilter callback arg
- @param activity keyword argument activity must be present to install
- the event handler into the activity's widget hierarchy
- """
- super(GtkWidgetEventFilter, self).install_handlers(callback, **kwargs)
- if not "activity" in kwargs:
- raise TypeError("activity argument is Mandatory")
-
- #find the widget and connect to its event
- self._widget = find_widget(kwargs["activity"], self.object_id)
- self._handler_id = self._widget.connect( \
- self.event_name, self.do_callback )
-
- def remove_handlers(self):
- """remove handlers"""
- super(GtkWidgetEventFilter, self).remove_handlers()
- #if an event was connected, disconnect it
- if self._handler_id:
- self._widget.handler_disconnect(self._handler_id)
- self._handler_id=None
-
-__event__ = {
- "name" : "GtkWidgetEventFilter",
- "display_name" : "GTK Event catcher",
- "icon" : "player_play",
- "class" : GtkWidgetEventFilter,
- "mandatory_props" : ["object_id"]
-}
-