Changeset 1084
- Timestamp:
- 11/21/06 06:56:23 (2 years ago)
- Files:
-
- gaphor/branches/new-canvas/gaphor/__init__.py (modified) (1 diff)
- gaphor/branches/new-canvas/gaphor/adapters/connectors.py (modified) (6 diffs)
- gaphor/branches/new-canvas/gaphor/diagram/tests/test_handletool.py (modified) (1 diff)
- gaphor/branches/new-canvas/gaphor/misc/meta.py (deleted)
- gaphor/branches/new-canvas/gaphor/misc/singleton.py (deleted)
- gaphor/branches/new-canvas/gaphor/tests/test_storage.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphor/branches/new-canvas/gaphor/__init__.py
r1007 r1084 11 11 #del pygtk 12 12 13 import misc.singleton14 13 import misc.logger 15 14 gaphor/branches/new-canvas/gaphor/adapters/connectors.py
r1081 r1084 11 11 from gaphor.diagram.interfaces import IConnect 12 12 from gaphor.diagram import items 13 13 from gaphor.misc.ipair import ipair 14 14 15 15 class AbstractConnect(object): … … 150 150 def _glue(self, handle, x, y): 151 151 """ 152 Return the point on the element (DiagramLine) closest to (x, y) 152 Return the segment and point on the element (DiagramLine) 153 closest to (x, y). 153 154 """ 154 155 h = self.line.handles() 155 156 pos = (x, y) 156 h0 = h[0]157 157 min_d = None 158 158 segment = -1 159 159 min_p = None 160 160 dlp = geometry.distance_line_point 161 for s, h1 in enumerate(h[1:]):161 for s, (h0, h1) in enumerate(ipair(h)): 162 162 d, p = dlp(h0.pos, h1.pos, pos) 163 163 if not s or d < min_d: … … 194 194 Connect a comment line to a comment item. 195 195 Connect Comment.annotatedElement to any element 196 197 TODO: adapt both ElementItem and DiagramLine198 use component.provideAdapter?199 196 """ 200 197 component.adapts(items.ElementItem, items.CommentLineItem) … … 248 245 component.provideAdapter(CommentLineElementConnect) 249 246 247 250 248 class CommentLineLineConnect(LineConnect): 251 249 """ 252 250 Connect a comment line to a comment item. 253 251 Connect Comment.annotatedElement to any element 254 255 TODO: adapt both ElementItem and DiagramLine256 use component.provideAdapter?257 252 """ 258 253 component.adapts(items.DiagramLine, items.CommentLineItem) … … 268 263 connected_to = opposite.connected_to 269 264 if connected_to is element: 270 #print 'item identical', connected_to, element271 265 return None 272 266 … … 275 269 (not (connected_to.subject or element.subject)) \ 276 270 and connected_to.subject is element.subject: 277 #print 'Subjects none or match:', connected_to.subject, element.subject278 271 return None 279 272 gaphor/branches/new-canvas/gaphor/diagram/tests/test_handletool.py
r1019 r1084 206 206 207 207 208 # vim:sw=4:et:ai gaphor/branches/new-canvas/gaphor/tests/test_storage.py
r1079 r1084 202 202 c2 = diagram.create(items.ClassItem, subject=UML.create(UML.Class)) 203 203 c2.matrix.translate(200, 200) 204 c2.request_update() 205 diagram.canvas.update_now() 204 diagram.canvas.update_matrix(c2) 206 205 assert tuple(diagram.canvas.get_matrix_i2w(c2)) == (1, 0, 0, 1, 200, 200) 207 206
