def load_settings(self): """ Load current primary and secondary display settings """ file_path = QtGui.QFileDialog.getOpenFileName()[0] if path.exists(file_path): loaded_settings = ReadConfig.read_configuration(file_path) if len(loaded_settings) == 4: self.primary_sliders_in_rgb_0_99(loaded_settings) elif len(loaded_settings) == 9: # checks just in case saved settings are for two displays, # but loads when only one display is connected if self.no_of_connected_dev == 1: self.primary_sliders_in_rgb_0_99( (loaded_settings[0], loaded_settings[1], loaded_settings[2], loaded_settings[3])) return # sets reverse control self.ui.checkBox.setChecked(loaded_settings[8]) self.primary_sliders_in_rgb_0_99( (loaded_settings[0], loaded_settings[1], loaded_settings[2], loaded_settings[3])) self.secondary_sliders_in_rgb_0_99( (loaded_settings[4], loaded_settings[5], loaded_settings[6], loaded_settings[7]))
def load_settings(self, location=None): """ Load current primary and secondary display settings """ file_path = location or QtGui.QFileDialog.getOpenFileName()[0] if path.exists(file_path): loaded_settings = ReadConfig.read_configuration(file_path) if len(loaded_settings) == 5: self._load_temperature(loaded_settings[4]) self.primary_sliders_in_rgb_0_99(loaded_settings) elif len(loaded_settings) == 11: # checks just in case saved settings are for two displays, # but loads when only one display is connected if self.no_of_connected_dev == 1: self.primary_sliders_in_rgb_0_99( (loaded_settings[0], loaded_settings[1], loaded_settings[2], loaded_settings[3])) return # sets reverse control primary_source = loaded_settings[4] secondary_source = loaded_settings[10] self._load_temperature(loaded_settings[5]) primary_combo_index = self.ui.primary_combobox.findText( primary_source, QtCore.Qt.MatchFixedString) second_combo_index = self.ui.secondary_combo.findText( secondary_source, QtCore.Qt.MatchFixedString) if primary_combo_index >= 0: self.ui.primary_combobox.setCurrentIndex(primary_combo_index) self.primary_source_combo_activated(primary_source) if second_combo_index >= 0: self.ui.secondary_combo.setCurrentIndex(second_combo_index) self.secondary_source_combo_activated(secondary_source) self.primary_sliders_in_rgb_0_99( (loaded_settings[0], loaded_settings[1], loaded_settings[2], loaded_settings[3])) # (99, 99, 99, 99, 'LVDS-1', 99, 38, 99, 99, 'VGA-1') self.secondary_sliders_in_rgb_0_99( (loaded_settings[6], loaded_settings[7], loaded_settings[8], loaded_settings[9]))