Plugins/VcsPlugins/vcsGit/GitListDialog.py

changeset 6020
baf6da1ae288
child 6048
82ad8ec9548c
equal deleted inserted replaced
6019:58ecdaf0b789 6020:baf6da1ae288
1 # -*- coding: utf-8 -*-
2
3 # Copyright (c) 2014 - 2017 Detlev Offenbach <detlev@die-offenbachs.de>
4 #
5
6 """
7 Module implementing a dialog to select from a list.
8 """
9
10 from __future__ import unicode_literals
11
12 from PyQt5.QtWidgets import QDialog
13
14 from .Ui_GitListDialog import Ui_GitListDialog
15
16
17 class GitListDialog(QDialog, Ui_GitListDialog):
18 """
19 Class implementing a dialog to select from a list.
20 """
21 def __init__(self, selections, parent=None):
22 """
23 Constructor
24
25 @param selections list of entries to select from (list of string)
26 @param parent reference to the parent widget (QWidget)
27 """
28 super(GitListDialog, self).__init__(parent)
29 self.setupUi(self)
30
31 self.selectionList.addItems(selections)
32
33 def getSelection(self):
34 """
35 Public method to return the selected entries.
36
37 @return list of selected entries (list of string)
38 """
39 selection = []
40 for itm in self.selectionList.selectedItems():
41 selection.append(itm.text())
42
43 return selection

eric ide

mercurial