Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--addons/bubblemessage.py17
-rw-r--r--tutorius/creator.py2
-rw-r--r--tutorius/overlayer.py38
-rw-r--r--tutorius/properties.py6
4 files changed, 32 insertions, 31 deletions
diff --git a/addons/bubblemessage.py b/addons/bubblemessage.py
index 42a2e7e..0e75dc4 100644
--- a/addons/bubblemessage.py
+++ b/addons/bubblemessage.py
@@ -19,16 +19,11 @@ 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)
- #
- # ?:;:.?
- #
- test = TPositionProperty((0,0))
- test2 = TArrayOneTypeProperty([position,tail_pos], 2, 2)
- #
- #
-
+ #postion = TPositionProperty((0,0)) May be it will be not possible to modify the position with a TPositionProperty.
+ #Create a list of tail positions as an array of N element : N to be defined...
+ tail_pos = TArrayOneTypeProperty([[0,0],[0,0],[0,0]], 2, 3)
+
+
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.
@@ -36,7 +31,7 @@ class BubbleMessage(Action):
@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
+ @param tailpos The position of each tail of the bubble; useful to point to
specific elements of the interface
"""
Action.__init__(self)
diff --git a/tutorius/creator.py b/tutorius/creator.py
index 7455ecb..7463fa3 100644
--- a/tutorius/creator.py
+++ b/tutorius/creator.py
@@ -395,7 +395,7 @@ class EditToolBox(gtk.Window):
def _list_prop_changed(self, widget, evt, action, propname, idx):
try:
- getattr(action, propname)[idx] = int(widget.get_text())
+ getattr(action, propname)[idx] = eval(widget.get_text())
except ValueError:
widget.set_text(str(getattr(action, propname)[idx]))
self.__parent._creator._action_refresh_cb(None, None, action)
diff --git a/tutorius/overlayer.py b/tutorius/overlayer.py
index 931949d..d2cb3ac 100644
--- a/tutorius/overlayer.py
+++ b/tutorius/overlayer.py
@@ -157,14 +157,14 @@ class TextBubble(gtk.Widget):
A CanvasDrawableWidget drawing a round textbox and a tail pointing
to a specified widget.
"""
- def __init__(self, text, speaker=None, tailpos=[0,0]):
+ def __init__(self, text, speaker=None, tailpos=[[0,0],[0,0],[0,0]]):#list with N éléments (cf bublemessage.py)
"""
Creates a new cairo rendered text bubble.
@param text the text to render in the bubble
@param speaker the widget to compute the tail position from
- @param tailpos (optional) position relative to the bubble to use as
- the tail position, if no speaker
+ @param tailpos (optional) list of positions relative to the bubble to use as
+ tails position, if no speaker
"""
gtk.Widget.__init__(self)
@@ -175,7 +175,7 @@ class TextBubble(gtk.Widget):
self.label = text
self.speaker = speaker
- self.tailpos = tailpos
+ self.tailpos = tailpos
self.line_width = 5
self.padding = 20
@@ -199,13 +199,14 @@ class TextBubble(gtk.Widget):
# TODO fetch speaker coordinates
# draw bubble tail if present
- if self.tailpos != [0,0]:
- context.move_to(xradius-width/4, yradius)
- context.line_to(self.tailpos[0], self.tailpos[1])
- context.line_to(xradius+width/4, yradius)
- context.set_line_width(self.line_width)
- context.set_source_rgb(*xo_line_color)
- context.stroke_preserve()
+ for i in range(len(self.tailpos)):
+ if self.tailpos[i] != [0,0]:
+ context.move_to(xradius-width/4, yradius)
+ context.line_to(self.tailpos[i][0], self.tailpos[i][1])
+ context.line_to(xradius+width/4, yradius)
+ context.set_line_width(self.line_width)
+ context.set_source_rgb(*xo_line_color)
+ context.stroke_preserve()
# bubble border
context.move_to(width-self.padding, 0.0)
@@ -228,13 +229,14 @@ class TextBubble(gtk.Widget):
context.fill()
# bubble painting. Redrawing the inside after the tail will combine
- if self.tailpos != [0,0]:
- context.move_to(xradius-width/4, yradius)
- context.line_to(self.tailpos[0], self.tailpos[1])
- context.line_to(xradius+width/4, yradius)
- context.set_line_width(self.line_width)
- context.set_source_rgb(*xo_fill_color)
- context.fill()
+ for i in range(len(self.tailpos)):
+ if self.tailpos[i] != [0,0]:
+ context.move_to(xradius-width/4, yradius)
+ context.line_to(self.tailpos[i][0], self.tailpos[i][1])
+ context.line_to(xradius+width/4, yradius)
+ context.set_line_width(self.line_width)
+ context.set_source_rgb(*xo_fill_color)
+ context.fill()
context.set_source_rgb(1.0, 1.0, 1.0)
pangoctx = pangocairo.CairoContext(context)
diff --git a/tutorius/properties.py b/tutorius/properties.py
index 62a7605..55b02ca 100644
--- a/tutorius/properties.py
+++ b/tutorius/properties.py
@@ -204,8 +204,12 @@ class TArrayProperty(TutoriusProperty):
self.type = "array"
self.max_size_limit = MaxSizeConstraint(max_size_limit)
self.min_size_limit = MinSizeConstraint(min_size_limit)
+ self.indexeur = value #stock la value, pour l'indexation
self.default = self.validate(value)
-
+
+ def __getitem__(self, key): # obligation de redéfinir l'indexation
+ return self.indexeur[key] #
+
class TColorProperty(TutoriusProperty):
"""
Represents a RGB color with 3 8-bit integer values.