|
1 | 1 | import hashlib |
2 | 2 | import pathlib |
3 | | -import pkg_resources |
| 3 | +import importlib.resources |
4 | 4 | import signal |
5 | 5 | import sys |
6 | 6 | import traceback |
|
32 | 32 | class DCKit(QtWidgets.QMainWindow): |
33 | 33 | def __init__(self): |
34 | 34 | super(DCKit, self).__init__() |
35 | | - path_ui = pkg_resources.resource_filename("dckit", "main.ui") |
36 | | - uic.loadUi(path_ui, self) |
| 35 | + ref = importlib.resources.files( |
| 36 | + "dckit") / "main.ui" |
| 37 | + with importlib.resources.as_file(ref) as path_ui: |
| 38 | + uic.loadUi(path_ui, self) |
| 39 | + |
37 | 40 | self.setWindowTitle(f"DCKit {version}") |
38 | 41 | # update check |
39 | 42 | self._update_thread = None |
@@ -345,8 +348,11 @@ def on_repack(self): |
345 | 348 | if self.checkBox_repack.isChecked(): |
346 | 349 | # ask the user whether he knows what he is doing |
347 | 350 | dlg = QtWidgets.QDialog() |
348 | | - path_ui = pkg_resources.resource_filename("dckit", "dlg_repack.ui") |
349 | | - uic.loadUi(path_ui, dlg) |
| 351 | + ref = importlib.resources.files( |
| 352 | + "dckit") / "dlg_repack.ui" |
| 353 | + with importlib.resources.as_file(ref) as path_ui: |
| 354 | + uic.loadUi(path_ui, dlg) |
| 355 | + |
350 | 356 | ret = dlg.exec_() |
351 | 357 | if ret == QtWidgets.QDialog.Rejected: |
352 | 358 | self.checkBox_repack.setChecked(False) |
@@ -434,8 +440,11 @@ def on_task_join(self): |
434 | 440 | """Join multiple RT-DC measurements""" |
435 | 441 | # show a dialog with sample name |
436 | 442 | dlg = QtWidgets.QDialog() |
437 | | - path_ui = pkg_resources.resource_filename("dckit", "dlg_join.ui") |
438 | | - uic.loadUi(path_ui, dlg) |
| 443 | + ref = importlib.resources.files( |
| 444 | + "dckit") / "dlg_join.ui" |
| 445 | + with importlib.resources.as_file(ref) as path_ui: |
| 446 | + uic.loadUi(path_ui, dlg) |
| 447 | + |
439 | 448 | dlg.lineEdit.setText(self.get_metadata(0)["experiment"]["sample"]) |
440 | 449 | ret = dlg.exec_() |
441 | 450 | if ret == QtWidgets.QDialog.Accepted: |
|
0 commit comments