Changeset 1643
- Timestamp:
- 07/16/07 10:23:39 (1 year ago)
- Files:
-
- gaphas/branches/hw/gaphas/examples.py (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
gaphas/branches/hw/gaphas/examples.py
r1642 r1643 209 209 210 210 if abs(hx - ax) < 0.01: 211 return handles[NW], handles[SW] , (hy - ay) / (by - ay)211 return handles[NW], handles[SW] 212 212 elif abs(hy - ay) < 0.01: 213 return handles[NW], handles[NE] , (hx - ax) / (bx - ax)213 return handles[NW], handles[NE] 214 214 elif abs(hx - bx) < 0.01: 215 return handles[NE], handles[SE] , (hy - ay) / (by - ay)215 return handles[NE], handles[SE] 216 216 else: 217 return handles[SW], handles[SE] , (hx - ax) / (bx - ax)217 return handles[SW], handles[SE] 218 218 assert False 219 219 … … 224 224 except KeyError: 225 225 pass # constraint was alreasy removed 226 handle._connect_constraint = None227 226 handle.connected_to = None 228 227 # Remove disconnect handler: … … 233 232 if glue_item and glue_item is handle.connected_to: 234 233 try: 235 view.canvas.solver.remove_constraint(handle._c1) 236 view.canvas.solver.remove_constraint(handle._c2) 234 item.remove_iconstraint(handle) 237 235 except KeyError: 238 236 pass # constraint was already removed 239 237 240 241 assert False, 'not now!' 242 h1, h2, b = side(handle, glue_item) 243 handle._c1 = BalanceConstraint(band=(h1.x, h1.x), v=handle.x) 244 handle._c2 = BalanceConstraint(band=(h2.y, h2.y), v=handle.y) 245 view.canvas.solver.add_constraint(handle._c1) 246 view.canvas.solver.add_constraint(handle._c2) 238 h1, h2 = side(handle, glue_item) 239 lc = LineConstraint(line=(h1.pos, h2.pos), point=handle.pos) 240 pdata = { 241 h1.pos: glue_item, 242 h2.pos: glue_item, 243 handle.pos: item, 244 } 245 246 view.canvas.proj(lc, xy=pdata) 247 view.canvas.proj(lc, xy=pdata, f=lc.update_ratio) 248 lc.update_ratio() 249 item.add_iconstraint(handle, lc) 250 247 251 handle.disconnect = handle_disconnect 248 252 return … … 254 258 if glue_item: 255 259 if isinstance(glue_item, Box): 256 h1, h2 , b= side(handle, glue_item)260 h1, h2 = side(handle, glue_item) 257 261 258 262 # Make a constraint that keeps into account item coordinates.
