src/eric7/Plugins/VcsPlugins/vcsMercurial/ShelveBuiltin/HgUnshelveDataDialog.py

branch
eric7
changeset 11068
15f0385e0471
parent 10439
21c28b0f9e41
child 11090
f5f5f5803935
equal deleted inserted replaced
11067:67b92e2cb719 11068:15f0385e0471
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2014 - 2024 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to enter the data for an unshelve operation.
8 """
9
10 from PyQt6.QtWidgets import QDialog
11
12 from .Ui_HgUnshelveDataDialog import Ui_HgUnshelveDataDialog
13
14
15 class HgUnshelveDataDialog(QDialog, Ui_HgUnshelveDataDialog):
16 """
17 Class implementing a dialog to enter the data for an unshelve operation.
18 """
19
20 def __init__(self, shelveNames, shelveName="", parent=None):
21 """
22 Constructor
23
24 @param shelveNames list of available shelves
25 @type list of str
26 @param shelveName name of the shelve to restore
27 @type str
28 @param parent reference to the parent widget
29 @type QWidget
30 """
31 super().__init__(parent)
32 self.setupUi(self)
33
34 self.nameComboBox.addItem("")
35 self.nameComboBox.addItems(sorted(shelveNames))
36
37 if shelveName and shelveName in shelveNames:
38 self.nameComboBox.setCurrentIndex(self.nameComboBox.findText(shelveName))
39
40 msh = self.minimumSizeHint()
41 self.resize(max(self.width(), msh.width()), msh.height())
42
43 def getData(self):
44 """
45 Public method to get the user data.
46
47 @return tuple containing the name and a flag indicating to keep the
48 shelved change
49 @rtype tuple of (str, bool)
50 """
51 return (
52 self.nameComboBox.currentText().replace(" ", "_"),
53 self.keepCheckBox.isChecked(),
54 )

eric ide

mercurial