Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

ILTIS_transfer_dialog.py 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. from PyQt5.QtWidgets import QMainWindow, QWidget, QVBoxLayout, QHBoxLayout, QAbstractItemView, QGroupBox, \
  2. QMessageBox, QDesktopWidget, QListWidget, QListWidgetItem, QPushButton, QHeaderView
  3. from PyQt5.QtCore import pyqtSignal
  4. from .custom_widgets import QTableWidgetPandasDF
  5. import pandas as pd
  6. class ILTISTransferDialog(QMainWindow):
  7. send_data_signal = pyqtSignal(list, list, pd.DataFrame, name="send data")
  8. def __init__(self, data_loaded_df, metadata_to_choose_from):
  9. super().__init__()
  10. self.data_loaded_df = data_loaded_df
  11. centralWidget = QWidget(self)
  12. main_vbox = QVBoxLayout(centralWidget)
  13. self.table = QTableWidgetPandasDF(self)
  14. self.table.setSelectionBehavior(QAbstractItemView.SelectRows)
  15. self.table.setSelectionMode(QAbstractItemView.MultiSelection)
  16. self.table.refresh(data_loaded_df)
  17. main_vbox.addWidget(self.table)
  18. metadata_choice_box = QGroupBox("Select one or more metadata that will be used to "
  19. "construct the dataset name in iltis")
  20. metadata_choice_vboxlayout = QVBoxLayout(metadata_choice_box)
  21. self.metadata_choice_list = QTableWidgetPandasDF(self)
  22. self.table.setSelectionBehavior(QAbstractItemView.SelectRows)
  23. self.metadata_choice_list.setSelectionMode(QAbstractItemView.MultiSelection)
  24. self.metadata_choice_list.refresh(pd.DataFrame.from_dict({"Metadata to choose from": metadata_to_choose_from}))
  25. self.metadata_choice_list.resizeColumnsToContents()
  26. metadata_choice_vboxlayout.addWidget(self.metadata_choice_list)
  27. main_vbox.addWidget(metadata_choice_box)
  28. import_button = QPushButton("Import")
  29. import_button.clicked.connect(self.send_data)
  30. main_vbox.addWidget(import_button)
  31. self.setCentralWidget(centralWidget)
  32. self.setWindowTitle('Transfer Data to ILTIS')
  33. self.setGeometry(300, 300, 500, 700)
  34. self.center()
  35. def center(self):
  36. qr = self.frameGeometry()
  37. cp = QDesktopWidget().availableGeometry().center()
  38. qr.moveCenter(cp)
  39. self.move(qr.topLeft())
  40. def send_data(self):
  41. indices = [x.row() for x in self.table.selectionModel().selectedRows()]
  42. metadata_cols = [self.metadata_choice_list.item(x.row(), 0).text()
  43. for x in self.metadata_choice_list.selectionModel().selectedRows()]
  44. if not indices:
  45. QMessageBox.critical(self, "No data Selected!", "Please select some data to continue transfer to ILTIS")
  46. else:
  47. self.send_data_signal.emit(indices, metadata_cols, self.data_loaded_df)
  48. self.close()