def __init__(self): # print("BulkEntryDialog/init entered") QDialog.__init__(self) self.ui = uic.loadUi( MultiOsUtil.path_for_file_in_program_directory("BulkEntry.ui")) # Set window font sizes according to saved preference settings = QSettings() standard_font_size = settings.value( MultiOsUtil.STANDARD_FONT_SIZE_SETTING) MultiOsUtil.set_font_sizes( parent=self.ui, standard_size=standard_font_size, title_prefix=MultiOsUtil.MAIN_TITLE_LABEL_PREFIX, title_increment=MultiOsUtil.MAIN_TITLE_FONT_SIZE_INCREMENT, subtitle_prefix=MultiOsUtil.SUBTITLE_LABEL_PREFIX, subtitle_increment=MultiOsUtil.SUBTITLE_FONT_SIZE_INCREMENT) self._numBiasFrames: int = 0 self._numDarkFrames: int = 0 self._darkExposures: [float] = [] self._biasBinnings: [int] = [] self._darkBinnings: [int] = [] self.set_bias_binnings() # Store from initially-set checkboxes self.set_dark_binnings() # Set up button responders self.ui.saveButton.clicked.connect(self.save_button_clicked) self.ui.cancelButton.clicked.connect(self.cancel_button_clicked) # Checkboxes for binning settings self.ui.biasBin11.clicked.connect(self.bias_binnings_changed) self.ui.biasBin22.clicked.connect(self.bias_binnings_changed) self.ui.biasBin33.clicked.connect(self.bias_binnings_changed) self.ui.biasBin44.clicked.connect(self.bias_binnings_changed) self.ui.darkBin11.clicked.connect(self.dark_binnings_changed) self.ui.darkBin22.clicked.connect(self.dark_binnings_changed) self.ui.darkBin33.clicked.connect(self.dark_binnings_changed) self.ui.darkBin44.clicked.connect(self.dark_binnings_changed) # Catch changes to the input fields self.ui.biasFramesCount.editingFinished.connect( self.bias_frames_count_changed) self.ui.darkFramesCount.editingFinished.connect( self.dark_frames_count_changed) self.ui.exposureLengths.textChanged.connect( self.exposure_lengths_changed) self.enable_buttons()
def __init__(self, preferences: Preferences, data_model: DataModel, descriptors: [FileDescriptor], output_path: str, disposed_callback: Callable[[str], None]): QDialog.__init__(self) self._disposed_callback = disposed_callback self._data_model = data_model self._descriptors = descriptors self._output_path = output_path self._preferences = preferences # Mutex to serialize signal handling from thread self._signal_mutex = QMutex() self.ui = uic.loadUi( MultiOsUtil.path_for_file_in_program_directory("ConsoleWindow.ui")) # If a window size is saved, set the window size window_size = self._preferences.get_console_window_size() if window_size is not None: self.ui.resize(window_size) # Responders self.ui.cancelButton.clicked.connect(self.cancel_button_clicked) self.ui.closeButton.clicked.connect(self.close_button_clicked) self.buttons_active_state(False) # Create thread to run the processing self._session_controller: SessionController = SessionController() self._worker_object = CombineThreadWorker(self._data_model, descriptors, output_path, self._session_controller) # Create and run the processing thread self._qthread = QThread() self._worker_object.moveToThread(self._qthread) # Have the thread-started signal invoke the actual worker object self._qthread.started.connect( self._worker_object.run_combination_session) # Have the worker finished signal tell the thread to quit # self._worker_object.finished.connect(self._qthread.quit) self._worker_object.finished.connect(self.worker_thread_finished) # Other signals of interest self._worker_object.console_line.connect(self.add_to_console) self._worker_object.remove_from_ui.connect(self.remove_from_ui) # Properly enable buttons (cancel and close) and start the worker thread self.buttons_active_state(True) self._qthread.start()
def __init__(self): """Initialize class object on creation""" # print("AddFrameSetDialog/init entered") QDialog.__init__(self) # Watch window events so we can catch and record resize events self.ui = uic.loadUi( MultiOsUtil.path_for_file_in_program_directory("AddFrameSet.ui")) self._numFramesValid = False # Set as part of field validation self._exposureValid = False self._completedValid = False self._frameSet: FrameSet # Set window font sizes according to saved preference settings = QSettings() standard_font_size = settings.value( MultiOsUtil.STANDARD_FONT_SIZE_SETTING) MultiOsUtil.set_font_sizes( parent=self.ui, standard_size=standard_font_size, title_prefix=MultiOsUtil.MAIN_TITLE_LABEL_PREFIX, title_increment=MultiOsUtil.MAIN_TITLE_FONT_SIZE_INCREMENT, subtitle_prefix=MultiOsUtil.SUBTITLE_LABEL_PREFIX, subtitle_increment=MultiOsUtil.SUBTITLE_FONT_SIZE_INCREMENT)
def __init__(self, preferences: Preferences, data_model: DataModel): """Initialize MainWindow class""" self._preferences = preferences self._data_model = data_model QMainWindow.__init__(self) self.ui = uic.loadUi( MultiOsUtil.path_for_file_in_program_directory("MainWindow.ui")) self._field_validity: {object, bool} = {} self._table_model: FitsFileTableModel self._indent_level = 0 # Load algorithm from preferences algorithm = data_model.get_master_combine_method() if algorithm == Constants.COMBINE_MEAN: self.ui.combineMeanRB.setChecked(True) elif algorithm == Constants.COMBINE_MEDIAN: self.ui.combineMedianRB.setChecked(True) elif algorithm == Constants.COMBINE_MINMAX: self.ui.combineMinMaxRB.setChecked(True) else: assert (algorithm == Constants.COMBINE_SIGMA_CLIP) self.ui.combineSigmaRB.setChecked(True) self.ui.minMaxNumDropped.setText( str(data_model.get_min_max_number_clipped_per_end())) self.ui.sigmaThreshold.setText( str(data_model.get_sigma_clip_threshold())) # Load disposition from preferences disposition = data_model.get_input_file_disposition() if disposition == Constants.INPUT_DISPOSITION_SUBFOLDER: self.ui.dispositionSubFolderRB.setChecked(True) else: assert (disposition == Constants.INPUT_DISPOSITION_NOTHING) self.ui.dispositionNothingRB.setChecked(True) self.ui.subFolderName.setText( data_model.get_disposition_subfolder_name()) # Pre-calibration options precalibration_option = data_model.get_precalibration_type() if precalibration_option == Constants.CALIBRATION_FIXED_FILE: self.ui.fixedPreCalFileRB.setChecked(True) elif precalibration_option == Constants.CALIBRATION_NONE: self.ui.noPreClalibrationRB.setChecked(True) elif precalibration_option == Constants.CALIBRATION_AUTO_DIRECTORY: self.ui.autoPreCalibrationRB.setChecked(True) else: assert precalibration_option == Constants.CALIBRATION_PEDESTAL self.ui.fixedPedestalRB.setChecked(True) self.ui.fixedPedestalAmount.setText( str(data_model.get_precalibration_pedestal())) self.ui.precalibrationPathDisplay.setText( os.path.basename(data_model.get_precalibration_fixed_path())) self.ui.autoDirectoryName.setText( os.path.basename(data_model.get_precalibration_auto_directory())) self.ui.autoRecursive.setChecked( data_model.get_auto_directory_recursive()) self.ui.autoBiasOnly.setChecked( data_model.get_auto_directory_bias_only()) # Grouping boxes and parameters self.ui.groupBySizeCB.setChecked(data_model.get_group_by_size()) self.ui.groupByExposureCB.setChecked( data_model.get_group_by_exposure()) self.ui.groupByTemperatureCB.setChecked( data_model.get_group_by_temperature()) self.ui.ignoreSmallGroupsCB.setChecked( data_model.get_ignore_groups_fewer_than()) self.ui.exposureGroupBandwidth.setText( f"{data_model.get_exposure_group_bandwidth()}") self.ui.temperatureGroupBandwidth.setText( f"{data_model.get_temperature_group_bandwidth()}") self.ui.minimumGroupSize.setText( str(data_model.get_minimum_group_size())) # Set up the file table self._table_model = FitsFileTableModel( self.ui.filesTable, data_model.get_ignore_file_type()) self.ui.filesTable.setModel(self._table_model) # Columns should resize to best fit their contents self.ui.filesTable.horizontalHeader().setSectionResizeMode( QHeaderView.ResizeToContents) # Write a summary, in the main tab, of the settings from the options tab (and data model) self.fill_options_readout() self.connect_responders() # If a window size is saved, set the window size window_size = self._preferences.get_main_window_size() if window_size is not None: self.ui.resize(window_size) self.enable_fields() self.enable_buttons()
def __init__(self): QDialog.__init__(self) self.ui = uic.loadUi( MultiOsUtil.path_for_file_in_program_directory( "PreferencesWindow.ui")) self._preferences: Preferences