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

Wed, 13 Jul 2022 14:55:47 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Wed, 13 Jul 2022 14:55:47 +0200
branch
eric7
changeset 9221
bf71ee032bb4
parent 9209
b99e7fd55fd3
child 9413
80c06d472826
permissions
-rw-r--r--

Reformatted the source code using the 'Black' utility.

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
8881
54e42bc2437a Updated copyright for 2022.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8651
diff changeset
3 # Copyright (c) 2010 - 2022 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
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
13 from PyQt6.QtCore import pyqtSlot, Qt, QSize
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 QWidget,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
17 QDialogButtonBox,
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 QHeaderView,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
20 QTreeWidgetItem,
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
8358
144a6b854f70 Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8356
diff changeset
23 from EricWidgets.EricApplication import ericApp
144a6b854f70 Sorted the eric specific extensions into packages named like the corresponding PyQt packages (i.e. EricCore,EricGui and EricWidgets).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8356
diff changeset
24 from EricWidgets import EricMessageBox
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 from .Ui_HgStatusDialog import Ui_HgStatusDialog
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
28 from .HgDiffHighlighter import HgDiffHighlighter
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
29 from .HgDiffGenerator import HgDiffGenerator
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
30
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 import Preferences
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
32 import UI.PixmapCache
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 917
diff changeset
34
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 class HgStatusDialog(QWidget, Ui_HgStatusDialog):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
37 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
38 process.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
40
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
41 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
42 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
44
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 @param vcs reference to the vcs object
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
46 @param mq flag indicating to show a queue repo status (boolean)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 @param parent parent widget (QWidget)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 """
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
49 super().__init__(parent)
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 self.setupUi(self)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
51
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
52 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
53 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
54 self.__pathColumn = 2
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 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
56
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
57 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
58 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
59 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
60 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
61 self.refreshButton.setEnabled(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
62 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
63 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
64
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
65 self.diff = None
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self.vcs = vcs
495
b31b0bffa5b0 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 470
diff changeset
67 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
68 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
69 self.__mq = mq
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
70
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 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
72 self.statusList.header().setSortIndicator(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
73 self.__pathColumn, Qt.SortOrder.AscendingOrder
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
74 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
75
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
76 font = Preferences.getEditorOtherFonts("MonospacedFont")
7779
757334671130 Optimized the various diff panes by using QPlainTextEdit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
77 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
78
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
79 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
80 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
81 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
82
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
83 self.__selectedName = ""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
84
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 self.modifiedIndicators = [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
86 self.tr("added"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
87 self.tr("modified"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
88 self.tr("removed"),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
90
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.unversionedIndicators = [
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
92 self.tr("not tracked"),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 ]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
94
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
95 self.missingIndicators = [self.tr("missing")]
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
96
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 self.status = {
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
98 "A": self.tr("added"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
99 "C": self.tr("normal"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
100 "I": self.tr("ignored"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
101 "M": self.tr("modified"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
102 "R": self.tr("removed"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
103 "?": self.tr("not tracked"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
104 "!": self.tr("missing"),
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 }
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
106
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
107 self.__initActionsMenu()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
108
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
109 if mq:
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
110 self.diffLabel.setVisible(False)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
111 self.diffEdit.setVisible(False)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
112 self.actionsButton.setEnabled(False)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
113 self.diffSplitter.setSizes([600, 0])
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
114 else:
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
115 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
116
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
117 def __initActionsMenu(self):
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
118 """
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
119 Private method to initialize the actions menu.
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
120 """
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
121 self.__actionsMenu = QMenu()
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
122 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
123 self.__actionsMenu.setToolTipsVisible(True)
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
124 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
125
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
126 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
127 self.tr("Commit"), self.__commit
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
128 )
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
129 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
130 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
131 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
132 )
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
133 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
134 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
135 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
136
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
137 self.__actionsMenu.addSeparator()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
138
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
139 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
140 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
141 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
142 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
143 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
144 self.__lfAddLargeAct.setToolTip(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
145 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
146 "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
147 " extension"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
148 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
149 )
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
150 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
151 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
152 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
153 self.__lfAddNormalAct.setToolTip(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
154 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
155 "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
156 " extension"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
157 )
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
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
160 self.__actionsMenu.addSeparator()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
161
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
162 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
163 self.tr("Differences"), self.__diff
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
164 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
165 self.__diffAct.setToolTip(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
166 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
167 "Shows the differences of the selected entry in a" " separate dialog"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
168 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
169 )
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
170 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
171 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
172 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
173 self.__sbsDiffAct.setToolTip(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
174 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
175 "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
176 " a separate dialog"
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 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
179
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
180 self.__actionsMenu.addSeparator()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
181
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
182 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
183 self.tr("Revert"), self.__revert
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
184 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
185 self.__revertAct.setToolTip(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
186 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
187 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
188
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
189 self.__actionsMenu.addSeparator()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
190
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
191 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
192 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
193 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
194 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
195 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
196 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
197 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
198 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
199
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
200 self.__actionsMenu.addSeparator()
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
201
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
202 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
203 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
204 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
205 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
206 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
207 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
208 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
209 self.__commitMergeAct.setToolTip(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
210 self.tr("Abort an uncommitted merge " "and lose all changes")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
211 )
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
212
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
213 self.__actionsMenu.addSeparator()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
214
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
215 act = self.__actionsMenu.addAction(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
216 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
217 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
218 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
219
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
220 self.actionsButton.setIcon(UI.PixmapCache.getIcon("actionsToolButton"))
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
221 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
222
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
223 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
224 """
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
225 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
226
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
227 @param e close event (QCloseEvent)
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
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 @param status status indicator (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 @param path path of the file or directory (string)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 """
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
296 statusText = self.status[status]
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
297 itm = QTreeWidgetItem(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
298 self.statusList,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
299 [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
300 "",
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
301 statusText,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
302 path,
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
303 ],
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
304 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
305
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
306 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
307 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
308
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
309 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
310 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
311 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
312 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
313 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
314
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
315 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
316 self.__statusFilters.append(statusText)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
317
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 def start(self, fn):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 """
198
7ab8e126f404 Fixed a few issues with the Mercurial plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 197
diff changeset
320 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
321
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 @param fn filename(s)/directoryname(s) to show the status of
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 (string or list of strings)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 self.errorGroup.hide()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 self.intercept = False
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 self.args = fn
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
328
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
329 self.actionsButton.setEnabled(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
330
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
331 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
332 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
333 self.statusList.clear()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
334
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
335 if self.__mq:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
336 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
337 else:
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 Status"))
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
339
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
340 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
341 if self.__mq:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
342 args.append("--mq")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 else:
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
344 if self.vcs.hasSubrepositories():
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
345 args.append("--subrepos")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
346
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
347 if isinstance(fn, list):
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
348 self.vcs.addArguments(args, fn)
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
349 else:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
350 args.append(fn)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
351
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
352 self.refreshButton.setEnabled(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
353
7979
54b73174ab61 Mercurial: fixed a few issues introduced during the recent code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7970
diff changeset
354 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
355
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
356 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
357 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
358 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
359 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
360 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
361 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
362 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
363 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
364 self.__finish()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
365
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
366 def __finish(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
368 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
369 the button.
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 """
221
38689444e922 Corrected the button handling of some Mercurial dialogs.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 216
diff changeset
371 self.refreshButton.setEnabled(True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
372
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
373 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
374 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
375 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
376 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
377 Qt.FocusReason.OtherFocusReason
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
378 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
379
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
380 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
381 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
382 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
383
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
384 if not self.__mq:
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
385 self.actionsButton.setEnabled(True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
386
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 self.__resort()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
388 self.__resizeColumns()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
389
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
390 self.__refreshDiff()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
391
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
392 def on_buttonBox_clicked(self, button):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
394 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
395
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396 @param button button that was clicked (QAbstractButton)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
397 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
398 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
399 self.close()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
400 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
401 self.__hgClient.cancel()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402 elif button == self.refreshButton:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 self.on_refreshButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
404
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
405 def __processOutputLine(self, line):
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
406 """
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
407 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
408
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
409 @param line output line to be processed (string)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
410 """
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
411 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
412 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
413 self.__generateItem(status, path)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
414
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
415 def __showError(self, out):
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
416 """
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
417 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
418
1241
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
419 @param out error to be shown (string)
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 self.errorGroup.show()
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
422 self.errors.insertPlainText(out)
09c6155ee612 Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
423 self.errors.ensureCursorVisible()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
424
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 @pyqtSlot()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426 def on_refreshButton_clicked(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 Private slot to refresh the status display.
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429 """
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
430 selectedItems = self.statusList.selectedItems()
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
431 if len(selectedItems) == 1:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
432 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
433 else:
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
434 self.__selectedName = ""
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
435
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 self.start(self.args)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
437
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
438 @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
439 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
440 """
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
441 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
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 @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
444 @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
445 """
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
446 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
447 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
448 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
449 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
450 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
451 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
452 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
453 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
454 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
455
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
456 @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
457 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
458 """
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 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
460 """
4132
04f395eef728 Enhanced the status dialog functionality by a diff view.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 4126
diff changeset
461 self.__generateDiffs()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
462
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
463 ###########################################################################
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
464 ## 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
465 ###########################################################################
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
466
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
467 def __showActionsMenu(self):
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
468 """
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
469 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
470 """
7970
c4ee8a81584c Mercurial: started more code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
471 if self.vcs.canCommitMerge():
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
472 self.__commitMergeAct.setEnabled(True)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
473 self.__abortMergeAct.setEnabled(True)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
474
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
475 self.__addAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
476 self.__diffAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
477 self.__sbsDiffAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
478 self.__revertAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
479 self.__forgetAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
480 self.__restoreAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
481 self.__commitAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
482 self.__commitSelectAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
483 self.__commitDeselectAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
484
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
485 self.__lfAddLargeAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
486 self.__lfAddNormalAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
487
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
488 else:
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
489 self.__commitMergeAct.setEnabled(False)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
490 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
491
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
492 modified = len(self.__getModifiedItems())
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
493 unversioned = len(self.__getUnversionedItems())
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
494 missing = len(self.__getMissingItems())
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
495 commitable = len(self.__getCommitableItems())
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
496 commitableUnselected = len(self.__getCommitableUnselectedItems())
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
497
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
498 self.__addAct.setEnabled(unversioned)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
499 self.__diffAct.setEnabled(modified)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
500 self.__sbsDiffAct.setEnabled(modified == 1)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
501 self.__revertAct.setEnabled(modified)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
502 self.__forgetAct.setEnabled(missing)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
503 self.__restoreAct.setEnabled(missing)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
504 self.__commitAct.setEnabled(commitable)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
505 self.__commitSelectAct.setEnabled(commitableUnselected)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
506 self.__commitDeselectAct.setEnabled(commitable)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
507
7183
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
508 if self.vcs.isExtensionActive("largefiles"):
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
509 enable = bool(unversioned)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
510 else:
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
511 enable = False
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
512 self.__lfAddLargeAct.setEnabled(enable)
4ac1c9daa90b HgStatusDialog: commitMerge and abortMerge actions added
Christos Sevastiadis <csevast@gmail.com>
parents: 6942
diff changeset
513 self.__lfAddNormalAct.setEnabled(enable)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
514
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 def __commit(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
516 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
517 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
518 """
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
519 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
520 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
521 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
522 names = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
523 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
524 for itm in self.__getCommitableItems()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
525 ]
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
526 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
527 EricMessageBox.information(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
528 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
529 self.tr("Commit"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
530 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
531 """There are no entries selected to be""" """ committed."""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
532 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
533 )
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
534 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
535
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
536 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
537 vm = ericApp().getObject("ViewManager")
2815
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
538 for name in names:
53c1d1f9ec86 Started to implement support for Mercurial queue repositories.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
539 vm.saveEditor(name)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
540 self.vcs.vcsCommit(names, "")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
541
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
542 def __committed(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
543 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 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
545 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
546 if self.isVisible():
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
547 self.on_refreshButton_clicked()
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
548 self.vcs.checkVCSStatus()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
549
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
550 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
551 """
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
552 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
553 """
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 self.__commitSelect(True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
555
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
556 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
557 """
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
558 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
559 """
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 self.__commitSelect(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
561
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
562 def __add(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
563 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
564 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
565 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
566 names = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
567 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
568 for itm in self.__getUnversionedItems()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
569 ]
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
570 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
571 EricMessageBox.information(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
572 self,
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
573 self.tr("Add"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
574 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
575 """There are no unversioned entries""" """ available/selected."""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
576 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
577 )
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
578 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
579
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
580 self.vcs.vcsAdd(names)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
581 self.on_refreshButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
582
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
583 project = ericApp().getObject("Project")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
584 for name in names:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
585 project.getModel().updateVCSStatus(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
586 self.vcs.checkVCSStatus()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
587
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
588 def __lfAdd(self, mode):
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
589 """
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
590 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
591
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
592 @param mode add mode (string one of 'normal' or 'large')
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
593 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
594 names = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
595 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
596 for itm in self.__getUnversionedItems()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
597 ]
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
598 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
599 EricMessageBox.information(
3315
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
600 self,
bd1a25ead18d Continued implementing support for Mercurial largefiles.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3302
diff changeset
601 self.tr("Add"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
602 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
603 """There are no unversioned entries""" """ available/selected."""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
604 ),
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"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
628 self.tr("""There are no missing entries""" """ available/selected."""),
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"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
647 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
648 """There are no uncommitted changes""" """ available/selected."""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
649 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
650 )
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
651 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
652
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
653 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
654 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
655 self.activateWindow()
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
656 self.on_refreshButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
657
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
658 project = ericApp().getObject("Project")
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
659 for name in names:
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
660 project.getModel().updateVCSStatus(name)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661 self.vcs.checkVCSStatus()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
662
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
663 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
664 """
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
665 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
666 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
667 names = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
668 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
669 for itm in self.__getMissingItems()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
670 ]
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
671 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
672 EricMessageBox.information(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
673 self,
8651
ce4c3c401482 Updated translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8621
diff changeset
674 self.tr("Restore Missing"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
675 self.tr("""There are no missing entries""" """ available/selected."""),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
676 )
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
677 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
678
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
679 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
680 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
681 self.vcs.checkVCSStatus()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
682
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
683 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
684 """
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
685 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
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"),
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
695 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
696 """There are no uncommitted changes""" """ available/selected."""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
697 ),
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 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
700
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
701 if self.diff is None:
2405
d4b5f3bd4720 Continued implementing the delayed import.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
702 from .HgDiffDialog import HgDiffDialog
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
703
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
704 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
705 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
706 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
707
2840
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
708 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
709 """
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
710 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
711 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
712 names = [
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
713 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
714 for itm in self.__getModifiedItems()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
715 ]
2840
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
716 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
717 EricMessageBox.information(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
718 self,
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
719 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
720 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
721 """There are no uncommitted changes""" """ available/selected."""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
722 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
723 )
2840
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
724 return
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
725 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
726 EricMessageBox.information(
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
727 self,
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
728 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
729 self.tr(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
730 """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
731 """ must be selected."""
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
732 ),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
733 )
2840
10a133f3a5e8 Added side-by-side diff support to the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2838
diff changeset
734 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
735
8621
8c9f41115c04 Continued implementing the VCS status widget for the left side.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8412
diff changeset
736 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
737
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 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
739 """
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 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
741
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
742 @return list of all items, the user has checked
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 """
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 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
745 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
746 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
747 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
748 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
749 return commitableItems
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 def __getCommitableUnselectedItems(self):
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
752 """
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
753 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
754 selected.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
755
5522
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
756 @return list of all items, the user has checked
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
757 """
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
758 items = []
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
759 for index in range(self.statusList.topLevelItemCount()):
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
760 itm = self.statusList.topLevelItem(index)
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
761 if (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
762 itm.flags() & Qt.ItemFlag.ItemIsUserCheckable
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
763 == Qt.ItemFlag.ItemIsUserCheckable
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
764 ) 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
765 items.append(itm)
e07d1df4c64a Improved the Mercurial status dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5520
diff changeset
766 return items
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 def __getModifiedItems(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
769 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
770 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
771
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
772 @return list of all items with a modified status
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
773 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
774 modifiedItems = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
775 for itm in self.statusList.selectedItems():
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
776 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
777 modifiedItems.append(itm)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
778 return modifiedItems
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
779
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
780 def __getUnversionedItems(self):
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
781 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2840
diff changeset
782 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
783 status.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
784
178
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
785 @return list of all items with an unversioned status
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
786 """
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
787 unversionedItems = []
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
788 for itm in self.statusList.selectedItems():
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
789 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
790 unversionedItems.append(itm)
dd9f0bca5e2f Added plugin for Mercurial version control system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
791 return unversionedItems
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
792
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
793 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
794 """
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 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
796
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 @return list of all items with a missing status
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 """
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 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
800 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
801 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
802 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
803 return missingItems
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
804
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
805 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
806 """
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
807 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
808
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
809 @param selected commit selection state to be set (boolean)
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