54 @param directory working directory of the dialog (string) |
54 @param directory working directory of the dialog (string) |
55 @param filterStr filter string for the dialog (string) |
55 @param filterStr filter string for the dialog (string) |
56 @param options various options for the dialog (QFileDialog.Options) |
56 @param options various options for the dialog (QFileDialog.Options) |
57 @return name of file to be opened (string) |
57 @return name of file to be opened (string) |
58 """ |
58 """ |
59 ## if options is None: |
59 if options is None: |
60 ## options = QFileDialog.Options() |
60 options = QFileDialog.Option(0) |
61 if Globals.isLinuxPlatform(): |
61 if Globals.isLinuxPlatform(): |
62 if options is None: |
62 options |= QFileDialog.Option.DontUseNativeDialog |
63 options = QFileDialog.Option.DontUseNativeDialog |
|
64 else: |
|
65 options |= QFileDialog.Option.DontUseNativeDialog |
|
66 return QFileDialog.getOpenFileName( |
63 return QFileDialog.getOpenFileName( |
67 parent, caption, directory, filterStr, "", options)[0] |
64 parent, caption, directory, filterStr, "", options)[0] |
68 |
65 |
69 |
66 |
70 def getOpenFileNameAndFilter(parent=None, caption="", directory="", |
67 def getOpenFileNameAndFilter(parent=None, caption="", directory="", |
80 @param filterStr filter string for the dialog (string) |
77 @param filterStr filter string for the dialog (string) |
81 @param initialFilter initial filter for the dialog (string) |
78 @param initialFilter initial filter for the dialog (string) |
82 @param options various options for the dialog (QFileDialog.Options) |
79 @param options various options for the dialog (QFileDialog.Options) |
83 @return name of file to be opened and selected filter (string, string) |
80 @return name of file to be opened and selected filter (string, string) |
84 """ |
81 """ |
85 ## if options is None: |
82 if options is None: |
86 ## options = QFileDialog.Options() |
83 options = QFileDialog.Option(0) |
87 if Globals.isLinuxPlatform(): |
84 if Globals.isLinuxPlatform(): |
88 if options is None: |
85 options |= QFileDialog.Option.DontUseNativeDialog |
89 options = QFileDialog.Option.DontUseNativeDialog |
|
90 else: |
|
91 options |= QFileDialog.Option.DontUseNativeDialog |
|
92 newfilter = __reorderFilter(filterStr, initialFilter) |
86 newfilter = __reorderFilter(filterStr, initialFilter) |
93 return QFileDialog.getOpenFileName( |
87 return QFileDialog.getOpenFileName( |
94 parent, caption, directory, newfilter, initialFilter, options) |
88 parent, caption, directory, newfilter, initialFilter, options) |
95 |
89 |
96 |
90 |
104 @param directory working directory of the dialog (string) |
98 @param directory working directory of the dialog (string) |
105 @param filterStr filter string for the dialog (string) |
99 @param filterStr filter string for the dialog (string) |
106 @param options various options for the dialog (QFileDialog.Options) |
100 @param options various options for the dialog (QFileDialog.Options) |
107 @return list of file names to be opened (list of string) |
101 @return list of file names to be opened (list of string) |
108 """ |
102 """ |
109 ## if options is None: |
103 if options is None: |
110 ## options = QFileDialog.Options() |
104 options = QFileDialog.Option(0) |
111 if Globals.isLinuxPlatform(): |
105 if Globals.isLinuxPlatform(): |
112 if options is None: |
106 options |= QFileDialog.Option.DontUseNativeDialog |
113 options = QFileDialog.Option.DontUseNativeDialog |
|
114 else: |
|
115 options |= QFileDialog.Option.DontUseNativeDialog |
|
116 return QFileDialog.getOpenFileNames( |
107 return QFileDialog.getOpenFileNames( |
117 parent, caption, directory, filterStr, "", options)[0] |
108 parent, caption, directory, filterStr, "", options)[0] |
118 |
109 |
119 |
110 |
120 def getOpenFileNamesAndFilter(parent=None, caption="", directory="", |
111 def getOpenFileNamesAndFilter(parent=None, caption="", directory="", |
131 @param initialFilter initial filter for the dialog (string) |
122 @param initialFilter initial filter for the dialog (string) |
132 @param options various options for the dialog (QFileDialog.Options) |
123 @param options various options for the dialog (QFileDialog.Options) |
133 @return list of file names to be opened and selected filter |
124 @return list of file names to be opened and selected filter |
134 (list of string, string) |
125 (list of string, string) |
135 """ |
126 """ |
136 ## if options is None: |
127 if options is None: |
137 ## options = QFileDialog.Options() |
128 options = QFileDialog.Option(0) |
138 if Globals.isLinuxPlatform(): |
129 if Globals.isLinuxPlatform(): |
139 if options is None: |
130 options |= QFileDialog.Option.DontUseNativeDialog |
140 options = QFileDialog.Option.DontUseNativeDialog |
|
141 else: |
|
142 options |= QFileDialog.Option.DontUseNativeDialog |
|
143 newfilter = __reorderFilter(filterStr, initialFilter) |
131 newfilter = __reorderFilter(filterStr, initialFilter) |
144 return QFileDialog.getOpenFileNames( |
132 return QFileDialog.getOpenFileNames( |
145 parent, caption, directory, newfilter, initialFilter, options) |
133 parent, caption, directory, newfilter, initialFilter, options) |
146 |
134 |
147 |
135 |
155 @param directory working directory of the dialog (string) |
143 @param directory working directory of the dialog (string) |
156 @param filterStr filter string for the dialog (string) |
144 @param filterStr filter string for the dialog (string) |
157 @param options various options for the dialog (QFileDialog.Options) |
145 @param options various options for the dialog (QFileDialog.Options) |
158 @return name of file to be saved (string) |
146 @return name of file to be saved (string) |
159 """ |
147 """ |
160 ## if options is None: |
148 if options is None: |
161 ## options = QFileDialog.Options() |
149 options = QFileDialog.Option(0) |
162 if Globals.isLinuxPlatform(): |
150 if Globals.isLinuxPlatform(): |
163 if options is None: |
151 options |= QFileDialog.Option.DontUseNativeDialog |
164 options = QFileDialog.Option.DontUseNativeDialog |
|
165 else: |
|
166 options |= QFileDialog.Option.DontUseNativeDialog |
|
167 return QFileDialog.getSaveFileName( |
152 return QFileDialog.getSaveFileName( |
168 parent, caption, directory, filterStr, "", options)[0] |
153 parent, caption, directory, filterStr, "", options)[0] |
169 |
154 |
170 |
155 |
171 def getSaveFileNameAndFilter(parent=None, caption="", directory="", |
156 def getSaveFileNameAndFilter(parent=None, caption="", directory="", |
181 @param filterStr filter string for the dialog (string) |
166 @param filterStr filter string for the dialog (string) |
182 @param initialFilter initial filter for the dialog (string) |
167 @param initialFilter initial filter for the dialog (string) |
183 @param options various options for the dialog (QFileDialog.Options) |
168 @param options various options for the dialog (QFileDialog.Options) |
184 @return name of file to be saved and selected filter (string, string) |
169 @return name of file to be saved and selected filter (string, string) |
185 """ |
170 """ |
186 ## if options is None: |
171 if options is None: |
187 ## options = QFileDialog.Options() |
172 options = QFileDialog.Option(0) |
188 if Globals.isLinuxPlatform(): |
173 if Globals.isLinuxPlatform(): |
189 if options is None: |
174 options |= QFileDialog.Option.DontUseNativeDialog |
190 options = QFileDialog.Option.DontUseNativeDialog |
|
191 else: |
|
192 options |= QFileDialog.Option.DontUseNativeDialog |
|
193 newfilter = __reorderFilter(filterStr, initialFilter) |
175 newfilter = __reorderFilter(filterStr, initialFilter) |
194 return QFileDialog.getSaveFileName( |
176 return QFileDialog.getSaveFileName( |
195 parent, caption, directory, newfilter, initialFilter, options) |
177 parent, caption, directory, newfilter, initialFilter, options) |
196 |
178 |
197 |
179 |
205 @param caption window title of the dialog (string) |
187 @param caption window title of the dialog (string) |
206 @param directory working directory of the dialog (string) |
188 @param directory working directory of the dialog (string) |
207 @param options various options for the dialog (QFileDialog.Options) |
189 @param options various options for the dialog (QFileDialog.Options) |
208 @return name of selected directory (string) |
190 @return name of selected directory (string) |
209 """ |
191 """ |
|
192 if options is None: |
|
193 options = QFileDialog.Option(0) |
210 if Globals.isLinuxPlatform(): |
194 if Globals.isLinuxPlatform(): |
211 options |= QFileDialog.Option.DontUseNativeDialog |
195 options |= QFileDialog.Option.DontUseNativeDialog |
212 return QFileDialog.getExistingDirectory(parent, caption, directory, |
196 return QFileDialog.getExistingDirectory(parent, caption, directory, |
213 options) |
197 options) |