eric6/Plugins/VcsPlugins/vcsGit/GitSubmodulesListDialog.py

Sat, 31 Aug 2019 12:58:11 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 31 Aug 2019 12:58:11 +0200
branch
without_py2_and_pyqt4
changeset 7192
a22eee00b052
parent 6942
2602857055c5
child 7229
53054eb5b15a
permissions
-rw-r--r--

Started removing runtime support for Python2 and PyQt4.

# -*- coding: utf-8 -*-

# Copyright (c) 2017 - 2019 Detlev Offenbach <detlev@die-offenbachs.de>
#

"""
Module implementing a dialog to list the defined submodules.
"""

from __future__ import unicode_literals

from PyQt5.QtCore import Qt
from PyQt5.QtWidgets import QDialog, QTreeWidgetItem, QHeaderView

from .Ui_GitSubmodulesListDialog import Ui_GitSubmodulesListDialog


class GitSubmodulesListDialog(QDialog, Ui_GitSubmodulesListDialog):
    """
    Class implementing a dialog to list the defined submodules.
    """
    def __init__(self, submodules, parent=None):
        """
        Constructor
        
        @param submodules list of submodule data to be shown
        @type list of dictionaries with submodule name, path, URL and branch
        @param parent reference to the parent widget
        @type QWidget
        """
        super(GitSubmodulesListDialog, self).__init__(parent)
        self.setupUi(self)
        
        for submodule in submodules:
            QTreeWidgetItem(self.submodulesList, [
                submodule["name"],
                submodule["path"],
                submodule["url"],
                submodule["branch"]
            ])
        self.submodulesList.header().resizeSections(
            QHeaderView.ResizeToContents)
        self.submodulesList.header().setStretchLastSection(True)
        
        self.submodulesList.setSortingEnabled(True)
        self.submodulesList.sortItems(0, Qt.AscendingOrder)
        self.submodulesList.setSortingEnabled(False)

eric ide

mercurial