ibridgesgui 0.2.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. ibridgesgui/__init__.py +1 -0
  2. ibridgesgui/__main__.py +164 -0
  3. ibridgesgui/_version.py +16 -0
  4. ibridgesgui/browser.py +625 -0
  5. ibridgesgui/config.py +250 -0
  6. ibridgesgui/gui_utils.py +118 -0
  7. ibridgesgui/icons/arrow-left.png +0 -0
  8. ibridgesgui/icons/arrow-right.png +0 -0
  9. ibridgesgui/icons/arrow-up.png +0 -0
  10. ibridgesgui/icons/home.png +0 -0
  11. ibridgesgui/icons/iBridges.ico +0 -0
  12. ibridgesgui/icons/loading_circle.gif +0 -0
  13. ibridgesgui/icons/nosync.png +0 -0
  14. ibridgesgui/icons/refresh.png +0 -0
  15. ibridgesgui/icons/syncing.png +0 -0
  16. ibridgesgui/info.py +53 -0
  17. ibridgesgui/irods_tree_model.py +158 -0
  18. ibridgesgui/login.py +101 -0
  19. ibridgesgui/popup_widgets.py +237 -0
  20. ibridgesgui/search.py +285 -0
  21. ibridgesgui/sync.py +289 -0
  22. ibridgesgui/threads.py +251 -0
  23. ibridgesgui/ui_files/.py +118 -0
  24. ibridgesgui/ui_files/ExampleTab.py +87 -0
  25. ibridgesgui/ui_files/ExampleTab.ui +93 -0
  26. ibridgesgui/ui_files/MainMenu.py +121 -0
  27. ibridgesgui/ui_files/MainMenu.ui +171 -0
  28. ibridgesgui/ui_files/__init__.py +1 -0
  29. ibridgesgui/ui_files/configCheck.py +96 -0
  30. ibridgesgui/ui_files/configCheck.ui +142 -0
  31. ibridgesgui/ui_files/createCollection.py +82 -0
  32. ibridgesgui/ui_files/createCollection.ui +153 -0
  33. ibridgesgui/ui_files/dataTransferState.py +114 -0
  34. ibridgesgui/ui_files/dataTransferState.ui +187 -0
  35. ibridgesgui/ui_files/irodsLogin.py +134 -0
  36. ibridgesgui/ui_files/irodsLogin.ui +237 -0
  37. ibridgesgui/ui_files/renameItem.py +77 -0
  38. ibridgesgui/ui_files/renameItem.ui +151 -0
  39. ibridgesgui/ui_files/tabBrowser.py +525 -0
  40. ibridgesgui/ui_files/tabBrowser.ui +829 -0
  41. ibridgesgui/ui_files/tabInfo.py +207 -0
  42. ibridgesgui/ui_files/tabInfo.ui +356 -0
  43. ibridgesgui/ui_files/tabSearch.py +233 -0
  44. ibridgesgui/ui_files/tabSearch.ui +400 -0
  45. ibridgesgui/ui_files/tabSync.py +223 -0
  46. ibridgesgui/ui_files/tabSync.ui +481 -0
  47. ibridgesgui/ui_files/tabUpDownload.py +303 -0
  48. ibridgesgui/ui_files/tabUpDownload.ui +460 -0
  49. ibridgesgui-0.2.0.dist-info/LICENSE +674 -0
  50. ibridgesgui-0.2.0.dist-info/METADATA +787 -0
  51. ibridgesgui-0.2.0.dist-info/RECORD +54 -0
  52. ibridgesgui-0.2.0.dist-info/WHEEL +5 -0
  53. ibridgesgui-0.2.0.dist-info/entry_points.txt +2 -0
  54. ibridgesgui-0.2.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1 @@
