addition of process dialogs during tool loading
This commit is contained in:
@@ -142,9 +142,16 @@ class InstallerWizard(QtWidgets.QWizard):
|
||||
def _load_tools(self):
|
||||
"""Loads tool data from supported_tools.json hosted on the project Github page
|
||||
"""
|
||||
process_dialog = QtWidgets.QProgressDialog("Loading tool information...", str(), 0, 100, self, QtCore.Qt.Dialog)
|
||||
process_dialog.setAutoClose(True)
|
||||
process_dialog.setAutoReset(True)
|
||||
process_dialog.setCancelButton(None)
|
||||
request = QtNetwork.QNetworkRequest(QtCore.QUrl("https://raw.githubusercontent.com/norweeg/portable-computing-toolkit-installer/initial_dev/portable_computing_toolkit_installer/resources/supported_tools.json"))
|
||||
request.setAttribute(QtNetwork.QNetworkRequest.CacheLoadControlAttribute, QtNetwork.QNetworkRequest.AlwaysNetwork)
|
||||
reply = self._network_manager.get(request)
|
||||
reply.downloadProgress.connect(lambda received, total: process_dialog.setMaximum(total))
|
||||
reply.downloadProgress.connect(lambda received, total: process_dialog.setValue(received))
|
||||
process_dialog.show()
|
||||
while reply.isRunning():
|
||||
QtWidgets.QApplication.instance().processEvents()
|
||||
QtCore.QThread.currentThread().msleep(100)
|
||||
@@ -161,10 +168,16 @@ class InstallerWizard(QtWidgets.QWizard):
|
||||
def _populate_menu(self):
|
||||
"""Populates the selection menu with items loaded from supported_tools.json
|
||||
"""
|
||||
process_dialog = QtWidgets.QProgressDialog("Loading tool information...", str(), 0, len(self.__tools__)-1, self, QtCore.Qt.Dialog)
|
||||
process_dialog.setAutoClose(True)
|
||||
process_dialog.setAutoReset(True)
|
||||
process_dialog.setCancelButton(None)
|
||||
process_dialog.show()
|
||||
for tool in sorted(self.__tools__, key = lambda x: x["category"] + f".{x['name']}"):
|
||||
placement = deque([level.capitalize().strip() for level in tool["category"].split(".") if level] + [tool["name"]])
|
||||
root = self.selection_menu.invisibleRootItem()
|
||||
self._add_menu_item(placement, root, tool)
|
||||
process_dialog.setValue(process_dialog.value() + 1)
|
||||
|
||||
self.selection_menu.resizeColumnToContents(0)
|
||||
self.selection_menu.resizeColumnToContents(1)
|
||||
|
||||
Reference in New Issue
Block a user