ProjectPyramid/MigrateSummaryDialog.py

Sun, 06 Jun 2021 16:30:37 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 06 Jun 2021 16:30:37 +0200
branch
eric7
changeset 148
dcbd3a96f03c
child 156
62170c2682a3
permissions
-rw-r--r--

Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.

148
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
3 # Copyright (c) 2020 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a dialog showing a summary of all created.migrations.
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10 from PyQt6.QtCore import pyqtSlot, Qt, QProcess, QEventLoop, QTimer
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 from PyQt6.QtGui import QGuiApplication
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 from PyQt6.QtWidgets import (
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
13 QDialog, QDialogButtonBox, QAbstractButton, QTreeWidgetItem,
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14 QAbstractItemView
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
15 )
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17 from EricGui.EricOverrideCursor import EricOverrideCursor, EricOverridenCursor
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18 from EricWidgets import EricMessageBox
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
19
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
20 from .Ui_MigrateSummaryDialog import Ui_MigrateSummaryDialog
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
22
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
23 class MigrateSummaryDialog(QDialog, Ui_MigrateSummaryDialog):
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
24 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
25 Class implementing a dialog showing a summary of all created.migrations.
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
26 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27 def __init__(self, project, parent=None):
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
28 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
29 Constructor
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
30
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
31 @param project reference to the project object
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
32 @type Project
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
33 @param parent reference to the parent widget
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34 @type QWidget
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 super().__init__(parent)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37 self.setupUi(self)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
38
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
39 self.__refreshButton = self.buttonBox.addButton(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 self.tr("Refresh"), QDialogButtonBox.ButtonRole.ActionRole)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
41 self.__refreshButton.clicked.connect(self.showSummary)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
43 self.__project = project
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
44
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
45 self.__process = None
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
46 self.__currentItemIndex = 1000000
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
47 self.__currentRevision = ""
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
48
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 def showSummary(self):
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
50 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
51 Public method to show the migrations summary.
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
52 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 projectPath = self.__project.projectPath()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 self.show()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 self.raise_()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 self.buttonBox.button(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 QDialogButtonBox.StandardButton.Close).setEnabled(False)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60 self.buttonBox.button(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 QDialogButtonBox.StandardButton.Cancel).setDefault(True)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 self.buttonBox.button(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 QDialogButtonBox.StandardButton.Cancel).setEnabled(True)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 self.buttonBox.button(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65 QDialogButtonBox.StandardButton.Cancel).setFocus(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 Qt.FocusReason.OtherFocusReason)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67 QGuiApplication.processEvents(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68 QEventLoop.ProcessEventsFlag.ExcludeUserInputEvents)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
69
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70 command = self.__project.getAlembicCommand()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
71
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
72 self.__process = QProcess()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
73 self.__process.setWorkingDirectory(projectPath)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
74
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
75 args = ["-c", "development.ini", "history", "--indicate-current"]
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77 with EricOverrideCursor():
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
78 self.__process.start(command, args)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
79 ok = self.__process.waitForStarted(10000)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
80 if ok:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 ok = self.__process.waitForFinished(10000)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 if ok:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 out = str(self.__process.readAllStandardOutput(),
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 "utf-8")
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 self.__processOutput(out)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 self.__selectItem(self.__currentRevision)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 else:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 with EricOverridenCursor():
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 EricMessageBox.critical(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 None,
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 self.tr("Migrations Summary"),
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 self.tr("""The 'alembic' process did not finish"""
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93 """ within 10 seconds."""))
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
94 else:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
95 with EricOverridenCursor():
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
96 EricMessageBox.critical(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
97 None,
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
98 self.tr("Migrations Summary"),
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
99 self.tr("""The 'alembic' process could not be"""
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
100 """ started."""))
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
101 for column in range(self.summaryWidget.columnCount()):
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
102 self.summaryWidget.resizeColumnToContents(column)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
103
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
104 self.buttonBox.button(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 QDialogButtonBox.StandardButton.Cancel).setEnabled(False)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
106 self.buttonBox.button(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
107 QDialogButtonBox.StandardButton.Close).setEnabled(True)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 self.buttonBox.button(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
109 QDialogButtonBox.StandardButton.Close).setDefault(True)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
110 self.buttonBox.button(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 QDialogButtonBox.StandardButton.Close).setFocus(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
112 Qt.FocusReason.OtherFocusReason)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
113
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 def __processOutput(self, output):
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
116 Private method to process the flask output and populate the summary
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
117 list.
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
118
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
119 @param output output of the flask process
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
120 @type str
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
122 self.summaryWidget.clear()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
123 self.upDownButton.setEnabled(False)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 self.__currentItemIndex = 1000000
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
125 self.__currentRevision = ""
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
126
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
127 lines = output.splitlines()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
128 for line in lines:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 isCurrent = False
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
130 oldRev, rest = line.split("->")
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
131 rest, message = rest.split(",", 1)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
132 newRev, *labels = rest.split()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133 if labels:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 labelList = [
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
135 label.replace("(", "").replace(")", "")
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
136 for label in labels
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
137 ]
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
138 labelsStr = ", ".join(labelList)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
139 if "current" in labelList:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
140 isCurrent = True
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
141 else:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
142 labelsStr = ""
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
143
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
144 itm = QTreeWidgetItem(self.summaryWidget, [
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
145 oldRev.strip(),
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
146 newRev.strip(),
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
147 message.strip(),
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
148 labelsStr,
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 ])
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
150 if isCurrent:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
151 font = itm.font(0)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
152 font.setBold(True)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
153 for column in range(self.summaryWidget.columnCount()):
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
154 itm.setFont(column, font)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
156 self.__currentItemIndex = (
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
157 self.summaryWidget.indexOfTopLevelItem(itm)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
158 )
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
159 self.__currentRevision = newRev.strip()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
161 @pyqtSlot()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
162 def on_summaryWidget_itemSelectionChanged(self):
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
163 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164 Private slot to handle the selection of an entry.
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
166 items = self.summaryWidget.selectedItems()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
167 if items:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
168 index = self.summaryWidget.indexOfTopLevelItem(items[0])
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
169 if index < self.__currentItemIndex:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
170 self.upDownButton.setText(self.tr("Upgrade"))
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
171 elif index > self.__currentItemIndex:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
172 self.upDownButton.setText(self.tr("Downgrade"))
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
173 self.upDownButton.setEnabled(index != self.__currentItemIndex)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
174 else:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
175 self.upDownButton.setEnabled(False)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
176
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
177 @pyqtSlot()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 def on_upDownButton_clicked(self):
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
179 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
180 Private slot to upgrade/downgrade to the selected revision.
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
181 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
182 itm = self.summaryWidget.selectedItems()[0]
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 rev = itm.text(1)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
184 if self.upDownButton.text() == self.tr("Upgrade"):
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
185 self.__project.upgradeDatabase(revision=rev)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
186 else:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 self.__project.downgradeDatabase(revision=rev)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188 self.showSummary()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 @pyqtSlot(QAbstractButton)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
191 def on_buttonBox_clicked(self, button):
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
192 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
193 Private slot handling a button press of the button box.
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
194
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
195 @param button reference to the pressed button
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
196 @type QAbstractButton
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
197 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
198 if button is self.buttonBox.button(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
199 QDialogButtonBox.StandardButton.Cancel
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 ):
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
201 self.__cancelProcess()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
202
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 @pyqtSlot()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
204 def __cancelProcess(self):
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
205 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 Private slot to terminate the current process.
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
208 if (
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
209 self.__process is not None and
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
210 self.__process.state() != QProcess.ProcessState.NotRunning
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
211 ):
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 self.__process.terminate()
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
213 QTimer.singleShot(2000, self.__process.kill)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
214 self.__process.waitForFinished(3000)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
215
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216 self.__process = None
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
218 def __selectItem(self, revision):
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
219 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
220 Private method to select an item given its revision.
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
221
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
222 @param revision revision of the item to select
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
223 @type str
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
224 """
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
225 if revision:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
226 items = self.summaryWidget.findItems(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 revision, Qt.MatchFlag.MatchExactly, 1)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
228 if items:
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
229 # select the first item
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
230 items[0].setSelected(True)
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 self.summaryWidget.scrollToItem(
dcbd3a96f03c Ported the plug-in to PyQt6 for eric7 and adopted it for Pyramid 2.x.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
232 items[0], QAbstractItemView.ScrollHint.PositionAtCenter)

eric ide

mercurial