48 self.__statusColumn = 1 |
48 self.__statusColumn = 1 |
49 self.__pathColumn = 2 |
49 self.__pathColumn = 2 |
50 self.__lastColumn = self.statusList.columnCount() |
50 self.__lastColumn = self.statusList.columnCount() |
51 |
51 |
52 self.refreshButton = self.buttonBox.addButton( |
52 self.refreshButton = self.buttonBox.addButton( |
53 self.tr("Refresh"), QDialogButtonBox.ActionRole) |
53 self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole) |
54 self.refreshButton.setToolTip( |
54 self.refreshButton.setToolTip( |
55 self.tr("Press to refresh the status display")) |
55 self.tr("Press to refresh the status display")) |
56 self.refreshButton.setEnabled(False) |
56 self.refreshButton.setEnabled(False) |
57 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
57 self.buttonBox.button( |
58 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
58 QDialogButtonBox.StandardButton.Close).setEnabled(False) |
|
59 self.buttonBox.button( |
|
60 QDialogButtonBox.StandardButton.Cancel).setDefault(True) |
59 |
61 |
60 self.diff = None |
62 self.diff = None |
61 self.vcs = vcs |
63 self.vcs = vcs |
62 self.vcs.committed.connect(self.__committed) |
64 self.vcs.committed.connect(self.__committed) |
63 self.__hgClient = self.vcs.getClient() |
65 self.__hgClient = self.vcs.getClient() |
64 self.__mq = mq |
66 self.__mq = mq |
65 |
67 |
66 self.statusList.headerItem().setText(self.__lastColumn, "") |
68 self.statusList.headerItem().setText(self.__lastColumn, "") |
67 self.statusList.header().setSortIndicator( |
69 self.statusList.header().setSortIndicator( |
68 self.__pathColumn, Qt.AscendingOrder) |
70 self.__pathColumn, Qt.SortOrder.AscendingOrder) |
69 |
71 |
70 font = Preferences.getEditorOtherFonts("MonospacedFont") |
72 font = Preferences.getEditorOtherFonts("MonospacedFont") |
71 self.diffEdit.document().setDefaultFont(font) |
73 self.diffEdit.document().setDefaultFont(font) |
72 |
74 |
73 self.diffHighlighter = HgDiffHighlighter(self.diffEdit.document()) |
75 self.diffHighlighter = HgDiffHighlighter(self.diffEdit.document()) |
255 |
257 |
256 def __resizeColumns(self): |
258 def __resizeColumns(self): |
257 """ |
259 """ |
258 Private method to resize the list columns. |
260 Private method to resize the list columns. |
259 """ |
261 """ |
260 self.statusList.header().resizeSections(QHeaderView.ResizeToContents) |
262 self.statusList.header().resizeSections( |
|
263 QHeaderView.ResizeMode.ResizeToContents) |
261 self.statusList.header().setStretchLastSection(True) |
264 self.statusList.header().setStretchLastSection(True) |
262 |
265 |
263 def __generateItem(self, status, path): |
266 def __generateItem(self, status, path): |
264 """ |
267 """ |
265 Private method to generate a status item in the status list. |
268 Private method to generate a status item in the status list. |
272 "", |
275 "", |
273 statusText, |
276 statusText, |
274 path, |
277 path, |
275 ]) |
278 ]) |
276 |
279 |
277 itm.setTextAlignment(1, Qt.AlignHCenter) |
280 itm.setTextAlignment(1, Qt.AlignmentFlag.AlignHCenter) |
278 itm.setTextAlignment(2, Qt.AlignLeft) |
281 itm.setTextAlignment(2, Qt.AlignmentFlag.AlignLeft) |
279 |
282 |
280 if status in "AMR": |
283 if status in "AMR": |
281 itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) |
284 itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable) |
282 itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) |
285 itm.setCheckState(self.__toBeCommittedColumn, |
283 else: |
286 Qt.CheckState.Checked) |
284 itm.setFlags(itm.flags() & ~Qt.ItemIsUserCheckable) |
287 else: |
|
288 itm.setFlags(itm.flags() & ~Qt.ItemFlag.ItemIsUserCheckable) |
285 |
289 |
286 if statusText not in self.__statusFilters: |
290 if statusText not in self.__statusFilters: |
287 self.__statusFilters.append(statusText) |
291 self.__statusFilters.append(statusText) |
288 |
292 |
289 def start(self, fn): |
293 def start(self, fn): |
340 Private slot called when the process finished or the user pressed |
344 Private slot called when the process finished or the user pressed |
341 the button. |
345 the button. |
342 """ |
346 """ |
343 self.refreshButton.setEnabled(True) |
347 self.refreshButton.setEnabled(True) |
344 |
348 |
345 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
349 self.buttonBox.button( |
346 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
350 QDialogButtonBox.StandardButton.Close).setEnabled(True) |
347 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
351 self.buttonBox.button( |
348 self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
352 QDialogButtonBox.StandardButton.Cancel).setEnabled(False) |
349 Qt.OtherFocusReason) |
353 self.buttonBox.button( |
|
354 QDialogButtonBox.StandardButton.Close).setDefault(True) |
|
355 self.buttonBox.button( |
|
356 QDialogButtonBox.StandardButton.Close).setFocus( |
|
357 Qt.FocusReason.OtherFocusReason) |
350 |
358 |
351 self.__statusFilters.sort() |
359 self.__statusFilters.sort() |
352 self.__statusFilters.insert(0, "<{0}>".format(self.tr("all"))) |
360 self.__statusFilters.insert(0, "<{0}>".format(self.tr("all"))) |
353 self.statusFilterCombo.addItems(self.__statusFilters) |
361 self.statusFilterCombo.addItems(self.__statusFilters) |
354 |
362 |
364 """ |
372 """ |
365 Private slot called by a button of the button box clicked. |
373 Private slot called by a button of the button box clicked. |
366 |
374 |
367 @param button button that was clicked (QAbstractButton) |
375 @param button button that was clicked (QAbstractButton) |
368 """ |
376 """ |
369 if button == self.buttonBox.button(QDialogButtonBox.Close): |
377 if button == self.buttonBox.button( |
|
378 QDialogButtonBox.StandardButton.Close |
|
379 ): |
370 self.close() |
380 self.close() |
371 elif button == self.buttonBox.button(QDialogButtonBox.Cancel): |
381 elif button == self.buttonBox.button( |
|
382 QDialogButtonBox.StandardButton.Cancel |
|
383 ): |
372 self.__hgClient.cancel() |
384 self.__hgClient.cancel() |
373 elif button == self.refreshButton: |
385 elif button == self.refreshButton: |
374 self.on_refreshButton_clicked() |
386 self.on_refreshButton_clicked() |
375 |
387 |
376 def __processOutputLine(self, line): |
388 def __processOutputLine(self, line): |
680 @return list of all items, the user has checked |
692 @return list of all items, the user has checked |
681 """ |
693 """ |
682 commitableItems = [] |
694 commitableItems = [] |
683 for index in range(self.statusList.topLevelItemCount()): |
695 for index in range(self.statusList.topLevelItemCount()): |
684 itm = self.statusList.topLevelItem(index) |
696 itm = self.statusList.topLevelItem(index) |
685 if itm.checkState(self.__toBeCommittedColumn) == Qt.Checked: |
697 if ( |
|
698 itm.checkState(self.__toBeCommittedColumn) == |
|
699 Qt.CheckState.Checked |
|
700 ): |
686 commitableItems.append(itm) |
701 commitableItems.append(itm) |
687 return commitableItems |
702 return commitableItems |
688 |
703 |
689 def __getCommitableUnselectedItems(self): |
704 def __getCommitableUnselectedItems(self): |
690 """ |
705 """ |
695 """ |
710 """ |
696 items = [] |
711 items = [] |
697 for index in range(self.statusList.topLevelItemCount()): |
712 for index in range(self.statusList.topLevelItemCount()): |
698 itm = self.statusList.topLevelItem(index) |
713 itm = self.statusList.topLevelItem(index) |
699 if ( |
714 if ( |
700 itm.flags() & Qt.ItemIsUserCheckable and |
715 itm.flags() & Qt.ItemFlag.ItemIsUserCheckable and |
701 itm.checkState(self.__toBeCommittedColumn) == Qt.Unchecked |
716 itm.checkState(self.__toBeCommittedColumn) == |
|
717 Qt.CheckState.Unchecked |
702 ): |
718 ): |
703 items.append(itm) |
719 items.append(itm) |
704 return items |
720 return items |
705 |
721 |
706 def __getModifiedItems(self): |
722 def __getModifiedItems(self): |
746 |
762 |
747 @param selected commit selection state to be set (boolean) |
763 @param selected commit selection state to be set (boolean) |
748 """ |
764 """ |
749 for index in range(self.statusList.topLevelItemCount()): |
765 for index in range(self.statusList.topLevelItemCount()): |
750 itm = self.statusList.topLevelItem(index) |
766 itm = self.statusList.topLevelItem(index) |
751 if itm.flags() & Qt.ItemIsUserCheckable: |
767 if itm.flags() & Qt.ItemFlag.ItemIsUserCheckable: |
752 if selected: |
768 if selected: |
753 itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) |
769 itm.setCheckState(self.__toBeCommittedColumn, |
|
770 Qt.CheckState.Checked) |
754 else: |
771 else: |
755 itm.setCheckState(self.__toBeCommittedColumn, Qt.Unchecked) |
772 itm.setCheckState(self.__toBeCommittedColumn, |
|
773 Qt.CheckState.Unchecked) |
756 |
774 |
757 def __commitMerge(self): |
775 def __commitMerge(self): |
758 """ |
776 """ |
759 Private slot to handle the Commit Merge context menu entry. |
777 Private slot to handle the Commit Merge context menu entry. |
760 """ |
778 """ |
799 else: |
817 else: |
800 diff.pop(0) |
818 diff.pop(0) |
801 self.diffEdit.setPlainText("".join(diff)) |
819 self.diffEdit.setPlainText("".join(diff)) |
802 |
820 |
803 tc = self.diffEdit.textCursor() |
821 tc = self.diffEdit.textCursor() |
804 tc.movePosition(QTextCursor.Start) |
822 tc.movePosition(QTextCursor.MoveOperation.Start) |
805 self.diffEdit.setTextCursor(tc) |
823 self.diffEdit.setTextCursor(tc) |
806 self.diffEdit.ensureCursorVisible() |
824 self.diffEdit.ensureCursorVisible() |
807 |
825 |
808 def __refreshDiff(self): |
826 def __refreshDiff(self): |
809 """ |
827 """ |