major fixes
This commit is contained in:
@@ -33,22 +33,23 @@ class MotorTweak(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, **kwargs):
|
||||
def connect_motor(self, rec_name, **kwargs):
|
||||
# TODO: DO NOT USE Motor base class, but reduce to the only really needed PV: s.a. class QopticZoom(object)
|
||||
# TODO: have a own motor Class as class SimMotor:
|
||||
m = Motor(motor_base)
|
||||
label=kwargs['label']
|
||||
self._label=label
|
||||
m = Motor(rec_name)
|
||||
m.get_position()
|
||||
self._ignore_limits = m.HLM == m.LLM # if both high/low limits are equal they are meaningless
|
||||
self._motor = m
|
||||
m._short_name = short_name
|
||||
self._rec_name = rec_name
|
||||
|
||||
for attr in ['RTYP', 'JVEL', 'HLS', 'LLS', 'TWV', 'RBV', 'VAL', 'LVIO', 'HLM', 'LLM']:
|
||||
@@ -96,6 +97,7 @@ class MotorTweak(QWidget, Ui_MotorTweak):
|
||||
def set_val(self, **kw):
|
||||
v = kw['char_value']
|
||||
_log.debug('updating VAL = {}'.format(v))
|
||||
self._val=float(v) # rewrite in case of tweaking
|
||||
self._drive_val.setText(v)
|
||||
|
||||
|
||||
@@ -187,7 +189,7 @@ class MotorTweak(QWidget, Ui_MotorTweak):
|
||||
'''
|
||||
field = kw['motor_field']
|
||||
src = kw['source_field']
|
||||
kw['alias'] = self.short_name
|
||||
kw['alias'] = self._label
|
||||
if field != src:
|
||||
return
|
||||
if field == 'VAL':
|
||||
@@ -243,7 +245,7 @@ class MotorTweak(QWidget, Ui_MotorTweak):
|
||||
def contextMenuEvent(self, event):
|
||||
m = self._motor
|
||||
menu = QMenu(self)
|
||||
menu.setTitle(self.short_name)
|
||||
menu.setTitle(self._label)
|
||||
|
||||
lockmotor = QAction('lock motor', menu, checkable=True)
|
||||
lockmotor.setChecked(self._locked)
|
||||
@@ -336,7 +338,7 @@ class MotorTweak(QWidget, Ui_MotorTweak):
|
||||
|
||||
for k in source:
|
||||
target[k] = source[k].format(
|
||||
short_name=self.short_name,
|
||||
label=self._label,
|
||||
precision=m.PREC,
|
||||
units=m.units)
|
||||
try:
|
||||
|
||||
Reference in New Issue
Block a user