5 |
5 |
6 """ |
6 """ |
7 Module implementing a dialog to enter the data for a stash operation. |
7 Module implementing a dialog to enter the data for a stash operation. |
8 """ |
8 """ |
9 |
9 |
|
10 import enum |
|
11 |
10 from PyQt6.QtWidgets import QDialog |
12 from PyQt6.QtWidgets import QDialog |
11 |
13 |
12 from .Ui_GitStashDataDialog import Ui_GitStashDataDialog |
14 from .Ui_GitStashDataDialog import Ui_GitStashDataDialog |
|
15 |
|
16 |
|
17 class GitStashKind(enum.Enum): |
|
18 """ |
|
19 Class defining the kind of stash to be performed. |
|
20 """ |
|
21 |
|
22 NoUntracked = 0 |
|
23 UntrackedOnly = 1 |
|
24 UntrackedAndIgnored = 2 |
13 |
25 |
14 |
26 |
15 class GitStashDataDialog(QDialog, Ui_GitStashDataDialog): |
27 class GitStashDataDialog(QDialog, Ui_GitStashDataDialog): |
16 """ |
28 """ |
17 Class implementing a dialog to enter the data for a stash operation. |
29 Class implementing a dialog to enter the data for a stash operation. |
18 """ |
30 """ |
19 |
|
20 # TODO: change this to an enum |
|
21 NoUntracked = 0 |
|
22 UntrackedOnly = 1 |
|
23 UntrackedAndIgnored = 2 |
|
24 |
31 |
25 def __init__(self, parent=None): |
32 def __init__(self, parent=None): |
26 """ |
33 """ |
27 Constructor |
34 Constructor |
28 |
35 |
40 Public method to get the user data. |
47 Public method to get the user data. |
41 |
48 |
42 @return tuple containing the message, a flag indicating to keep changes |
49 @return tuple containing the message, a flag indicating to keep changes |
43 in the staging area and an indication to stash untracked and/or |
50 in the staging area and an indication to stash untracked and/or |
44 ignored files |
51 ignored files |
45 @rtype tuple of (str, bool, int) |
52 @rtype tuple of (str, bool, GitStashKind) |
46 """ |
53 """ |
47 if self.noneRadioButton.isChecked(): |
54 if self.noneRadioButton.isChecked(): |
48 untracked = self.NoUntracked |
55 untracked = GitStashKind.NoUntracked |
49 elif self.untrackedRadioButton.isChecked(): |
56 elif self.untrackedRadioButton.isChecked(): |
50 untracked = self.UntrackedOnly |
57 untracked = GitStashKind.UntrackedOnly |
51 else: |
58 else: |
52 untracked = self.UntrackedAndIgnored |
59 untracked = GitStashKind.UntrackedAndIgnored |
53 |
60 |
54 return (self.messageEdit.text(), self.keepCheckBox.isChecked(), untracked) |
61 return (self.messageEdit.text(), self.keepCheckBox.isChecked(), untracked) |