Changeset 1640

Show
Ignore:
Timestamp:
07/16/07 09:55:49 (1 year ago)
Author:
wrobe..@pld-linux.org
Message:

- allow xy projection, useful in case of line constraint

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • gaphas/branches/hw/gaphas/canvas.py

    r1637 r1640  
    607607 
    608608    def _cproj(self, c, x=None, y=None, xy=None, **kw): 
    609         if x is not None: 
     609        if xy is not None: 
     610            for point, item in xy.items(): 
     611                x, y = point 
     612                i2c = self._canvas.get_matrix_i2c(item).transform_point 
     613                x._value, y._value = i2c(x._value, y._value) 
     614        elif x is not None: 
    610615            for v, item in x.items(): 
    611616                i2c = self._canvas.get_matrix_i2c(item).transform_point 
    612617                v._value, _ = i2c(v._value, 0) 
    613         if y is not None: 
     618        elif y is not None: 
    614619            for v, item in y.items(): 
    615620                i2c = self._canvas.get_matrix_i2c(item).transform_point 
    616621                _, v._value = i2c(0, v._value) 
     622        else: 
     623            raise AttributeError('Projection data not specified') 
    617624 
    618625 
    619626    def _iproj(self, c, x=None, y=None, xy=None, **kw): 
    620         if x is not None: 
     627        if xy is not None: 
     628            for point, item in xy.items(): 
     629                x, y = point 
     630                c2i = self._canvas.get_matrix_c2i(item).transform_point 
     631                x._value, y._value = c2i(x._value, y._value) 
     632                item.request_update() 
     633        elif x is not None: 
    621634            for v, item in x.items(): 
    622635                c2i = self._canvas.get_matrix_c2i(item).transform_point 
    623636                v._value, _ = c2i(v._value, 0) 
    624637                item.request_update() 
    625         if y is not None: 
     638        elif y is not None: 
    626639            for v, item in y.items(): 
    627640                c2i = self._canvas.get_matrix_c2i(item).transform_point 
    628641                _, v._value = c2i(0, v._value) 
    629642                item.request_update() 
     643        else: 
     644            raise AttributeError('Projection data not specified') 
    630645 
    631646