def import_default_config_settings(): """ Returns all the settings for the default config file :return: the settings for the default config file """ settings = QSettings() defaultConfigName = settings.value('default_config', type=str) return utils.import_config_settings(defaultConfigName)
def get_board_dimensions(): #TODO: fix this settings = QSettings() defaultConfigName = settings.value('default_config', type=str) config = utils.import_config_settings(defaultConfigName) if config is not None: boardType = config['system']['device_cal'] return (9, 9) if boardType == '9x9' else (7, 7) else: return (7, 7)
def refresh(self, i): self.tree.setModel(None) self.tree.setModel(QStandardItemModel()) self.tree.setAlternatingRowColors(True) # self.tree.setSortingEnabled(True) self.tree.setHeaderHidden(False) self.tree.setSelectionBehavior(QAbstractItemView.SelectItems) self.tree.model().setHorizontalHeaderLabels(['Parameter', 'Value']) self.tree.setColumnWidth(0, 200) self.data = utils.import_config_settings(self.combobox.itemText(i)) self.tree.model().itemChanged.connect(self.handleItemChanged) self.loadData() self.tree.expandAll()
def get_board_dimensions(): """ Gets the current dimensions for the transmitter board (7x7, 9x9 .etc) :return: a list indicating the current dimensions for the transmitter board """ #TODO: fix this settings = QSettings() defaultConfigName = settings.value('default_config', type=str) config = utils.import_config_settings(defaultConfigName) if config is not None: boardType = config['system']['device_cal'] return (9, 9) if boardType == '9x9' else (7, 7) else: return (7, 7)
def __init__(self): super(ConfigEditorTab, self).__init__() # stores all the data for the current config file self.data = None # applyButton - saves any changes made to the config file applyButton = QPushButton("Apply Changes") applyButton.clicked.connect(self.saveChanges) # defaultButton - makes the current config file the default config file. self.defaultButton = QPushButton('Make Default') self.defaultButton.clicked.connect( lambda: self.UI_REQUEST_CHANGE_DEFAULT_CONFIG.emit( self.fileCombobox.currentText())) # fileCombobox - allows the user to select and view different config files self.fileCombobox = QComboBox() self.fileCombobox.currentIndexChanged.connect(self.refresh) buttonLayout = QHBoxLayout() buttonLayout.addWidget(self.fileCombobox, 0, Qt.AlignLeft) buttonLayout.addWidget(self.defaultButton, 0, Qt.AlignLeft) buttonLayout.addStretch(1) buttonLayout.addWidget(applyButton, 0, Qt.AlignRight) # The TreeView Widget provides textfields allowing the user to edit the config file self.tree = QTreeView() mainLayout = QVBoxLayout() mainLayout.addLayout(buttonLayout) mainLayout.addWidget(self.tree) self.setLayout(mainLayout) self.setGeometry(300, 300, 600, 400) self.populateCombos() # stores all the data for the current config file self.data = utils.import_config_settings( self.fileCombobox.currentText()) self.tree.setModel(QStandardItemModel()) self.tree.setAlternatingRowColors(True) #self.tree.setSortingEnabled(False) self.tree.setHeaderHidden(False) self.tree.setSelectionBehavior(QAbstractItemView.SelectItems) self.tree.model().setHorizontalHeaderLabels(['Parameter', 'Value']) self.tree.setColumnWidth(0, 200) self.tree.model().itemChanged.connect(self.handleItemChanged) self.loadData() self.tree.expandAll()
def refresh(self, i): """ refreshes the TreeView Widget. Called when the user selects a different config file from the fileCombobox. :param i: current index of fileCombobox """ self.tree.setModel(None) self.tree.setModel(QStandardItemModel()) self.tree.setAlternatingRowColors(True) # self.tree.setSortingEnabled(True) self.tree.setHeaderHidden(False) self.tree.setSelectionBehavior(QAbstractItemView.SelectItems) self.tree.model().setHorizontalHeaderLabels(['Parameter', 'Value']) self.tree.setColumnWidth(0, 200) self.data = utils.import_config_settings(self.fileCombobox.itemText(i)) self.tree.model().itemChanged.connect(self.handleItemChanged) self.loadData() self.tree.expandAll()
def import_default_config_settings(): settings = QSettings() defaultConfigName = settings.value('default_config', type=str) return utils.import_config_settings(defaultConfigName)