def restore_settings(self, do_restore, filename=None): if (filename): s = QtCore.QSettings(filename, QtCore.QSettings.IniFormat) else: s = QtCore.QSettings() self._init_geometry(s) self._init_recorder(s) loaded_sources = [] try: if do_restore: loaded_sources = self._init_data_sources(s) except (TypeError, KeyError): # raise #raise # Be a bit more resilient against configuration problems logging.warning( "Failed to load data source settings! Continuing...") if do_restore: try: self._restore_data_windows(s, loaded_sources) except (TypeError, KeyError): # Be a bit more resilient against configuration problems logging.warning( "Failed to load data windows settings! Continuing...") self.plotdata_widget.restore_state(s) self.settings = s
def save_settings(self, filename=None): if (filename): s = QtCore.QSettings(filename, QtCore.QSettings.IniFormat) else: s = QtCore.QSettings() s.setValue("geometry", self.saveGeometry()) s.setValue("windowState", self.saveState()) # Save data sources ds_settings = [] for ds in self._data_sources: ds_settings.append([ds.hostname, ds.port, ds.ssh_tunnel, ds.conf]) s.setValue("dataSources", ds_settings) self.plotdata_widget.save_state(s) s.setValue("plotData", self.plotdata_widget.save_plotdata()) s.setValue("dataWindows", self.save_data_windows()) # Make sure settings are saved s.sync()
def __init__(self, parent=None): QtGui.QMainWindow.__init__(self, None) self.setAttribute(QtCore.Qt.WA_DeleteOnClose) self._enabled_sources = {} self.settings = QtCore.QSettings() self.setupUi(self) self.alertBlinkTimer = QtCore.QTimer() self.alertBlinkTimer.setInterval(500) self._setup_connections() self._parent = parent # If True this DataWindow was restored from saved settings self.restored = False self.alertBlinking = False self.set_sounds_and_volume()
def __init__(self, parent): QtGui.QDialog.__init__(self, parent, QtCore.Qt.WindowTitleHint) self.setupUi(self) settings = QtCore.QSettings() self.outputPath.setText(settings.value("outputPath"))