[change] metadata not saved as part of project file anymore (files might get really big), still possible to load same project, idea: add QSetting whether to save or not to PyLoTprefs

This commit is contained in:
Marcel Paffrath 2017-06-06 15:28:43 +02:00
parent bdc85fa56a
commit 20300daecf
2 changed files with 20 additions and 13 deletions

View File

@ -1910,8 +1910,11 @@ class MainWindow(QMainWindow):
self.rm_thread.start() self.rm_thread.start()
def set_metadata(self): def set_metadata(self):
settings = QSettings()
self.metadata = self.rm_thread.data self.metadata = self.rm_thread.data
self.project.metadata = self.rm_thread.data if settings.value('saveMetadata'):
self.project.metadata = self.rm_thread.data
self.project.inv_path = settings.value("inventoryFile")
self.init_array_map() self.init_array_map()
def get_metadata(self): def get_metadata(self):
@ -1932,25 +1935,29 @@ class MainWindow(QMainWindow):
self.read_metadata_thread(fninv) self.read_metadata_thread(fninv)
return True return True
settings = QSettings()
if hasattr(self.project, 'metadata'): if hasattr(self.project, 'metadata'):
self.metadata = self.project.metadata self.metadata = self.project.metadata
return True return True
if hasattr(self.project, 'invPath'):
settings = QSettings() settings.setValue("inventoryFile", self.project.inv_path)
fninv = settings.value("inventoryFile", None)
fninv = settings.value("inventoryFile", None)
if fninv is None and not self.metadata: if fninv is None and not self.metadata:
if not set_inv(settings): if not set_inv(settings):
return None return None
elif fninv is not None and not self.metadata: elif fninv is not None and not self.metadata:
ans = QMessageBox.question(self, self.tr("Use default..."), if not hasattr(self.project, 'invPath'):
self.tr( ans = QMessageBox.question(self, self.tr("Use default metadata..."),
"Do you want to use the default value?"), self.tr(
QMessageBox.Yes | QMessageBox.No, "Do you want to use the default value for metadata?"),
QMessageBox.Yes) QMessageBox.Yes | QMessageBox.No,
if ans == QMessageBox.No: QMessageBox.Yes)
if not set_inv(settings): if ans == QMessageBox.No:
return None if not set_inv(settings):
return None
else: else:
self.read_metadata_thread(fninv) self.read_metadata_thread(fninv)

View File

@ -1 +1 @@
9007-dirty bdc8-dirty