major fixes
This commit is contained in:
@@ -22,14 +22,13 @@ _log = logging.getLogger(__name__)
|
||||
#logger.setLevel(logging.INFO)
|
||||
|
||||
class SimMotor:
|
||||
def __init__(self,rec_name, short_name):
|
||||
def __init__(self,rec_name):
|
||||
self._llm = -10
|
||||
self._hlm = 10
|
||||
self._prec = 5
|
||||
self._twv = 0.1
|
||||
self._units = 'mm'
|
||||
self._pos = 3.1415
|
||||
self._short_name=short_name
|
||||
self._rec_name=rec_name
|
||||
|
||||
class SimMotorTweak(QWidget, Ui_MotorTweak):
|
||||
@@ -48,17 +47,19 @@ class SimMotorTweak(QWidget, Ui_MotorTweak):
|
||||
self._locked = False
|
||||
self._label_style = 'basic'
|
||||
self._templates_source = {
|
||||
'basic': '<b>{short_name}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>',
|
||||
'small': '<small>{short_name} <font size="small" color="#080">{{rbv:.{precision}f}} {units}</font><small>',
|
||||
'2 lines': '<b>{short_name}</b><br><font size="small" color="#080">{{rbv:.{precision}f}} {units}</font>',
|
||||
'busy': '<b>{short_name}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>'
|
||||
'basic': '<b>{label}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>',
|
||||
'small': '<small>{label} <font size="small" color="#080">{{rbv:.{precision}f}} {units}</font><small>',
|
||||
'2 lines': '<b>{label}</b><br><font size="small" color="#080">{{rbv:.{precision}f}} {units}</font>',
|
||||
'busy': '<b>{label}</b> <font color="#080">{{rbv:.{precision}f}} {units}</font>'
|
||||
}
|
||||
self._templates = {}
|
||||
|
||||
|
||||
def connect_motor(self, rec_name, short_name, *args, **kwargs):
|
||||
self.label.setToolTip('{} => {}'.format(rec_name, short_name))
|
||||
self._motor=m=SimMotor(rec_name, short_name)
|
||||
def connect_motor(self, rec_name, **kwargs):
|
||||
label=kwargs['label']
|
||||
self._label=label
|
||||
self.label.setToolTip('{} => {}'.format(rec_name, label))
|
||||
self._motor=m=SimMotor(rec_name)
|
||||
self.set_motor_validator()
|
||||
self._drive_val.setText(str(m._pos))
|
||||
self._drive_val.returnPressed.connect(self.move_abs)
|
||||
@@ -107,7 +108,7 @@ class SimMotorTweak(QWidget, Ui_MotorTweak):
|
||||
m._pos += dist
|
||||
if delay:
|
||||
sleep(delay)
|
||||
_log.debug('{} rel move => {}'.format(m._short_name, dist))
|
||||
_log.debug('{} rel move => {} {:5.4g}'.format(self._label, dist,m._pos))
|
||||
self.update_label()
|
||||
self.emit_signals(source_field='VAL')
|
||||
|
||||
@@ -149,9 +150,9 @@ class SimMotorTweak(QWidget, Ui_MotorTweak):
|
||||
if assert_position:
|
||||
wait=True
|
||||
if drive is None:
|
||||
_log.debug('{} abs target from widget'.format(m._short_name))
|
||||
_log.debug('{} abs target from widget'.format(self._label))
|
||||
drive = float(self._drive_val.text())
|
||||
_log.debug('{} abs move => {}'.format(m._short_name, drive))
|
||||
_log.debug('{} abs move => {}'.format(self._label, drive))
|
||||
m._pos=drive
|
||||
self.update_label()
|
||||
self.emit_signals(source_field='VAL')
|
||||
@@ -225,7 +226,7 @@ class SimMotorTweak(QWidget, Ui_MotorTweak):
|
||||
prec = self._prec
|
||||
|
||||
menu = QMenu(self)
|
||||
menu.setTitle(self.short_name)
|
||||
menu.setTitle(self._label)
|
||||
|
||||
lockmotor = QAction('lock motor', menu, checkable=True)
|
||||
lockmotor.setChecked(self._locked)
|
||||
@@ -292,7 +293,7 @@ class SimMotorTweak(QWidget, Ui_MotorTweak):
|
||||
|
||||
for k in source:
|
||||
target[k] = source[k].format(
|
||||
short_name=m._short_name,
|
||||
label=self._label,
|
||||
precision=m._prec,
|
||||
units=m._units)
|
||||
self.label.setText(target[self._label_style].format(rbv=m._pos))
|
||||
|
||||
Reference in New Issue
Block a user