diff options
Diffstat (limited to 'addons/bubblemessage.py')
-rw-r--r-- | addons/bubblemessage.py | 25 |
1 files changed, 14 insertions, 11 deletions
diff --git a/addons/bubblemessage.py b/addons/bubblemessage.py index a859ef8..2bd2d31 100644 --- a/addons/bubblemessage.py +++ b/addons/bubblemessage.py @@ -13,31 +13,34 @@ # 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.actions import Action, DragWrapper +from sugar.tutorius.properties import TStringProperty, TArrayProperty +from sugar.tutorius import overlayer +from sugar.tutorius.services import ObjectStore class BubbleMessage(Action): message = TStringProperty("Message") # Create the position as an array of fixed-size 2 - position = TArrayProperty([0,0], 2, 2) + position = TArrayProperty((0,0), 2, 2) # Do the same for the tail position - tail_pos = TArrayProperty([0,0], 2, 2) + tail_pos = TArrayProperty((0,0), 2, 2) - def __init__(self, message=None, pos=None, speaker=None, tailpos=None): + def __init__(self, message=None, position=None, speaker=None, tail_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] + @param position 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 + @param tail_pos 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 position: + self.position = position + if tail_pos: + self.tail_pos = tail_pos if message: self.message = message @@ -94,7 +97,7 @@ class BubbleMessage(Action): def exit_editmode(self, *args): x,y = self._drag.position - self.position = [int(x), int(y)] + self.position = (int(x), int(y)) if self._drag: self._drag.draggable = False self._drag = None |