36 def __init__(self, vcs, mode="browse", parent=None): |
36 def __init__(self, vcs, mode="browse", parent=None): |
37 """ |
37 """ |
38 Constructor |
38 Constructor |
39 |
39 |
40 @param vcs reference to the vcs object |
40 @param vcs reference to the vcs object |
41 @param mode mode of the dialog (string, "browse" or "select") |
41 @type Subversion |
42 @param parent parent widget (QWidget) |
42 @param mode mode of the dialog ("browse" or "select") |
|
43 @type str |
|
44 @param parent parent widget |
|
45 @type QWidget |
43 """ |
46 """ |
44 super().__init__(parent) |
47 super().__init__(parent) |
45 self.setupUi(self) |
48 self.setupUi(self) |
46 self.setWindowFlags(Qt.WindowType.Window) |
49 self.setWindowFlags(Qt.WindowType.Window) |
47 |
50 |
81 |
84 |
82 def closeEvent(self, e): |
85 def closeEvent(self, e): |
83 """ |
86 """ |
84 Protected slot implementing a close event handler. |
87 Protected slot implementing a close event handler. |
85 |
88 |
86 @param e close event (QCloseEvent) |
89 @param e close event |
|
90 @type QCloseEvent |
87 """ |
91 """ |
88 if ( |
92 if ( |
89 self.__process is not None |
93 self.__process is not None |
90 and self.__process.state() != QProcess.ProcessState.NotRunning |
94 and self.__process.state() != QProcess.ProcessState.NotRunning |
91 ): |
95 ): |
112 |
116 |
113 def __generateItem(self, repopath, revision, author, size, date, nodekind, url): |
117 def __generateItem(self, repopath, revision, author, size, date, nodekind, url): |
114 """ |
118 """ |
115 Private method to generate a tree item in the repository tree. |
119 Private method to generate a tree item in the repository tree. |
116 |
120 |
117 @param repopath path of the item (string) |
121 @param repopath path of the item |
118 @param revision revision info (string) |
122 @type str |
119 @param author author info (string) |
123 @param revision revision info |
120 @param size size info (string) |
124 @type str |
121 @param date date info (string) |
125 @param author author info |
122 @param nodekind node kind info (string, "dir" or "file") |
126 @type str |
123 @param url url of the entry (string) |
127 @param size size info |
124 @return reference to the generated item (QTreeWidgetItem) |
128 @type str |
|
129 @param date date info |
|
130 @type str |
|
131 @param nodekind node kind info ("dir" or "file") |
|
132 @type str |
|
133 @param url url of the entry |
|
134 @type str |
|
135 @return reference to the generated item |
|
136 @rtype QTreeWidgetItem |
125 """ |
137 """ |
126 rev = "" if revision == "" else int(revision) |
138 rev = "" if revision == "" else int(revision) |
127 sz = "" if size == "" else int(size) |
139 sz = "" if size == "" else int(size) |
128 |
140 |
129 itm = QTreeWidgetItem(self.parentItem) |
141 itm = QTreeWidgetItem(self.parentItem) |
153 |
165 |
154 def __repoRoot(self, url): |
166 def __repoRoot(self, url): |
155 """ |
167 """ |
156 Private method to get the repository root using the svn info command. |
168 Private method to get the repository root using the svn info command. |
157 |
169 |
158 @param url the repository URL to browser (string) |
170 @param url the repository URL to browser |
159 @return repository root (string) |
171 @type str |
|
172 @return repository root |
|
173 @rtype str |
160 """ |
174 """ |
161 ioEncoding = Preferences.getSystem("IOEncoding") |
175 ioEncoding = Preferences.getSystem("IOEncoding") |
162 repoRoot = None |
176 repoRoot = None |
163 |
177 |
164 process = QProcess() |
178 process = QProcess() |
202 |
216 |
203 def __listRepo(self, url, parent=None): |
217 def __listRepo(self, url, parent=None): |
204 """ |
218 """ |
205 Private method to perform the svn list command. |
219 Private method to perform the svn list command. |
206 |
220 |
207 @param url the repository URL to browse (string) |
221 @param url the repository URL to browse |
|
222 @type str |
208 @param parent reference to the item, the data should be appended to |
223 @param parent reference to the item, the data should be appended to |
209 (QTreeWidget or QTreeWidgetItem) |
224 @type QTreeWidget or QTreeWidgetItem |
210 """ |
225 """ |
211 self.errorGroup.hide() |
226 self.errorGroup.hide() |
212 |
227 |
213 self.repoUrl = url |
228 self.repoUrl = url |
214 |
229 |
269 |
284 |
270 def __normalizeUrl(self, url): |
285 def __normalizeUrl(self, url): |
271 """ |
286 """ |
272 Private method to normalite the url. |
287 Private method to normalite the url. |
273 |
288 |
274 @param url the url to normalize (string) |
289 @param url the url to normalize |
275 @return normalized URL (string) |
290 @type str |
|
291 @return normalized URL |
|
292 @rtype str |
276 """ |
293 """ |
277 if url.endswith("/"): |
294 if url.endswith("/"): |
278 return url[:-1] |
295 return url[:-1] |
279 return url |
296 return url |
280 |
297 |
281 def start(self, url): |
298 def start(self, url): |
282 """ |
299 """ |
283 Public slot to start the svn info command. |
300 Public slot to start the svn info command. |
284 |
301 |
285 @param url the repository URL to browser (string) |
302 @param url the repository URL to browser |
|
303 @type str |
286 """ |
304 """ |
287 self.repoTree.clear() |
305 self.repoTree.clear() |
288 |
306 |
289 self.url = "" |
307 self.url = "" |
290 |
308 |
310 @pyqtSlot(QTreeWidgetItem) |
328 @pyqtSlot(QTreeWidgetItem) |
311 def on_repoTree_itemExpanded(self, item): |
329 def on_repoTree_itemExpanded(self, item): |
312 """ |
330 """ |
313 Private slot called when an item is expanded. |
331 Private slot called when an item is expanded. |
314 |
332 |
315 @param item reference to the item to be expanded (QTreeWidgetItem) |
333 @param item reference to the item to be expanded |
|
334 @type QTreeWidgetItem |
316 """ |
335 """ |
317 if not self.__ignoreExpand: |
336 if not self.__ignoreExpand: |
318 url = item.data(0, self.__urlRole) |
337 url = item.data(0, self.__urlRole) |
319 self.__listRepo(url, item) |
338 self.__listRepo(url, item) |
320 |
339 |
321 @pyqtSlot(QTreeWidgetItem) |
340 @pyqtSlot(QTreeWidgetItem) |
322 def on_repoTree_itemCollapsed(self, item): |
341 def on_repoTree_itemCollapsed(self, item): |
323 """ |
342 """ |
324 Private slot called when an item is collapsed. |
343 Private slot called when an item is collapsed. |
325 |
344 |
326 @param item reference to the item to be collapsed (QTreeWidgetItem) |
345 @param item reference to the item to be collapsed |
|
346 @type QTreeWidgetItem |
327 """ |
347 """ |
328 for child in item.takeChildren(): |
348 for child in item.takeChildren(): |
329 del child |
349 del child |
330 |
350 |
331 @pyqtSlot() |
351 @pyqtSlot() |
347 |
367 |
348 def getSelectedUrl(self): |
368 def getSelectedUrl(self): |
349 """ |
369 """ |
350 Public method to retrieve the selected repository URL. |
370 Public method to retrieve the selected repository URL. |
351 |
371 |
352 @return the selected repository URL (string) |
372 @return the selected repository URL |
|
373 @rtype str |
353 """ |
374 """ |
354 items = self.repoTree.selectedItems() |
375 items = self.repoTree.selectedItems() |
355 if len(items) == 1: |
376 if len(items) == 1: |
356 return items[0].data(0, self.__urlRole) |
377 return items[0].data(0, self.__urlRole) |
357 else: |
378 else: |
379 @pyqtSlot(int, QProcess.ExitStatus) |
400 @pyqtSlot(int, QProcess.ExitStatus) |
380 def __procFinished(self, exitCode, exitStatus): |
401 def __procFinished(self, exitCode, exitStatus): |
381 """ |
402 """ |
382 Private slot connected to the finished signal. |
403 Private slot connected to the finished signal. |
383 |
404 |
384 @param exitCode exit code of the process (integer) |
405 @param exitCode exit code of the process |
385 @param exitStatus exit status of the process (QProcess.ExitStatus) |
406 @type int |
|
407 @param exitStatus exit status of the process |
|
408 @type QProcess.ExitStatus |
386 """ |
409 """ |
387 self.__finish() |
410 self.__finish() |
388 |
411 |
389 def __readStdout(self): |
412 def __readStdout(self): |
390 """ |
413 """ |
446 |
469 |
447 def on_passwordCheckBox_toggled(self, isOn): |
470 def on_passwordCheckBox_toggled(self, isOn): |
448 """ |
471 """ |
449 Private slot to handle the password checkbox toggled. |
472 Private slot to handle the password checkbox toggled. |
450 |
473 |
451 @param isOn flag indicating the status of the check box (boolean) |
474 @param isOn flag indicating the status of the check box |
|
475 @type bool |
452 """ |
476 """ |
453 if isOn: |
477 if isOn: |
454 self.input.setEchoMode(QLineEdit.EchoMode.Password) |
478 self.input.setEchoMode(QLineEdit.EchoMode.Password) |
455 else: |
479 else: |
456 self.input.setEchoMode(QLineEdit.EchoMode.Normal) |
480 self.input.setEchoMode(QLineEdit.EchoMode.Normal) |