src/eric7/Plugins/VcsPlugins/vcsMercurial/HgStatusDialog.py

Sat, 23 Dec 2023 15:48:12 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 23 Dec 2023 15:48:12 +0100
branch
eric7
changeset 10439
21c28b0f9e41
parent 10438
4cd7e5a8b3cf
child 10922
36a90a94765c
permissions
-rw-r--r--

Updated copyright for 2024.

178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
10439
21c28b0f9e41 Updated copyright for 2024.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10438
diff changeset
3 # Copyright (c) 2010 - 2024 Detlev Offenbach <detlev@die-offenbachs.de>
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
7 Module implementing a dialog to show the output of the hg status command
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
8 process.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import os
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
13 from PyQt6.QtCore import QSize, Qt, pyqtSlot
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
14 from PyQt6.QtGui import QTextCursor
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
15 from PyQt6.QtWidgets import (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
16 QDialogButtonBox,
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
17 QHeaderView,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
18 QMenu,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
19 QTreeWidgetItem,
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
20 QWidget,
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
21 )
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
23 from eric7 import Preferences
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
24 from eric7.EricGui import EricPixmapCache
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
25 from eric7.EricWidgets import EricMessageBox
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
26 from eric7.EricWidgets.EricApplication import ericApp
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
27
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
28 from .HgDiffGenerator import HgDiffGenerator
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
29 from .HgDiffHighlighter import HgDiffHighlighter
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
30 from .Ui_HgStatusDialog import Ui_HgStatusDialog
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 917
diff changeset
32
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 class HgStatusDialog(QWidget, Ui_HgStatusDialog):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
35 Class implementing a dialog to show the output of the hg status command
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
36 process.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
38
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
39 def __init__(self, vcs, mq=False, parent=None):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
42
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 @param vcs reference to the vcs object
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
44 @type Hg
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
45 @param mq flag indicating to show a queue repo status
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
46 @type bool
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
47 @param parent parent widget
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
48 @type QWidget
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8151
diff changeset
50 super().__init__(parent)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self.setupUi(self)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
52
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
53 self.__toBeCommittedColumn = 0
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
54 self.__statusColumn = 1
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
55 self.__pathColumn = 2
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 self.__lastColumn = self.statusList.columnCount()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
57
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
58 self.refreshButton = self.buttonBox.addButton(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
59 self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
60 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
61 self.refreshButton.setToolTip(self.tr("Press to refresh the status display"))
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 self.refreshButton.setEnabled(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
63 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
64 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
65
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
66 self.diff = None
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 self.vcs = vcs
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 470
diff changeset
68 self.vcs.committed.connect(self.__committed)
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
69 self.__hgClient = self.vcs.getClient()
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
70 self.__mq = mq
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
71
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 self.statusList.headerItem().setText(self.__lastColumn, "")
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
73 self.statusList.header().setSortIndicator(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
74 self.__pathColumn, Qt.SortOrder.AscendingOrder
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
75 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
76
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
77 font = Preferences.getEditorOtherFonts("MonospacedFont")
7779
757334671130 Optimized the various diff panes by using QPlainTextEdit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
78 self.diffEdit.document().setDefaultFont(font)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
79
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
80 self.diffHighlighter = HgDiffHighlighter(self.diffEdit.document())
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
81 self.__diffGenerator = HgDiffGenerator(vcs, self)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
82 self.__diffGenerator.finished.connect(self.__generatorFinished)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
83
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
84 self.__selectedName = ""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
85
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 self.modifiedIndicators = [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
87 self.tr("added"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
88 self.tr("modified"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
89 self.tr("removed"),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
91
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 self.unversionedIndicators = [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
93 self.tr("not tracked"),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
95
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
96 self.missingIndicators = [self.tr("missing")]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
97
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 self.status = {
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
99 "A": self.tr("added"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
100 "C": self.tr("normal"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
101 "I": self.tr("ignored"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
102 "M": self.tr("modified"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
103 "R": self.tr("removed"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
104 "?": self.tr("not tracked"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
105 "!": self.tr("missing"),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 }
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
107
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
108 self.__initActionsMenu()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
109
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
110 if mq:
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
111 self.diffLabel.setVisible(False)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
112 self.diffEdit.setVisible(False)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
113 self.actionsButton.setEnabled(False)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
114 self.diffSplitter.setSizes([600, 0])
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
115 else:
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
116 self.diffSplitter.setSizes([300, 300])
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
117
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
118 def __initActionsMenu(self):
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
119 """
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
120 Private method to initialize the actions menu.
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
121 """
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
122 self.__actionsMenu = QMenu()
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
123 self.__actionsMenu.setTearOffEnabled(True)
7201
6b42677d7043 Modified sources to be in line with the minimum Qt/PyQt requirement (v 5.9.0).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7192
diff changeset
124 self.__actionsMenu.setToolTipsVisible(True)
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
125 self.__actionsMenu.aboutToShow.connect(self.__showActionsMenu)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
126
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
127 self.__commitAct = self.__actionsMenu.addAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
128 self.tr("Commit"), self.__commit
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
129 )
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
130 self.__commitAct.setToolTip(self.tr("Commit the selected changes"))
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
131 self.__commitSelectAct = self.__actionsMenu.addAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
132 self.tr("Select all for commit"), self.__commitSelectAll
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
133 )
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
134 self.__commitDeselectAct = self.__actionsMenu.addAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
135 self.tr("Unselect all from commit"), self.__commitDeselectAll
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
136 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
137
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
138 self.__actionsMenu.addSeparator()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
139
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
140 self.__addAct = self.__actionsMenu.addAction(self.tr("Add"), self.__add)
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
141 self.__addAct.setToolTip(self.tr("Add the selected files"))
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
142 self.__lfAddLargeAct = self.__actionsMenu.addAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
143 self.tr("Add as Large Files"), lambda: self.__lfAdd("large")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
144 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
145 self.__lfAddLargeAct.setToolTip(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
146 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
147 "Add the selected files as a large files using the 'Large Files'"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
148 " extension"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
149 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
150 )
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
151 self.__lfAddNormalAct = self.__actionsMenu.addAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
152 self.tr("Add as Normal Files"), lambda: self.__lfAdd("normal")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
153 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
154 self.__lfAddNormalAct.setToolTip(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
155 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
156 "Add the selected files as a normal files using the 'Large Files'"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
157 " extension"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
158 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
159 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
160
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
161 self.__actionsMenu.addSeparator()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
162
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
163 self.__diffAct = self.__actionsMenu.addAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
164 self.tr("Differences"), self.__diff
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
165 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
166 self.__diffAct.setToolTip(
9576
be9f8e7e42e0 Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9573
diff changeset
167 self.tr("Shows the differences of the selected entry in a separate dialog")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
168 )
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
169 self.__sbsDiffAct = self.__actionsMenu.addAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
170 self.tr("Differences Side-By-Side"), self.__sbsDiff
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
171 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
172 self.__sbsDiffAct.setToolTip(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
173 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
174 "Shows the differences of the selected entry side-by-side in"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
175 " a separate dialog"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
176 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
177 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
178
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
179 self.__actionsMenu.addSeparator()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
180
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
181 self.__revertAct = self.__actionsMenu.addAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
182 self.tr("Revert"), self.__revert
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
183 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
184 self.__revertAct.setToolTip(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
185 self.tr("Reverts the changes of the selected files")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
186 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
187
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
188 self.__actionsMenu.addSeparator()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
189
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
190 self.__forgetAct = self.__actionsMenu.addAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
191 self.tr("Forget Missing"), self.__forget
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
192 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
193 self.__forgetAct.setToolTip(self.tr("Forgets about the selected missing files"))
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
194 self.__restoreAct = self.__actionsMenu.addAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
195 self.tr("Restore Missing"), self.__restoreMissing
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
196 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
197 self.__restoreAct.setToolTip(self.tr("Restores the selected missing files"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
198
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
199 self.__actionsMenu.addSeparator()
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
200
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
201 self.__commitMergeAct = self.__actionsMenu.addAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
202 self.tr("Commit Merge"), self.__commitMerge
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
203 )
9576
be9f8e7e42e0 Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9573
diff changeset
204 self.__commitMergeAct.setToolTip(self.tr("Commit all the merged changes."))
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
205 self.__abortMergeAct = self.__actionsMenu.addAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
206 self.tr("Abort Merge"), self.__abortMerge
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
207 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
208 self.__commitMergeAct.setToolTip(
9576
be9f8e7e42e0 Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9573
diff changeset
209 self.tr("Abort an uncommitted merge and lose all changes")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
210 )
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
211
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
212 self.__actionsMenu.addSeparator()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
213
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
214 act = self.__actionsMenu.addAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
215 self.tr("Adjust column sizes"), self.__resizeColumns
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
216 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
217 act.setToolTip(self.tr("Adjusts the width of all columns to their contents"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
218
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
219 self.actionsButton.setIcon(EricPixmapCache.getIcon("actionsToolButton"))
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
220 self.actionsButton.setMenu(self.__actionsMenu)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
221
5520
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
222 def closeEvent(self, e):
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
223 """
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
224 Protected slot implementing a close event handler.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
225
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
226 @param e close event
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
227 @type QCloseEvent
5520
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
228 """
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
229 if self.__hgClient.isExecuting():
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
230 self.__hgClient.cancel()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
231
5520
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
232 if self.__mq:
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
233 self.vcs.getPlugin().setPreferences(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
234 "MqStatusDialogGeometry", self.saveGeometry()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
235 )
5520
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
236 self.vcs.getPlugin().setPreferences(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
237 "MqStatusDialogSplitterState", self.diffSplitter.saveState()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
238 )
5520
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
239 else:
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
240 self.vcs.getPlugin().setPreferences(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
241 "StatusDialogGeometry", self.saveGeometry()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
242 )
5520
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
243 self.vcs.getPlugin().setPreferences(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
244 "StatusDialogSplitterState", self.diffSplitter.saveState()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
245 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
246
5520
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
247 e.accept()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
248
5520
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
249 def show(self):
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
250 """
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
251 Public slot to show the dialog.
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
252 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8151
diff changeset
253 super().show()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
254
8259
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
255 geom = (
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
256 self.vcs.getPlugin().getPreferences("MqStatusDialogGeometry")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
257 if self.__mq
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
258 else self.vcs.getPlugin().getPreferences("StatusDialogGeometry")
8259
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
259 )
5520
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
260 if geom.isEmpty():
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
261 s = QSize(800, 600)
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
262 self.resize(s)
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
263 else:
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
264 self.restoreGeometry(geom)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
265
8259
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
266 diffSplitterState = (
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
267 self.vcs.getPlugin().getPreferences("MqStatusDialogSplitterState")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
268 if self.__mq
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
269 else self.vcs.getPlugin().getPreferences("StatusDialogSplitterState")
8259
2bbec88047dd Applied some more code simplifications suggested by the new Simplify checker (Y108: use ternary operator).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8218
diff changeset
270 )
5520
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
271 if diffSplitterState is not None:
2a97a4d58bc6 Added code to the Mercurial status dialog to remember the window geometry and the splitter state.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5507
diff changeset
272 self.diffSplitter.restoreState(diffSplitterState)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
273
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 def __resort(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 Private method to resort the tree.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 """
3023
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
278 self.statusList.sortItems(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
279 self.statusList.sortColumn(), self.statusList.header().sortIndicatorOrder()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
280 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
281
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 def __resizeColumns(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 Private method to resize the list columns.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
286 self.statusList.header().resizeSections(QHeaderView.ResizeMode.ResizeToContents)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 self.statusList.header().setStretchLastSection(True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
288
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 def __generateItem(self, status, path):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 Private method to generate a status item in the status list.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
292
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
293 @param status status indicator
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
294 @type str
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
295 @param path path of the file or directory
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
296 @type str
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 """
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
298 statusText = self.status[status]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
299 itm = QTreeWidgetItem(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
300 self.statusList,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
301 [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
302 "",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
303 statusText,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
304 path,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
305 ],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
306 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
307
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7979
diff changeset
308 itm.setTextAlignment(1, Qt.AlignmentFlag.AlignHCenter)
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7979
diff changeset
309 itm.setTextAlignment(2, Qt.AlignmentFlag.AlignLeft)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
310
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
311 if status in "AMR":
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7979
diff changeset
312 itm.setFlags(itm.flags() | Qt.ItemFlag.ItemIsUserCheckable)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
313 itm.setCheckState(self.__toBeCommittedColumn, Qt.CheckState.Checked)
1294
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
314 else:
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7979
diff changeset
315 itm.setFlags(itm.flags() & ~Qt.ItemFlag.ItemIsUserCheckable)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
316
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
317 if statusText not in self.__statusFilters:
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
318 self.__statusFilters.append(statusText)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
319
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 def start(self, fn):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 """
198
7ab8e126f404 Fixed a few issues with the Mercurial plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 197
diff changeset
322 Public slot to start the hg status command.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
323
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 @param fn filename(s)/directoryname(s) to show the status of
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
325 @type str or list of str
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 self.errorGroup.hide()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 self.intercept = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 self.args = fn
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
330
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
331 self.actionsButton.setEnabled(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
332
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
333 self.statusFilterCombo.clear()
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
334 self.__statusFilters = []
4126
c28d0cf3b639 Some changes to the various VCS interfaces to use one dialog instead of creating a new one each time.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4072
diff changeset
335 self.statusList.clear()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
336
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
337 if self.__mq:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
338 self.setWindowTitle(self.tr("Mercurial Queue Repository Status"))
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
339 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
340 self.setWindowTitle(self.tr("Mercurial Status"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
341
3302
e92f0dd51979 Removed the Mercurial support for a command options dialog and added useable global options to the Mercurial config page.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3190
diff changeset
342 args = self.vcs.initCommand("status")
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
343 if self.__mq:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
344 args.append("--mq")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 else:
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
346 if self.vcs.hasSubrepositories():
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
347 args.append("--subrepos")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
348
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
349 if isinstance(fn, list):
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
350 self.vcs.addArguments(args, fn)
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
351 else:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
352 args.append(fn)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
353
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
354 self.refreshButton.setEnabled(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
355
7979
54b73174ab61 Mercurial: fixed a few issues introduced during the recent code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
356 self.__repoPath = self.__hgClient.getRepository()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
357
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
358 out, err = self.__hgClient.runcommand(args)
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
359 if err:
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
360 self.__showError(err)
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
361 if out:
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
362 for line in out.splitlines():
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
363 self.__processOutputLine(line)
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
364 if self.__hgClient.wasCanceled():
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
365 break
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
366 self.__finish()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
367
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 def __finish(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
370 Private slot called when the process finished or the user pressed
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
371 the button.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 """
221
38689444e922 Corrected the button handling of some Mercurial dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 216
diff changeset
373 self.refreshButton.setEnabled(True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
374
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
375 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(True)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
376 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
377 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setDefault(True)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
378 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setFocus(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
379 Qt.FocusReason.OtherFocusReason
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
380 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
381
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
382 self.__statusFilters.sort()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
383 self.__statusFilters.insert(0, "<{0}>".format(self.tr("all")))
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
384 self.statusFilterCombo.addItems(self.__statusFilters)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
385
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
386 if not self.__mq:
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
387 self.actionsButton.setEnabled(True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
388
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
389 self.__resort()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
390 self.__resizeColumns()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
391
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
392 self.__refreshDiff()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
393
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 def on_buttonBox_clicked(self, button):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
395 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 Private slot called by a button of the button box clicked.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
397
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
398 @param button button that was clicked
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
399 @type QAbstractButton
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
401 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 self.close()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
403 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel):
7370
5fb53279f2df Mercurial: removed some old code dealing with using the hg commandline executable instead of the command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7360
diff changeset
404 self.__hgClient.cancel()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 elif button == self.refreshButton:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 self.on_refreshButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
407
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
408 def __processOutputLine(self, line):
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
409 """
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
410 Private method to process the lines of output.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
411
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
412 @param line output line to be processed
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
413 @type str
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
414 """
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
415 if line[0] in "ACIMR?!" and line[1] == " ":
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
416 status, path = line.strip().split(" ", 1)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
417 self.__generateItem(status, path)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
418
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
419 def __showError(self, out):
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
420 """
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
421 Private slot to show some error.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
422
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
423 @param out error to be shown
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
424 @type str
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
425 """
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
426 self.errorGroup.show()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
427 self.errors.insertPlainText(out)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
428 self.errors.ensureCursorVisible()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
429
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 @pyqtSlot()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 def on_refreshButton_clicked(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433 Private slot to refresh the status display.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
434 """
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
435 selectedItems = self.statusList.selectedItems()
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
436 if len(selectedItems) == 1:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
437 self.__selectedName = selectedItems[0].text(self.__pathColumn)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
438 else:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
439 self.__selectedName = ""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
440
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 self.start(self.args)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
442
8151
8c1445825e7b Changed code to not use QComboBox.activated[str] and QComboBoc.highlighted[str] signals but the int variants instead.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
443 @pyqtSlot(int)
8c1445825e7b Changed code to not use QComboBox.activated[str] and QComboBoc.highlighted[str] signals but the int variants instead.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
444 def on_statusFilterCombo_activated(self, index):
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
445 """
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
446 Private slot to react to the selection of a status filter.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
447
8151
8c1445825e7b Changed code to not use QComboBox.activated[str] and QComboBoc.highlighted[str] signals but the int variants instead.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
448 @param index index of the selected entry
8c1445825e7b Changed code to not use QComboBox.activated[str] and QComboBoc.highlighted[str] signals but the int variants instead.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
449 @type int
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
450 """
8151
8c1445825e7b Changed code to not use QComboBox.activated[str] and QComboBoc.highlighted[str] signals but the int variants instead.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
451 txt = self.statusFilterCombo.itemText(index)
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
452 if txt == "<{0}>".format(self.tr("all")):
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
453 for topIndex in range(self.statusList.topLevelItemCount()):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
454 topItem = self.statusList.topLevelItem(topIndex)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
455 topItem.setHidden(False)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
456 else:
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
457 for topIndex in range(self.statusList.topLevelItemCount()):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
458 topItem = self.statusList.topLevelItem(topIndex)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
459 topItem.setHidden(topItem.text(self.__statusColumn) != txt)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
460
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
461 @pyqtSlot()
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
462 def on_statusList_itemSelectionChanged(self):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
463 """
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
464 Private slot to act upon changes of selected items.
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
465 """
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
466 self.__generateDiffs()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
467
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
468 ###########################################################################
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
469 ## Menu handling methods
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
470 ###########################################################################
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
471
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
472 def __showActionsMenu(self):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
473 """
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
474 Private slot to prepare the actions button menu before it is shown.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
475 """
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
476 if self.vcs.canCommitMerge():
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
477 self.__commitMergeAct.setEnabled(True)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
478 self.__abortMergeAct.setEnabled(True)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
479
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
480 self.__addAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
481 self.__diffAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
482 self.__sbsDiffAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
483 self.__revertAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
484 self.__forgetAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
485 self.__restoreAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
486 self.__commitAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
487 self.__commitSelectAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
488 self.__commitDeselectAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
489
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
490 self.__lfAddLargeAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
491 self.__lfAddNormalAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
492
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
493 else:
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
494 self.__commitMergeAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
495 self.__abortMergeAct.setEnabled(False)
3406
b3612f0fbf55 Changed the context menu of the Mercurial status dialog to only enable items available in the current situation.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3342
diff changeset
496
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
497 modified = len(self.__getModifiedItems())
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
498 unversioned = len(self.__getUnversionedItems())
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
499 missing = len(self.__getMissingItems())
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
500 commitable = len(self.__getCommitableItems())
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
501 commitableUnselected = len(self.__getCommitableUnselectedItems())
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
502
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
503 self.__addAct.setEnabled(unversioned)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
504 self.__diffAct.setEnabled(modified)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
505 self.__sbsDiffAct.setEnabled(modified == 1)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
506 self.__revertAct.setEnabled(modified)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
507 self.__forgetAct.setEnabled(missing)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
508 self.__restoreAct.setEnabled(missing)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
509 self.__commitAct.setEnabled(commitable)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
510 self.__commitSelectAct.setEnabled(commitableUnselected)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
511 self.__commitDeselectAct.setEnabled(commitable)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
512
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
513 if self.vcs.isExtensionActive("largefiles"):
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
514 enable = bool(unversioned)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
515 else:
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
516 enable = False
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
517 self.__lfAddLargeAct.setEnabled(enable)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
518 self.__lfAddNormalAct.setEnabled(enable)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
519
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 def __commit(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
522 Private slot to handle the Commit context menu entry.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523 """
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
524 if self.__mq:
7979
54b73174ab61 Mercurial: fixed a few issues introduced during the recent code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
525 self.vcs.vcsCommit(self.__repoPath, "", mq=True)
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
526 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
527 names = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
528 os.path.join(self.__repoPath, itm.text(self.__pathColumn))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
529 for itm in self.__getCommitableItems()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
530 ]
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
531 if not names:
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
532 EricMessageBox.information(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
533 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
534 self.tr("Commit"),
9576
be9f8e7e42e0 Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9573
diff changeset
535 self.tr("""There are no entries selected to be committed."""),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
536 )
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
537 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
538
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
539 if Preferences.getVCS("AutoSaveFiles"):
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
540 vm = ericApp().getObject("ViewManager")
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
541 for name in names:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
542 vm.saveEditor(name)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
543 self.vcs.vcsCommit(names, "")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
544
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
545 def __committed(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547 Private slot called after the commit has finished.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549 if self.isVisible():
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 self.on_refreshButton_clicked()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
551 self.vcs.checkVCSStatus()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
552
1294
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
553 def __commitSelectAll(self):
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
554 """
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
555 Private slot to select all entries for commit.
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
556 """
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
557 self.__commitSelect(True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
558
1294
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
559 def __commitDeselectAll(self):
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
560 """
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
561 Private slot to deselect all entries from commit.
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
562 """
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
563 self.__commitSelect(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
564
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
565 def __add(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
566 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
567 Private slot to handle the Add context menu entry.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
568 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
569 names = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
570 os.path.join(self.__repoPath, itm.text(self.__pathColumn))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
571 for itm in self.__getUnversionedItems()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
572 ]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
573 if not names:
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
574 EricMessageBox.information(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
575 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
576 self.tr("Add"),
9576
be9f8e7e42e0 Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9573
diff changeset
577 self.tr("""There are no unversioned entries available/selected."""),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
578 )
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
579 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
580
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581 self.vcs.vcsAdd(names)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
582 self.on_refreshButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
583
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
584 project = ericApp().getObject("Project")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
585 for name in names:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
586 project.getModel().updateVCSStatus(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
587 self.vcs.checkVCSStatus()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
588
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
589 def __lfAdd(self, mode):
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
590 """
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
591 Private slot to add a file to the repository.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
592
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
593 @param mode add mode (one of 'normal' or 'large')
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
594 @type str
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
595 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
596 names = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
597 os.path.join(self.__repoPath, itm.text(self.__pathColumn))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
598 for itm in self.__getUnversionedItems()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
599 ]
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
600 if not names:
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
601 EricMessageBox.information(
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
602 self,
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
603 self.tr("Add"),
9576
be9f8e7e42e0 Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9573
diff changeset
604 self.tr("""There are no unversioned entries available/selected."""),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
605 )
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
606 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
607
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
608 self.vcs.getExtensionObject("largefiles").hgAdd(names, mode)
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
609 self.on_refreshButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
610
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
611 project = ericApp().getObject("Project")
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
612 for name in names:
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
613 project.getModel().updateVCSStatus(name)
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
614 self.vcs.checkVCSStatus()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
615
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
616 def __forget(self):
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
617 """
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
618 Private slot to handle the Forget Missing context menu entry.
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
619 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
620 names = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
621 os.path.join(self.__repoPath, itm.text(self.__pathColumn))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
622 for itm in self.__getMissingItems()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
623 ]
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
624 if not names:
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
625 EricMessageBox.information(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
626 self,
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
627 self.tr("Forget Missing"),
9573
9960d19d66b5 Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9482
diff changeset
628 self.tr("""There are no missing entries available/selected."""),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
629 )
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
630 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
631
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
632 self.vcs.vcsForget(names)
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
633 self.on_refreshButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
634
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
635 def __revert(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
637 Private slot to handle the Revert context menu entry.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
638 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
639 names = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
640 os.path.join(self.__repoPath, itm.text(self.__pathColumn))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
641 for itm in self.__getModifiedItems()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
642 ]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643 if not names:
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
644 EricMessageBox.information(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
645 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
646 self.tr("Revert"),
9576
be9f8e7e42e0 Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9573
diff changeset
647 self.tr("""There are no uncommitted changes available/selected."""),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
648 )
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
650
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
651 self.vcs.vcsRevert(names)
2616
954b4069325b Fixed a little issue in the various VCS status dialogs __revert function causing the status dialog to get hidden behind the main window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2405
diff changeset
652 self.raise_()
954b4069325b Fixed a little issue in the various VCS status dialogs __revert function causing the status dialog to get hidden behind the main window.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2405
diff changeset
653 self.activateWindow()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654 self.on_refreshButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
655
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
656 project = ericApp().getObject("Project")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
657 for name in names:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
658 project.getModel().updateVCSStatus(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659 self.vcs.checkVCSStatus()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
660
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
661 def __restoreMissing(self):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
662 """
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
663 Private slot to handle the Restore Missing context menu entry.
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
664 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
665 names = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
666 os.path.join(self.__repoPath, itm.text(self.__pathColumn))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
667 for itm in self.__getMissingItems()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
668 ]
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
669 if not names:
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
670 EricMessageBox.information(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
671 self,
8651
ce4c3c401482 Updated translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8621
diff changeset
672 self.tr("Restore Missing"),
9573
9960d19d66b5 Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9482
diff changeset
673 self.tr("""There are no missing entries available/selected."""),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
674 )
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
675 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
676
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
677 self.vcs.vcsRevert(names)
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
678 self.on_refreshButton_clicked()
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
679 self.vcs.checkVCSStatus()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
680
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
681 def __diff(self):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
682 """
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
683 Private slot to handle the Diff context menu entry.
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
684 """
9482
a2bc06a54d9d Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
685 from .HgDiffDialog import HgDiffDialog
a2bc06a54d9d Corrected/acknowledged some bad import style and removed some obsolete code.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
686
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
687 names = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
688 os.path.join(self.__repoPath, itm.text(self.__pathColumn))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
689 for itm in self.__getModifiedItems()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
690 ]
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
691 if not names:
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
692 EricMessageBox.information(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
693 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
694 self.tr("Differences"),
9576
be9f8e7e42e0 Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9573
diff changeset
695 self.tr("""There are no uncommitted changes available/selected."""),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
696 )
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
697 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
698
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
699 if self.diff is None:
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
700 self.diff = HgDiffDialog(self.vcs)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
701 self.diff.show()
4072
46fb585f60f2 Extended the diff dialogs of the various VCS interfaces to allow a refresh in certain situations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4021
diff changeset
702 self.diff.start(names, refreshable=True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
703
2840
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
704 def __sbsDiff(self):
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
705 """
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
706 Private slot to handle the Side-By-Side Diff context menu entry.
2840
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
707 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
708 names = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
709 os.path.join(self.__repoPath, itm.text(self.__pathColumn))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
710 for itm in self.__getModifiedItems()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
711 ]
2840
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
712 if not names:
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
713 EricMessageBox.information(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
714 self,
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
715 self.tr("Differences Side-By-Side"),
9576
be9f8e7e42e0 Corrected some 'wrong' string quotes caused by the Black line merging.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9573
diff changeset
716 self.tr("""There are no uncommitted changes available/selected."""),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
717 )
2840
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
718 return
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
719 elif len(names) > 1:
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
720 EricMessageBox.information(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
721 self,
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
722 self.tr("Differences Side-By-Side"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
723 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
724 """Only one file with uncommitted changes"""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
725 """ must be selected."""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
726 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
727 )
2840
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
728 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
729
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
730 self.vcs.vcsSbsDiff(names[0])
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
731
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
732 def __getCommitableItems(self):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
733 """
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
734 Private method to retrieve all entries the user wants to commit.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
735
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
736 @return list of all items, the user has checked
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
737 @rtype list of QTreeWidgetItems
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
738 """
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
739 commitableItems = []
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
740 for index in range(self.statusList.topLevelItemCount()):
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
741 itm = self.statusList.topLevelItem(index)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
742 if itm.checkState(self.__toBeCommittedColumn) == Qt.CheckState.Checked:
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
743 commitableItems.append(itm)
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
744 return commitableItems
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
745
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
746 def __getCommitableUnselectedItems(self):
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
747 """
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
748 Private method to retrieve all entries the user may commit but hasn't
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
749 selected.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
750
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
751 @return list of all items, the user has checked
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
752 @rtype list of QTreeWidgetItems
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
753 """
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
754 items = []
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
755 for index in range(self.statusList.topLevelItemCount()):
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
756 itm = self.statusList.topLevelItem(index)
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
757 if (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
758 itm.flags() & Qt.ItemFlag.ItemIsUserCheckable
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
759 == Qt.ItemFlag.ItemIsUserCheckable
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
760 ) and itm.checkState(self.__toBeCommittedColumn) == Qt.CheckState.Unchecked:
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
761 items.append(itm)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
762 return items
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
763
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
764 def __getModifiedItems(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
765 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
766 Private method to retrieve all entries, that have a modified status.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
767
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
768 @return list of all items with a modified status
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
769 @rtype list of QTreeWidgetItems
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
771 modifiedItems = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 for itm in self.statusList.selectedItems():
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
773 if itm.text(self.__statusColumn) in self.modifiedIndicators:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 modifiedItems.append(itm)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775 return modifiedItems
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
776
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
777 def __getUnversionedItems(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
779 Private method to retrieve all entries, that have an unversioned
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
780 status.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
781
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
782 @return list of all items with an unversioned status
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
783 @rtype list of QTreeWidgetItems
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
784 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785 unversionedItems = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786 for itm in self.statusList.selectedItems():
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787 if itm.text(self.__statusColumn) in self.unversionedIndicators:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 unversionedItems.append(itm)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
789 return unversionedItems
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
790
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
791 def __getMissingItems(self):
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
792 """
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
793 Private method to retrieve all entries, that have a missing status.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
794
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
795 @return list of all items with a missing status
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
796 @rtype list of QTreeWidgetItems
216
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
797 """
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
798 missingItems = []
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
799 for itm in self.statusList.selectedItems():
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
800 if itm.text(self.__statusColumn) in self.missingIndicators:
6f9713e8d570 Added actions to identify the repo, to forget about files and added an additional status to be reported by the status monitor.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 198
diff changeset
801 missingItems.append(itm)
917
746c54b643eb Added functionality to the VCS status dialogs to make them more general commit dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
802 return missingItems
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
803
1294
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
804 def __commitSelect(self, selected):
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
805 """
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
806 Private slot to select or deselect all entries.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
807
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
808 @param selected commit selection state to be set
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
809 @type bool
1294
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
810 """
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
811 for index in range(self.statusList.topLevelItemCount()):
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
812 itm = self.statusList.topLevelItem(index)
8412
16e8c2896469 Fixed a few issue using the Qt.ItemFlag enum.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
813 if (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
814 itm.flags() & Qt.ItemFlag.ItemIsUserCheckable
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
815 == Qt.ItemFlag.ItemIsUserCheckable
8412
16e8c2896469 Fixed a few issue using the Qt.ItemFlag enum.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8358
diff changeset
816 ):
1294
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
817 if selected:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
818 itm.setCheckState(self.__toBeCommittedColumn, Qt.CheckState.Checked)
1294
d051b9d1426d Added context menu actions to select/deselect all commitable items of the various VCS status dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
819 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
820 itm.setCheckState(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
821 self.__toBeCommittedColumn, Qt.CheckState.Unchecked
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
822 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
823
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
824 def __commitMerge(self):
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
825 """
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
826 Private slot to handle the Commit Merge context menu entry.
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
827 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
828 self.vcs.vcsCommit(self.__repoPath, self.tr("Merge"), merge=True)
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
829 self.__committed()
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
830
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
831 def __abortMerge(self):
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
832 """
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
833 Private slot used to abort an uncommitted merge.
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
834 """
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
835 self.vcs.hgAbortMerge()
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
836 self.__committed()
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
837
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
838 ###########################################################################
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
839 ## Diff handling methods below
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
840 ###########################################################################
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
841
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
842 def __generateDiffs(self):
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
843 """
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
844 Private slot to generate diff outputs for the selected item.
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
845 """
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
846 self.diffEdit.clear()
5765
39d8b26ff557 Made the colors of the diff dialogs configurable.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5736
diff changeset
847 self.diffHighlighter.regenerateRules()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
848
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
849 if not self.__mq:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
850 selectedItems = self.statusList.selectedItems()
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
851 if len(selectedItems) == 1:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
852 fn = os.path.join(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
853 self.__repoPath, selectedItems[0].text(self.__pathColumn)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
854 )
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
855 self.__diffGenerator.start(fn)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
856
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
857 def __generatorFinished(self):
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
858 """
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
859 Private slot connected to the finished signal of the diff generator.
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
860 """
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
861 diff = self.__diffGenerator.getResult()[0]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
862
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
863 if diff:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
864 for line in diff[:]:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
865 if line.startswith("@@ "):
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
866 break
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
867 else:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
868 diff.pop(0)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
869 self.diffEdit.setPlainText("".join(diff))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
870
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
871 tc = self.diffEdit.textCursor()
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7979
diff changeset
872 tc.movePosition(QTextCursor.MoveOperation.Start)
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
873 self.diffEdit.setTextCursor(tc)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
874 self.diffEdit.ensureCursorVisible()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
875
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
876 def __refreshDiff(self):
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
877 """
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
878 Private method to refresh the diff output after a refresh.
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
879 """
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
880 if self.__selectedName and not self.__mq:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
881 for index in range(self.statusList.topLevelItemCount()):
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
882 itm = self.statusList.topLevelItem(index)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
883 if itm.text(self.__pathColumn) == self.__selectedName:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
884 itm.setSelected(True)
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
885 break
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
886
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
887 self.__selectedName = ""

eric ide

mercurial