Skip to content

Commit

Permalink
Release Data Preparation Tool 3.0.1.
Browse files Browse the repository at this point in the history
  • Loading branch information
olivergoetze committed Mar 23, 2020
1 parent 01fd876 commit e89d9d5
Show file tree
Hide file tree
Showing 5 changed files with 141 additions and 126 deletions.
15 changes: 13 additions & 2 deletions build_standalone_dist.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
timer_start = datetime.datetime.now()

# Variablen für den Build-Prozess (64 bit Python-Umgebung):
include_providerspecific_modules = False
qt_lib_path = "C:\\Users\\OGoetze\\venv\\build\\ddbmappings_build\\Lib\\site-packages\\PyQt5\\Qt\\bin"
msvc_path = "C:\\Program Files (x86)\\Windows Kits\\10\\Redist\\ucrt\\DLLs\\x64"
icon_path = "gui_components/ui_templates/resources/datapreparationtool.ico"
Expand All @@ -30,7 +31,7 @@
rmtree("build")

# Ausführen des PyInstaller-Skripts als Subprozess:
execute_string = 'pyinstaller --clean --onefile -p "{}" -p "{}" --name "datapreparationtool" --noconsole --icon "{}" main_gui.py'.format(qt_lib_path, msvc_path, icon_path)
execute_string = 'pyinstaller --clean --onefile -p "{}" -p "{}" --name "datapreparationtool" --icon "{}" main_gui.py'.format(qt_lib_path, msvc_path, icon_path)
logger.info("Führe PyInstaller-Script aus: {execute_string}", execute_string=execute_string)
subprocess.call(execute_string)

Expand All @@ -45,6 +46,7 @@
os.makedirs("dist/modules/common/provider_metadata")
os.makedirs("dist/modules/analysis/enrichment")
os.makedirs("dist/modules/serializers/eadddb")
os.makedirs("dist/modules/provider_specific")

logger.info("Kopieren der gui_session Daten ...")
copyfile("gui_session/templates/processing_status.xml", "dist/gui_session/templates/processing_status.xml")
Expand All @@ -57,7 +59,16 @@
copyfile("gui_components/ui_templates/resources/list.png", "dist/gui_components/ui_templates/resources/list.png")

logger.info("Kopieren der providerspezifischen Anpassungen, inkl. modules/provider_specific/aggregator_mapping.xml ...")
copytree("modules/provider_specific", "dist/modules/provider_specific")
if include_providerspecific_modules:
copytree("modules/provider_specific", "dist/modules/provider_specific")
os.remove("dist/modules/provider_specific/handle_provider_aggregator_mapping.py")
os.remove("dist/modules/provider_specific/handle_provider_rights.py")
os.remove("dist/modules/provider_specific/handle_provider_scripts.py")
if os.path.isdir("dist/modules/provider_specific/__pycache__"):
rmtree("dist/modules/provider_specific/__pycache__")
else:
copyfile("modules/provider_specific/aggregator_mapping.xml",
"dist/modules/provider_specific/aggregator_mapping.xml")

logger.info("Kopieren des Templates zur METS/MODS-Generierung ...")
copyfile("modules/ead2mets/mets_template.xml", "dist/modules/ead2mets/mets_template.xml")
Expand Down
4 changes: 2 additions & 2 deletions gui_session/version.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<mapping-library-version>
<version-number>3.0.0</version-number>
<version-number>3.0.1</version-number>
<branch>stable</branch>
<revision>32ad5ca0</revision> <!-- Commit-Revision im Git-Repository -->
<revision>6bfc54be</revision> <!-- Commit-Revision im Git-Repository -->
</mapping-library-version>
43 changes: 20 additions & 23 deletions main_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,10 @@ def finished_validation():
self.validationStatusDialog_ui.frame_validation_error.setVisible(True)

self.statusbar.showMessage("Validierung abgeschlossen.")
self.enable_processing_controls()
if len(self.comboBox_provider.currentText()) == 0:
self.enable_processing_controls(is_first_launch=True)
else:
self.enable_processing_controls()

self.validationStatusDialog_ui.stackedWidget.setCurrentIndex(1)

Expand Down Expand Up @@ -859,22 +862,12 @@ def get_provider_list(self):
self.comboBox_provider.clear()
self.comboBox_provider.addItems(self.provider_list)

