15 |
15 |
16 class GitSubmodulesListDialog(QDialog, Ui_GitSubmodulesListDialog): |
16 class GitSubmodulesListDialog(QDialog, Ui_GitSubmodulesListDialog): |
17 """ |
17 """ |
18 Class implementing a dialog to list the defined submodules. |
18 Class implementing a dialog to list the defined submodules. |
19 """ |
19 """ |
|
20 |
20 def __init__(self, submodules, parent=None): |
21 def __init__(self, submodules, parent=None): |
21 """ |
22 """ |
22 Constructor |
23 Constructor |
23 |
24 |
24 @param submodules list of submodule data to be shown |
25 @param submodules list of submodule data to be shown |
25 @type list of dictionaries with submodule name, path, URL and branch |
26 @type list of dictionaries with submodule name, path, URL and branch |
26 @param parent reference to the parent widget |
27 @param parent reference to the parent widget |
27 @type QWidget |
28 @type QWidget |
28 """ |
29 """ |
29 super().__init__(parent) |
30 super().__init__(parent) |
30 self.setupUi(self) |
31 self.setupUi(self) |
31 |
32 |
32 for submodule in submodules: |
33 for submodule in submodules: |
33 QTreeWidgetItem(self.submodulesList, [ |
34 QTreeWidgetItem( |
34 submodule["name"], |
35 self.submodulesList, |
35 submodule["path"], |
36 [ |
36 submodule["url"], |
37 submodule["name"], |
37 submodule["branch"] |
38 submodule["path"], |
38 ]) |
39 submodule["url"], |
|
40 submodule["branch"], |
|
41 ], |
|
42 ) |
39 self.submodulesList.header().resizeSections( |
43 self.submodulesList.header().resizeSections( |
40 QHeaderView.ResizeMode.ResizeToContents) |
44 QHeaderView.ResizeMode.ResizeToContents |
|
45 ) |
41 self.submodulesList.header().setStretchLastSection(True) |
46 self.submodulesList.header().setStretchLastSection(True) |
42 |
47 |
43 self.submodulesList.setSortingEnabled(True) |
48 self.submodulesList.setSortingEnabled(True) |
44 self.submodulesList.sortItems(0, Qt.SortOrder.AscendingOrder) |
49 self.submodulesList.sortItems(0, Qt.SortOrder.AscendingOrder) |
45 self.submodulesList.setSortingEnabled(False) |
50 self.submodulesList.setSortingEnabled(False) |