forked from julienGautier77/camera
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcameraRosa.py
executable file
·132 lines (91 loc) · 4.15 KB
/
cameraRosa.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 6 13:56:12 2020
@author: LOA
"""
import qdarkstyle
import sys,time
from camera2 import CAMERA
from PyQt5.QtWidgets import QApplication,QVBoxLayout,QHBoxLayout,QWidget,QToolButton
import pathlib,os
from pyqtgraph.Qt import QtCore
from PyQt5.QtGui import QIcon
from TiltGuiLight import TILTMOTORGUI
from oneMotorSimple import ONEMOTOR
from scanMotorCamera import SCAN
class CAMERAMOTOR(QWidget):
def __init__(self,cam='choose',confFile='confCamera.ini',**kwds):
super(CAMERAMOTOR, self).__init__()
self.cam=cam
p = pathlib.Path(__file__)
self.nbcam=cam
self.kwds=kwds
if "affLight" in kwds:
self.light=kwds["affLight"]
else:
self.light=True
if "multi" in kwds:
self.multi=kwds["multi"]
else:
self.multi=False
# self.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5()) # qdarkstyle : black windows style
if "confPath" in kwds:
self.conf=QtCore.QSettings(kwds["confPath"], QtCore.QSettings.IniFormat)
else :
self.conf=QtCore.QSettings(str(p.parent / confFile), QtCore.QSettings.IniFormat) # ini file
# self.confPath=str(p.parent / confFile) # ini file path
if "conf" in kwds:
self.conf=kwds["conf"]
self.kwds["conf"]=self.conf
sepa=os.sep
self.configPath=str(p.parent)+"/fichiersConfig/"
self.configMotName='configMoteurRSAI.ini'
self.confMotorPath=self.configPath+self.configMotName
self.confMot=QtCore.QSettings(str(p.parent / self.confMotorPath), QtCore.QSettings.IniFormat)
self.icon=str(p.parent) + sepa+'icons'+sepa
self.setWindowIcon(QIcon(self.icon+'LOA.png'))
self.setup()
self.actionButton()
def setup(self):
hMainLayout=QHBoxLayout()
self.camWidget=CAMERA(cam=self.cam,confMot=self.confMot,**self.kwds)
motorTilt=TILTMOTORGUI(motLat='camLat',motorTypeName0='RSAI',motVert='camVert',motorTypeName1='RSAI',configMotorPath=self.configPath)
motorTilt.startThread2()
self.motorFoc=ONEMOTOR(mot0='camFoc',motorTypeName0='RSAI',nomWin='Foc',unit=1,jogValue=100)
self.motorFoc.startThread2()
self.scanWidget=SCAN(self,mot0='camFoc',motorTypeName0='RSAI',confMot=self.confMot)
self.scanWidget.acqMain.connect(self.camWidget.acquireOneImage)
self.scanButton=QToolButton()
self.scanButton.setText('Scan Foc')
self.scanButton.setMinimumWidth(40)
self.scanButton.setMinimumHeight(30)
self.scanButton.setStyleSheet('background-color: gray ;border-color: gray')
hMainLayout.addWidget(self.camWidget)
vmainLayout=QVBoxLayout()
vmainLayout.addWidget(motorTilt)
vmainLayout.addWidget(self.scanButton)
hMainLayout.addLayout(vmainLayout)
self.setLayout(hMainLayout)
self.setGeometry(100, 30, 1500, 800)
def actionButton(self):
self.scanButton.clicked.connect((lambda:self.open_widget(self.scanWidget)))
def open_widget(self,fene):
""" ouverture widget suplementaire
"""
if fene.isWinOpen==False:
fene.setup
fene.isWinOpen=True
fene.show()
else:
fene.activateWindow()
fene.raise_()
fene.showNormal()
if __name__ == "__main__":
appli = QApplication(sys.argv)
appli.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
p = pathlib.Path(__file__)
sepa=os.sep
pathVisu=str(p.parent) + sepa +'confCamera.ini'
e = CAMERAMOTOR(cam="firstBasler",affLight=False,multi=False,fft='off',confPath=pathVisu,separate=False)
e.show()
appli.exec_()