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

Wed, 03 Jan 2024 18:09:15 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 03 Jan 2024 18:09:15 +0100
branch
eric7
changeset 10475
ee41fab001f2
parent 10439
21c28b0f9e41
child 10489
1800956305ca
permissions
-rw-r--r--

Added a bunch of TODO markers to convert some definitions to an enum.

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

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

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

from PyQt6.QtWidgets import QDialog

from .Ui_GitStashDataDialog import Ui_GitStashDataDialog


class GitStashDataDialog(QDialog, Ui_GitStashDataDialog):
    """
    Class implementing a dialog to enter the data for a stash operation.
    """

    # TODO: change this to an enum
    NoUntracked = 0
    UntrackedOnly = 1
    UntrackedAndIgnored = 2

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

        @param parent reference to the parent widget
        @type QWidget
        """
        super().__init__(parent)
        self.setupUi(self)

        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 message, a flag indicating to keep changes
            in the staging area and an indication to stash untracked and/or
            ignored files
        @rtype tuple of (str, bool, int)
        """
        if self.noneRadioButton.isChecked():
            untracked = self.NoUntracked
        elif self.untrackedRadioButton.isChecked():
            untracked = self.UntrackedOnly
        else:
            untracked = self.UntrackedAndIgnored

        return (self.messageEdit.text(), self.keepCheckBox.isChecked(), untracked)

eric ide

mercurial