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

branch
eric7
changeset 9209
b99e7fd55fd3
parent 8881
54e42bc2437a
child 9221
bf71ee032bb4
equal deleted inserted replaced
9208:3fc8dfeb6ebe 9209:b99e7fd55fd3
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2014 - 2022 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to enter the data for a shelve operation.
8 """
9
10 from PyQt6.QtCore import QDateTime
11 from PyQt6.QtWidgets import QDialog
12
13 from .Ui_HgShelveDataDialog import Ui_HgShelveDataDialog
14
15
16 class HgShelveDataDialog(QDialog, Ui_HgShelveDataDialog):
17 """
18 Class implementing a dialog to enter the data for a shelve operation.
19 """
20 def __init__(self, version, parent=None):
21 """
22 Constructor
23
24 @param version Mercurial version
25 @type tuple of three int
26 @param parent reference to the parent widget
27 @type QWidget
28 """
29 super().__init__(parent)
30 self.setupUi(self)
31
32 self.__initialDateTime = QDateTime.currentDateTime()
33 self.dateTimeEdit.setDateTime(self.__initialDateTime)
34
35 if version < (5, 0, 0):
36 self.keepCheckBox.setChecked(False)
37 self.keepCheckBox.hide()
38
39 msh = self.minimumSizeHint()
40 self.resize(max(self.width(), msh.width()), msh.height())
41
42 def getData(self):
43 """
44 Public method to get the user data.
45
46 @return tuple containing the name, date, message, a flag indicating
47 to add/remove new/missing files and a flag indicating to keep the
48 shelved changes in the working directory
49 @rtype tuple of (str, QDateTime, str, bool, bool)
50 """
51 dateTime = (
52 self.dateTimeEdit.dateTime()
53 if self.dateTimeEdit.dateTime() != self.__initialDateTime else
54 QDateTime()
55 )
56 return (
57 self.nameEdit.text().replace(" ", "_"),
58 dateTime,
59 self.messageEdit.text(),
60 self.addRemoveCheckBox.isChecked(),
61 self.keepCheckBox.isChecked(),
62 )

eric ide

mercurial