Plugins/VcsPlugins/vcsMercurial/ShelveExtension/HgShelvesSelectionDialog.py

changeset 3297
7b7e8124fb51
child 3359
6b6c224d67d6
equal deleted inserted replaced
3294:3aabaf28817b 3297:7b7e8124fb51
1 # -*- coding: utf-8 -*-
2
3 """
4 Module implementing a dialog to select multiple shelve names.
5 """
6
7 from PyQt4.QtCore import pyqtSlot
8 from PyQt4.QtGui import QDialog, QDialogButtonBox
9
10 from .Ui_HgShelvesSelectionDialog import Ui_HgShelvesSelectionDialog
11
12
13 class HgShelvesSelectionDialog(QDialog, Ui_HgShelvesSelectionDialog):
14 """
15 Class implementing a dialog to select multiple shelve names.
16 """
17 def __init__(self, message, shelveNames, parent=None):
18 """
19 Constructor
20
21 @param parent reference to the parent widget (QWidget)
22 """
23 super().__init__(parent)
24 self.setupUi(self)
25
26 self.message.setText(message)
27 self.shelvesList.addItems(shelveNames)
28
29 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(False)
30
31 @pyqtSlot()
32 def on_shelvesList_itemSelectionChanged(self):
33 """
34 Private slot to enabled the OK button if items have been selected.
35 """
36 self.buttonBox.button(QDialogButtonBox.Ok).setEnabled(
37 len(self.shelvesList.selectedItems()) > 0)
38
39 def getSelectedShelves(self):
40 """
41 Public method to retrieve the selected shelve names.
42
43 @return selected shelve names (list of string)
44 """
45 names = []
46 for itm in self.shelvesList.selectedItems():
47 names.append(itm.text())
48
49 return names

eric ide

mercurial