Changeset 2296 for gaphor/trunk/gaphor/diagram/classes
- Timestamp:
- 04/08/08 16:53:20 (8 months ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphor/trunk/gaphor/diagram/classes/association.py
r2294 r2296 1 2 """AssociationItem -- Graphical representation of an association.1 """ 2 Association item - graphical representation of an association. 3 3 4 4 Plan: … … 6 6 - for assocation name and direction tag, use the same trick as is used 7 7 for line ends. 8 -9 10 8 """ 11 9 … … 107 105 108 106 def invert_direction(self): 109 """Invert the direction of the association, this is done by 110 swapping the head and tail-ends subjects. 107 """ 108 Invert the direction of the association, this is done by swapping 109 the head and tail-ends subjects. 111 110 """ 112 111 if not self.subject: … … 118 117 def on_named_element_name(self, event): 119 118 """ 119 Update names of the association as well as its ends. 120 120 121 Override NamedLine.on_named_element_name. 121 Update names of the association as well as its ends.122 122 """ 123 123 if event is None: … … 206 206 207 207 def point(self, x, y): 208 """Returns the distance from the Association to the (mouse) cursor. 208 """ 209 Returns the distance from the Association to the (mouse) cursor. 209 210 """ 210 211 return min(super(AssociationItem, self).point(x, y), … … 213 214 214 215 def draw_head_none(self, context): 215 """Draw an 'x' on the line end, indicating no traversing. 216 """ 217 Draw an 'x' on the line end to indicate no navigability at 218 association head. 216 219 """ 217 220 cr = context.cairo … … 223 226 cr.move_to(0, 0) 224 227 228 225 229 def draw_tail_none(self, context): 226 """Draw an 'x' on the line end, indicating no traversing. 230 """ 231 Draw an 'x' on the line end to indicate no navigability at 232 association tail. 227 233 """ 228 234 cr = context.cairo … … 234 240 cr.stroke() 235 241 242 236 243 def _draw_diamond(self, cr): 244 """ 245 Helper function to draw diamond shape for shared and composite 246 aggregations. 247 """ 237 248 cr.move_to(20, 0) 238 249 cr.line_to(10, -6) … … 242 253 cr.close_path() 243 254 255 244 256 def draw_head_composite(self, context): 245 """Draw a closed diamond on the line end. 257 """ 258 Draw a closed diamond on the line end to indicate composite 259 aggregation at association head. 246 260 """ 247 261 cr = context.cairo … … 251 265 cr.move_to(20, 0) 252 266 267 253 268 def draw_tail_composite(self, context): 254 """Draw a closed diamond on the line end. 269 """ 270 Draw a closed diamond on the line end to indicate composite 271 aggregation at association tail. 255 272 """ 256 273 cr = context.cairo … … 261 278 cr.stroke() 262 279 280 263 281 def draw_head_shared(self, context): 264 """Draw an open diamond on the line end. 282 """ 283 Draw an open diamond on the line end to indicate shared aggregation 284 at association head. 265 285 """ 266 286 cr = context.cairo … … 268 288 cr.move_to(20, 0) 269 289 290 270 291 def draw_tail_shared(self, context): 271 """Draw an open diamond on the line end. 292 """ 293 Draw an open diamond on the line end to indicate shared aggregation 294 at association tail. 272 295 """ 273 296 cr = context.cairo … … 277 300 cr.stroke() 278 301 302 279 303 def draw_head_navigable(self, context): 280 """Draw a normal arrow. 304 """ 305 Draw a normal arrow to indicate association end navigability at 306 association head. 281 307 """ 282 308 cr = context.cairo … … 287 313 cr.move_to(0, 0) 288 314 315 289 316 def draw_tail_navigable(self, context): 290 """Draw a normal arrow. 317 """ 318 Draw a normal arrow to indicate association end navigability at 319 association tail. 291 320 """ 292 321 cr = context.cairo … … 297 326 cr.line_to(15, 6) 298 327 328 299 329 def draw_head_undefined(self, context): 300 """Draw nothing. undefined. 330 """ 331 Draw nothing to indicate undefined association end at association 332 head. 301 333 """ 302 334 context.cairo.move_to(0, 0) 303 335 336 304 337 def draw_tail_undefined(self, context): 305 """Draw nothing. undefined. 338 """ 339 Draw nothing to indicate undefined association end at association 340 tail. 306 341 """ 307 342 context.cairo.line_to(0, 0) 343 308 344 309 345 def draw(self, context):
