src/eric7/Plugins/VcsPlugins/vcsMercurial/ShelveExtension/HgUnshelveDataDialog.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 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 def __init__(self, shelveNames, shelveName="", parent=None):
20 """
21 Constructor
22
23 @param shelveNames list of available shelves (list of string)
24 @param shelveName name of the shelve to restore (string)
25 @param parent reference to the parent widget (QWidget)
26 """
27 super().__init__(parent)
28 self.setupUi(self)
29
30 self.nameComboBox.addItem("")
31 self.nameComboBox.addItems(sorted(shelveNames))
32
33 if shelveName and shelveName in shelveNames:
34 self.nameComboBox.setCurrentIndex(
35 self.nameComboBox.findText(shelveName))
36
37 msh = self.minimumSizeHint()
38 self.resize(max(self.width(), msh.width()), msh.height())
39
40 def getData(self):
41 """
42 Public method to get the user data.
43
44 @return tuple containing the name (string) and a flag indicating
45 to keep the shelved change (boolean)
46 """
47 return (
48 self.nameComboBox.currentText().replace(" ", "_"),
49 self.keepCheckBox.isChecked()
50 )

eric ide

mercurial