src/eric7/Plugins/VcsPlugins/vcsGit/GitRemoteRepositoriesDialog.py

Tue, 10 Dec 2024 15:46:34 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Tue, 10 Dec 2024 15:46:34 +0100
branch
eric7
changeset 11090
f5f5f5803935
parent 10690
fab36645aa7d
permissions
-rw-r--r--

Updated copyright for 2025.

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
11090
f5f5f5803935 Updated copyright for 2025.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10690
diff changeset
3 # Copyright (c) 2014 - 2025 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 available remote repositories.
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
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 import os
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
12 from PyQt6.QtCore import QProcess, Qt, QTimer, pyqtSlot
8318
962bce857696 Replaced all imports of PyQt5 to PyQt6 and started to replace code using obsoleted methods and adapt to the PyQt6 enum usage.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8312
diff changeset
13 from PyQt6.QtWidgets import (
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
14 QDialogButtonBox,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
15 QHeaderView,
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
16 QLineEdit,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
17 QTreeWidgetItem,
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
18 QWidget,
7257
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
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
21 from eric7 import Preferences
9413
80c06d472826 Changed the eric7 import statements to include the package name (i.e. eric7) in order to not fiddle with sys.path.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9221
diff changeset
22 from eric7.EricWidgets import EricMessageBox
9473
3f23dbf37dbe Resorted the import statements using isort.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9413
diff changeset
23 from eric7.Globals import strToQByteArray
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 from .Ui_GitRemoteRepositoriesDialog import Ui_GitRemoteRepositoriesDialog
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26
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 class GitRemoteRepositoriesDialog(QWidget, Ui_GitRemoteRepositoriesDialog):
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 Class implementing a dialog to show available remote repositories.
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
32
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 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
34 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 Constructor
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
36
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 @param vcs reference to the vcs object
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
38 @type Git
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
39 @param parent parent widget
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
40 @type QWidget
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 """
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
42 super().__init__(parent)
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.setupUi(self)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
44
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.vcs = vcs
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 self.process = QProcess()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 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
48 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
49 self.process.readyReadStandardError.connect(self.__readStderr)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
50
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self.refreshButton = self.buttonBox.addButton(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
52 self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
53 )
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.refreshButton.setToolTip(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
55 self.tr("Press to refresh the repositories display")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
56 )
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 self.refreshButton.setEnabled(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
58 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(False)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
59 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(True)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
60
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 self.__lastColumn = self.repolist.columnCount()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
62
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 self.repolist.headerItem().setText(self.__lastColumn, "")
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
64 self.repolist.header().setSortIndicator(0, Qt.SortOrder.AscendingOrder)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
65
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self.__ioEncoding = Preferences.getSystem("IOEncoding")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
67
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 def __resort(self):
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 Private method to resort the list.
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 self.repolist.sortItems(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
73 self.repolist.sortColumn(), self.repolist.header().sortIndicatorOrder()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
74 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
75
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 def __resizeColumns(self):
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 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
79 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
80 self.repolist.header().resizeSections(QHeaderView.ResizeMode.ResizeToContents)
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 self.repolist.header().setStretchLastSection(True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
82
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 def __generateItem(self, name, url, oper):
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 Private method to generate a status item in the status list.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
86
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
87 @param name name of the remote repository
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
88 @type str
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
89 @param url URL of the remote repository
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
90 @type str
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
91 @param oper operation the remote repository may be used for
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
92 @type str
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
94 foundItems = self.repolist.findItems(name, Qt.MatchFlag.MatchExactly, 0)
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 if foundItems:
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 # modify the operations column only
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
97 foundItems[0].setText(2, "{0} + {1}".format(foundItems[0].text(2), oper))
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 else:
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 QTreeWidgetItem(self.repolist, [name, url, oper])
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
100
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 def closeEvent(self, e):
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 Protected slot implementing a close event handler.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
104
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
105 @param e close event
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
106 @type QCloseEvent
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 """
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
108 if (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
109 self.process is not None
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
110 and self.process.state() != QProcess.ProcessState.NotRunning
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
111 ):
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 self.process.terminate()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113 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
114 self.process.waitForFinished(3000)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
115
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 e.accept()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
117
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118 def start(self, projectDir):
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 Public slot to start the git remote command.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
121
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
122 @param projectDir name of the project directory
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
123 @type str
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 self.repolist.clear()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
126
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 self.errorGroup.hide()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 self.intercept = False
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 self.projectDir = projectDir
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
130
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 self.__ioEncoding = Preferences.getSystem("IOEncoding")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
132
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 self.removeButton.setEnabled(False)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 self.renameButton.setEnabled(False)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 self.pruneButton.setEnabled(False)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 self.showInfoButton.setEnabled(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
137
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 args = self.vcs.initCommand("remote")
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
139 args.append("--verbose")
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
140
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 # find the root of the repo
9616
13aa04c979d7 Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
142 repodir = self.vcs.findRepoRoot(self.projectDir)
13aa04c979d7 Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
143 if not repodir:
13aa04c979d7 Version Control Systems - git
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9473
diff changeset
144 return
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
145
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 self.process.kill()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 self.process.setWorkingDirectory(repodir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
148
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
149 self.process.start("git", args)
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 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
151 if not procStarted:
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 self.inputGroup.setEnabled(False)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 self.inputGroup.hide()
8356
68ec9c3d4de5 Renamed the modules and classes of the E5Gui package to have the prefix 'Eric' instead of 'E5'.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8318
diff changeset
154 EricMessageBox.critical(
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 self,
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
156 self.tr("Process Generation Error"),
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 self.tr(
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
158 "The process {0} could not be started. "
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
159 "Ensure, that it is in the search path."
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
160 ).format("git"),
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
161 )
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 else:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
163 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
164 False
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
165 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
166 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
167 True
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
168 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
169 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setDefault(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
170 True
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
171 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
172
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 self.inputGroup.setEnabled(True)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 self.inputGroup.show()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 self.refreshButton.setEnabled(False)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
176
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 def __finish(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 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
180 the button.
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 """
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
182 if (
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
183 self.process is not None
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
184 and self.process.state() != QProcess.ProcessState.NotRunning
7257
c4d0cac9b5c9 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
185 ):
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 self.process.terminate()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 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
188 self.process.waitForFinished(3000)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
189
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 self.inputGroup.setEnabled(False)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 self.inputGroup.hide()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 self.refreshButton.setEnabled(True)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
193
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
194 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setEnabled(True)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
195 self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
196 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setDefault(True)
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
197 self.buttonBox.button(QDialogButtonBox.StandardButton.Close).setFocus(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
198 Qt.FocusReason.OtherFocusReason
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
199 )
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
200
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 self.__resort()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202 self.__resizeColumns()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
203
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 self.__updateButtons()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
205
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 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
207 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 Private slot called by a button of the button box clicked.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
209
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
210 @param button button that was clicked
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
211 @type QAbstractButton
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 """
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
213 if button == self.buttonBox.button(QDialogButtonBox.StandardButton.Close):
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 self.close()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
215 elif button == self.buttonBox.button(QDialogButtonBox.StandardButton.Cancel):
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 self.__finish()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 elif button == self.refreshButton:
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 self.on_refreshButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
219
10069
435cc5875135 Corrected and checked some code style issues (unused function arguments).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9653
diff changeset
220 @pyqtSlot(int, QProcess.ExitStatus)
10690
fab36645aa7d Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
221 def __procFinished(self, _exitCode, _exitStatus):
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 Private slot connected to the finished signal.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
224
10690
fab36645aa7d Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
225 @param _exitCode exit code of the process (unused)
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
226 @type int
10690
fab36645aa7d Changed the source code and the source code documentation to improve the indication of unused method/function arguments.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10439
diff changeset
227 @param _exitStatus exit status of the process (unused)
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
228 @type QProcess.ExitStatus
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 self.__finish()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
231
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 def __readStdout(self):
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
233 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
234 Private slot to handle the readyReadStandardOutput signal.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
235
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 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
237 the contents pane.
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 if self.process is not None:
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
240 self.process.setReadChannel(QProcess.ProcessChannel.StandardOutput)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
241
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 while self.process.canReadLine():
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
243 line = str(
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
244 self.process.readLine(), self.__ioEncoding, "replace"
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
245 ).strip()
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
246
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
247 name, line = line.split(None, 1)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
248 url, oper = line.rsplit(None, 1)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
249 oper = oper[1:-1] # it is enclosed in ()
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 self.__generateItem(name, url, oper)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
251
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252 def __readStderr(self):
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 Private slot to handle the readyReadStandardError signal.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
255
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256 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
257 error pane.
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 if self.process is not None:
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
260 s = str(self.process.readAllStandardError(), self.__ioEncoding, "replace")
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
261 self.errorGroup.show()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 self.errors.insertPlainText(s)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 self.errors.ensureCursorVisible()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
264
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 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
266 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 Private slot to handle the password checkbox toggled.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
268
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
269 @param isOn flag indicating the status of the check box
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
270 @type bool
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
271 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272 if isOn:
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
273 self.input.setEchoMode(QLineEdit.EchoMode.Password)
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274 else:
8143
2c730d5fd177 Changed the use of PyQt enums because the way they were used previously is deprecated since two years and replaced some deprecated Qt stuff.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
275 self.input.setEchoMode(QLineEdit.EchoMode.Normal)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
276
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 @pyqtSlot()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 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
279 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 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
281 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 inputTxt = self.input.text()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 inputTxt += os.linesep
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
284
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 if self.passwordCheckBox.isChecked():
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 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
287 self.errors.ensureCursorVisible()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 else:
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 self.errors.insertPlainText(inputTxt)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
290 self.errors.ensureCursorVisible()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
291
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 self.process.write(strToQByteArray(inputTxt))
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
293
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 self.passwordCheckBox.setChecked(False)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 self.input.clear()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
296
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 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
298 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
299 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
300 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 self.intercept = True
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302 self.on_sendButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
303
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
304 def keyPressEvent(self, evt):
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 Protected slot to handle a key press event.
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
307
10438
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
308 @param evt the key press event
4cd7e5a8b3cf Converted some source code documentation to the new style.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 10069
diff changeset
309 @type QKeyEvent
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 if self.intercept:
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 self.intercept = False
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 evt.accept()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 return
8218
7c09585bd960 Applied some more code simplifications suggested by the new Simplify checker (super(Foo, self) => super()).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 8143
diff changeset
315 super().keyPressEvent(evt)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
316
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 @pyqtSlot()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 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
319 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 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
321 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322 self.start(self.projectDir)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
323
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 def __updateButtons(self):
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 Private method to update the buttons status.
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 enable = len(self.repolist.selectedItems()) == 1
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
329
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 self.removeButton.setEnabled(enable)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 self.pruneButton.setEnabled(enable)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 self.showInfoButton.setEnabled(enable)
6324
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
333 self.renameButton.setEnabled(enable)
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
334 self.changeUrlButton.setEnabled(enable)
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
335 self.credentialsButton.setEnabled(enable)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
336
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 @pyqtSlot()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 def on_repolist_itemSelectionChanged(self):
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 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
341 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 self.__updateButtons()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
343
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 @pyqtSlot()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 def on_addButton_clicked(self):
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347 Private slot to add a remote repository.
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 self.vcs.gitAddRemote(self.projectDir)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
350 self.on_refreshButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
351
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 @pyqtSlot()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 def on_removeButton_clicked(self):
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 Private slot to remove a remote repository.
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357 remoteName = self.repolist.selectedItems()[0].text(0)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
358 self.vcs.gitRemoveRemote(self.projectDir, remoteName)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359 self.on_refreshButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
360
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 @pyqtSlot()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 def on_showInfoButton_clicked(self):
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 Private slot to show information about a remote repository.
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 remoteName = self.repolist.selectedItems()[0].text(0)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367 self.vcs.gitShowRemote(self.projectDir, remoteName)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
368
6020
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 @pyqtSlot()
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 def on_pruneButton_clicked(self):
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 Private slot to prune all stale remote-tracking branches.
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373 """
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
374 remoteName = self.repolist.selectedItems()[0].text(0)
baf6da1ae288 Added the git plug-in to the core plug-ins.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375 self.vcs.gitPruneRemote(self.projectDir, remoteName)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
376
6324
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
377 @pyqtSlot()
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
378 def on_renameButton_clicked(self):
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
379 """
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
380 Private slot to rename a remote repository.
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
381 """
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
382 remoteName = self.repolist.selectedItems()[0].text(0)
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
383 self.vcs.gitRenameRemote(self.projectDir, remoteName)
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
384 self.on_refreshButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
385
6324
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
386 @pyqtSlot()
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
387 def on_changeUrlButton_clicked(self):
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
388 """
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
389 Private slot to change the URL of a remote repository.
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
390 """
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
391 repositoryItem = self.repolist.selectedItems()[0]
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
392 remoteName = repositoryItem.text(0)
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
393 remoteUrl = repositoryItem.text(1)
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
394 self.vcs.gitChangeRemoteUrl(self.projectDir, remoteName, remoteUrl)
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
395 self.on_refreshButton_clicked()
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
396
6324
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
397 @pyqtSlot()
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
398 def on_credentialsButton_clicked(self):
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
399 """
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
400 Private slot to change the credentials of a remote repository.
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
401 """
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
402 repositoryItem = self.repolist.selectedItems()[0]
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
403 remoteName = repositoryItem.text(0)
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
404 remoteUrl = repositoryItem.text(1)
9221
bf71ee032bb4 Reformatted the source code using the 'Black' utility.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 9209
diff changeset
405 self.vcs.gitChangeRemoteCredentials(self.projectDir, remoteName, remoteUrl)
6324
b11c36cba2a1 Git: added capability to change the URL and/or user credentials for a remote repository.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 6318
diff changeset
406 self.on_refreshButton_clicked()

eric ide

mercurial