def __init__(self, timeSleep): self.continuous = None super(DarkShooterThread, self).__init__() self.console = ConsoleThreadOutput() self.s = timeSleep self.ss = SThread() self.settings = SettingsCamera()
def __init__(self, timeSleep): super(ContinuousShooterThread, self).__init__() self.continuous = True self.s = timeSleep self.ss = SThread() self.ss.started.connect(self.thread_iniciada) self.console = ConsoleThreadOutput() self.count = 0 self.wait_temperature = False self.not_two_dark = True
def __init__(self): self.lock = Locker() self.console = ConsoleThreadOutput() self.settings = SettingsCamera() self.settings.setup_settings() self.fan = Fan() # Campos da janela principal para as informações da câmera self.firmware_field = None self.model_field = None self.main = Status() self.now_plus_10 = datetime.now() self.settedhour = datetime.now() self.continuousShooterThread = ContinuousShooterThread( int(self.settings.get_camera_settings()[4])) self.ephemerisShooterThread = EphemerisShooter() self.sthread = SThread() self.commands = CameraQThread(self) self.shooting = False # Initiating the Slots self.init_slots() self.info_ini = [] info_ini = self.get_camera_settings_ini() self.aux_temperature = int(info_ini[0]) self.temp = 0 self.temp_contador = 0 self.temp_contador_manual = 0
class DarkShooterThread(QtCore.QThread): def __init__(self, timeSleep): self.continuous = None super(DarkShooterThread, self).__init__() self.console = ConsoleThreadOutput() self.s = timeSleep self.ss = SThread() self.settings = SettingsCamera() def run(self): self.s = int(self.settings.get_camera_settings()[4]) while self.continuous: time.sleep(self.s) if self.continuous: self.console.raise_text("Taking dark photo", 1) self.ss.take_dark()
def __init__(self, timeSleep): super(ContinuousShooterThread, self).__init__() self.continuous = True self.s = timeSleep ''' SThread manda para o Sbigdriver as informações para se tirar a foto em si. ''' self.ss = SThread() self.ss.started.connect(self.thread_iniciada) self.console = ConsoleThreadOutput() self.count = 0 self.wait_temperature = False self.not_two_dark = True self.one_photo = False
def __init__(self, parent=None): super(SettingsCCDInfos, self).__init__(parent) # Instance attributes create_ccd_info_group self.p = parent self.info_port_ccd_l = None self.info_port_ccd_f = None self.info_camera_model_l = None self.info_camera_model_f = None self.info_pixel_array_l = None self.info_pixel_array_f = None # Instance attributes create_ccd_camera_group self.close_open = None self.temp_set_point_l = None self.temp_set_point_f = None self.temp_init_l = None self.temp_init_f = None self.time_between_photos_l = None self.time_between_photos_f = None self.one_photoButton = None self.tempButton = None self.fanButton = None # Instance attributes create_push_button_group self.saveButton = None self.cancelButton = None self.clearButton = None self.imager_window = parent self.cam = Camera() self.var_save_ini_camera = SettingsCamera() self.console = ConsoleThreadOutput() self.fan = Fan(self.fanButton) self.one_photo = SThread() self.lock = Locker() self.firmware = "????" self.model = "????" self.y_pixels = "????" self.x_pixels = "????" grid = QGridLayout() # Additional Parameters (Apparently Useless) 0, 1 | 1, 1 | 2, 1 grid.addWidget(self.create_ccd_info_group()) grid.addWidget(self.create_ccd_camera_group()) grid.addWidget(self.create_push_button_group()) self.setLayout(grid) self.w = grid.geometry().width() self.h = grid.geometry().height() self.setWindowTitle("Imager Box")
def __init__(self, timeSleep): super(ContinuousShooterThread, self).__init__() self.continuous = True self.s = timeSleep self.ss = SThread() self.ss.started.connect(self.thread_iniciada) self.console = ConsoleThreadOutput() self.count = 0
class ContinuousShooterThread(QtCore.QThread): """classe para modo manual""" signalAfterShooting = QtCore.pyqtSignal(name="signalAfterShooting") signal_temp = QtCore.pyqtSignal(name="signalTemp") def __init__(self, timeSleep): super(ContinuousShooterThread, self).__init__() self.continuous = True self.s = timeSleep self.ss = SThread() self.ss.started.connect(self.thread_iniciada) self.console = ConsoleThreadOutput() self.count = 0 self.wait_temperature = False self.not_two_dark = True def set_sleep_time(self, t): self.s = t def run(self): self.count = 1 while self.continuous: try: self.signal_temp.emit() if self.wait_temperature: self.ss.start() while self.ss.isRunning(): time.sleep(1) except Exception as e: print(e) time.sleep(self.s) self.signalAfterShooting.emit() def start_continuous_shooter(self): self.continuous = True def stop_continuous_shooter(self): self.wait_temperature = False self.continuous = False self.not_two_dark = False self.console.raise_text("Taking dark photo", 1) self.ss.take_dark() time.sleep(1) self.count = 1 def thread_iniciada(self): if self.count == 1: self.console.raise_text("Taking dark photo", 1) self.ss.take_dark() self.count += 1 self.not_two_dark = False elif self.count != 1: self.console.raise_text("Taking photo N: {}".format(self.count), 1) self.count += 1
class ContinuousShooterThread(QtCore.QThread): signalAfterShooting = QtCore.pyqtSignal(name="signalAfterShooting") def __init__(self, timeSleep): super(ContinuousShooterThread, self).__init__() self.continuous = True self.s = timeSleep self.ss = SThread() self.ss.started.connect(self.thread_iniciada) self.console = ConsoleThreadOutput() self.count = 0 def set_sleep_time(self, t): self.s = t def run(self): self.count = 1 while self.continuous: try: self.ss.start() while self.ss.isRunning(): time.sleep(1) except Exception as e: print(e) time.sleep(self.s) self.signalAfterShooting.emit() def start_continuous_shooter(self): self.continuous = True def stop_continuous_shooter(self): self.count = 1 self.continuous = False def thread_iniciada(self): self.console.raise_text("Taking photo N: {}".format(self.count), 2) self.count += 1
def __init__(self, parent=None): super(SettingsWindow, self).__init__(parent) self.cam = SettingsCamera() self.camera = Camera() self.console = ConsoleThreadOutput() self.create_cam_widgets() self.p = parent self.fan = Fan(self.fanButton) self.lock = Locker() self.setting_values() self.one_photo = SThread() self.setLayout( set_lvbox( set_hbox(self.setField_temperature_label, self.setField_temperature), set_hbox(self.pre, self.prel), set_hbox(self.exp, self.expl), set_hbox(self.binning, self.combo), set_hbox(self.dark, self.close_open), set_hbox(self.tempo_fotos_label, self.tempo_fotos), set_hbox(self.time_colling_label, self.time_colling), set_hbox(self.contrast_msg), set_hbox(self.getlevel1, self.getlevel1l, self.getlevel2, self.getlevel2l), set_hbox(self.ignore_crop_l), set_hbox(self.crop_msg), set_hbox(self.crop_xi, self.getcropxi_l, self.crop_xf, self.getcropxf_l), set_hbox(self.crop_yi, self.getcropyi_l, self.crop_yf, self.getcropyf_l), set_hbox(self.image_tif_l), set_hbox(self.image_fit_l), set_hbox(self.btn_one_photo, self.tempButton, self.fanButton, stretch2=1), set_hbox(self.buttonok, self.button_clear, self.buttoncancel, stretch2=1)))
def __init__(self, time_sleep): super(ContinuousShooterThread, self).__init__() self.continuous = True # SThread manda para o Sbigdriver as informações para se tirar a foto em si. self.ss = SThread() self.photo_type = self.ss.recebe_argumento self.ss.started.connect(self.thread_iniciada) self.console = ConsoleThreadOutput() self.count = 0 self.wait_temperature = False self.not_two_dark = True self.one_photo = False self.one_photo_shutter_state = None self.select_filter_manual = None self.select_filter_shutter = None
def __init__(self, parent=None): super(SettingsWindow, self).__init__(parent) self.cam = SettingsCamera() self.camera = Camera() self.console = ConsoleThreadOutput() #self.a_temp_regulation = TempRegulation(self) self.create_cam_widgets() self.p = parent self.fan = Fan(self.fanButton) #self.button_clear = QtWidgets.QPushButton('Clear', self) self.setField_temperature = QtWidgets.QLineEdit(self) self.setting_values() self.one_photo = SThread() self.setLayout( set_lvbox( set_hbox(self.setField_temperature_label, self.setField_temperature), set_hbox(self.pre, self.prel), set_hbox(self.exp, self.expl), set_hbox(self.binning, self.combo), set_hbox(self.tempo_fotos_label, self.tempo_fotos), set_hbox(self.time_colling_label, self.time_colling), set_hbox(self.dark, self.close_open), set_hbox(self.getlevel1, self.getlevel1l), set_hbox(self.getlevel2, self.getlevel2l), set_hbox(self.btn_one_photo, self.tempButton, self.fanButton, stretch2=1), set_hbox(self.buttonok, self.button_clear, self.buttoncancel, stretch2=1)))
def __init__(self): self.lock = Locker() self.console = ConsoleThreadOutput() self.settings = SettingsCamera() self.settings.setup_settings() self.fan = Fan() # Campos da janela principal para as informações da câmera self.firmware_field = None self.model_field = None self.valor_pixels_x = None self.valor_pixels_y = None self.main = Status() self.now_plus = datetime.now() self.settedhour = datetime.now() """ executa o modo manual continuousShooterThread """ self.continuousShooterThread = ContinuousShooterThread( int(self.settings.get_camera_settings()[4])) """ executa o modo automatico ephemerisShooterThread """ self.ephemerisShooterThread = EphemerisShooter() self.sthread = SThread() self.commands = CameraQThread(self) self.shooting = False # Initiating the Slots self.init_slots() self.info_ini = [] self.pass_list = [1024, 1024] self.pass_list_str = ["1024", "1024"] info_ini = self.get_camera_settings_ini() self.aux_temperature = int(info_ini[0]) self.temp = 0 self.temp_contador = False self.temp_contador_manual = False self.is_connected = False
class SettingsWindow(QtWidgets.QWidget): def __init__(self, parent=None): super(SettingsWindow, self).__init__(parent) self.cam = SettingsCamera() self.camera = Camera() self.console = ConsoleThreadOutput() #self.a_temp_regulation = TempRegulation(self) self.create_cam_widgets() self.p = parent self.fan = Fan(self.fanButton) #self.button_clear = QtWidgets.QPushButton('Clear', self) self.setField_temperature = QtWidgets.QLineEdit(self) self.setting_values() self.one_photo = SThread() self.setLayout( set_lvbox( set_hbox(self.setField_temperature_label, self.setField_temperature), set_hbox(self.pre, self.prel), set_hbox(self.exp, self.expl), set_hbox(self.binning, self.combo), set_hbox(self.tempo_fotos_label, self.tempo_fotos), set_hbox(self.time_colling_label, self.time_colling), set_hbox(self.dark, self.close_open), set_hbox(self.getlevel1, self.getlevel1l), set_hbox(self.getlevel2, self.getlevel2l), set_hbox(self.btn_one_photo, self.tempButton, self.fanButton, stretch2=1), set_hbox(self.buttonok, self.button_clear, self.buttoncancel, stretch2=1))) def get_camera_settings(self): settings = SettingsCamera() info = settings.get_camera_settings() return info def get_values(self): return self.cam.get_camera_settings() def setting_values(self): info = self.get_values() self.set_values(info[0], info[1], info[2], info[3], info[4], info[5], info[6], info[7], info[8]) def set_values(self, temperature_camera, prefixo, exposicao, binning, tempo_entre_fotos, time_colling, get_level1, get_level2, dark_photo): self.setField_temperature.setText(temperature_camera) self.prel.setText(prefixo) self.expl.setText(exposicao) try: b = int(binning) except: b = 0 try: open_or_close = int(dark_photo) except: open_or_close = 0 self.tempo_fotos.setText(tempo_entre_fotos) self.time_colling.setText(time_colling) self.combo.setCurrentIndex(b) self.close_open.setCurrentIndex(open_or_close) self.getlevel1l.setText(get_level1) self.getlevel2l.setText(get_level2) def create_cam_widgets(self): self.setField_temperature_label = QtWidgets.QLabel( "Temperature(°C):", self) self.pre = QtWidgets.QLabel("Filter name:", self) self.prel = QtWidgets.QLineEdit(self) self.exp = QtWidgets.QLabel("Exposure time(s):", self) self.expl = QtWidgets.QLineEdit(self) self.binning = QtWidgets.QLabel("Binning:", self) self.combo = QtWidgets.QComboBox(self) self.fill_combo() self.dark = QtWidgets.QLabel("Shooter:", self) self.close_open = QtWidgets.QComboBox(self) self.fill_combo_close_open() self.getlevel1 = QtWidgets.QLabel("Image contrast: bottom level:", self) self.getlevel1l = QtWidgets.QLineEdit(self) self.getlevel2 = QtWidgets.QLabel("Image contrast: top level:", self) self.getlevel2l = QtWidgets.QLineEdit(self) self.button_clear = QtWidgets.QPushButton('Clear', self) self.button_clear.clicked.connect(self.clear_all) self.btn_one_photo = QtWidgets.QPushButton('Take Photo', self) self.btn_one_photo.clicked.connect(self.take_one_photo) self.tempButton = QtWidgets.QPushButton("Set Temp", self) self.tempButton.clicked.connect(self.btn_temperature) self.fanButton = QtWidgets.QPushButton("Fan (On/Off)") self.fanButton.clicked.connect(self.button_fan_func) self.buttonok = QtWidgets.QPushButton("Save", self) self.buttonok.clicked.connect(self.button_ok_func) self.buttoncancel = QtWidgets.QPushButton("Cancel", self) self.buttoncancel.clicked.connect(self.func_cancel) self.tempo_fotos_label = QtWidgets.QLabel("Time between photos(s):", self) self.tempo_fotos = QtWidgets.QLineEdit(self) self.time_colling_label = QtWidgets.QLabel("CCD Cooling Time(s):", self) self.time_colling = QtWidgets.QLineEdit(self) def button_ok_func(self): try: # Saving the Settings self.cam.set_camera_settings(self.setField_temperature.text(), self.prel.text(), self.expl.text(),\ self.combo.currentIndex(), self.tempo_fotos.text(), self.time_colling.text(), \ self.getlevel1l.text(), self.getlevel2l.text(), self.close_open.currentIndex()) self.cam.save_settings() self.console.raise_text("Camera settings successfully saved!", 1) except Exception as e: self.console.raise_text("Camera settings were not saved.", 3) finally: pass #self.p.close() def clear_all(self): self.setField_temperature.clear() self.prel.clear() self.expl.clear() self.tempo_fotos.clear() def take_one_photo(self): try: info = self.get_camera_settings() if int(info[6]) == 1: self.console.raise_text("Taking dark photo", 1) self.one_photo.start() else: self.console.raise_text("Taking photo", 1) self.one_photo.start() except Exception: self.console.raise_text("Not possible taking photo", 1) def func_cancel(self): self.p.close() def button_fan_func(self): if getlinkstatus() is True: try: self.fan.set_fan() self.console.raise_text('State changed Fan!', 2) except Exception: self.console.raise_text("The camera is not connected!", 3) self.console.raise_text('State Fan unchanged', 3) else: self.console.raise_text("The camera is not connected!", 3) self.console.raise_text('State Fan unchanged', 3) def fill_combo(self): self.combo.addItem("1x1", 0) self.combo.addItem("2x2", 1) self.combo.addItem("3x3", 2) def fill_combo_close_open(self): self.close_open.addItem("Open", 0) self.close_open.addItem("Close", 1) def btn_temperature(self): try: value = self.setField_temperature.text() if value is '': pass else: self.camera.set_temperature(float(value)) except Exception as e: print("Exception -> {}".format(e))
class SettingsWindow(QtWidgets.QWidget): ''' Cria os campos e espaços no menu settings window ''' def __init__(self, parent=None): super(SettingsWindow, self).__init__(parent) self.cam = SettingsCamera() self.camera = Camera() self.console = ConsoleThreadOutput() self.create_cam_widgets() self.p = parent self.fan = Fan(self.fanButton) self.lock = Locker() self.setting_values() self.one_photo = SThread() self.setLayout( set_lvbox( set_hbox(self.setField_temperature_label, self.setField_temperature), set_hbox(self.pre, self.prel), set_hbox(self.exp, self.expl), set_hbox(self.binning, self.combo), set_hbox(self.dark, self.close_open), set_hbox(self.tempo_fotos_label, self.tempo_fotos), set_hbox(self.time_colling_label, self.time_colling), set_hbox(self.contrast_msg), set_hbox(self.getlevel1, self.getlevel1l, self.getlevel2, self.getlevel2l), set_hbox(self.ignore_crop_l), set_hbox(self.crop_msg), set_hbox(self.crop_xi, self.getcropxi_l, self.crop_xf, self.getcropxf_l), set_hbox(self.crop_yi, self.getcropyi_l, self.crop_yf, self.getcropyf_l), set_hbox(self.image_tif_l), set_hbox(self.image_fit_l), set_hbox(self.btn_one_photo, self.tempButton, self.fanButton, stretch2=1), set_hbox(self.buttonok, self.button_clear, self.buttoncancel, stretch2=1))) def get_camera_settings(self): settings = SettingsCamera() info = settings.get_camera_settings() return info def get_pixels(self): info = self.get_info_pixels() return int(info[-2]), int(info[-1]) def get_info_pixels(self): ''' Function to get the CCD Info This function will return [Pixels] ''' ret = None self.lock.set_acquire() try: ret = tuple(ccdinfo()) except Exception as e: self.console.raise_text( "Failed to get camera information.\n{}".format(e)) finally: self.lock.set_release() return ret def get_values(self): return self.cam.get_camera_settings() def setting_values(self): info = self.get_values() self.set_values(info[0], info[1], info[2], info[3], info[4], info[5], info[6], info[7], info[8], info[9],\ info[10], info[11], info[12], info[13], info[14], info[15]) def set_values(self, temperature_camera, prefixo, exposicao, binning, tempo_entre_fotos, time_colling, get_level1,\ get_level2, dark_photo, crop_xi, crop_xf, crop_yi, crop_yf, ignore_crop, image_tif, image_fit): self.setField_temperature.setText(temperature_camera) self.prel.setText(prefixo) self.expl.setText(exposicao) try: b = int(binning) except: b = 0 try: open_or_close = int(dark_photo) except: open_or_close = 0 self.tempo_fotos.setText(tempo_entre_fotos) self.time_colling.setText(time_colling) self.combo.setCurrentIndex(b) self.close_open.setCurrentIndex(open_or_close) self.getlevel1l.setText(get_level1) self.getlevel2l.setText(get_level2) self.getcropxi_l.setText(crop_xi) self.getcropxf_l.setText(crop_xf) self.getcropyi_l.setText(crop_yi) self.getcropyf_l.setText(crop_yf) self.ignore_crop_l.setChecked(ignore_crop) self.image_tif_l.setChecked(image_tif) self.image_fit_l.setChecked(image_fit) def create_cam_widgets(self): self.setField_temperature_label = QtWidgets.QLabel( "CCD Temperature(°C):", self) self.setField_temperature_label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.setField_temperature = QtWidgets.QLineEdit(self) self.setField_temperature.setMaximumWidth(100) self.pre = QtWidgets.QLabel("Filter Name:", self) self.pre.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.prel = QtWidgets.QLineEdit(self) self.prel.setMaximumWidth(100) self.exp = QtWidgets.QLabel("Exposure time (s):", self) self.exp.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.expl = QtWidgets.QLineEdit(self) self.expl.setMaximumWidth(100) self.binning = QtWidgets.QLabel("Binning:", self) self.binning.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.combo = QtWidgets.QComboBox(self) self.combo.setMaximumWidth(100) self.fill_combo() self.dark = QtWidgets.QLabel("Shutter:", self) self.dark.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.close_open = QtWidgets.QComboBox(self) self.close_open.setMaximumWidth(100) self.fill_combo_close_open() self.tempo_fotos_label = QtWidgets.QLabel("Time Between Images (s):", self) self.tempo_fotos_label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.tempo_fotos = QtWidgets.QLineEdit(self) self.tempo_fotos.setMaximumWidth(100) self.time_colling_label = QtWidgets.QLabel("CCD Cooling Time (s):", self) self.time_colling_label.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.time_colling = QtWidgets.QLineEdit(self) self.time_colling.setMaximumWidth(100) self.contrast_msg = QtWidgets.QLabel("Image Contrast:", self) self.getlevel1 = QtWidgets.QLabel("Bottom Level:", self) self.getlevel1.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.getlevel1l = QtWidgets.QLineEdit(self) self.getlevel1l.setMaximumWidth(50) self.getlevel2 = QtWidgets.QLabel("Top Level:", self) self.getlevel2.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.getlevel2l = QtWidgets.QLineEdit(self) self.getlevel2l.setMaximumWidth(50) self.ignore_crop_l = QtWidgets.QCheckBox('Ignore Crop Image', self) self.crop_msg = QtWidgets.QLabel("Crop Image", self) self.crop_xi = QtWidgets.QLabel("Width: Wi:", self) self.crop_xi.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.getcropxi_l = QtWidgets.QLineEdit(self) self.getcropxi_l.setMaximumWidth(50) self.crop_xf = QtWidgets.QLabel("Wf:", self) self.crop_xf.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.getcropxf_l = QtWidgets.QLineEdit(self) self.getcropxf_l.setMaximumWidth(50) self.crop_yi = QtWidgets.QLabel("Height: Hi:", self) self.crop_yi.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.getcropyi_l = QtWidgets.QLineEdit(self) self.getcropyi_l.setMaximumWidth(50) self.crop_yf = QtWidgets.QLabel("Hf:", self) self.crop_yf.setAlignment(QtCore.Qt.AlignRight | QtCore.Qt.AlignVCenter) self.getcropyf_l = QtWidgets.QLineEdit(self) self.getcropyf_l.setMaximumWidth(50) self.image_tif_l = QtWidgets.QCheckBox('Image .tif', self) self.image_fit_l = QtWidgets.QCheckBox('Image .fit', self) self.button_clear = QtWidgets.QPushButton('Clear', self) self.button_clear.clicked.connect(self.clear_all) self.btn_one_photo = QtWidgets.QPushButton('Take Photo', self) self.btn_one_photo.clicked.connect(self.camera.start_one_photo) self.tempButton = QtWidgets.QPushButton("Set Temp", self) self.tempButton.clicked.connect(self.btn_temperature) self.fanButton = QtWidgets.QPushButton("Fan (On/Off)") self.fanButton.clicked.connect(self.button_fan_func) self.buttonok = QtWidgets.QPushButton("Save", self) self.buttonok.clicked.connect(self.button_ok_func) self.buttoncancel = QtWidgets.QPushButton("Cancel", self) self.buttoncancel.clicked.connect(self.func_cancel) def button_ok_func(self): try: y_pixels, x_pixels = self.get_pixels() # Saving the Settings if int(self.getcropxi_l.text()) > int(self.getcropxf_l.text()) or\ int(self.getcropyi_l.text()) > int(self.getcropyf_l.text()) or\ int(self.getcropxf_l.text()) >= x_pixels/(int(self.combo.currentIndex() + 1)) or \ int(self.getcropyf_l.text()) >= y_pixels/(int(self.combo.currentIndex() + 1)): self.console.raise_text("Wrong values for image crop.", 3) else: self.cam.set_camera_settings(self.setField_temperature.text(), self.time_colling.text(), self.tempo_fotos.text()) self.cam.save_settings() self.console.raise_text("Camera settings successfully saved!", 1) """ self.setField_temperature.text(), self.prel.text(), self.expl.text(), self.combo.currentIndex(), self.tempo_fotos.text(), self.time_colling.text(), self.getlevel1l.text(), self.getlevel2l.text(), self.close_open.currentIndex(), self.getcropxi_l.text(), self.getcropxf_l.text(), self.getcropyi_l.text(), self.getcropyf_l.text(), self.ignore_crop_l.isChecked(), self.image_tif_l.isChecked(), self.image_fit_l.isChecked() """ except Exception as e: self.console.raise_text("Camera settings were not saved.", 3) def clear_all(self): self.setField_temperature.clear() self.prel.clear() self.expl.clear() self.tempo_fotos.clear() def take_one_photo(self): try: info = self.get_camera_settings() if int(info[8]) == 1: self.console.raise_text("Taking dark photo", 1) self.one_photo.start() else: self.console.raise_text("Taking photo", 1) self.one_photo.start() except Exception: self.console.raise_text("Not possible taking photo", 1) def func_cancel(self): self.p.close() def button_fan_func(self): if getlinkstatus() is True: try: self.fan.set_fan() self.console.raise_text('State changed Fan!', 2) except Exception: self.console.raise_text("The camera is not connected!", 3) self.console.raise_text('State Fan unchanged', 3) else: self.console.raise_text("The camera is not connected!", 3) self.console.raise_text('State Fan unchanged', 3) def fill_combo(self): self.combo.addItem("1x1", 0) self.combo.addItem("2x2", 1) self.combo.addItem("3x3", 2) def fill_combo_close_open(self): self.close_open.addItem("Open", 0) self.close_open.addItem("Close", 1) def btn_temperature(self): try: value = self.setField_temperature.text() if value is '': pass else: self.camera.set_temperature(float(value)) except Exception as e: print("Exception -> {}".format(e))
class ContinuousShooterThread(QtCore.QThread): # classe para modo manual signalAfterShooting = QtCore.pyqtSignal(name="signalAfterShooting") signal_temp = QtCore.pyqtSignal(name="signalTemp") def __init__(self, time_sleep): super(ContinuousShooterThread, self).__init__() self.continuous = True # SThread manda para o Sbigdriver as informações para se tirar a foto em si. self.ss = SThread() self.photo_type = self.ss.recebe_argumento self.ss.started.connect(self.thread_iniciada) self.console = ConsoleThreadOutput() self.count = 0 self.wait_temperature = False self.not_two_dark = True self.one_photo = False self.one_photo_shutter_state = None self.select_filter_manual = None self.select_filter_shutter = None def recebe_args(self, select_filter_manual, select_filter_shutter): self.select_filter_manual = select_filter_manual self.select_filter_shutter = select_filter_shutter print("\n\nself.select_filter_shutter") print(self.select_filter_shutter) print("\nself.select_filter_manual") print(self.select_filter_manual) print("\n\n") def run(self): try: self.count = 1 while self.continuous: try: self.signal_temp.emit() if self.wait_temperature: if self.count <= 1 and not self.one_photo: self.console.raise_text("Taking dark photo", 1) self.start_dark_sthread() print("\n\nself.select_filter_shutter") print(self.select_filter_shutter) print("\n\n") if self.select_filter_shutter == "Closed" and self.one_photo: self.ss.recebe_argumento(1) else: self.ss.recebe_argumento(0) if self.one_photo: self.ss.args_one_photo(self.select_filter_manual, self.select_filter_shutter) self.ss.start() if self.one_photo: break while self.ss.isRunning(): time.sleep(1) self.signalAfterShooting.emit() except Exception as e: print(e) time.sleep(1) except Exception as e: print("Exception Run ContinuousShooterThread ->" + str(e)) finally: if not self.one_photo: self.console.raise_text("Taking dark photo", 1) self.start_dark_sthread() self.one_photo = False def start_continuous_shooter(self): self.continuous = True def stop_continuous_shooter(self): self.wait_temperature = False self.continuous = False self.not_two_dark = False # self.console.raise_text("Taking dark photo", 1) self.count = 1 def stop_one_photo(self): self.one_photo = False self.wait_temperature = False self.continuous = False self.count = 1 def thread_iniciada(self): if self.one_photo: self.console.raise_text("Taking photo", 1) self.stop_one_photo() else: self.console.raise_text("Taking photo N: {}".format(self.count), 1) self.count += 1 def start_dark_sthread(self): if not self.one_photo: try: self.ss.recebe_argumento(1) self.ss.start() while self.ss.isRunning(): time.sleep(1) except Exception as e: print("Error start_dark_sthread! {}".format(e)) self.console.raise_text("Error start_dark_sthread! {}".format(e), 3) finally: self.count = 1
class ContinuousShooterThread(QtCore.QThread): ''' classe para modo manual ''' signalAfterShooting = QtCore.pyqtSignal(name="signalAfterShooting") signal_temp = QtCore.pyqtSignal(name="signalTemp") def __init__(self, timeSleep): super(ContinuousShooterThread, self).__init__() self.continuous = True self.s = timeSleep ''' SThread manda para o Sbigdriver as informações para se tirar a foto em si. ''' self.ss = SThread() self.ss.started.connect(self.thread_iniciada) self.console = ConsoleThreadOutput() self.count = 0 self.wait_temperature = False self.not_two_dark = True self.one_photo = False def set_sleep_time(self, t): self.s = t def run(self): self.count = 1 while self.continuous: try: self.signal_temp.emit() if self.wait_temperature: self.ss.start() while self.ss.isRunning(): time.sleep(1) except Exception as e: print(e) time.sleep(self.s) self.signalAfterShooting.emit() def start_continuous_shooter(self): if not self.one_photo: self.shutter_control(True) self.continuous = True def stop_continuous_shooter(self): self.wait_temperature = False self.continuous = False self.not_two_dark = False self.console.raise_text("Taking dark photo", 1) self.shutter_control(False) self.ss.take_dark() time.sleep(1) self.count = 1 # Consertar Shutter Para o onePhoto def stop_one_photo(self): self.one_photo = False self.wait_temperature = False self.continuous = False self.count = 1 def thread_iniciada(self): if self.one_photo: self.console.raise_text("Taking photo", 1) self.stop_one_photo() elif self.count == 1 and not self.one_photo: self.console.raise_text("Taking dark photo", 1) self.ss.take_dark() self.count += 1 self.not_two_dark = False elif self.count != 1 and not self.one_photo: self.console.raise_text("Taking photo N: {}".format(self.count), 1) self.count += 1 def shutter_control(self, cont): try: ser = serial.Serial(serial_ports()[len(serial_ports()) - 1], 9600, bytesize=serial.EIGHTBITS, parity=serial.PARITY_NONE, stopbits=serial.STOPBITS_ONE) if cont is True: self.console.raise_text("Opening Shutter", 1) send = bytes([235, 144, 86, 1, 46]) ser.write(send) # time.sleep(15) else: self.console.raise_text("Closing Shutter", 1) send = bytes([235, 144, 214, 1, 174]) ser.write(send) # time.sleep(15) except Exception: self.console.raise_text("No Serial Equipment!", 3)
class ContinuousShooterThread(QtCore.QThread): ''' classe para modo manual ''' signalAfterShooting = QtCore.pyqtSignal(name="signalAfterShooting") signal_temp = QtCore.pyqtSignal(name="signalTemp") def __init__(self, timeSleep): super(ContinuousShooterThread, self).__init__() self.continuous = True self.s = timeSleep self.ds = DarkShooterThread(self.s) ''' SThread manda para o Sbigdriver as informações para se tirar a foto em si. ''' self.ss = SThread() self.ss.started.connect(self.thread_iniciada) self.console = ConsoleThreadOutput() self.count = 0 self.wait_temperature = False self.not_two_dark = True self.one_photo = False def set_sleep_time(self, t): self.s = t def run(self): self.count = 1 while self.continuous: if not self.ss.check_connection(): self.console.raise_text("Connection Lost!", 3) time.sleep(1) self.console.raise_text("Attempting Reconnection...", 2) time.sleep(1) status = self.ss.reconnect() while (not status[0] and status[2]) and \ (datetime.now() < datetime.now() + timedelta(seconds=self.s)): continue if status[0] and status[2]: self.console.raise_text("Successfully Reconnected!", 1) time.sleep(1) else: self.console.raise_text("Reconnection Failed. Aborting...", 3) time.sleep(1) self.stop_continuous_shooter() try: self.signal_temp.emit() if self.wait_temperature: self.ss.start() self.ds.start() while self.ss.isRunning(): time.sleep(1) except Exception as e: print(e) # time.sleep(self.s) self.signalAfterShooting.emit() def start_continuous_shooter(self): """ if not self.one_photo: self.shutter_control(True) """ shutter_control(True) self.continuous = True self.ds.continuous = True def stop_continuous_shooter(self): if self.wait_temperature: self.ds.continuous = False self.wait_temperature = False self.continuous = False self.not_two_dark = False shutter_control(False) self.console.raise_text("Taking dark photo", 1) self.ss.take_dark() time.sleep(1) self.count = 1 else: self.ds.continuous = False self.wait_temperature = False self.continuous = False self.not_two_dark = False shutter_control(False) time.sleep(1) self.count = 1 def stop_one_photo(self): self.one_photo = False self.wait_temperature = False self.continuous = False self.count = 1 self.exit() def thread_iniciada(self): if self.one_photo: self.console.raise_text("Taking photo", 1) self.stop_one_photo() elif self.count == 1 and not self.one_photo: self.console.raise_text("Taking dark photo", 1) self.ss.take_dark() self.count += 1 self.not_two_dark = False elif self.count != 1 and not self.one_photo: self.console.raise_text("Taking photo N: {}".format(self.count), 1) self.count += 1 '''
def __init__(self, parent=None): super(SettingsCCDInfos, self).__init__(parent) # Instance attributes create_filter_wheel_info_group self.serial_filter_wheel_info_l = None self.serial_filter_wheel_info_f = None self.tempt_filter_wheel_info_l = None self.tempt_filter_wheel_info_f = None self.slots_filter_wheel_info_l = None self.slots_filter_wheel_info_f = None # Instance attributes create_filter_wheel_group self.shutter_l = None self.close_open_filter_wheel = None self.close_open_filter_wheel_info = None self.btn_set_shutter = None self.get_filter_l = None self.filter_position = None self.btn_set_filter = None self.set_filter_position = None self.btn_home_position_filter = None # Instance attributes create_ccd_info_group self.info_port_ccd_l = None self.info_port_ccd_f = None self.info_camera_model_l = None self.info_camera_model_f = None self.info_pixel_array_l = None self.info_pixel_array_f = None # Instance attributes create_ccd_camera_group self.close_open = None self.temp_set_point_l = None self.temp_set_point_f = None self.temp_init_l = None self.temp_init_f = None self.one_photoButton = None self.tempButton = None self.fanButton = None # Instance attributes create_push_button_group self.saveButton = None self.cancelButton = None self.clearButton = None self.select_filter_manual = 1 self.select_filter_shutter = "Closed" self.imager_window = parent self.cam = Camera() self.roda_filtros = FilterControl() self.var_save_ini_camera = SettingsCamera() self.console = ConsoleThreadOutput() self.fan = Fan(self.fanButton) self.one_photo = SThread() self.lock = Locker() self.firmware = "????" self.model = "????" self.y_pixels = "????" self.x_pixels = "????" grid = QGridLayout() grid.addWidget(self.create_filter_wheel_info_group(), 0, 0) grid.addWidget(self.create_filter_wheel_group(), 1, 0) grid.addWidget(self.create_ccd_info_group(), 0, 1) grid.addWidget(self.create_ccd_camera_group(), 1, 1) grid.addWidget(self.create_push_button_group(), 2, 1) self.setLayout(grid) self.button_settings() self.setWindowTitle("Imager Box") self.resize(500, 340) self.info_cam()