src/eric7/MicroPython/Devices/CircuitPythonUpdater/ShowInstalledDialog.py

branch
eric7
changeset 9756
9854647c8c5c
parent 9740
90072e10ae9b
child 10439
21c28b0f9e41
equal deleted inserted replaced
9755:1a09700229e7 9756:9854647c8c5c
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2023 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to show the modules installed on the connected device.
8 """
9
10 import circup
11
12 from PyQt6.QtCore import Qt
13 from PyQt6.QtWidgets import QDialog, QTreeWidgetItem
14
15 from .Ui_ShowInstalledDialog import Ui_ShowInstalledDialog
16
17
18 class ShowInstalledDialog(QDialog, Ui_ShowInstalledDialog):
19 """
20 Class implementing a dialog to show the modules installed on the connected device.
21 """
22
23 def __init__(self, devicePath, parent=None):
24 """
25 Constructor
26
27 @param devicePath path to the connected board
28 @type str
29 @param parent reference to the parent widget (defaults to None)
30 @type QWidget (optional)
31 """
32 super().__init__(parent)
33 self.setupUi(self)
34
35 self.modulesList.clear()
36 deviceModules = circup.get_device_versions(devicePath)
37 for name, metadata in deviceModules.items():
38 QTreeWidgetItem(
39 self.modulesList,
40 [name, metadata.get("__version__", self.tr("unknown"))],
41 )
42
43 self.modulesList.sortItems(0, Qt.SortOrder.AscendingOrder)
44 self.modulesList.resizeColumnToContents(0)
45 self.modulesList.resizeColumnToContents(1)

eric ide

mercurial