# Wenn noch keine Datengeber vorhanden sind: Einstellungs-TabWidget, Buttons für Transformation und Analyse, Menüpunkte "Tools" und "Validierung" sowie "Datei" -> "Dateien per OAI-PMH laden ..." deaktivieren
# Wenn noch keine Datengeber vorhanden sind, Funktionen zur Prozessierung deaktivieren.
if len(self.comboBox_provider.currentText()) == 0:
self.tabWidget.setEnabled(False)
self.pushButton_startTransformation.setEnabled(False)
self.pushButton_startAnalyse.setEnabled(False)
self.menuTools.setEnabled(False)
self.menuValidierung.setEnabled(False)
self.action_fetch_from_oai.setEnabled(False)
self.disable_processing_controls(is_first_launch=True)
self.stackedWidget.setCurrentIndex(1)
else:
self.tabWidget.setEnabled(True)
self.pushButton_startTransformation.setEnabled(True)
self.pushButton_startAnalyse.setEnabled(True)
self.menuTools.setEnabled(True)
self.menuValidierung.setEnabled(True)
self.action_fetch_from_oai.setEnabled(True)
self.enable_processing_controls()
self.stackedWidget.setCurrentIndex(0)

def set_provider_from_list(self, current_index):
Expand Down Expand Up @@ -1294,23 +1287,27 @@ def save_mets_settings(self):
def open_in_browser(target_url):
webbrowser.open(target_url)

def disable_processing_controls(self):
def disable_processing_controls(self, is_first_launch=False):
"""GUI-Elemente zur Steuerung von Prozessierungen deaktivieren, während bereits eine Prozessierung läuft."""
self.tabWidget.setEnabled(False)
self.pushButton_startTransformation.setEnabled(False)
self.pushButton_startAnalyse.setEnabled(False)
self.menuTools.setEnabled(False)
self.menuValidierung.setEnabled(False)
if not is_first_launch:
self.menuValidierung.setEnabled(False)
self.action_fetch_from_oai.setEnabled(False)

def enable_processing_controls(self):
def enable_processing_controls(self, is_first_launch=False):
"""GUI-Elemente zur Steuerung von Prozessierungen aktivieren, nachdem eine Prozessierung abgeschlossen wurde."""
self.tabWidget.setEnabled(True)
self.pushButton_startTransformation.setEnabled(True)
self.pushButton_startAnalyse.setEnabled(True)
self.menuTools.setEnabled(True)
self.menuValidierung.setEnabled(True)
self.action_fetch_from_oai.setEnabled(True)
if not is_first_launch:
self.tabWidget.setEnabled(True)
self.pushButton_startTransformation.setEnabled(True)
self.pushButton_startAnalyse.setEnabled(True)
self.menuTools.setEnabled(True)
self.action_fetch_from_oai.setEnabled(True)
self.menuValidierung.setEnabled(True)
else:
self.menuValidierung.setEnabled(True)

def exit_application(self):
handle_session_data.save_to_xml(self.session_data) # Speichern der Sitzungsdaten beim Beenden
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,15 @@ def merge_repeatable_elements(source_value_multiple, compare_with_existing_eleme
for existing_element in element_exists_in_target_doc:
existing_element_p = existing_element.findall("{urn:isbn:1-931666-22-9}p")
existing_element_text = None
if len(existing_element_p) == 0 and (len(existing_element.text) > 0 or len(existing_element) > 0): # abstract (ohne p-Subelement) berücksichtigen
existing_element_text_compare_value = get_compare_value(existing_element)

if len(existing_element_p) == 0 and existing_element_text_compare_value != "": # abstract (ohne p-Subelement) berücksichtigen
existing_element_text = existing_element
if len(existing_element_p) > 0:
if get_compare_value(value[1]) == get_compare_value(existing_element_p[0]):
target_possible_duplicate = True
if existing_element_text is not None:
if get_compare_value(value[1]) == get_compare_value(existing_element_text):
if get_compare_value(value[1]) == existing_element_text_compare_value:
target_possible_duplicate = True

if not target_possible_duplicate:
Expand Down
Loading

0 comments on commit e89d9d5

Please sign in to comment.