E5Gui/E5PathPicker.py

changeset 4575
464a6b049f89
parent 4573
365f39d86985
child 4576
a258569d44db
equal deleted inserted replaced
4574:86647045bc03 4575:464a6b049f89
14 try: 14 try:
15 from enum import Enum 15 from enum import Enum
16 except ImportError: 16 except ImportError:
17 from ThirdParty.enum import Enum 17 from ThirdParty.enum import Enum
18 18
19 from PyQt5.QtCore import Qt 19 from PyQt5.QtCore import pyqtSignal, Qt
20 from PyQt5.QtWidgets import QWidget, QHBoxLayout, QToolButton 20 from PyQt5.QtWidgets import QWidget, QHBoxLayout, QToolButton
21 21
22 from . import E5FileDialog 22 from . import E5FileDialog
23 from .E5LineEdit import E5ClearableLineEdit 23 from .E5LineEdit import E5ClearableLineEdit
24 from .E5Completers import E5FileCompleter, E5DirCompleter 24 from .E5Completers import E5FileCompleter, E5DirCompleter
39 39
40 class E5PathPicker(QWidget): 40 class E5PathPicker(QWidget):
41 """ 41 """
42 Class implementing a path picker widget consisting of a line edit and a 42 Class implementing a path picker widget consisting of a line edit and a
43 tool button to open a file dialog. 43 tool button to open a file dialog.
44
45 @signal textChanged(path) emitted when the entered path has changed
44 """ 46 """
45 DefaultMode = E5PathPickerModes.OpenFileMode 47 DefaultMode = E5PathPickerModes.OpenFileMode
48
49 textChanged = pyqtSignal(str)
46 50
47 def __init__(self, parent=None): 51 def __init__(self, parent=None):
48 """ 52 """
49 Constructor 53 Constructor
50 54
74 78
75 self.__layout.addWidget(self.__editor) 79 self.__layout.addWidget(self.__editor)
76 self.__layout.addWidget(self.__button) 80 self.__layout.addWidget(self.__button)
77 81
78 self.__button.clicked.connect(self.__showPathPickerDialog) 82 self.__button.clicked.connect(self.__showPathPickerDialog)
83 self.__editor.textChanged.connect(self.textChanged)
79 84
80 def setMode(self, mode): 85 def setMode(self, mode):
81 """ 86 """
82 Public method to set the path picker mode. 87 Public method to set the path picker mode.
83 88
106 111
107 @return path picker mode 112 @return path picker mode
108 @rtype E5PathPickerModes 113 @rtype E5PathPickerModes
109 """ 114 """
110 return self.__mode 115 return self.__mode
116
117 def clear(self):
118 """
119 Public method to clear the current path.
120 """
121 self.__editor.clear()
111 122
112 def setText(self, path): 123 def setText(self, path):
113 """ 124 """
114 Public method to set the current path. 125 Public method to set the current path.
115 126

eric ide

mercurial