def apply_preferences(self): ''' save and update preferences :return: ''' for section in self.preferences_changed.keys(): for option in self.preferences_changed[section].keys(): CONF.set(section, option, self.preferences_changed[section][option]) self.preferences_updated.emit()
def switch_display_mode(self, mode): if mode == 0: CONF.set(self.CONF_SECTION, 'antialiasing', 'filter') elif mode == 1: CONF.set(self.CONF_SECTION, 'antialiasing', 'min_max') self.update_subsample() if len(self.data_map.get_active_channels()): self.set_plot_data() return
def setup_layout(self, default=False): """Setup window layout""" prefix = 'window' + '/' settings = self.load_window_settings(prefix, default) hexstate = settings[0] self.set_window_settings(*settings) self.first_pysigview_run = False if hexstate is None: # First Pysigview execution: self.setWindowState(Qt.WindowMaximized) self.first_pysigview_run = True # store the initial layout as the default in pysigview prefix = 'layout_default/' section = 'quick_layouts' self.save_current_window_settings(prefix, section) self.current_quick_layout = 'default' CONF.set(section, prefix+'state', None)
def save_current_window_settings(self, prefix, section='main'): """Save current window settings with *prefix* in the userconfig-based configuration, under *section*""" self.get_window_settings() win_size = self.window_size # prefs_size = self.prefs_dialog_size CONF.set(section, prefix+'size', (win_size.width(), win_size.height())) # CONF.set(section, prefix+'prefs_dialog_size', # (prefs_size.width(), prefs_size.height())) CONF.set(section, prefix+'is_maximized', self.isMaximized()) CONF.set(section, prefix+'is_fullscreen', self.isFullScreen()) pos = self.window_position CONF.set(section, prefix+'position', (pos.x(), pos.y())) # self.maximize_dockwidget(restore=True)# Restore non-maximized layout qba = self.saveState() hexstate = str(bytes(qba.toHex().data()).decode()) CONF.set(section, prefix+'state', hexstate) CONF.set(section, prefix+'statusbar', not self.statusBar().isHidden())
def store_settings(self): CONF.set(self.CONF_SECTION, 'host', self.host_le.text()) CONF.set(self.CONF_SECTION, 'port', self.port_le.text()) CONF.set(self.CONF_SECTION, 'username', self.user_le.text())