A backend to scan a feat for a given instrument.
| 17 | |
| 18 | |
| 19 | class FeatScan(Scan): |
| 20 | """A backend to scan a feat for a given instrument. |
| 21 | """ |
| 22 | |
| 23 | #: Signal emitted before starting a new iteration |
| 24 | #: Parameters: loop counter, step value, overrun |
| 25 | iteration = QtCore.Signal(int, int, bool) |
| 26 | |
| 27 | #: Signal emitted when the loop finished. |
| 28 | #: The parameter is used to inform if the loop was canceled. |
| 29 | loop_done = QtCore.Signal(bool) |
| 30 | |
| 31 | instrument = InstrumentSlot |
| 32 | |
| 33 | #: Name of the scanned feat |
| 34 | #: :type: str |
| 35 | |
| 36 | def __init__(self, feat_name, *args, **kwargs): |
| 37 | super().__init__(*args, **kwargs) |
| 38 | self.feat_name = feat_name |
| 39 | |
| 40 | def _pre_body(self, counter, new_value, overrun): |
| 41 | setattr(self.instrument, self.feat_name, new_value) |
| 42 | |
| 43 | @property |
| 44 | def feat_units(self): |
| 45 | """Units of the scanned feat. |
| 46 | """ |
| 47 | target = self.instrument |
| 48 | feat_name = self.feat_name |
| 49 | feat = target.feats[feat_name] |
| 50 | return str(feat.units) |
| 51 | |
| 52 | |
| 53 | class FeatScanUi(ScanUi): |