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