45 self.setupUi(self) |
45 self.setupUi(self) |
46 SvnDialogMixin.__init__(self) |
46 SvnDialogMixin.__init__(self) |
47 |
47 |
48 self.__position = QPoint() |
48 self.__position = QPoint() |
49 |
49 |
50 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
50 self.buttonBox.button( |
51 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
51 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
|
52 self.buttonBox.button( |
|
53 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
52 |
54 |
53 self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow")) |
55 self.upButton.setIcon(UI.PixmapCache.getIcon("1uparrow")) |
54 self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow")) |
56 self.downButton.setIcon(UI.PixmapCache.getIcon("1downarrow")) |
55 |
57 |
56 self.filesTree.headerItem().setText(self.filesTree.columnCount(), "") |
58 self.filesTree.headerItem().setText(self.filesTree.columnCount(), "") |
57 self.filesTree.header().setSortIndicator(0, Qt.AscendingOrder) |
59 self.filesTree.header().setSortIndicator( |
|
60 0, Qt.SortOrder.AscendingOrder) |
58 |
61 |
59 self.vcs = vcs |
62 self.vcs = vcs |
60 |
63 |
61 self.__initData() |
64 self.__initData() |
62 |
65 |
63 self.fromDate.setDisplayFormat("yyyy-MM-dd") |
66 self.fromDate.setDisplayFormat("yyyy-MM-dd") |
64 self.toDate.setDisplayFormat("yyyy-MM-dd") |
67 self.toDate.setDisplayFormat("yyyy-MM-dd") |
65 self.__resetUI() |
68 self.__resetUI() |
66 |
69 |
67 self.__messageRole = Qt.UserRole |
70 self.__messageRole = Qt.ItemDataRole.UserRole |
68 self.__changesRole = Qt.UserRole + 1 |
71 self.__changesRole = Qt.ItemDataRole.UserRole + 1 |
69 |
72 |
70 self.flags = { |
73 self.flags = { |
71 'A': self.tr('Added'), |
74 'A': self.tr('Added'), |
72 'D': self.tr('Deleted'), |
75 'D': self.tr('Deleted'), |
73 'M': self.tr('Modified'), |
76 'M': self.tr('Modified'), |
141 """ |
144 """ |
142 SvnDialogMixin._reset(self) |
145 SvnDialogMixin._reset(self) |
143 |
146 |
144 self.cancelled = False |
147 self.cancelled = False |
145 |
148 |
146 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
149 self.buttonBox.button( |
147 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) |
150 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
148 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
151 self.buttonBox.button( |
|
152 QDialogButtonBox.StandardButton.Cancel).setEnabled(True) |
|
153 self.buttonBox.button( |
|
154 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
149 QApplication.processEvents() |
155 QApplication.processEvents() |
150 |
156 |
151 def __resizeColumnsLog(self): |
157 def __resizeColumnsLog(self): |
152 """ |
158 """ |
153 Private method to resize the log tree columns. |
159 Private method to resize the log tree columns. |
154 """ |
160 """ |
155 self.logTree.header().resizeSections(QHeaderView.ResizeToContents) |
161 self.logTree.header().resizeSections( |
|
162 QHeaderView.ResizeMode.ResizeToContents) |
156 self.logTree.header().setStretchLastSection(True) |
163 self.logTree.header().setStretchLastSection(True) |
157 |
164 |
158 def __resortLog(self): |
165 def __resortLog(self): |
159 """ |
166 """ |
160 Private method to resort the log tree. |
167 Private method to resort the log tree. |
165 |
172 |
166 def __resizeColumnsFiles(self): |
173 def __resizeColumnsFiles(self): |
167 """ |
174 """ |
168 Private method to resize the changed files tree columns. |
175 Private method to resize the changed files tree columns. |
169 """ |
176 """ |
170 self.filesTree.header().resizeSections(QHeaderView.ResizeToContents) |
177 self.filesTree.header().resizeSections( |
|
178 QHeaderView.ResizeMode.ResizeToContents) |
171 self.filesTree.header().setStretchLastSection(True) |
179 self.filesTree.header().setStretchLastSection(True) |
172 |
180 |
173 def __resortFiles(self): |
181 def __resortFiles(self): |
174 """ |
182 """ |
175 Private method to resort the changed files tree. |
183 Private method to resort the changed files tree. |
202 dt = "" |
210 dt = "" |
203 else: |
211 else: |
204 dt = formatTime(date) |
212 dt = formatTime(date) |
205 |
213 |
206 itm = QTreeWidgetItem(self.logTree) |
214 itm = QTreeWidgetItem(self.logTree) |
207 itm.setData(0, Qt.DisplayRole, rev) |
215 itm.setData(0, Qt.ItemDataRole.DisplayRole, rev) |
208 itm.setData(1, Qt.DisplayRole, author) |
216 itm.setData(1, Qt.ItemDataRole.DisplayRole, author) |
209 itm.setData(2, Qt.DisplayRole, dt) |
217 itm.setData(2, Qt.ItemDataRole.DisplayRole, dt) |
210 itm.setData(3, Qt.DisplayRole, " ".join(message.splitlines())) |
218 itm.setData(3, Qt.ItemDataRole.DisplayRole, |
|
219 " ".join(message.splitlines())) |
211 |
220 |
212 changes = [] |
221 changes = [] |
213 for changedPath in changedPaths: |
222 for changedPath in changedPaths: |
214 if changedPath["copyfrom_path"] is None: |
223 if changedPath["copyfrom_path"] is None: |
215 copyPath = "" |
224 copyPath = "" |
228 } |
237 } |
229 changes.append(change) |
238 changes.append(change) |
230 itm.setData(0, self.__messageRole, message) |
239 itm.setData(0, self.__messageRole, message) |
231 itm.setData(0, self.__changesRole, changes) |
240 itm.setData(0, self.__changesRole, changes) |
232 |
241 |
233 itm.setTextAlignment(0, Qt.AlignRight) |
242 itm.setTextAlignment(0, Qt.AlignmentFlag.AlignRight) |
234 itm.setTextAlignment(1, Qt.AlignLeft) |
243 itm.setTextAlignment(1, Qt.AlignmentFlag.AlignLeft) |
235 itm.setTextAlignment(2, Qt.AlignLeft) |
244 itm.setTextAlignment(2, Qt.AlignmentFlag.AlignLeft) |
236 itm.setTextAlignment(3, Qt.AlignLeft) |
245 itm.setTextAlignment(3, Qt.AlignmentFlag.AlignLeft) |
237 itm.setTextAlignment(4, Qt.AlignLeft) |
246 itm.setTextAlignment(4, Qt.AlignmentFlag.AlignLeft) |
238 |
247 |
239 return itm |
248 return itm |
240 |
249 |
241 def __generateFileItem(self, action, path, copyFrom, copyRev): |
250 def __generateFileItem(self, action, path, copyFrom, copyRev): |
242 """ |
251 """ |
251 itm = QTreeWidgetItem( |
260 itm = QTreeWidgetItem( |
252 self.filesTree, |
261 self.filesTree, |
253 [self.flags[action], path, copyFrom, copyRev] |
262 [self.flags[action], path, copyFrom, copyRev] |
254 ) |
263 ) |
255 |
264 |
256 itm.setTextAlignment(3, Qt.AlignRight) |
265 itm.setTextAlignment(3, Qt.AlignmentFlag.AlignRight) |
257 |
266 |
258 return itm |
267 return itm |
259 |
268 |
260 def __getLogEntries(self, startRev=None): |
269 def __getLogEntries(self, startRev=None): |
261 """ |
270 """ |
369 |
378 |
370 def __finish(self): |
379 def __finish(self): |
371 """ |
380 """ |
372 Private slot called when the user pressed the button. |
381 Private slot called when the user pressed the button. |
373 """ |
382 """ |
374 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
383 self.buttonBox.button( |
375 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
384 QDialogButtonBox.StandardButton.Close).setEnabled(True) |
376 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
385 self.buttonBox.button( |
|
386 QDialogButtonBox.StandardButton.Cancel).setEnabled(False) |
|
387 self.buttonBox.button( |
|
388 QDialogButtonBox.StandardButton.Close).setDefault(True) |
377 |
389 |
378 self._cancel() |
390 self._cancel() |
379 |
391 |
380 def __diffRevisions(self, rev1, rev2, peg_rev): |
392 def __diffRevisions(self, rev1, rev2, peg_rev): |
381 """ |
393 """ |
401 """ |
413 """ |
402 Private slot called by a button of the button box clicked. |
414 Private slot called by a button of the button box clicked. |
403 |
415 |
404 @param button button that was clicked (QAbstractButton) |
416 @param button button that was clicked (QAbstractButton) |
405 """ |
417 """ |
406 if button == self.buttonBox.button(QDialogButtonBox.Close): |
418 if button == self.buttonBox.button( |
|
419 QDialogButtonBox.StandardButton.Close |
|
420 ): |
407 self.close() |
421 self.close() |
408 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): |
422 elif button == self.buttonBox.button( |
|
423 QDialogButtonBox.StandardButton.Cancel |
|
424 ): |
409 self.cancelled = True |
425 self.cancelled = True |
410 self.__finish() |
426 self.__finish() |
411 |
427 |
412 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) |
428 @pyqtSlot(QTreeWidgetItem, QTreeWidgetItem) |
413 def on_logTree_currentItemChanged(self, current, previous): |
429 def on_logTree_currentItemChanged(self, current, previous): |