lot a small steps...
This commit is contained in:
63
swissmx.py
63
swissmx.py
@@ -344,13 +344,13 @@ class Main(QMainWindow, Ui_MainWindow):
|
||||
vb.addItem(grid)
|
||||
|
||||
#--- beam marker ---
|
||||
bm_sz=np.array(tuple(map(int, cfg.value(AppCfg.GEO_BEAM_SZ))))
|
||||
self._goBeamMarker=bm=UsrGO.Marker(-opt_ctr-[50, 120],bm_sz,mode=0)
|
||||
bm.setTransform(tr) # assign transform
|
||||
bm_sz=np.array((50, 40)) # it is immidiatly repositioned in zoom_changed_cb
|
||||
self._goBeamMarker=bm=UsrGO.Marker(-opt_ctr-bm_sz/2,bm_sz,mode=0)
|
||||
self.vb.addItem(bm)
|
||||
|
||||
#--- opctical center ---
|
||||
self._goOptCtr=obj=UsrGO.Marker(-opt_ctr, [50, 50],mode=1)
|
||||
#--- opctical center ----
|
||||
oc_sz=np.array((50,50))
|
||||
self._goOptCtr=obj=UsrGO.Marker(-opt_ctr-oc_sz/2, oc_sz,mode=1)
|
||||
bm.setTransform(tr) # assign transform
|
||||
self.vb.addItem(obj)
|
||||
|
||||
@@ -1038,26 +1038,24 @@ class Main(QMainWindow, Ui_MainWindow):
|
||||
|
||||
def zoom_changed_cb(self, value):
|
||||
self.zoomChanged.emit(value)
|
||||
app=QApplication.instance()
|
||||
cfg=app._cfg
|
||||
geo=app._geometry
|
||||
try:
|
||||
ppm = self.ppm_fitter(value)
|
||||
geo.interp_zoom(value)
|
||||
except AttributeError as e:
|
||||
_log.warning(e)
|
||||
else:
|
||||
_log.debug("zoom callback zoomChanged.emit({}), pixelsPerMillimeter.emit({})".format(value, ppm))
|
||||
self.pixelsPerMillimeter.emit(ppm)
|
||||
self.update_beam_marker(value)
|
||||
|
||||
# def getZoom(self):
|
||||
# return qoptic_zoom.get_position()
|
||||
|
||||
# def getPpm(self):
|
||||
# ppm_fitter = None
|
||||
# try:
|
||||
# ppm_fitter = self.ppm_fitter(self.getZoom())
|
||||
# except Exception as e:
|
||||
# _log.error("garbage in getPpm()")
|
||||
# traceback.print_exc()
|
||||
# return ppm_fitter
|
||||
opt_ctr=geo._opt_ctr
|
||||
bm_sz=np.array(tuple(map(float, cfg.value(AppCfg.GEO_BEAM_SZ))))/1000
|
||||
bm_pos=np.array(tuple(map(float, cfg.value(AppCfg.GEO_BEAM_POS))))/1000
|
||||
bm_sz=np.abs(geo.pos2pix(bm_sz))
|
||||
bm_pos=-opt_ctr-geo.pos2pix(bm_pos)-bm_sz/2
|
||||
bm=self._goBeamMarker
|
||||
bm.setPos(bm_pos,finish=False)
|
||||
bm.setSize(bm_sz)
|
||||
_log.debug(f"zoom->{value} beam marker pos:{bm_pos} sz:{bm_sz})")
|
||||
#self.update_beam_marker(value)
|
||||
|
||||
def append_to_beam_markers(self, x, y, zoom):
|
||||
self._beam_markers[zoom] = (x, y)
|
||||
@@ -1181,9 +1179,10 @@ class Main(QMainWindow, Ui_MainWindow):
|
||||
if task==TASK_SETUP_GEOMETRY_CALIB:
|
||||
self.mouse_click_event_geometry_calib(event)
|
||||
return
|
||||
|
||||
#Ctrl-left : move to position
|
||||
#Ctrl-left : move to position
|
||||
################################
|
||||
# Ctrl-left : move to position
|
||||
# Ctrl-right : object tree
|
||||
################################
|
||||
|
||||
#dblclick = event.double()
|
||||
app=QApplication.instance()
|
||||
@@ -1201,8 +1200,19 @@ class Main(QMainWindow, Ui_MainWindow):
|
||||
p1=self._goImg.mapFromScene(pos)
|
||||
p2=bm.pos()+bm.size()/2
|
||||
px=p2+p1
|
||||
um=geo.pix2pos(px)
|
||||
_log.debug(f'{px} -> {um}')
|
||||
mm=geo.pix2pos(px)
|
||||
_log.debug(f'{px} -> {mm}')
|
||||
fx_motor, fy_motor, bx_motor, bz_motor, omega_motor=self.get_gonio_tweakers()
|
||||
#fx=fx_motor.get_position()
|
||||
#fy=fy_motor.get_position()
|
||||
#dx=(x-bx)/ppm
|
||||
#dy=-(y-by)/ppm
|
||||
#fx+=dx
|
||||
#fy+=dy
|
||||
fx_motor.move_relative(mm[0])
|
||||
fy_motor.move_relative(mm[1])
|
||||
#self.fast_dx_position.emit(dx)
|
||||
#self.fast_dy_position.emit(dy)
|
||||
pass
|
||||
elif mod&Qt.AltModifier:
|
||||
pass
|
||||
@@ -1228,7 +1238,6 @@ class Main(QMainWindow, Ui_MainWindow):
|
||||
event.pos()# return Point(self.currentItem.mapFromScene(self._scenePos))
|
||||
|
||||
app=QApplication.instance()
|
||||
fx_motor, fy_motor, bx_motor, bz_motor, omega_motor = self.get_gonio_tweakers()
|
||||
|
||||
if event.button() == Qt.RightButton:
|
||||
UsrGO.obj_info(self.vb.childTransform())
|
||||
|
||||
Reference in New Issue
Block a user