src/eric7/Plugins/VcsPlugins/vcsGit/GitSubmodulesListDialog.py

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
54e42bc2437a
child 9221
bf71ee032bb4
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2017 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to list the defined submodules.
8 """
9
10 from PyQt6.QtCore import Qt
11 from PyQt6.QtWidgets import QDialog, QTreeWidgetItem, QHeaderView
12
13 from .Ui_GitSubmodulesListDialog import Ui_GitSubmodulesListDialog
14
15
16 class GitSubmodulesListDialog(QDialog, Ui_GitSubmodulesListDialog):
17 """
18 Class implementing a dialog to list the defined submodules.
19 """
20 def __init__(self, submodules, parent=None):
21 """
22 Constructor
23
24 @param submodules list of submodule data to be shown
25 @type list of dictionaries with submodule name, path, URL and branch
26 @param parent reference to the parent widget
27 @type QWidget
28 """
29 super().__init__(parent)
30 self.setupUi(self)
31
32 for submodule in submodules:
33 QTreeWidgetItem(self.submodulesList, [
34 submodule["name"],
35 submodule["path"],
36 submodule["url"],
37 submodule["branch"]
38 ])
39 self.submodulesList.header().resizeSections(
40 QHeaderView.ResizeMode.ResizeToContents)
41 self.submodulesList.header().setStretchLastSection(True)
42
43 self.submodulesList.setSortingEnabled(True)
44 self.submodulesList.sortItems(0, Qt.SortOrder.AscendingOrder)
45 self.submodulesList.setSortingEnabled(False)

eric ide

mercurial