checkpoint. getting stuck
This commit is contained in:
@@ -44,7 +44,7 @@
|
||||
},
|
||||
"MSYS2": {
|
||||
"page": "https://www.msys2.org/",
|
||||
"category": "development.languages.C / C++",
|
||||
"category": "development.languages.c and c++",
|
||||
"homepage": "https://www.msys2.org",
|
||||
"icon url": "https://avatars1.githubusercontent.com/u/6759993?s=200&v=4",
|
||||
"search": {
|
||||
@@ -246,7 +246,7 @@
|
||||
},
|
||||
"Cppcheck": {
|
||||
"page": "https://portableapps.com/apps/development/cppcheck-portable",
|
||||
"category": "development.languages.C/C++",
|
||||
"category": "development.languages.c and c++",
|
||||
"homepage": "http://cppcheck.sourceforge.net/",
|
||||
"search": {
|
||||
"selector": "",
|
||||
|
||||
@@ -7,6 +7,7 @@ import zipfile
|
||||
from pathlib import Path
|
||||
from queue import Queue
|
||||
import json
|
||||
from operator import itemgetter
|
||||
|
||||
import psutil
|
||||
from PyQt5 import QtCore, QtGui, QtNetwork, QtWebEngineWidgets, QtWidgets
|
||||
@@ -48,7 +49,7 @@ class InstallerWizard(QtWidgets.QWizard):
|
||||
def _link_clicked(self, address):
|
||||
"""Receives anchorClicked signal from the intro or license text browsers and opens the address in an external web browser.
|
||||
Opens an error message window if it is not able to do so.
|
||||
|
||||
|
||||
Arguments:
|
||||
address {QtCore.QUrl} -- The URL from the received signal
|
||||
"""
|
||||
@@ -122,11 +123,11 @@ class InstallerWizard(QtWidgets.QWizard):
|
||||
return False
|
||||
|
||||
def _display_error(self, message, details = None):
|
||||
"""Displays an error message.
|
||||
|
||||
"""Displays an error message.
|
||||
|
||||
Arguments:
|
||||
message {str} -- The contents of the error message to be displayed
|
||||
|
||||
|
||||
Keyword Arguments:
|
||||
details {Any} -- Any string-printable object that will be set in the more details, typically an Exception object (default: {None})
|
||||
"""
|
||||
@@ -155,16 +156,13 @@ class InstallerWizard(QtWidgets.QWizard):
|
||||
else:
|
||||
self._display_error(f"Encountered an error while loading supported tools from {request.url().toString()}", reply.errorString()).finished.connect(lambda x: self.back())
|
||||
|
||||
|
||||
def _populate_menu(self):
|
||||
"""Populates the selection menu with items loaded from supported_tools.json
|
||||
"""
|
||||
for name, info in self.__tools__.items():
|
||||
placement = [level.capitalize().strip() for level in info["category"].split(".") if level] + [name]
|
||||
|
||||
root = self.selection_menu.invisibleRootItem()
|
||||
#children = [root.child(i) for i in range(root.childCount())]
|
||||
children = list(MenuIterator(root, QtWidgets.QTreeWidgetItemIterator.All))
|
||||
children = [root.child(i) for i in range(root.childCount())]
|
||||
while placement:
|
||||
current_level = placement.pop()
|
||||
|
||||
@@ -191,16 +189,21 @@ class InstallerWizard(QtWidgets.QWizard):
|
||||
pass
|
||||
else:
|
||||
new_item.setFlags(new_item.flags()|QtCore.Qt.ItemIsAutoTristate)
|
||||
|
||||
|
||||
root.addChild(new_item)
|
||||
new_item.setExpanded(False)
|
||||
self.selection_menu.resizeColumnToContents(0)
|
||||
self.selection_menu.resizeColumnToContents(1)
|
||||
|
||||
def _create_placements(self):
|
||||
placements = [[level.capitalize().strip() for level in info["category"].split(".") if info["category"]] + [name] for name, info in self.__tools__.items()]
|
||||
for menu_placement in placements:
|
||||
self.__tools__[menu_placement[-1]]["placement"] = menu_placement
|
||||
|
||||
@QtCore.pyqtSlot("QTreeWidgetItem*", "int")
|
||||
def _open_homepage(self, item, column):
|
||||
"""Receives the itemClicked signal from the selection_menu QTreeWidget and if the user has clicked a homepage, opens it in a new browser tab.
|
||||
|
||||
|
||||
Arguments:
|
||||
item {QTreeWidgetItem} -- The item that was clicked
|
||||
column {int} -- The index of the column of the item that was clicked
|
||||
@@ -215,22 +218,22 @@ class InstallerWizard(QtWidgets.QWizard):
|
||||
def _get_icon(self, tree_item, icon_url = None):
|
||||
"""Given a QTreeWidgetItem, this will initiate a request to download an icon for it. If icon_url is specified, that will be fetched, otherwise
|
||||
the favicon of the tree item's homepage.
|
||||
|
||||
|
||||
Arguments:
|
||||
tree_item {QTreeWidgetItem} -- a tree item with a specified homepage to set an icon on
|
||||
|
||||
|
||||
Keyword Arguments:
|
||||
icon_url {str} -- A string representing the url of the icon to fetch instead of the favicon of the homepage (default: {None})
|
||||
"""
|
||||
if not icon_url:
|
||||
if not icon_url:
|
||||
icon_url = QtCore.QUrl(f"http://www.google.com/s2/favicons?domain={QtCore.QUrl(tree_item.data(1, QtCore.Qt.ToolTipRole)).toString()}")
|
||||
icon_request = self._network_manager.get(QtNetwork.QNetworkRequest(QtCore.QUrl(icon_url)))
|
||||
#when download is complete, validates request returned without error and sets icon
|
||||
icon_request.finished.connect(lambda: self._set_icon(tree_item, icon_request))
|
||||
icon_request.finished.connect(lambda: self._set_icon(tree_item, icon_request))
|
||||
|
||||
def _set_icon(self, tree_item, request):
|
||||
"""Validates a network request and sets its result as the icon of a QTreeWidgetItem.
|
||||
|
||||
|
||||
Arguments:
|
||||
tree_item {QTreeWidgetItem} -- A tree widget item to set the icon of
|
||||
request {QNetworkReply} -- The results of the HTTP GET request whose data will be used as the icon for tree_item
|
||||
|
||||
Reference in New Issue
Block a user