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

branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9653
e67609152c5e
equal deleted inserted replaced
9220:e9e7eca7efee 9221:bf71ee032bb4
15 15
16 class HgShelvesSelectionDialog(QDialog, Ui_HgShelvesSelectionDialog): 16 class HgShelvesSelectionDialog(QDialog, Ui_HgShelvesSelectionDialog):
17 """ 17 """
18 Class implementing a dialog to select multiple shelve names. 18 Class implementing a dialog to select multiple shelve names.
19 """ 19 """
20
20 def __init__(self, message, shelveNames, parent=None): 21 def __init__(self, message, shelveNames, parent=None):
21 """ 22 """
22 Constructor 23 Constructor
23 24
24 @param message message to be shown (string) 25 @param message message to be shown (string)
25 @param shelveNames list of shelve names (list of string) 26 @param shelveNames list of shelve names (list of string)
26 @param parent reference to the parent widget (QWidget) 27 @param parent reference to the parent widget (QWidget)
27 """ 28 """
28 super().__init__(parent) 29 super().__init__(parent)
29 self.setupUi(self) 30 self.setupUi(self)
30 31
31 self.message.setText(message) 32 self.message.setText(message)
32 self.shelvesList.addItems(shelveNames) 33 self.shelvesList.addItems(shelveNames)
33 34
34 self.buttonBox.button( 35 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(False)
35 QDialogButtonBox.StandardButton.Ok).setEnabled(False) 36
36
37 @pyqtSlot() 37 @pyqtSlot()
38 def on_shelvesList_itemSelectionChanged(self): 38 def on_shelvesList_itemSelectionChanged(self):
39 """ 39 """
40 Private slot to enabled the OK button if items have been selected. 40 Private slot to enabled the OK button if items have been selected.
41 """ 41 """
42 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled( 42 self.buttonBox.button(QDialogButtonBox.StandardButton.Ok).setEnabled(
43 len(self.shelvesList.selectedItems()) > 0) 43 len(self.shelvesList.selectedItems()) > 0
44 44 )
45
45 def getSelectedShelves(self): 46 def getSelectedShelves(self):
46 """ 47 """
47 Public method to retrieve the selected shelve names. 48 Public method to retrieve the selected shelve names.
48 49
49 @return selected shelve names (list of string) 50 @return selected shelve names (list of string)
50 """ 51 """
51 names = [] 52 names = []
52 for itm in self.shelvesList.selectedItems(): 53 for itm in self.shelvesList.selectedItems():
53 names.append(itm.text()) 54 names.append(itm.text())
54 55
55 return names 56 return names

eric ide

mercurial