17 from .Ui_SvnRepoBrowserDialog import Ui_SvnRepoBrowserDialog |
17 from .Ui_SvnRepoBrowserDialog import Ui_SvnRepoBrowserDialog |
18 |
18 |
19 import UI.PixmapCache |
19 import UI.PixmapCache |
20 |
20 |
21 import Preferences |
21 import Preferences |
|
22 |
22 |
23 |
23 class SvnRepoBrowserDialog(QDialog, Ui_SvnRepoBrowserDialog): |
24 class SvnRepoBrowserDialog(QDialog, Ui_SvnRepoBrowserDialog): |
24 """ |
25 """ |
25 Class implementing the subversion repository browser dialog. |
26 Class implementing the subversion repository browser dialog. |
26 """ |
27 """ |
27 def __init__(self, vcs, mode = "browse", parent = None): |
28 def __init__(self, vcs, mode="browse", parent=None): |
28 """ |
29 """ |
29 Constructor |
30 Constructor |
30 |
31 |
31 @param vcs reference to the vcs object |
32 @param vcs reference to the vcs object |
32 @param mode mode of the dialog (string, "browse" or "select") |
33 @param mode mode of the dialog (string, "browse" or "select") |
77 |
78 |
78 def __resort(self): |
79 def __resort(self): |
79 """ |
80 """ |
80 Private method to resort the tree. |
81 Private method to resort the tree. |
81 """ |
82 """ |
82 self.repoTree.sortItems(self.repoTree.sortColumn(), |
83 self.repoTree.sortItems(self.repoTree.sortColumn(), |
83 self.repoTree.header().sortIndicatorOrder()) |
84 self.repoTree.header().sortIndicatorOrder()) |
84 |
85 |
85 def __resizeColumns(self): |
86 def __resizeColumns(self): |
86 """ |
87 """ |
87 Private method to resize the tree columns. |
88 Private method to resize the tree columns. |
88 """ |
89 """ |
89 self.repoTree.header().resizeSections(QHeaderView.ResizeToContents) |
90 self.repoTree.header().resizeSections(QHeaderView.ResizeToContents) |
90 self.repoTree.header().setStretchLastSection(True) |
91 self.repoTree.header().setStretchLastSection(True) |
91 |
92 |
92 def __generateItem(self, repopath, revision, author, size, date, |
93 def __generateItem(self, repopath, revision, author, size, date, |
93 nodekind, url): |
94 nodekind, url): |
94 """ |
95 """ |
95 Private method to generate a tree item in the repository tree. |
96 Private method to generate a tree item in the repository tree. |
96 |
97 |
97 @param parent parent of the item to be created (QTreeWidget or QTreeWidgetItem) |
98 @param parent parent of the item to be created (QTreeWidget or QTreeWidgetItem) |
105 @return reference to the generated item (QTreeWidgetItem) |
106 @return reference to the generated item (QTreeWidgetItem) |
106 """ |
107 """ |
107 path = repopath |
108 path = repopath |
108 |
109 |
109 itm = QTreeWidgetItem(self.parentItem, [ |
110 itm = QTreeWidgetItem(self.parentItem, [ |
110 path, |
111 path, |
111 revision, |
112 revision, |
112 author, |
113 author, |
113 size, |
114 size, |
114 date, |
115 date, |
115 ]) |
116 ]) |
116 |
117 |
117 if nodekind == "dir": |
118 if nodekind == "dir": |
118 itm.setIcon(0, self.__dirIcon) |
119 itm.setIcon(0, self.__dirIcon) |
119 itm.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator) |
120 itm.setChildIndicatorPolicy(QTreeWidgetItem.ShowIndicator) |
159 line = line.strip() |
160 line = line.strip() |
160 if line.startswith('<root>'): |
161 if line.startswith('<root>'): |
161 repoRoot = line.replace('<root>', '').replace('</root>', '') |
162 repoRoot = line.replace('<root>', '').replace('</root>', '') |
162 break |
163 break |
163 else: |
164 else: |
164 error = str(process.readAllStandardError(), |
165 error = str(process.readAllStandardError(), |
165 Preferences.getSystem("IOEncoding"), |
166 Preferences.getSystem("IOEncoding"), |
166 'replace') |
167 'replace') |
167 self.errors.insertPlainText(error) |
168 self.errors.insertPlainText(error) |
168 self.errors.ensureCursorVisible() |
169 self.errors.ensureCursorVisible() |
169 else: |
170 else: |
170 QApplication.restoreOverrideCursor() |
171 QApplication.restoreOverrideCursor() |
174 'The process {0} could not be started. ' |
175 'The process {0} could not be started. ' |
175 'Ensure, that it is in the search path.' |
176 'Ensure, that it is in the search path.' |
176 ).format('svn')) |
177 ).format('svn')) |
177 return repoRoot |
178 return repoRoot |
178 |
179 |
179 def __listRepo(self, url, parent = None): |
180 def __listRepo(self, url, parent=None): |
180 """ |
181 """ |
181 Private method to perform the svn list command. |
182 Private method to perform the svn list command. |
182 |
183 |
183 @param url the repository URL to browse (string) |
184 @param url the repository URL to browse (string) |
184 @param parent reference to the item, the data should be appended to |
185 @param parent reference to the item, the data should be appended to |
365 """ |
366 """ |
366 if self.process is not None: |
367 if self.process is not None: |
367 self.process.setReadChannel(QProcess.StandardOutput) |
368 self.process.setReadChannel(QProcess.StandardOutput) |
368 |
369 |
369 while self.process.canReadLine(): |
370 while self.process.canReadLine(): |
370 s = str(self.process.readLine(), |
371 s = str(self.process.readLine(), |
371 Preferences.getSystem("IOEncoding"), |
372 Preferences.getSystem("IOEncoding"), |
372 'replace') |
373 'replace') |
373 if self.__rx_dir.exactMatch(s): |
374 if self.__rx_dir.exactMatch(s): |
374 revision = self.__rx_dir.cap(1) |
375 revision = self.__rx_dir.cap(1) |
375 author = self.__rx_dir.cap(2) |
376 author = self.__rx_dir.cap(2) |
376 date = self.__rx_dir.cap(3) |
377 date = self.__rx_dir.cap(3) |
397 |
398 |
398 It reads the error output of the process and inserts it into the |
399 It reads the error output of the process and inserts it into the |
399 error pane. |
400 error pane. |
400 """ |
401 """ |
401 if self.process is not None: |
402 if self.process is not None: |
402 s = str(self.process.readAllStandardError(), |
403 s = str(self.process.readAllStandardError(), |
403 Preferences.getSystem("IOEncoding"), |
404 Preferences.getSystem("IOEncoding"), |
404 'replace') |
405 'replace') |
405 self.errors.insertPlainText(s) |
406 self.errors.insertPlainText(s) |
406 self.errors.ensureCursorVisible() |
407 self.errors.ensureCursorVisible() |
407 |
408 |
408 def on_passwordCheckBox_toggled(self, isOn): |
409 def on_passwordCheckBox_toggled(self, isOn): |