|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2014 - 2021 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing a dialog to enter the data for a stash operation. |
|
8 """ |
|
9 |
|
10 from PyQt5.QtWidgets import QDialog |
|
11 |
|
12 from .Ui_GitStashDataDialog import Ui_GitStashDataDialog |
|
13 |
|
14 |
|
15 class GitStashDataDialog(QDialog, Ui_GitStashDataDialog): |
|
16 """ |
|
17 Class implementing a dialog to enter the data for a stash operation. |
|
18 """ |
|
19 NoUntracked = 0 |
|
20 UntrackedOnly = 1 |
|
21 UntrackedAndIgnored = 2 |
|
22 |
|
23 def __init__(self, parent=None): |
|
24 """ |
|
25 Constructor |
|
26 |
|
27 @param parent reference to the parent widget (QWidget) |
|
28 """ |
|
29 super().__init__(parent) |
|
30 self.setupUi(self) |
|
31 |
|
32 msh = self.minimumSizeHint() |
|
33 self.resize(max(self.width(), msh.width()), msh.height()) |
|
34 |
|
35 def getData(self): |
|
36 """ |
|
37 Public method to get the user data. |
|
38 |
|
39 @return tuple containing the message (string), a flag indicating to |
|
40 keep changes in the staging area (boolean) and an indication to |
|
41 stash untracked and/or ignored files (integer) |
|
42 """ |
|
43 if self.noneRadioButton.isChecked(): |
|
44 untracked = self.NoUntracked |
|
45 elif self.untrackedRadioButton.isChecked(): |
|
46 untracked = self.UntrackedOnly |
|
47 else: |
|
48 untracked = self.UntrackedAndIgnored |
|
49 |
|
50 return (self.messageEdit.text(), self.keepCheckBox.isChecked(), |
|
51 untracked) |