def __init__(self): QMainWindow.__init__(self) self.setWindowIcon(get_icon(os.path.join(APP_RESOURCES, 'icons', 'python.png'))) self.setupUi(self) # Redirect output to GUI's QTextEdit sys.stdout = OutLog(self.outputTextEdit, sys.stdout) sys.stderr = OutLog(self.outputTextEdit, sys.stderr, QColor(255,0,0) ) settings = QSettings() size = settings.value("MainWindow/Size", QVariant(QSize(600, 500))).toSize() self.resize(size) position = settings.value("MainWindow/Position", QVariant(QPoint(0, 0))).toPoint() self.move(position) self.restoreState( settings.value("MainWindow/State").toByteArray()) self.logger = Logger('Zupport.GUIloader') self.logger.debugging = settings.value("Logging/debugging").toBool() # Set up a ZupportManager to deal with the plugins self.manager = Manager(self) self.plugins = {} # Set up the extents menu self.extent = ExtentContainer() self.menuExtent = QMenu("Extent") resolutions = self.extent.resolutions self.extenactiongroup = QActionGroup(self.menuExtent) noneaction = QAction("None", self.menuExtent) self.extenactiongroup.addAction(noneaction) self.menuExtent.addAction(noneaction) for resolution in resolutions: resolution_text = str(resolution) submenu = self.menuExtent.addMenu(resolution_text) self.menuExtent.addMenu(submenu) for area in self.extent.get_names(resolution): subaction = QAction(str(area) + ": %s" % resolution_text, submenu) subaction.setCheckable(True) self.extenactiongroup.addAction(subaction) submenu.addAction(subaction) noneaction.isChecked() self.menuSettings.addMenu(self.menuExtent) self.actionDebugging_messages.setChecked(self.logger.debugging) self.setWindowTitle("Zupport GUI") self.load_tools() self.toolTreeWidget.itemSelectionChanged.connect(self.update_ui) self.actionDebugging_messages.toggled.connect(self._set_debugging) self.menuExtent.triggered.connect(self.update_ui) self.actionLoad_tool.triggered.connect(self.show_tool_gui) self.toolTreeWidget.doubleClicked.connect(self.show_tool_gui)
def closeEvent(self, event): settings = QSettings() settings.setValue("Logging/debugging", self.logger.debugging) settings.setValue("MainWindow/Size", QVariant(self.size())) settings.setValue("MainWindow/Position", QVariant(self.pos())) settings.setValue("MainWindow/State", QVariant(self.saveState()))
def __init__(self, reset=False, start_freq=None, bandwidth=None, numpts=None, max_hold=None): QMainWindow.__init__(self) self.settings = QSettings("Darkstar007", "signal_generator") if reset: self.settings.clear() self.setup(start_freq, bandwidth, numpts, max_hold)
def __init__(self, reset=False, start_freq=None, bandwidth=None, numpts=None, max_hold=None, dev='/dev/ttyUSB0'): QMainWindow.__init__(self) self.settings = QSettings("Darkstar007", "networkanalyser") if reset: self.settings.clear() self.file_dir = self.settings.value('spectrum/file_dir', os.getenv('HOME')) print 'File dir', self.file_dir self.dev = dev self.setup(start_freq, bandwidth, numpts, max_hold)
def _load_settings(self): self.appsettings = DataSetShowGroupBox("Settings", AppSettings, comment='', title=_("Application settings")) self.settings_storage = QSettings('settings.ini', QSettings.IniFormat) self.restoreGeometry( self.settings_storage.value('docksGeometry').toByteArray() ) self.restoreState( self.settings_storage.value('docksState').toByteArray() ) # load settings: self.settings_storage.beginGroup('BioHarnessPackets') rrdata = self.settings_storage.value('rrdata', True).toBool() breathing = self.settings_storage.value('breathing', True).toBool() ecg = self.settings_storage.value('ecg', False).toBool() summary = self.settings_storage.value('summary', False).toBool() accelerometer = self.settings_storage.value('accelerometer', False).toBool() self.settings_storage.endGroup() self.appsettings.dataset.bh_packets = [] if rrdata: self.appsettings.dataset.bh_packets.append(0) if breathing: self.appsettings.dataset.bh_packets.append(1) if ecg: self.appsettings.dataset.bh_packets.append(2) if summary: self.appsettings.dataset.bh_packets.append(3) if accelerometer: self.appsettings.dataset.bh_packets.append(4) self.settings_storage.beginGroup('Misc') self.appsettings.dataset.timedsession = self.settings_storage.value('TimedDuration', 5).toInt()[0] # handle windows and linux serial port name portname = self.settings_storage.value('Serial_Port').toString() if str(portname).isdigit() is True: self.appsettings.dataset.serialport = int(portname) else: self.appsettings.dataset.serialport = str(portname) self.appsettings.dataset.use_virtual_serial = self.settings_storage.value('Use_Virtual_Serial_Port', False).toBool() self.settings_storage.endGroup() self.settings_storage.beginGroup('Storage') self.appsettings.dataset.enable_database = self.settings_storage.value('db_enable', False).toBool() self.appsettings.dataset.db_url = self.settings_storage.value('db_url').toString() self.appsettings.dataset.db_port = self.settings_storage.value('db_port').toString() self.appsettings.dataset.db_user = self.settings_storage.value('db_user').toString() self.appsettings.dataset.db_pwd = self.settings_storage.value('db_pwd').toString() self.appsettings.dataset.db_dbname = self.settings_storage.value('db_dbname').toString() self.appsettings.dataset.enable_files = self.settings_storage.value('files_enable', False).toBool() self.appsettings.dataset.directory_storage = self.settings_storage.value('directory').toString() self.settings_storage.endGroup()