Plugins/VcsPlugins/vcsMercurial/ShelveExtension/HgUnshelveDataDialog.py

changeset 3297
7b7e8124fb51
child 3366
6084bb3c3911
equal deleted inserted replaced
3294:3aabaf28817b 3297:7b7e8124fb51
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2014 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 PyQt4.QtGui 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 self.resize(self.width(), self.minimumSizeHint().height())
38
39 def getData(self):
40 """
41 Public method to get the user data.
42
43 @return tuple containing the name (string) and a flag indicating
44 to keep the shelved change (boolean)
45 """
46 return (
47 self.nameComboBox.currentText(),
48 self.keepCheckBox.isChecked()
49 )

eric ide

mercurial