Mon, 12 Oct 2020 17:39:45 +0200
Optimized the various diff panes by using QPlainTextEdit.
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1 | # -*- coding: utf-8 -*- |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
2 | |
7360
9190402e4505
Updated copyright for 2020.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7257
diff
changeset
|
3 | # Copyright (c) 2014 - 2020 Detlev Offenbach <detlev@die-offenbachs.de> |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
4 | # |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
5 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
6 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
7 | Module implementing a dialog to show the output of the git status command |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
8 | process. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
9 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
10 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
11 | import os |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
12 | import tempfile |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
13 | |
6369
09bc694c00bc
git Interface: replaced two occurrances of qVersion() by qVersionTuple in order to work with Qt >= 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
14 | from PyQt5.QtCore import pyqtSlot, Qt, QProcess, QTimer, QSize |
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
|
15 | from PyQt5.QtGui import QTextCursor |
7257
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
16 | from PyQt5.QtWidgets import ( |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
17 | QWidget, QDialogButtonBox, QMenu, QHeaderView, QTreeWidgetItem, QLineEdit, |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
18 | QInputDialog |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
19 | ) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
20 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
21 | from E5Gui.E5Application import e5App |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
22 | from E5Gui import E5MessageBox |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
23 | |
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
|
24 | from Globals import strToQByteArray |
6369
09bc694c00bc
git Interface: replaced two occurrances of qVersion() by qVersionTuple in order to work with Qt >= 5.10.0.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
6048
diff
changeset
|
25 | |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
26 | from .Ui_GitStatusDialog import Ui_GitStatusDialog |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
27 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
28 | from .GitDiffHighlighter import GitDiffHighlighter |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
29 | from .GitDiffGenerator import GitDiffGenerator |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
30 | from .GitDiffParser import GitDiffParser |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
31 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
32 | import Preferences |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
33 | import UI.PixmapCache |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
34 | import Utilities |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
35 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
36 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
37 | class GitStatusDialog(QWidget, Ui_GitStatusDialog): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
38 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
39 | Class implementing a dialog to show the output of the git status command |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
40 | process. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
41 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
42 | ConflictStates = ["AA", "AU", "DD", "DU", "UA", "UD", "UU"] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
43 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
44 | ConflictRole = Qt.UserRole |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
45 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
46 | def __init__(self, vcs, parent=None): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
47 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
48 | Constructor |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
49 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
50 | @param vcs reference to the vcs object |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
51 | @param parent parent widget (QWidget) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
52 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
53 | super(GitStatusDialog, self).__init__(parent) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
54 | self.setupUi(self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
55 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
56 | self.__toBeCommittedColumn = 0 |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
57 | self.__statusWorkColumn = 1 |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
58 | self.__statusIndexColumn = 2 |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
59 | self.__pathColumn = 3 |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
60 | self.__lastColumn = self.statusList.columnCount() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
61 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
62 | self.refreshButton = self.buttonBox.addButton( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
63 | self.tr("Refresh"), QDialogButtonBox.ActionRole) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
64 | self.refreshButton.setToolTip( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
65 | self.tr("Press to refresh the status display")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
66 | self.refreshButton.setEnabled(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
67 | self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
68 | self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
69 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
70 | self.diff = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
71 | self.vcs = vcs |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
72 | self.vcs.committed.connect(self.__committed) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
73 | self.process = QProcess() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
74 | self.process.finished.connect(self.__procFinished) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
75 | self.process.readyReadStandardOutput.connect(self.__readStdout) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
76 | self.process.readyReadStandardError.connect(self.__readStderr) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
77 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
78 | self.errorGroup.hide() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
79 | self.inputGroup.hide() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
80 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
81 | self.vDiffSplitter.setStretchFactor(0, 2) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
82 | self.vDiffSplitter.setStretchFactor(0, 2) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
83 | self.vDiffSplitter.setSizes([400, 400]) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
84 | self.__hDiffSplitterState = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
85 | self.__vDiffSplitterState = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
86 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
87 | self.statusList.headerItem().setText(self.__lastColumn, "") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
88 | self.statusList.header().setSortIndicator( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
89 | self.__pathColumn, Qt.AscendingOrder) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
90 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
91 | font = Preferences.getEditorOtherFonts("MonospacedFont") |
7779
757334671130
Optimized the various diff panes by using QPlainTextEdit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7533
diff
changeset
|
92 | self.lDiffEdit.document().setDefaultFont(font) |
757334671130
Optimized the various diff panes by using QPlainTextEdit.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7533
diff
changeset
|
93 | self.rDiffEdit.document().setDefaultFont(font) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
94 | self.lDiffEdit.customContextMenuRequested.connect( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
95 | self.__showLDiffContextMenu) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
96 | self.rDiffEdit.customContextMenuRequested.connect( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
97 | self.__showRDiffContextMenu) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
98 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
99 | self.__lDiffMenu = QMenu() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
100 | self.__stageLinesAct = self.__lDiffMenu.addAction( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7492
diff
changeset
|
101 | UI.PixmapCache.getIcon("vcsAdd"), |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
102 | self.tr("Stage Selected Lines"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
103 | self.__stageHunkOrLines) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
104 | self.__revertLinesAct = self.__lDiffMenu.addAction( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7492
diff
changeset
|
105 | UI.PixmapCache.getIcon("vcsRevert"), |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
106 | self.tr("Revert Selected Lines"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
107 | self.__revertHunkOrLines) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
108 | self.__stageHunkAct = self.__lDiffMenu.addAction( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7492
diff
changeset
|
109 | UI.PixmapCache.getIcon("vcsAdd"), |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
110 | self.tr("Stage Hunk"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
111 | self.__stageHunkOrLines) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
112 | self.__revertHunkAct = self.__lDiffMenu.addAction( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7492
diff
changeset
|
113 | UI.PixmapCache.getIcon("vcsRevert"), |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
114 | self.tr("Revert Hunk"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
115 | self.__revertHunkOrLines) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
116 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
117 | self.__rDiffMenu = QMenu() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
118 | self.__unstageLinesAct = self.__rDiffMenu.addAction( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7492
diff
changeset
|
119 | UI.PixmapCache.getIcon("vcsRemove"), |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
120 | self.tr("Unstage Selected Lines"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
121 | self.__unstageHunkOrLines) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
122 | self.__unstageHunkAct = self.__rDiffMenu.addAction( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7492
diff
changeset
|
123 | UI.PixmapCache.getIcon("vcsRemove"), |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
124 | self.tr("Unstage Hunk"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
125 | self.__unstageHunkOrLines) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
126 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
127 | self.lDiffHighlighter = GitDiffHighlighter(self.lDiffEdit.document()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
128 | self.rDiffHighlighter = GitDiffHighlighter(self.rDiffEdit.document()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
129 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
130 | self.lDiffParser = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
131 | self.rDiffParser = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
132 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
133 | self.__selectedName = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
134 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
135 | self.__diffGenerator = GitDiffGenerator(vcs, self) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
136 | self.__diffGenerator.finished.connect(self.__generatorFinished) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
137 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
138 | self.modifiedIndicators = [ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
139 | self.tr('added'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
140 | self.tr('copied'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
141 | self.tr('deleted'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
142 | self.tr('modified'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
143 | self.tr('renamed'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
144 | ] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
145 | self.modifiedOnlyIndicators = [ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
146 | self.tr('modified'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
147 | ] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
148 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
149 | self.unversionedIndicators = [ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
150 | self.tr('not tracked'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
151 | ] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
152 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
153 | self.missingIndicators = [ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
154 | self.tr('deleted'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
155 | ] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
156 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
157 | self.unmergedIndicators = [ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
158 | self.tr('unmerged'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
159 | ] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
160 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
161 | self.status = { |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
162 | ' ': self.tr("unmodified"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
163 | 'A': self.tr('added'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
164 | 'C': self.tr('copied'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
165 | 'D': self.tr('deleted'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
166 | 'M': self.tr('modified'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
167 | 'R': self.tr('renamed'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
168 | 'U': self.tr('unmerged'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
169 | '?': self.tr('not tracked'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
170 | '!': self.tr('ignored'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
171 | } |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
172 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
173 | self.__ioEncoding = Preferences.getSystem("IOEncoding") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
174 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
175 | self.__initActionsMenu() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
176 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
177 | def __initActionsMenu(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
178 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
179 | Private method to initialize the actions menu. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
180 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
181 | self.__actionsMenu = QMenu() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
182 | 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
|
183 | self.__actionsMenu.setToolTipsVisible(True) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
184 | self.__actionsMenu.aboutToShow.connect(self.__showActionsMenu) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
185 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
186 | self.__commitAct = self.__actionsMenu.addAction( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
187 | self.tr("Commit"), self.__commit) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
188 | self.__commitAct.setToolTip(self.tr("Commit the selected changes")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
189 | self.__amendAct = self.__actionsMenu.addAction( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
190 | self.tr("Amend"), self.__amend) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
191 | self.__amendAct.setToolTip(self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
192 | "Amend the latest commit with the selected changes")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
193 | self.__commitSelectAct = self.__actionsMenu.addAction( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
194 | self.tr("Select all for commit"), self.__commitSelectAll) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
195 | self.__commitDeselectAct = self.__actionsMenu.addAction( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
196 | self.tr("Unselect all from commit"), self.__commitDeselectAll) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
197 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
198 | self.__actionsMenu.addSeparator() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
199 | self.__addAct = self.__actionsMenu.addAction( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
200 | self.tr("Add"), self.__add) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
201 | self.__addAct.setToolTip(self.tr("Add the selected files")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
202 | self.__stageAct = self.__actionsMenu.addAction( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
203 | self.tr("Stage changes"), self.__stage) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
204 | self.__stageAct.setToolTip(self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
205 | "Stages all changes of the selected files")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
206 | self.__unstageAct = self.__actionsMenu.addAction( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
207 | self.tr("Unstage changes"), self.__unstage) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
208 | self.__unstageAct.setToolTip(self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
209 | "Unstages all changes of the selected files")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
210 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
211 | self.__actionsMenu.addSeparator() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
212 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
213 | self.__diffAct = self.__actionsMenu.addAction( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
214 | self.tr("Differences"), self.__diff) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
215 | self.__diffAct.setToolTip(self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
216 | "Shows the differences of the selected entry in a" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
217 | " separate dialog")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
218 | self.__sbsDiffAct = self.__actionsMenu.addAction( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
219 | self.tr("Differences Side-By-Side"), self.__sbsDiff) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
220 | self.__sbsDiffAct.setToolTip(self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
221 | "Shows the differences of the selected entry side-by-side in" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
222 | " a separate dialog")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
223 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
224 | self.__actionsMenu.addSeparator() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
225 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
226 | self.__revertAct = self.__actionsMenu.addAction( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
227 | self.tr("Revert"), self.__revert) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
228 | self.__revertAct.setToolTip(self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
229 | "Reverts the changes of the selected files")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
230 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
231 | self.__actionsMenu.addSeparator() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
232 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
233 | self.__forgetAct = self.__actionsMenu.addAction( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
234 | self.tr("Forget missing"), self.__forget) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
235 | self.__forgetAct.setToolTip(self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
236 | "Forgets about the selected missing files")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
237 | self.__restoreAct = self.__actionsMenu.addAction( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
238 | self.tr("Restore missing"), self.__restoreMissing) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
239 | self.__restoreAct.setToolTip(self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
240 | "Restores the selected missing files")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
241 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
242 | self.__actionsMenu.addSeparator() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
243 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
244 | self.__editAct = self.__actionsMenu.addAction( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
245 | self.tr("Edit file"), self.__editConflict) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
246 | self.__editAct.setToolTip(self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
247 | "Edit the selected conflicting file")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
248 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
249 | self.__actionsMenu.addSeparator() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
250 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
251 | act = self.__actionsMenu.addAction( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
252 | self.tr("Adjust column sizes"), self.__resizeColumns) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
253 | act.setToolTip(self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
254 | "Adjusts the width of all columns to their contents")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
255 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
256 | self.actionsButton.setIcon( |
7533
88261c96484b
Removed the '.png' extension from all call to get an icon or a pixmap from the PixmapCache because this is not needed anymore.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7492
diff
changeset
|
257 | UI.PixmapCache.getIcon("actionsToolButton")) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
258 | self.actionsButton.setMenu(self.__actionsMenu) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
259 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
260 | def closeEvent(self, e): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
261 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
262 | Protected slot implementing a close event handler. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
263 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
264 | @param e close event (QCloseEvent) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
265 | """ |
7257
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
266 | if ( |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
267 | self.process is not None and |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
268 | self.process.state() != QProcess.NotRunning |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
269 | ): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
270 | self.process.terminate() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
271 | QTimer.singleShot(2000, self.process.kill) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
272 | self.process.waitForFinished(3000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
273 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
274 | self.vcs.getPlugin().setPreferences( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
275 | "StatusDialogGeometry", self.saveGeometry()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
276 | self.vcs.getPlugin().setPreferences( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
277 | "StatusDialogSplitterStates", [ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
278 | self.vDiffSplitter.saveState(), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
279 | self.hDiffSplitter.saveState() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
280 | ] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
281 | ) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
282 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
283 | e.accept() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
284 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
285 | def show(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
286 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
287 | Public slot to show the dialog. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
288 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
289 | super(GitStatusDialog, self).show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
290 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
291 | geom = self.vcs.getPlugin().getPreferences( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
292 | "StatusDialogGeometry") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
293 | if geom.isEmpty(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
294 | s = QSize(900, 600) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
295 | self.resize(s) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
296 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
297 | self.restoreGeometry(geom) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
298 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
299 | states = self.vcs.getPlugin().getPreferences( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
300 | "StatusDialogSplitterStates") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
301 | if len(states) == 2: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
302 | # we have two splitters |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
303 | self.vDiffSplitter.restoreState(states[0]) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
304 | self.hDiffSplitter.restoreState(states[1]) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
305 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
306 | def __resort(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
307 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
308 | Private method to resort the tree. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
309 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
310 | self.statusList.sortItems( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
311 | self.statusList.sortColumn(), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
312 | self.statusList.header().sortIndicatorOrder()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
313 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
314 | def __resizeColumns(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
315 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
316 | Private method to resize the list columns. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
317 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
318 | self.statusList.header().resizeSections(QHeaderView.ResizeToContents) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
319 | self.statusList.header().setStretchLastSection(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
320 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
321 | def __generateItem(self, status, path): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
322 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
323 | Private method to generate a status item in the status list. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
324 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
325 | @param status status indicator (string) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
326 | @param path path of the file or directory (string) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
327 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
328 | statusWorkText = self.status[status[1]] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
329 | statusIndexText = self.status[status[0]] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
330 | itm = QTreeWidgetItem(self.statusList, [ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
331 | "", |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
332 | statusWorkText, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
333 | statusIndexText, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
334 | path, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
335 | ]) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
336 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
337 | itm.setTextAlignment(self.__statusWorkColumn, Qt.AlignHCenter) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
338 | itm.setTextAlignment(self.__statusIndexColumn, Qt.AlignHCenter) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
339 | itm.setTextAlignment(self.__pathColumn, Qt.AlignLeft) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
340 | |
7257
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
341 | if ( |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
342 | status not in self.ConflictStates + ["??", "!!"] and |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
343 | statusIndexText in self.modifiedIndicators |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
344 | ): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
345 | itm.setFlags(itm.flags() | Qt.ItemIsUserCheckable) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
346 | itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
347 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
348 | itm.setFlags(itm.flags() & ~Qt.ItemIsUserCheckable) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
349 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
350 | if statusWorkText not in self.__statusFilters: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
351 | self.__statusFilters.append(statusWorkText) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
352 | if statusIndexText not in self.__statusFilters: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
353 | self.__statusFilters.append(statusIndexText) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
354 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
355 | if status in self.ConflictStates: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
356 | itm.setIcon(self.__statusWorkColumn, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
357 | UI.PixmapCache.getIcon( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
358 | os.path.join("VcsPlugins", "vcsGit", "icons", |
7492
39e3ed0bc0c6
Added vector icons for the git plug-in.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7360
diff
changeset
|
359 | "conflict.svg"))) |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
360 | itm.setData(0, self.ConflictRole, status in self.ConflictStates) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
361 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
362 | def start(self, fn): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
363 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
364 | Public slot to start the git status command. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
365 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
366 | @param fn filename(s)/directoryname(s) to show the status of |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
367 | (string or list of strings) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
368 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
369 | self.errorGroup.hide() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
370 | self.intercept = False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
371 | self.args = fn |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
372 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
373 | self.__ioEncoding = Preferences.getSystem("IOEncoding") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
374 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
375 | self.statusFilterCombo.clear() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
376 | self.__statusFilters = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
377 | self.statusList.clear() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
378 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
379 | self.setWindowTitle(self.tr('Git Status')) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
380 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
381 | args = self.vcs.initCommand("status") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
382 | args.append('--porcelain') |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
383 | args.append("--") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
384 | if isinstance(fn, list): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
385 | self.dname, fnames = self.vcs.splitPathList(fn) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
386 | self.vcs.addArguments(args, fn) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
387 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
388 | self.dname, fname = self.vcs.splitPath(fn) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
389 | args.append(fn) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
390 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
391 | # find the root of the repo |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
392 | self.__repodir = self.dname |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
393 | while not os.path.isdir( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
394 | os.path.join(self.__repodir, self.vcs.adminDir)): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
395 | self.__repodir = os.path.dirname(self.__repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
396 | if os.path.splitdrive(self.__repodir)[1] == os.sep: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
397 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
398 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
399 | self.process.kill() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
400 | self.process.setWorkingDirectory(self.__repodir) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
401 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
402 | self.process.start('git', args) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
403 | procStarted = self.process.waitForStarted(5000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
404 | if not procStarted: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
405 | self.inputGroup.setEnabled(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
406 | self.inputGroup.hide() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
407 | E5MessageBox.critical( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
408 | self, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
409 | self.tr('Process Generation Error'), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
410 | self.tr( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
411 | 'The process {0} could not be started. ' |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
412 | 'Ensure, that it is in the search path.' |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
413 | ).format('git')) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
414 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
415 | self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
416 | self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
417 | self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
418 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
419 | self.refreshButton.setEnabled(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
420 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
421 | def __finish(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
422 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
423 | Private slot called when the process finished or the user pressed |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
424 | the button. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
425 | """ |
7257
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
426 | if ( |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
427 | self.process is not None and |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
428 | self.process.state() != QProcess.NotRunning |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
429 | ): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
430 | self.process.terminate() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
431 | QTimer.singleShot(2000, self.process.kill) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
432 | self.process.waitForFinished(3000) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
433 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
434 | self.inputGroup.setEnabled(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
435 | self.inputGroup.hide() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
436 | self.refreshButton.setEnabled(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
437 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
438 | self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
439 | self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
440 | self.buttonBox.button(QDialogButtonBox.Close).setDefault(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
441 | self.buttonBox.button(QDialogButtonBox.Close).setFocus( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
442 | Qt.OtherFocusReason) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
443 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
444 | self.__statusFilters.sort() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
445 | self.__statusFilters.insert(0, "<{0}>".format(self.tr("all"))) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
446 | self.statusFilterCombo.addItems(self.__statusFilters) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
447 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
448 | self.__resort() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
449 | self.__resizeColumns() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
450 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
451 | self.__refreshDiff() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
452 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
453 | def on_buttonBox_clicked(self, button): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
454 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
455 | Private slot called by a button of the button box clicked. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
456 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
457 | @param button button that was clicked (QAbstractButton) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
458 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
459 | if button == self.buttonBox.button(QDialogButtonBox.Close): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
460 | self.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
461 | elif button == self.buttonBox.button(QDialogButtonBox.Cancel): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
462 | self.__finish() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
463 | elif button == self.refreshButton: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
464 | self.on_refreshButton_clicked() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
465 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
466 | def __procFinished(self, exitCode, exitStatus): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
467 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
468 | Private slot connected to the finished signal. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
469 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
470 | @param exitCode exit code of the process (integer) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
471 | @param exitStatus exit status of the process (QProcess.ExitStatus) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
472 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
473 | self.__finish() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
474 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
475 | def __readStdout(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
476 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
477 | Private slot to handle the readyReadStandardOutput signal. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
478 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
479 | It reads the output of the process, formats it and inserts it into |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
480 | the contents pane. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
481 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
482 | if self.process is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
483 | self.process.setReadChannel(QProcess.StandardOutput) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
484 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
485 | while self.process.canReadLine(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
486 | line = str(self.process.readLine(), self.__ioEncoding, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
487 | 'replace') |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
488 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
489 | status = line[:2] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
490 | path = line[3:].strip().split(" -> ")[-1].strip('"') |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
491 | self.__generateItem(status, path) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
492 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
493 | def __readStderr(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
494 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
495 | Private slot to handle the readyReadStandardError signal. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
496 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
497 | It reads the error output of the process and inserts it into the |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
498 | error pane. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
499 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
500 | if self.process is not None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
501 | s = str(self.process.readAllStandardError(), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
502 | self.__ioEncoding, 'replace') |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
503 | self.errorGroup.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
504 | self.errors.insertPlainText(s) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
505 | self.errors.ensureCursorVisible() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
506 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
507 | # show input in case the process asked for some input |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
508 | self.inputGroup.setEnabled(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
509 | self.inputGroup.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
510 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
511 | def on_passwordCheckBox_toggled(self, isOn): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
512 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
513 | Private slot to handle the password checkbox toggled. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
514 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
515 | @param isOn flag indicating the status of the check box (boolean) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
516 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
517 | if isOn: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
518 | self.input.setEchoMode(QLineEdit.Password) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
519 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
520 | self.input.setEchoMode(QLineEdit.Normal) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
521 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
522 | @pyqtSlot() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
523 | def on_sendButton_clicked(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
524 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
525 | Private slot to send the input to the git process. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
526 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
527 | inputTxt = self.input.text() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
528 | inputTxt += os.linesep |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
529 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
530 | if self.passwordCheckBox.isChecked(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
531 | self.errors.insertPlainText(os.linesep) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
532 | self.errors.ensureCursorVisible() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
533 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
534 | self.errors.insertPlainText(inputTxt) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
535 | self.errors.ensureCursorVisible() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
536 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
537 | self.process.write(strToQByteArray(inputTxt)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
538 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
539 | self.passwordCheckBox.setChecked(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
540 | self.input.clear() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
541 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
542 | def on_input_returnPressed(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
543 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
544 | Private slot to handle the press of the return key in the input field. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
545 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
546 | self.intercept = True |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
547 | self.on_sendButton_clicked() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
548 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
549 | def keyPressEvent(self, evt): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
550 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
551 | Protected slot to handle a key press event. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
552 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
553 | @param evt the key press event (QKeyEvent) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
554 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
555 | if self.intercept: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
556 | self.intercept = False |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
557 | evt.accept() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
558 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
559 | super(GitStatusDialog, self).keyPressEvent(evt) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
560 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
561 | @pyqtSlot() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
562 | def on_refreshButton_clicked(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
563 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
564 | Private slot to refresh the status display. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
565 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
566 | selectedItems = self.statusList.selectedItems() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
567 | if len(selectedItems) == 1: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
568 | self.__selectedName = selectedItems[0].text(self.__pathColumn) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
569 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
570 | self.__selectedName = "" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
571 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
572 | self.start(self.args) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
573 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
574 | @pyqtSlot(str) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
575 | def on_statusFilterCombo_activated(self, txt): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
576 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
577 | Private slot to react to the selection of a status filter. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
578 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
579 | @param txt selected status filter (string) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
580 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
581 | if txt == "<{0}>".format(self.tr("all")): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
582 | for topIndex in range(self.statusList.topLevelItemCount()): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
583 | topItem = self.statusList.topLevelItem(topIndex) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
584 | topItem.setHidden(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
585 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
586 | for topIndex in range(self.statusList.topLevelItemCount()): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
587 | topItem = self.statusList.topLevelItem(topIndex) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
588 | topItem.setHidden( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
589 | topItem.text(self.__statusWorkColumn) != txt and |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
590 | topItem.text(self.__statusIndexColumn) != txt |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
591 | ) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
592 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
593 | @pyqtSlot() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
594 | def on_statusList_itemSelectionChanged(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
595 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
596 | Private slot to act upon changes of selected items. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
597 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
598 | self.__generateDiffs() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
599 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
600 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
601 | ## Menu handling methods |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
602 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
603 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
604 | def __showActionsMenu(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
605 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
606 | Private slot to prepare the actions button menu before it is shown. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
607 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
608 | modified = len(self.__getModifiedItems()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
609 | modifiedOnly = len(self.__getModifiedOnlyItems()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
610 | unversioned = len(self.__getUnversionedItems()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
611 | missing = len(self.__getMissingItems()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
612 | commitable = len(self.__getCommitableItems()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
613 | commitableUnselected = len(self.__getCommitableUnselectedItems()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
614 | stageable = len(self.__getStageableItems()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
615 | unstageable = len(self.__getUnstageableItems()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
616 | conflicting = len(self.__getConflictingItems()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
617 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
618 | self.__commitAct.setEnabled(commitable) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
619 | self.__amendAct.setEnabled(commitable) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
620 | self.__commitSelectAct.setEnabled(commitableUnselected) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
621 | self.__commitDeselectAct.setEnabled(commitable) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
622 | self.__addAct.setEnabled(unversioned) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
623 | self.__stageAct.setEnabled(stageable) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
624 | self.__unstageAct.setEnabled(unstageable) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
625 | self.__diffAct.setEnabled(modified) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
626 | self.__sbsDiffAct.setEnabled(modifiedOnly == 1) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
627 | self.__revertAct.setEnabled(stageable) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
628 | self.__forgetAct.setEnabled(missing) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
629 | self.__restoreAct.setEnabled(missing) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
630 | self.__editAct.setEnabled(conflicting == 1) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
631 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
632 | def __amend(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
633 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
634 | Private slot to handle the Amend context menu entry. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
635 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
636 | self.__commit(amend=True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
637 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
638 | def __commit(self, amend=False): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
639 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
640 | Private slot to handle the Commit context menu entry. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
641 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
642 | @param amend flag indicating to perform an amend operation (boolean) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
643 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
644 | names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
645 | for itm in self.__getCommitableItems()] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
646 | if not names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
647 | E5MessageBox.information( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
648 | self, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
649 | self.tr("Commit"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
650 | self.tr("""There are no entries selected to be""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
651 | """ committed.""")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
652 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
653 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
654 | if Preferences.getVCS("AutoSaveFiles"): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
655 | vm = e5App().getObject("ViewManager") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
656 | for name in names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
657 | vm.saveEditor(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
658 | self.vcs.vcsCommit(names, commitAll=False, amend=amend) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
659 | # staged changes |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
660 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
661 | def __committed(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
662 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
663 | Private slot called after the commit has finished. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
664 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
665 | if self.isVisible(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
666 | self.on_refreshButton_clicked() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
667 | self.vcs.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
668 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
669 | def __commitSelectAll(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
670 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
671 | Private slot to select all entries for commit. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
672 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
673 | self.__commitSelect(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
674 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
675 | def __commitDeselectAll(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
676 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
677 | Private slot to deselect all entries from commit. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
678 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
679 | self.__commitSelect(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
680 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
681 | def __add(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
682 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
683 | Private slot to handle the Add context menu entry. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
684 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
685 | names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
686 | for itm in self.__getUnversionedItems()] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
687 | if not names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
688 | E5MessageBox.information( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
689 | self, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
690 | self.tr("Add"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
691 | self.tr("""There are no unversioned entries""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
692 | """ available/selected.""")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
693 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
694 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
695 | self.vcs.vcsAdd(names) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
696 | self.on_refreshButton_clicked() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
697 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
698 | project = e5App().getObject("Project") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
699 | for name in names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
700 | project.getModel().updateVCSStatus(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
701 | self.vcs.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
702 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
703 | def __stage(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
704 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
705 | Private slot to handle the Stage context menu entry. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
706 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
707 | names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
708 | for itm in self.__getStageableItems()] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
709 | if not names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
710 | E5MessageBox.information( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
711 | self, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
712 | self.tr("Stage"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
713 | self.tr("""There are no stageable entries""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
714 | """ available/selected.""")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
715 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
716 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
717 | self.vcs.vcsAdd(names) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
718 | self.on_refreshButton_clicked() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
719 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
720 | project = e5App().getObject("Project") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
721 | for name in names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
722 | project.getModel().updateVCSStatus(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
723 | self.vcs.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
724 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
725 | def __unstage(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
726 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
727 | Private slot to handle the Unstage context menu entry. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
728 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
729 | names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
730 | for itm in self.__getUnstageableItems()] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
731 | if not names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
732 | E5MessageBox.information( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
733 | self, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
734 | self.tr("Unstage"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
735 | self.tr("""There are no unstageable entries""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
736 | """ available/selected.""")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
737 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
738 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
739 | self.vcs.gitUnstage(names) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
740 | self.on_refreshButton_clicked() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
741 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
742 | project = e5App().getObject("Project") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
743 | for name in names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
744 | project.getModel().updateVCSStatus(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
745 | self.vcs.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
746 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
747 | def __forget(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
748 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
749 | Private slot to handle the Forget Missing context menu entry. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
750 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
751 | names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
752 | for itm in self.__getMissingItems()] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
753 | if not names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
754 | E5MessageBox.information( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
755 | self, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
756 | self.tr("Forget Missing"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
757 | self.tr("""There are no missing entries""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
758 | """ available/selected.""")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
759 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
760 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
761 | self.vcs.vcsRemove(names, stageOnly=True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
762 | self.on_refreshButton_clicked() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
763 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
764 | def __revert(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
765 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
766 | Private slot to handle the Revert context menu entry. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
767 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
768 | names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
769 | for itm in self.__getStageableItems()] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
770 | if not names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
771 | E5MessageBox.information( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
772 | self, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
773 | self.tr("Revert"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
774 | self.tr("""There are no uncommitted, unstaged changes""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
775 | """ available/selected.""")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
776 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
777 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
778 | self.vcs.gitRevert(names) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
779 | self.raise_() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
780 | self.activateWindow() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
781 | self.on_refreshButton_clicked() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
782 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
783 | project = e5App().getObject("Project") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
784 | for name in names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
785 | project.getModel().updateVCSStatus(name) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
786 | self.vcs.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
787 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
788 | def __restoreMissing(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
789 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
790 | Private slot to handle the Restore Missing context menu entry. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
791 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
792 | names = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
793 | for itm in self.__getMissingItems()] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
794 | if not names: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
795 | E5MessageBox.information( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
796 | self, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
797 | self.tr("Restore Missing"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
798 | self.tr("""There are no missing entries""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
799 | """ available/selected.""")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
800 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
801 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
802 | self.vcs.gitRevert(names) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
803 | self.on_refreshButton_clicked() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
804 | self.vcs.checkVCSStatus() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
805 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
806 | def __editConflict(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
807 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
808 | Private slot to handle the Edit file context menu entry. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
809 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
810 | itm = self.__getConflictingItems()[0] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
811 | filename = os.path.join(self.__repodir, itm.text(self.__pathColumn)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
812 | if Utilities.MimeTypes.isTextFile(filename): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
813 | e5App().getObject("ViewManager").getEditor(filename) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
814 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
815 | def __diff(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
816 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
817 | Private slot to handle the Diff context menu entry. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
818 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
819 | namesW = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
820 | for itm in self.__getStageableItems()] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
821 | namesS = [os.path.join(self.dname, itm.text(self.__pathColumn)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
822 | for itm in self.__getUnstageableItems()] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
823 | if not namesW and not namesS: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
824 | E5MessageBox.information( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
825 | self, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
826 | self.tr("Differences"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
827 | self.tr("""There are no uncommitted changes""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
828 | """ available/selected.""")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
829 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
830 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
831 | diffMode = "work2stage2repo" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
832 | names = namesW + namesS |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
833 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
834 | if self.diff is None: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
835 | from .GitDiffDialog import GitDiffDialog |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
836 | self.diff = GitDiffDialog(self.vcs) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
837 | self.diff.show() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
838 | self.diff.start(names, diffMode=diffMode, refreshable=True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
839 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
840 | def __sbsDiff(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
841 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
842 | Private slot to handle the Diff context menu entry. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
843 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
844 | itm = self.__getModifiedOnlyItems()[0] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
845 | workModified = (itm.text(self.__statusWorkColumn) in |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
846 | self.modifiedOnlyIndicators) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
847 | stageModified = (itm.text(self.__statusIndexColumn) in |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
848 | self.modifiedOnlyIndicators) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
849 | names = [os.path.join(self.dname, itm.text(self.__pathColumn))] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
850 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
851 | if workModified and stageModified: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
852 | # select from all three variants |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
853 | messages = [ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
854 | self.tr("Working Tree to Staging Area"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
855 | self.tr("Staging Area to HEAD Commit"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
856 | self.tr("Working Tree to HEAD Commit"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
857 | ] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
858 | result, ok = QInputDialog.getItem( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
859 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
860 | self.tr("Side-by-Side Difference"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
861 | self.tr("Select the compare method."), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
862 | messages, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
863 | 0, False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
864 | if not ok: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
865 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
866 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
867 | if result == messages[0]: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
868 | revisions = ["", ""] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
869 | elif result == messages[1]: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
870 | revisions = ["HEAD", "Stage"] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
871 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
872 | revisions = ["HEAD", ""] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
873 | elif workModified: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
874 | # select from work variants |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
875 | messages = [ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
876 | self.tr("Working Tree to Staging Area"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
877 | self.tr("Working Tree to HEAD Commit"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
878 | ] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
879 | result, ok = QInputDialog.getItem( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
880 | None, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
881 | self.tr("Side-by-Side Difference"), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
882 | self.tr("Select the compare method."), |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
883 | messages, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
884 | 0, False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
885 | if not ok: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
886 | return |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
887 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
888 | if result == messages[0]: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
889 | revisions = ["", ""] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
890 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
891 | revisions = ["HEAD", ""] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
892 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
893 | revisions = ["HEAD", "Stage"] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
894 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
895 | self.vcs.gitSbsDiff(names[0], revisions=revisions) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
896 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
897 | def __getCommitableItems(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
898 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
899 | Private method to retrieve all entries the user wants to commit. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
900 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
901 | @return list of all items, the user has checked |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
902 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
903 | commitableItems = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
904 | for index in range(self.statusList.topLevelItemCount()): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
905 | itm = self.statusList.topLevelItem(index) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
906 | if itm.checkState(self.__toBeCommittedColumn) == Qt.Checked: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
907 | commitableItems.append(itm) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
908 | return commitableItems |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
909 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
910 | def __getCommitableUnselectedItems(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
911 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
912 | Private method to retrieve all entries the user may commit but hasn't |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
913 | selected. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
914 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
915 | @return list of all items, the user has not checked |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
916 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
917 | items = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
918 | for index in range(self.statusList.topLevelItemCount()): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
919 | itm = self.statusList.topLevelItem(index) |
7257
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
920 | if ( |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
921 | itm.flags() & Qt.ItemIsUserCheckable and |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
922 | itm.checkState(self.__toBeCommittedColumn) == Qt.Unchecked |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
923 | ): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
924 | items.append(itm) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
925 | return items |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
926 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
927 | def __getModifiedItems(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
928 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
929 | Private method to retrieve all entries, that have a modified status. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
930 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
931 | @return list of all items with a modified status |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
932 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
933 | modifiedItems = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
934 | for itm in self.statusList.selectedItems(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
935 | if (itm.text(self.__statusWorkColumn) in |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
936 | self.modifiedIndicators or |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
937 | itm.text(self.__statusIndexColumn) in |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
938 | self.modifiedIndicators): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
939 | modifiedItems.append(itm) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
940 | return modifiedItems |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
941 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
942 | def __getModifiedOnlyItems(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
943 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
944 | Private method to retrieve all entries, that have a modified status. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
945 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
946 | @return list of all items with a modified status |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
947 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
948 | modifiedItems = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
949 | for itm in self.statusList.selectedItems(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
950 | if (itm.text(self.__statusWorkColumn) in |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
951 | self.modifiedOnlyIndicators or |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
952 | itm.text(self.__statusIndexColumn) in |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
953 | self.modifiedOnlyIndicators): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
954 | modifiedItems.append(itm) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
955 | return modifiedItems |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
956 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
957 | def __getUnversionedItems(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
958 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
959 | Private method to retrieve all entries, that have an unversioned |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
960 | status. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
961 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
962 | @return list of all items with an unversioned status |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
963 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
964 | unversionedItems = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
965 | for itm in self.statusList.selectedItems(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
966 | if itm.text(self.__statusWorkColumn) in self.unversionedIndicators: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
967 | unversionedItems.append(itm) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
968 | return unversionedItems |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
969 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
970 | def __getStageableItems(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
971 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
972 | Private method to retrieve all entries, that have a stageable |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
973 | status. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
974 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
975 | @return list of all items with a stageable status |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
976 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
977 | stageableItems = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
978 | for itm in self.statusList.selectedItems(): |
7257
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
979 | if ( |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
980 | itm.text(self.__statusWorkColumn) in |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
981 | self.modifiedIndicators + self.unmergedIndicators |
c4d0cac9b5c9
Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
7229
diff
changeset
|
982 | ): |
6020
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
983 | stageableItems.append(itm) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
984 | return stageableItems |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
985 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
986 | def __getUnstageableItems(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
987 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
988 | Private method to retrieve all entries, that have an unstageable |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
989 | status. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
990 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
991 | @return list of all items with an unstageable status |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
992 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
993 | unstageableItems = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
994 | for itm in self.statusList.selectedItems(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
995 | if itm.text(self.__statusIndexColumn) in self.modifiedIndicators: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
996 | unstageableItems.append(itm) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
997 | return unstageableItems |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
998 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
999 | def __getMissingItems(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1000 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1001 | Private method to retrieve all entries, that have a missing status. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1002 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1003 | @return list of all items with a missing status |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1004 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1005 | missingItems = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1006 | for itm in self.statusList.selectedItems(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1007 | if itm.text(self.__statusWorkColumn) in self.missingIndicators: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1008 | missingItems.append(itm) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1009 | return missingItems |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1010 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1011 | def __getConflictingItems(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1012 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1013 | Private method to retrieve all entries, that have a conflict status. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1014 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1015 | @return list of all items with a conflict status |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1016 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1017 | conflictingItems = [] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1018 | for itm in self.statusList.selectedItems(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1019 | if itm.data(0, self.ConflictRole): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1020 | conflictingItems.append(itm) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1021 | return conflictingItems |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1022 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1023 | def __commitSelect(self, selected): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1024 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1025 | Private slot to select or deselect all entries. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1026 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1027 | @param selected commit selection state to be set (boolean) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1028 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1029 | for index in range(self.statusList.topLevelItemCount()): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1030 | itm = self.statusList.topLevelItem(index) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1031 | if itm.flags() & Qt.ItemIsUserCheckable: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1032 | if selected: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1033 | itm.setCheckState(self.__toBeCommittedColumn, Qt.Checked) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1034 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1035 | itm.setCheckState(self.__toBeCommittedColumn, Qt.Unchecked) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1036 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1037 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1038 | ## Diff handling methods below |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1039 | ########################################################################### |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1040 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1041 | def __generateDiffs(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1042 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1043 | Private slot to generate diff outputs for the selected item. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1044 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1045 | self.lDiffEdit.clear() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1046 | self.rDiffEdit.clear() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1047 | try: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1048 | self.lDiffHighlighter.regenerateRules() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1049 | self.rDiffHighlighter.regenerateRules() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1050 | except AttributeError: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1051 | # backward compatibility |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1052 | pass |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1053 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1054 | selectedItems = self.statusList.selectedItems() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1055 | if len(selectedItems) == 1: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1056 | fn = os.path.join(self.dname, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1057 | selectedItems[0].text(self.__pathColumn)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1058 | self.__diffGenerator.start(fn, diffMode="work2stage2repo") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1059 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1060 | def __generatorFinished(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1061 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1062 | Private slot connected to the finished signal of the diff generator. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1063 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1064 | diff1, diff2 = self.__diffGenerator.getResult()[:2] |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1065 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1066 | if diff1: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1067 | self.lDiffParser = GitDiffParser(diff1) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1068 | for line in diff1[:]: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1069 | if line.startswith("@@ "): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1070 | break |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1071 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1072 | diff1.pop(0) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1073 | self.lDiffEdit.setPlainText("".join(diff1)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1074 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1075 | self.lDiffParser = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1076 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1077 | if diff2: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1078 | self.rDiffParser = GitDiffParser(diff2) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1079 | for line in diff2[:]: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1080 | if line.startswith("@@ "): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1081 | break |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1082 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1083 | diff2.pop(0) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1084 | self.rDiffEdit.setPlainText("".join(diff2)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1085 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1086 | self.rDiffParser = None |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1087 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1088 | for diffEdit in [self.lDiffEdit, self.rDiffEdit]: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1089 | tc = diffEdit.textCursor() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1090 | tc.movePosition(QTextCursor.Start) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1091 | diffEdit.setTextCursor(tc) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1092 | diffEdit.ensureCursorVisible() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1093 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1094 | def __showLDiffContextMenu(self, coord): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1095 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1096 | Private slot to show the context menu of the status list. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1097 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1098 | @param coord position of the mouse pointer (QPoint) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1099 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1100 | if bool(self.lDiffEdit.toPlainText()): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1101 | cursor = self.lDiffEdit.textCursor() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1102 | if cursor.hasSelection(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1103 | self.__stageLinesAct.setEnabled(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1104 | self.__revertLinesAct.setEnabled(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1105 | self.__stageHunkAct.setEnabled(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1106 | self.__revertHunkAct.setEnabled(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1107 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1108 | self.__stageLinesAct.setEnabled(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1109 | self.__revertLinesAct.setEnabled(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1110 | self.__stageHunkAct.setEnabled(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1111 | self.__revertHunkAct.setEnabled(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1112 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1113 | cursor = self.lDiffEdit.cursorForPosition(coord) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1114 | self.lDiffEdit.setTextCursor(cursor) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1115 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1116 | self.__lDiffMenu.popup(self.lDiffEdit.mapToGlobal(coord)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1117 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1118 | def __showRDiffContextMenu(self, coord): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1119 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1120 | Private slot to show the context menu of the status list. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1121 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1122 | @param coord position of the mouse pointer (QPoint) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1123 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1124 | if bool(self.rDiffEdit.toPlainText()): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1125 | cursor = self.rDiffEdit.textCursor() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1126 | if cursor.hasSelection(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1127 | self.__unstageLinesAct.setEnabled(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1128 | self.__unstageHunkAct.setEnabled(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1129 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1130 | self.__unstageLinesAct.setEnabled(False) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1131 | self.__unstageHunkAct.setEnabled(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1132 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1133 | cursor = self.rDiffEdit.cursorForPosition(coord) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1134 | self.rDiffEdit.setTextCursor(cursor) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1135 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1136 | self.__rDiffMenu.popup(self.rDiffEdit.mapToGlobal(coord)) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1137 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1138 | def __stageHunkOrLines(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1139 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1140 | Private method to stage the selected lines or hunk. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1141 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1142 | cursor = self.lDiffEdit.textCursor() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1143 | startIndex, endIndex = self.__selectedLinesIndexes(self.lDiffEdit) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1144 | if cursor.hasSelection(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1145 | patch = self.lDiffParser.createLinesPatch(startIndex, endIndex) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1146 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1147 | patch = self.lDiffParser.createHunkPatch(startIndex) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1148 | if patch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1149 | patchFile = self.__tmpPatchFileName() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1150 | try: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1151 | f = open(patchFile, "w") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1152 | f.write(patch) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1153 | f.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1154 | self.vcs.gitApply(self.dname, patchFile, cached=True, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1155 | noDialog=True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1156 | self.on_refreshButton_clicked() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1157 | finally: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1158 | os.remove(patchFile) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1159 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1160 | def __unstageHunkOrLines(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1161 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1162 | Private method to unstage the selected lines or hunk. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1163 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1164 | cursor = self.rDiffEdit.textCursor() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1165 | startIndex, endIndex = self.__selectedLinesIndexes(self.rDiffEdit) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1166 | if cursor.hasSelection(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1167 | patch = self.rDiffParser.createLinesPatch(startIndex, endIndex, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1168 | reverse=True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1169 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1170 | patch = self.rDiffParser.createHunkPatch(startIndex) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1171 | if patch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1172 | patchFile = self.__tmpPatchFileName() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1173 | try: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1174 | f = open(patchFile, "w") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1175 | f.write(patch) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1176 | f.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1177 | self.vcs.gitApply(self.dname, patchFile, cached=True, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1178 | reverse=True, noDialog=True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1179 | self.on_refreshButton_clicked() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1180 | finally: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1181 | os.remove(patchFile) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1182 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1183 | def __revertHunkOrLines(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1184 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1185 | Private method to revert the selected lines or hunk. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1186 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1187 | cursor = self.lDiffEdit.textCursor() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1188 | startIndex, endIndex = self.__selectedLinesIndexes(self.lDiffEdit) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1189 | if cursor.hasSelection(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1190 | title = self.tr("Revert selected lines") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1191 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1192 | title = self.tr("Revert hunk") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1193 | res = E5MessageBox.yesNo( |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1194 | self, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1195 | title, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1196 | self.tr("""Are you sure you want to revert the selected""" |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1197 | """ changes?""")) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1198 | if res: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1199 | if cursor.hasSelection(): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1200 | patch = self.lDiffParser.createLinesPatch(startIndex, endIndex, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1201 | reverse=True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1202 | else: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1203 | patch = self.lDiffParser.createHunkPatch(startIndex) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1204 | if patch: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1205 | patchFile = self.__tmpPatchFileName() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1206 | try: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1207 | f = open(patchFile, "w") |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1208 | f.write(patch) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1209 | f.close() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1210 | self.vcs.gitApply(self.dname, patchFile, reverse=True, |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1211 | noDialog=True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1212 | self.on_refreshButton_clicked() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1213 | finally: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1214 | os.remove(patchFile) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1215 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1216 | def __selectedLinesIndexes(self, diffEdit): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1217 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1218 | Private method to extract the indexes of the selected lines. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1219 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1220 | @param diffEdit reference to the edit widget (QTextEdit) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1221 | @return tuple of start and end indexes (integer, integer) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1222 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1223 | cursor = diffEdit.textCursor() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1224 | selectionStart = cursor.selectionStart() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1225 | selectionEnd = cursor.selectionEnd() |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1226 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1227 | startIndex = -1 |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1228 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1229 | lineStart = 0 |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1230 | for lineIdx, line in enumerate(diffEdit.toPlainText().splitlines()): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1231 | lineEnd = lineStart + len(line) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1232 | if lineStart <= selectionStart <= lineEnd: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1233 | startIndex = lineIdx |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1234 | if lineStart <= selectionEnd <= lineEnd: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1235 | endIndex = lineIdx |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1236 | break |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1237 | lineStart = lineEnd + 1 |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1238 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1239 | return startIndex, endIndex |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1240 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1241 | def __tmpPatchFileName(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1242 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1243 | Private method to generate a temporary patch file. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1244 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1245 | @return name of the temporary file (string) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1246 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1247 | prefix = 'eric-git-{0}-'.format(os.getpid()) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1248 | suffix = '-patch' |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1249 | fd, path = tempfile.mkstemp(suffix, prefix) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1250 | os.close(fd) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1251 | return path |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1252 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1253 | def __refreshDiff(self): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1254 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1255 | Private method to refresh the diff output after a refresh. |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1256 | """ |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1257 | if self.__selectedName: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1258 | for index in range(self.statusList.topLevelItemCount()): |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1259 | itm = self.statusList.topLevelItem(index) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1260 | if itm.text(self.__pathColumn) == self.__selectedName: |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1261 | itm.setSelected(True) |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1262 | break |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1263 | |
baf6da1ae288
Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff
changeset
|
1264 | self.__selectedName = "" |