def _create_survey(self): """ """ try: try: dir_path = app_core.DesktopAppSync().get_workspace() name = str(self._surveytitle_edit.text()) filename = str(self._surveyfilename_edit.text()) ws = hdf54bats.Hdf5Workspace(dir_path, create_ws=True) ws.create_h5(filename, title=name) finally: self.accept() # Close dialog box. except Exception as e: debug_info = self.__class__.__name__ + ', row ' + str( sys._getframe().f_lineno) app_utils.Logging().error('Exception: (' + debug_info + '): ' + str(e))
def _create_survey(self): """ """ if self.name_combo.currentIndex() > 0: try: try: dir_path = app_core.DesktopAppSync().get_workspace() name_combo = self.name_combo.currentText() name = self._surveytitle_edit.text() filename = self._surveyfilename_edit.text() ws = hdf54bats.Hdf5Workspace(dir_path) ws.copy_h5(name_combo, filename) ws.set_h5_title(filename, name) finally: self.accept() # Close dialog box. except Exception as e: debug_info = self.__class__.__name__ + ', row ' + str( sys._getframe().f_lineno) app_utils.Logging().error('Exception: (' + debug_info + '): ' + str(e))
def _delete_marked_surveys(self): """ """ try: try: dir_path = app_core.DesktopAppSync().get_workspace() ws = hdf54bats.Hdf5Workspace(dir_path) for rowindex in range(self._surveys_model.rowCount()): item = self._surveys_model.item(rowindex, 0) if item.checkState() == QtCore.Qt.Checked: survey_filename = str(item.text()) ws.delete_h5(survey_filename) finally: self.accept() # Close dialog box. # except Exception as e: debug_info = self.__class__.__name__ + ', row ' + str( sys._getframe().f_lineno) app_utils.Logging().error('Exception: (' + debug_info + '): ' + str(e)) self.accept() # Close dialog box.
def update_surveys_dict(self): """ """ self.survey_dict = {} if self.workspace: try: if not pathlib.Path(self.workspace).exists(): return h5_ws = hdf54bats.Hdf5Workspace(self.workspace) # h5_list = h5_ws.get_h5_list() for h5_file_key in sorted(h5_list.keys()): h5_file_dict = h5_list[h5_file_key] h5_dict = {} h5_dict['h5_file'] = h5_file_dict['name'] h5_dict['h5_title'] = h5_file_dict['title'] h5_dict['h5_filepath'] = h5_file_dict['f5_filepath'] # self.survey_dict[h5_file_dict['name']] = h5_dict except Exception as e: debug_info = self.__class__.__name__ + ', row ' + str( sys._getframe().f_lineno) app_utils.Logging().error('Exception: (' + debug_info + '): ' + str(e))