E5Gui/E5Completers.py

changeset 945
8cd4d08fa9f6
parent 791
9ec2ac20e54e
child 1131
7781e396c903
equal deleted inserted replaced
944:1b59c4ba121e 945:8cd4d08fa9f6
10 from PyQt4.QtCore import QDir, Qt 10 from PyQt4.QtCore import QDir, Qt
11 from PyQt4.QtGui import QCompleter, QDirModel, QStringListModel 11 from PyQt4.QtGui import QCompleter, QDirModel, QStringListModel
12 12
13 from Globals import isWindowsPlatform 13 from Globals import isWindowsPlatform
14 14
15
15 class E5FileCompleter(QCompleter): 16 class E5FileCompleter(QCompleter):
16 """ 17 """
17 Class implementing a completer for file names. 18 Class implementing a completer for file names.
18 """ 19 """
19 def __init__(self, parent = None, 20 def __init__(self, parent=None,
20 completionMode = QCompleter.PopupCompletion, 21 completionMode=QCompleter.PopupCompletion,
21 showHidden = False): 22 showHidden=False):
22 """ 23 """
23 Constructor 24 Constructor
24 25
25 @param parent parent widget of the completer (QWidget) 26 @param parent parent widget of the completer (QWidget)
26 @keyparam completionMode completion mode of the 27 @keyparam completionMode completion mode of the
27 completer (QCompleter.CompletionMode) 28 completer (QCompleter.CompletionMode)
28 @keyparam showHidden flag indicating to show hidden entries as well (boolean) 29 @keyparam showHidden flag indicating to show hidden entries as well (boolean)
29 """ 30 """
30 QCompleter.__init__(self, parent) 31 QCompleter.__init__(self, parent)
31 self.__model = QDirModel(self) 32 self.__model = QDirModel(self)
41 if isWindowsPlatform(): 42 if isWindowsPlatform():
42 self.setCaseSensitivity(Qt.CaseInsensitive) 43 self.setCaseSensitivity(Qt.CaseInsensitive)
43 if parent: 44 if parent:
44 parent.setCompleter(self) 45 parent.setCompleter(self)
45 46
47
46 class E5DirCompleter(QCompleter): 48 class E5DirCompleter(QCompleter):
47 """ 49 """
48 Class implementing a completer for directory names. 50 Class implementing a completer for directory names.
49 """ 51 """
50 def __init__(self, parent = None, 52 def __init__(self, parent=None,
51 completionMode = QCompleter.PopupCompletion, 53 completionMode=QCompleter.PopupCompletion,
52 showHidden = False): 54 showHidden=False):
53 """ 55 """
54 Constructor 56 Constructor
55 57
56 @param parent parent widget of the completer (QWidget) 58 @param parent parent widget of the completer (QWidget)
57 @keyparam completionMode completion mode of the 59 @keyparam completionMode completion mode of the
58 completer (QCompleter.CompletionMode) 60 completer (QCompleter.CompletionMode)
59 @keyparam showHidden flag indicating to show hidden entries as well (boolean) 61 @keyparam showHidden flag indicating to show hidden entries as well (boolean)
60 """ 62 """
61 QCompleter.__init__(self, parent) 63 QCompleter.__init__(self, parent)
62 self.__model = QDirModel(self) 64 self.__model = QDirModel(self)
71 if isWindowsPlatform(): 73 if isWindowsPlatform():
72 self.setCaseSensitivity(Qt.CaseInsensitive) 74 self.setCaseSensitivity(Qt.CaseInsensitive)
73 if parent: 75 if parent:
74 parent.setCompleter(self) 76 parent.setCompleter(self)
75 77
78
76 class E5StringListCompleter(QCompleter): 79 class E5StringListCompleter(QCompleter):
77 """ 80 """
78 Class implementing a completer for string lists. 81 Class implementing a completer for string lists.
79 """ 82 """
80 def __init__(self, parent = None, strings = [], 83 def __init__(self, parent=None, strings=[],
81 completionMode = QCompleter.PopupCompletion): 84 completionMode=QCompleter.PopupCompletion):
82 """ 85 """
83 Constructor 86 Constructor
84 87
85 @param parent parent widget of the completer (QWidget) 88 @param parent parent widget of the completer (QWidget)
86 @param strings list of string to load into the completer (list of strings) 89 @param strings list of string to load into the completer (list of strings)
87 @keyparam completionMode completion mode of the 90 @keyparam completionMode completion mode of the
88 completer (QCompleter.CompletionMode) 91 completer (QCompleter.CompletionMode)
89 """ 92 """
90 QCompleter.__init__(self, parent) 93 QCompleter.__init__(self, parent)
91 self.__model = QStringListModel(strings, parent) 94 self.__model = QStringListModel(strings, parent)
92 self.setModel(self.__model) 95 self.setModel(self.__model)

eric ide

mercurial