Plugins/VcsPlugins/vcsSubversion/SvnPropSetDialog.py

changeset 4600
fc4f447ab637
parent 4021
195a471c327b
child 4631
5c1a96925da4
equal deleted inserted replaced
4599:960d1e63f802 4600:fc4f447ab637
7 Module implementing a dialog to enter the data for a new property. 7 Module implementing a dialog to enter the data for a new property.
8 """ 8 """
9 9
10 from __future__ import unicode_literals 10 from __future__ import unicode_literals
11 11
12 from PyQt5.QtCore import pyqtSlot
13 from PyQt5.QtWidgets import QDialog 12 from PyQt5.QtWidgets import QDialog
14 13
15 from E5Gui.E5Completers import E5FileCompleter 14 from E5Gui.E5PathPicker import E5PathPickerModes
16 from E5Gui import E5FileDialog
17 15
18 from .Ui_SvnPropSetDialog import Ui_SvnPropSetDialog 16 from .Ui_SvnPropSetDialog import Ui_SvnPropSetDialog
19
20 import Utilities
21 import UI.PixmapCache
22 17
23 18
24 class SvnPropSetDialog(QDialog, Ui_SvnPropSetDialog): 19 class SvnPropSetDialog(QDialog, Ui_SvnPropSetDialog):
25 """ 20 """
26 Class implementing a dialog to enter the data for a new property. 21 Class implementing a dialog to enter the data for a new property.
32 @param parent parent widget (QWidget) 27 @param parent parent widget (QWidget)
33 """ 28 """
34 super(SvnPropSetDialog, self).__init__(parent) 29 super(SvnPropSetDialog, self).__init__(parent)
35 self.setupUi(self) 30 self.setupUi(self)
36 31
37 self.fileButton.setIcon(UI.PixmapCache.getIcon("open.png")) 32 self.propFilePicker.setMode(E5PathPickerModes.OpenFileMode)
38
39 self.propFileCompleter = E5FileCompleter(self.propFileEdit)
40
41 @pyqtSlot()
42 def on_fileButton_clicked(self):
43 """
44 Private slot called by pressing the file selection button.
45 """
46 fn = E5FileDialog.getOpenFileName(
47 self,
48 self.tr("Select file for property"),
49 self.propFileEdit.text(),
50 "")
51
52 if fn:
53 self.propFileEdit.setText(Utilities.toNativeSeparators(fn))
54 33
55 def getData(self): 34 def getData(self):
56 """ 35 """
57 Public slot used to retrieve the data entered into the dialog. 36 Public slot used to retrieve the data entered into the dialog.
58 37
59 @return tuple of three values giving the property name, a flag 38 @return tuple of three values giving the property name, a flag
60 indicating a file was selected and the text of the property 39 indicating a file was selected and the text of the property
61 or the selected filename. (string, boolean, string) 40 or the selected filename. (string, boolean, string)
62 """ 41 """
63 if self.fileRadioButton.isChecked(): 42 if self.fileRadioButton.isChecked():
64 return (self.propNameEdit.text(), True, self.propFileEdit.text()) 43 return (self.propNameEdit.text(), True, self.propFilePicker.text())
65 else: 44 else:
66 return (self.propNameEdit.text(), False, 45 return (self.propNameEdit.text(), False,
67 self.propTextEdit.toPlainText()) 46 self.propTextEdit.toPlainText())

eric ide

mercurial