Plugins/VcsPlugins/vcsMercurial/QueuesExtension/HgQueuesListDialog.py

Sat, 14 Dec 2013 23:44:25 +0100

author
T.Rzepka <Tobias.Rzepka@gmail.com>
date
Sat, 14 Dec 2013 23:44:25 +0100
branch
Py2 comp.
changeset 3145
a9de05d4a22f
parent 3060
5883ce99ee12
child 3161
06f57a834adf
permissions
-rw-r--r--

# __IGNORE_WARNING__ added/ removed.

1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
2302
f29e9405c851 Updated copyright for 2013.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1640
diff changeset
3 # Copyright (c) 2011 - 2013 Detlev Offenbach <detlev@die-offenbachs.de>
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog to show a list of applied and unapplied patches.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3060
diff changeset
10 from __future__ import unicode_literals
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
11 try:
3145
a9de05d4a22f # __IGNORE_WARNING__ added/ removed.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 3060
diff changeset
12 str = unicode # __IGNORE_WARNING__
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
13 except (NameError):
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
14 pass
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
15
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16 import os
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
1260
9488a3aceb0e Added code to some Mercurial dialogs to improve user experience.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
18 from PyQt4.QtCore import pyqtSlot, QProcess, Qt, QTimer, QCoreApplication
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
19 from PyQt4.QtGui import QDialog, QDialogButtonBox, QHeaderView, \
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
20 QTreeWidgetItem, QLineEdit
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22 from E5Gui import E5MessageBox
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 from .Ui_HgQueuesListDialog import Ui_HgQueuesListDialog
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 import Preferences
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 class HgQueuesListDialog(QDialog, Ui_HgQueuesListDialog):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
31 Class implementing a dialog to show a list of applied and unapplied
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
32 patches.
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 def __init__(self, vcs, parent=None):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 Constructor
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38 @param vcs reference to the vcs object
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 @param parent parent widget (QWidget)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 """
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
41 super(HgQueuesListDialog, self).__init__(parent)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42 self.setupUi(self)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(False)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.buttonBox.button(QDialogButtonBox.Cancel).setDefault(True)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 self.process = QProcess()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48 self.vcs = vcs
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
49 self.__hgClient = vcs.getClient()
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 self.patchesList.header().setSortIndicator(0, Qt.AscendingOrder)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 self.process.finished.connect(self.__procFinished)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 self.process.readyReadStandardOutput.connect(self.__readStdout)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 self.process.readyReadStandardError.connect(self.__readStderr)
1055
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
56
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
57 self.__statusDict = {
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
58 "A": self.trUtf8("applied"),
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
59 "U": self.trUtf8("not applied"),
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
60 "G": self.trUtf8("guarded"),
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
61 "D": self.trUtf8("missing"),
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
62 }
1260
9488a3aceb0e Added code to some Mercurial dialogs to improve user experience.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
63
9488a3aceb0e Added code to some Mercurial dialogs to improve user experience.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
64 self.show()
9488a3aceb0e Added code to some Mercurial dialogs to improve user experience.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1256
diff changeset
65 QCoreApplication.processEvents()
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 def closeEvent(self, e):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69 Private slot implementing a close event handler.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71 @param e close event (QCloseEvent)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 """
1256
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1255
diff changeset
73 if self.__hgClient:
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1255
diff changeset
74 if self.__hgClient.isExecuting():
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1255
diff changeset
75 self.__hgClient.cancel()
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1255
diff changeset
76 else:
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1255
diff changeset
77 if self.process is not None and \
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1255
diff changeset
78 self.process.state() != QProcess.NotRunning:
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1255
diff changeset
79 self.process.terminate()
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1255
diff changeset
80 QTimer.singleShot(2000, self.process.kill)
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1255
diff changeset
81 self.process.waitForFinished(3000)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 e.accept()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 def start(self, path):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 Public slot to start the list command.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 @param path name of directory to be listed (string)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.errorGroup.hide()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 self.intercept = False
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 self.activateWindow()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 dname, fname = self.vcs.splitPath(path)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 # find the root of the repo
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 repodir = dname
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 while not os.path.isdir(os.path.join(repodir, self.vcs.adminDir)):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 repodir = os.path.dirname(repodir)
1318
6fa303bd65d6 Fixed issues in various Mercurial files that could cause infinite loops on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1260
diff changeset
102 if os.path.splitdrive(repodir)[1] == os.sep:
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103 return
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 self.__repodir = repodir
1055
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
106 self.__getSeries()
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107
1055
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
108 def __getSeries(self, missing=False):
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
110 Private slot to get the list of applied, unapplied and guarded patches
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
111 and patches missing in the series file.
1055
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
112
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
113 @param missing flag indicating to get the patches missing in the
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
114 series file (boolean)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 """
1055
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
116 if missing:
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
117 self.__mode = "missing"
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
118 else:
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
119 self.__mode = "qseries"
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 args = []
1055
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
122 args.append('qseries')
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 args.append('--summary')
1055
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
124 args.append('--verbose')
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
125 if missing:
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
126 args.append('--missing')
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
128 if self.__hgClient:
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 self.inputGroup.setEnabled(False)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 self.inputGroup.hide()
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
131
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
132 out, err = self.__hgClient.runcommand(args)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
133 if err:
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
134 self.__showError(err)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
135 if out:
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
136 for line in out.splitlines():
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
137 self.__processOutputLine(line)
1256
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1255
diff changeset
138 if self.__hgClient.wasCanceled():
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1255
diff changeset
139 self.__mode = ""
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1255
diff changeset
140 break
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
141 if self.__mode == "qseries":
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
142 self.__getSeries(True)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
143 elif self.__mode == "missing":
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
144 self.__getTop()
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
145 else:
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
146 self.__finish()
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 else:
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
148 self.process.kill()
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
149 self.process.setWorkingDirectory(self.__repodir)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
150
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
151 self.process.start('hg', args)
2771
281c9b30dd91 Changed all QProcess.waitForStarted() calls to use a 5s timeout (except the debugger interfaces, which have a 10s timeout).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
152 procStarted = self.process.waitForStarted(5000)
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
153 if not procStarted:
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
154 self.inputGroup.setEnabled(False)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
155 self.inputGroup.hide()
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
156 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
157 self,
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
158 self.trUtf8('Process Generation Error'),
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
159 self.trUtf8(
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
160 'The process {0} could not be started. '
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
161 'Ensure, that it is in the search path.'
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
162 ).format('hg'))
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
163 else:
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
164 self.inputGroup.setEnabled(True)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
165 self.inputGroup.show()
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 def __getTop(self):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 Private slot to get patch at the top of the stack.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 self.__mode = "qtop"
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 args = []
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 args.append('qtop')
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
176 if self.__hgClient:
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 self.inputGroup.setEnabled(False)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 self.inputGroup.hide()
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
179
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
180 out, err = self.__hgClient.runcommand(args)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
181 if err:
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
182 self.__showError(err)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
183 if out:
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
184 for line in out.splitlines():
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
185 self.__processOutputLine(line)
1256
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1255
diff changeset
186 if self.__hgClient.wasCanceled():
885706dbb69f Refined the Mercurial command server interface.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1255
diff changeset
187 break
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
188 self.__finish()
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 else:
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
190 self.process.kill()
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
191 self.process.setWorkingDirectory(self.__repodir)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
192
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
193 self.process.start('hg', args)
2771
281c9b30dd91 Changed all QProcess.waitForStarted() calls to use a 5s timeout (except the debugger interfaces, which have a 10s timeout).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2302
diff changeset
194 procStarted = self.process.waitForStarted(5000)
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
195 if not procStarted:
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
196 self.inputGroup.setEnabled(False)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
197 self.inputGroup.hide()
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
198 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3008
diff changeset
199 self,
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
200 self.trUtf8('Process Generation Error'),
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
201 self.trUtf8(
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
202 'The process {0} could not be started. '
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
203 'Ensure, that it is in the search path.'
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
204 ).format('hg'))
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
205 else:
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
206 self.inputGroup.setEnabled(True)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
207 self.inputGroup.show()
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 def __finish(self):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 """
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
211 Private slot called when the process finished or the user pressed
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
212 the button.
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 if self.process is not None and \
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215 self.process.state() != QProcess.NotRunning:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 self.process.terminate()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 QTimer.singleShot(2000, self.process.kill)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 self.process.waitForFinished(3000)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 self.inputGroup.setEnabled(False)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221 self.inputGroup.hide()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 self.buttonBox.button(QDialogButtonBox.Close).setEnabled(True)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 self.buttonBox.button(QDialogButtonBox.Cancel).setEnabled(False)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 self.buttonBox.button(QDialogButtonBox.Close).setDefault(True)
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
226 self.buttonBox.button(QDialogButtonBox.Close).setFocus(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
227 Qt.OtherFocusReason)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 self.process = None
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 if self.patchesList.topLevelItemCount() == 0:
1055
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
232 # no patches present
3008
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
233 self.__generateItem(
7848489bcb92 Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
234 0, "", self.trUtf8("no patches found"), "", True)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
235 self.__resizeColumns()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
236 self.__resort()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
238 def on_buttonBox_clicked(self, button):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
239 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 Private slot called by a button of the button box clicked.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
241
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
242 @param button button that was clicked (QAbstractButton)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
243 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
244 if button == self.buttonBox.button(QDialogButtonBox.Close):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 self.close()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
246 elif button == self.buttonBox.button(QDialogButtonBox.Cancel):
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
247 self.__mode = ""
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
248 if self.__hgClient:
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
249 self.__hgClient.cancel()
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
250 else:
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
251 self.__finish()
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
252
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
253 def __procFinished(self, exitCode, exitStatus):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
254 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
255 Private slot connected to the finished signal.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
256
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
257 @param exitCode exit code of the process (integer)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
258 @param exitStatus exit status of the process (QProcess.ExitStatus)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
259 """
1055
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
260 if self.__mode == "qseries":
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
261 self.__getSeries(True)
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
262 elif self.__mode == "missing":
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
263 self.__getTop()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
264 else:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
265 self.__finish()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
266
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 def __resort(self):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
268 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
269 Private method to resort the tree.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
270 """
3023
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
271 self.patchesList.sortItems(
34ce20603bf7 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
272 self.patchesList.sortColumn(),
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
273 self.patchesList.header().sortIndicatorOrder())
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
274
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
275 def __resizeColumns(self):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
276 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
277 Private method to resize the list columns.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279 self.patchesList.header().resizeSections(QHeaderView.ResizeToContents)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 self.patchesList.header().setStretchLastSection(True)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281
1055
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
282 def __generateItem(self, index, status, name, summary, error=False):
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 Private method to generate a patch item in the list of patches.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285
1055
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
286 @param index index of the patch (integer, -1 for missing)
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
287 @param status status of the patch (string)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288 @param name name of the patch (string)
1039
dc91f24e307d Fixed an issue in the new MQ list patches dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
289 @param summary first line of the patch header (string)
dc91f24e307d Fixed an issue in the new MQ list patches dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
290 @param error flag indicating an error entry (boolean)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
291 """
1039
dc91f24e307d Fixed an issue in the new MQ list patches dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
292 if error:
dc91f24e307d Fixed an issue in the new MQ list patches dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
293 itm = QTreeWidgetItem(self.patchesList, [
dc91f24e307d Fixed an issue in the new MQ list patches dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
294 "",
dc91f24e307d Fixed an issue in the new MQ list patches dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
295 name,
dc91f24e307d Fixed an issue in the new MQ list patches dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
296 "",
dc91f24e307d Fixed an issue in the new MQ list patches dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
297 summary
dc91f24e307d Fixed an issue in the new MQ list patches dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
298 ])
dc91f24e307d Fixed an issue in the new MQ list patches dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1034
diff changeset
299 else:
1055
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
300 if index == -1:
1640
1699d46026cd Fixed a compatibility issue with Qt 4.8.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
301 index = ""
1055
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
302 try:
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
303 statusStr = self.__statusDict[status]
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
304 except KeyError:
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
305 statusStr = self.trUtf8("unknown")
1640
1699d46026cd Fixed a compatibility issue with Qt 4.8.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
306 itm = QTreeWidgetItem(self.patchesList)
1699d46026cd Fixed a compatibility issue with Qt 4.8.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
307 itm.setData(0, Qt.DisplayRole, index)
1699d46026cd Fixed a compatibility issue with Qt 4.8.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
308 itm.setData(1, Qt.DisplayRole, name)
1699d46026cd Fixed a compatibility issue with Qt 4.8.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
309 itm.setData(2, Qt.DisplayRole, statusStr)
1699d46026cd Fixed a compatibility issue with Qt 4.8.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1532
diff changeset
310 itm.setData(3, Qt.DisplayRole, summary)
1055
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
311 if status == "A":
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
312 # applied
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
313 for column in range(itm.columnCount()):
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
314 itm.setForeground(column, Qt.blue)
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
315 elif status == "D":
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
316 # missing
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
317 for column in range(itm.columnCount()):
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
318 itm.setForeground(column, Qt.red)
885c8d93e6f9 Refined the Mercurial patches list dialog.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1039
diff changeset
319
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
320 itm.setTextAlignment(0, Qt.AlignRight)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
321 itm.setTextAlignment(2, Qt.AlignHCenter)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
322
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
323 def __markTopItem(self, name):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 Private slot to mark the top patch entry.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 @param name name of the patch (string)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 items = self.patchesList.findItems(name, Qt.MatchCaseSensitive, 1)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 if items:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 itm = items[0]
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 for column in range(itm.columnCount()):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
333 font = itm.font(column)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 font.setBold(True)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335 itm.setFont(column, font)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 def __readStdout(self):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 Private slot to handle the readyReadStdout signal.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341 It reads the output of the process, formats it and inserts it into
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
342 the contents pane.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 self.process.setReadChannel(QProcess.StandardOutput)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 while self.process.canReadLine():
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347 s = str(self.process.readLine(),
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 Preferences.getSystem("IOEncoding"),
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349 'replace').strip()
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
350 self.__processOutputLine(s)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
351
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
352 def __processOutputLine(self, line):
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
353 """
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
354 Private method to process the lines of output.
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
355
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
356 @param line output line to be processed (string)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
357 """
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
358 if self.__mode == "qtop":
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
359 self.__markTopItem(line)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
360 else:
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3023
diff changeset
361 li = line.split(": ", 1)
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3023
diff changeset
362 if len(li) == 1:
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3023
diff changeset
363 data, summary = li[0][:-1], ""
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 else:
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3023
diff changeset
365 data, summary = li[0], li[1]
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3023
diff changeset
366 li = data.split(None, 2)
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3023
diff changeset
367 if len(li) == 2:
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
368 # missing entry
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3023
diff changeset
369 index, status, name = -1, li[0], li[1]
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3023
diff changeset
370 elif len(li) == 3:
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3023
diff changeset
371 index, status, name = li[:3]
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
372 else:
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
373 return
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
374 self.__generateItem(index, status, name, summary)
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 def __readStderr(self):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 Private slot to handle the readyReadStderr signal.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
380 It reads the error output of the process and inserts it into the
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
381 error pane.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383 if self.process is not None:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 s = str(self.process.readAllStandardError(),
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 Preferences.getSystem("IOEncoding"),
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
386 'replace')
1255
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
387 self.__showError(s)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
388
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
389 def __showError(self, out):
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
390 """
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
391 Private slot to show some error.
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
392
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
393 @param out error to be shown (string)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
394 """
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
395 self.errorGroup.show()
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
396 self.errors.insertPlainText(out)
e1d8a8a4d40c Continued implementing an interface to the Mercurial command server.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1131
diff changeset
397 self.errors.ensureCursorVisible()
1034
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
399 def on_passwordCheckBox_toggled(self, isOn):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 Private slot to handle the password checkbox toggled.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
402
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
403 @param isOn flag indicating the status of the check box (boolean)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
404 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
405 if isOn:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 self.input.setEchoMode(QLineEdit.Password)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
407 else:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
408 self.input.setEchoMode(QLineEdit.Normal)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
409
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
410 @pyqtSlot()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 def on_sendButton_clicked(self):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 Private slot to send the input to the subversion process.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
414 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415 input = self.input.text()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
416 input += os.linesep
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
418 if self.passwordCheckBox.isChecked():
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 self.errors.insertPlainText(os.linesep)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 self.errors.ensureCursorVisible()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
421 else:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
422 self.errors.insertPlainText(input)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
423 self.errors.ensureCursorVisible()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
424
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 self.process.write(input)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
426
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
427 self.passwordCheckBox.setChecked(False)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
428 self.input.clear()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
429
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 def on_input_returnPressed(self):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 Private slot to handle the press of the return key in the input field.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
433 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
434 self.intercept = True
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 self.on_sendButton_clicked()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 def keyPressEvent(self, evt):
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 Protected slot to handle a key press event.
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 @param evt the key press event (QKeyEvent)
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442 """
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 if self.intercept:
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 self.intercept = False
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445 evt.accept()
8a7fa049e9d3 Started with support for Mercurial queues extension.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
446 return
2525
8b507a9a2d40 Script changes: Future import added, super calls modified and unicode behavior for str.
T.Rzepka <Tobias.Rzepka@gmail.com>
parents: 2302
diff changeset
447 super(HgQueuesListDialog, self).keyPressEvent(evt)

eric ide

mercurial