src/eric7/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/HgUnshelveDataDialog.py

Thu, 06 Apr 2023 09:32:12 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Thu, 06 Apr 2023 09:32:12 +0200
branch
eric7-maintenance
changeset 9974
c2ae0dd2021a
parent 9653
e67609152c5e
child 10438
4cd7e5a8b3cf
permissions
-rw-r--r--

Version Control Systems
- fixed an issue triggered by loading very old project files (i.e. those containing a no longer supported programmin language like Python2)
(grafted from d537cba05d38d157fb337507cc1f3adf4fa5234c)

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

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

"""
Module implementing a dialog to enter the data for an unshelve operation.
"""

from PyQt6.QtWidgets import QDialog

from .Ui_HgUnshelveDataDialog import Ui_HgUnshelveDataDialog


class HgUnshelveDataDialog(QDialog, Ui_HgUnshelveDataDialog):
    """
    Class implementing a dialog to enter the data for an unshelve operation.
    """

    def __init__(self, shelveNames, shelveName="", parent=None):
        """
        Constructor

        @param shelveNames list of available shelves (list of string)
        @param shelveName name of the shelve to restore (string)
        @param parent reference to the parent widget (QWidget)
        """
        super().__init__(parent)
        self.setupUi(self)

        self.nameComboBox.addItem("")
        self.nameComboBox.addItems(sorted(shelveNames))

        if shelveName and shelveName in shelveNames:
            self.nameComboBox.setCurrentIndex(self.nameComboBox.findText(shelveName))

        msh = self.minimumSizeHint()
        self.resize(max(self.width(), msh.width()), msh.height())

    def getData(self):
        """
        Public method to get the user data.

        @return tuple containing the name (string) and a flag indicating
            to keep the shelved change (boolean)
        """
        return (
            self.nameComboBox.currentText().replace(" ", "_"),
            self.keepCheckBox.isChecked(),
        )

eric ide

mercurial