def btn_save_config_clicked(self): """ Opens a FileSelectionDialog and saves the current config. """ conf = GuiConfigHandler.create_config_file(self) fn = QtGui.QFileDialog.getSaveFileName(self, 'Save Config-File', os.getcwd(), filter='*.json') if fn == "": # cancel EventLogger.debug("Cancelled load Config.") return try: with open(fn, 'w') as outfile: json.dump(conf, outfile, sort_keys=True, indent=2) except Exception as e1: EventLogger.warning("Load Config - Exception: " + str(e1)) QMessageBox.warning( self, 'Error', 'Could not save the Config-File! Look at the Log-File for further information.', QMessageBox.Ok) return QMessageBox.information(self, 'Success', 'Config-File saved!', QMessageBox.Ok) EventLogger.info("Config-File saved to: " + str(fn))
def btn_start_logging_clicked(self): """ Start/Stop of the logging process """ if (self.data_logger_thread is not None) and (not self.data_logger_thread.stopped): self.btn_start_logging.clicked.disconnect() self.data_logger_thread.stop() self._reset_stop() elif self.data_logger_thread is None: from data_logger import main arguments_map = {} arguments_map[ main.GUI_CONFIG] = GuiConfigHandler.create_config_file(self) self._gui_job = GuiDataJob(name="GuiData-Writer") self.connect(self._gui_job, QtCore.SIGNAL(GuiDataJob.SIGNAL_NEW_DATA), self.table_add_row) arguments_map[main.GUI_ELEMENT] = self._gui_job self.data_logger_thread = main.main(arguments_map) if self.data_logger_thread is not None: self.btn_start_logging.setText("Stop Logging") self.tab_devices.setEnabled(False) self.tab_setup.setEnabled(False) # self.tab_xively.setEnabled(False)#nyi self.tab_widget.setCurrentIndex( self.tab_widget.indexOf(self.tab_console)) self.tab_reset_warning()
def btn_start_logging_clicked(self): """ Start/Stop of the logging process """ if (self.data_logger_thread is not None) and (not self.data_logger_thread.stopped): self.btn_start_logging.clicked.disconnect() self.data_logger_thread.stop() self._reset_stop() elif self.data_logger_thread is None: from data_logger import main arguments_map = {} arguments_map[main.GUI_CONFIG] = GuiConfigHandler.create_config_file(self) self._gui_job = GuiDataJob(name="GuiData-Writer") self.connect(self._gui_job, QtCore.SIGNAL(GuiDataJob.SIGNAL_NEW_DATA), self.table_add_row) arguments_map[main.GUI_ELEMENT] = self._gui_job self.data_logger_thread = main.main(arguments_map) if self.data_logger_thread is not None: self.btn_start_logging.setText("Stop Logging") self.tab_devices.setEnabled(False) self.tab_setup.setEnabled(False) # self.tab_xively.setEnabled(False)#nyi self.tab_widget.setCurrentIndex(self.tab_widget.indexOf(self.tab_console)) self.tab_reset_warning()
def btn_save_config_clicked(self): """ Opens a FileSelectionDialog and saves the current config. """ conf = GuiConfigHandler.create_config_file(self) fn = QtGui.QFileDialog.getSaveFileName(self, 'Save Config-File', os.getcwd(), filter='*.json') if fn == "": # cancel EventLogger.debug("Cancelled load Config.") return try: with open(fn, 'w') as outfile: json.dump(conf, outfile, sort_keys=True, indent=2) except Exception as e1: EventLogger.warning("Load Config - Exception: " + str(e1)) QMessageBox.warning(self, 'Error', 'Could not save the Config-File! Look at the Log-File for further information.', QMessageBox.Ok) return QMessageBox.information(self, 'Success', 'Config-File saved!', QMessageBox.Ok) EventLogger.info("Config-File saved to: " + str(fn))