1
+ """iBridges GUI modules."""
@@ -0,0 +1,164 @@
1
+ #!/usr/bin/env python3
2
+ """iBridges GUI startup script."""
3
+
4
+ import logging
5
+ import sys
6
+ from pathlib import Path
7
+
8
+ import PyQt6.QtWidgets
9
+ import PyQt6.uic
10
+ import setproctitle
11
+
12
+ from ibridgesgui.browser import Browser
13
+ from ibridgesgui.config import get_log_level, init_logger, set_log_level
14
+ from ibridgesgui.gui_utils import UI_FILE_DIR
15
+ from ibridgesgui.info import Info
16
+ from ibridgesgui.login import Login
17
+ from ibridgesgui.popup_widgets import CheckConfig
18
+ from ibridgesgui.search import Search
19
+ from ibridgesgui.sync import Sync
20
+ from ibridgesgui.ui_files.MainMenu import Ui_MainWindow
21
+
22
+ # Global constants
23
+ THIS_APPLICATION = "ibridges-gui"
24
+
25
+ # Application globals
26
+ app = PyQt6.QtWidgets.QApplication(sys.argv)
27
+
28
+
29
+ class MainMenu(PyQt6.QtWidgets.QMainWindow, Ui_MainWindow):
30
+ """Set up the GUI Main Menu."""
31
+
32
+ def __init__(self, app_name):
33
+ """Initialise the main window."""
34
+ super().__init__()
35
+ if getattr(sys, "frozen", False):
36
+ super().setupUi(self)
37
+ else:
38
+ PyQt6.uic.loadUi(UI_FILE_DIR / "MainMenu.ui", self)
39
+
40
+ self.logger = logging.getLogger(app_name)
41
+ self.irods_path = Path("~", ".irods").expanduser()
42
+ self.app_name = app_name
43
+ self.ui_tabs_lookup = {
44
+ "tabBrowser": self.init_browser_tab,
45
+ "tabSync": self.init_sync_tab,
46
+ "tabSearch": self.init_search_tab,
47
+ #'tabDataBundle': self.setupTabDataBundle,
48
+ #'tabCreateTicket': self.setupTabCreateTicket,
49
+ #'tabELNData': self.setupTabELNData,
50
+ #'tabAmberWorkflow': self.setupTabAmberWorkflow,
51
+ "tabInfo": self.init_info_tab,
52
+ #'tabExample': self.setupTabExample,
53
+ }
54
+
55
+ self.session = None
56
+ self.irods_browser = None
57
+ self.session_dict = {}
58
+ self.action_connect.triggered.connect(self.connect)
59
+ self.action_exit.triggered.connect(self.exit)
60
+ self.action_close_session.triggered.connect(self.disconnect)
61
+ self.action_add_configuration.triggered.connect(self.create_env_file)
62
+ self.action_check_configuration.triggered.connect(self.inspect_env_file)
63
+ self.tab_widget.setCurrentIndex(0)
64
+
65
+ def disconnect(self):
66
+ """Close iRODS session."""
67
+ self.error_label.clear()
68
+ if "session" in self.session_dict:
69
+ self.logger.info("Disconnecting %s from %s", self.session.username, self.session.host)
70
+ self.session.close()
71
+ self.session = None
72
+ self.session_dict.clear()
73
+ self.tab_widget.clear()
74
+
75
+ def connect(self):
76
+ """Create iRODS session."""
77
+ self.error_label.clear()
78
+ if self.session:
79
+ self.error_label.setText("Please close session first.")
80
+ return
81
+
82
+ login_window = Login(self.session_dict, self.app_name)
83
+ login_window.exec()
84
+ # Trick to get the session object from the QDialog
85
+ if "session" in self.session_dict:
86
+ self.session = self.session_dict["session"]
87
+ try:
88
+ self.setup_tabs()
89
+ except:
90
+ self.session = None
91
+ raise
92
+
93
+ def exit(self):
94
+ """Quit program."""
95
+ quit_msg = "Are you sure you want to exit the program?"
96
+ reply = PyQt6.QtWidgets.QMessageBox.question(
97
+ self,
98
+ "Message",
99
+ quit_msg,
100
+ PyQt6.QtWidgets.QMessageBox.StandardButton.Yes,
101
+ PyQt6.QtWidgets.QMessageBox.StandardButton.No,
102
+ )
103
+ if reply == PyQt6.QtWidgets.QMessageBox.StandardButton.Yes:
104
+ self.disconnect()
105
+ sys.exit()
106
+ else:
107
+ pass
108
+
109
+ def setup_tabs(self):
110
+ """Init tab view."""
111
+ for tab_fun in self.ui_tabs_lookup.values():
112
+ tab_fun()
113
+ # self.ui_tabs_lookup[tab_name]()
114
+
115
+ def init_info_tab(self):
116
+ """Create info."""
117
+ irods_info = Info(self.session)
118
+ self.tab_widget.addTab(irods_info, "Info")
119
+
120
+ def init_browser_tab(self):
121
+ """Create browser."""
122
+ self.irods_browser = Browser(self.session, self.app_name)
123
+ self.tab_widget.addTab(self.irods_browser, "Browser")
124
+
125
+ def init_search_tab(self):
126
+ """Create search. Depends on Browser."""
127
+ irods_search = Search(self.session, self.app_name, self.irods_browser)
128
+ self.tab_widget.addTab(irods_search, "Search")
129
+
130
+ def init_sync_tab(self):
131
+ """Create sync."""
132
+ irods_sync = Sync(self.session, self.app_name)
133
+ self.tab_widget.addTab(irods_sync, "Synchronise Data")
134
+
135
+ def create_env_file(self):
136
+ """Populate drop down menu to create a new environment.json."""
137
+ create_widget = CheckConfig(self.logger, self.irods_path)
138
+ create_widget.exec()
139
+
140
+ def inspect_env_file(self):
141
+ """Init drop down menu to inspect an environment.json."""
142
+ create_widget = CheckConfig(self.logger, self.irods_path)
143
+ create_widget.exec()
144
+
145
+
146
+ def main():
147
+ """Call main function."""
148
+ setproctitle.setproctitle(THIS_APPLICATION)
149
+
150
+ log_level = get_log_level()
151
+ if log_level is not None:
152
+ init_logger(THIS_APPLICATION, log_level)
153
+ else:
154
+ set_log_level("error")
155
+ init_logger(THIS_APPLICATION, "error")
156
+ main_widget = PyQt6.QtWidgets.QStackedWidget()
157
+ main_app = MainMenu(THIS_APPLICATION)
158
+ main_widget.addWidget(main_app)
159
+ main_widget.show()
160
+ app.exec()
161
+
162
+
163
+ if __name__ == "__main__":
164
+ main()
@@ -0,0 +1,16 @@
1
+ # file generated by setuptools_scm
2
+ # don't change, don't track in version control
3
+ TYPE_CHECKING = False
4
+ if TYPE_CHECKING:
5
+ from typing import Tuple, Union
6
+ VERSION_TUPLE = Tuple[Union[int, str], ...]
7
+ else:
8
+ VERSION_TUPLE = object
9
+
10
+ version: str
11
+ __version__: str
12
+ __version_tuple__: VERSION_TUPLE
13
+ version_tuple: VERSION_TUPLE
14
+
15
+ __version__ = version = '0.2.0'
16
+ __version_tuple__ = version_tuple = (0, 2, 0)