PluginExtensionProtobuf.py

Sun, 04 Dec 2022 14:32:07 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 04 Dec 2022 14:32:07 +0100
changeset 1
7157a39d4a0f
parent 0
PluginExtensionProtobuf@f6cff7759b24
child 3
31678035389a
permissions
-rw-r--r--

First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.

1
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
1 # -*- coding: utf-8 -*-
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
2
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
3 # Copyright (c) 2022 Detlev Offenbach <detlev@die-offenbachs.de>
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
4 #
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
5
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
6 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
7 Module implementing a plugin to add support for Protobuf development.
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
8 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
9
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
10 import os
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
11
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
12 from PyQt6.QtCore import QCoreApplication, QObject, QTranslator
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
13
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
14 from eric7 import Globals, Preferences
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
15 from eric7.EricWidgets import EricMessageBox
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
16 from eric7.EricWidgets.EricApplication import ericApp
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
17 from ExtensionProtobuf.ProjectProtocolsBrowser import ProjectProtocolsBrowser
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
18
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
19 # Start-Of-Header
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
20 name = "Protobuf and gRPC Extension Plugin"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
21 author = "Detlev Offenbach <detlev@die-offenbachs.de>"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
22 autoactivate = True
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
23 deactivateable = True
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
24 version = "10.0.0"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
25 className = "ProtobufExtensionPlugin"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
26 packageName = "ExtensionProtobuf"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
27 shortDescription = "Support for the development of Protobuf and gRPC projects"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
28 longDescription = (
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
29 "This plugin adds support for the development of Protobuf and gRPC related"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
30 " projects."
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
31 )
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
32 needsRestart = False
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
33 pyqtApi = 2
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
34 # End-Of-Header
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
35
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
36 error = ""
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
37
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
38 protobufExtensionPluginObject = None
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
39
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
40
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
41 def exeDisplayDataList():
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
42 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
43 Module function to support the display of some executable info.
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
44
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
45 @return list of dictionaries containing the data to query the presence of
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
46 the executable
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
47 @rtype list of dict
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
48 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
49 global protobufExtensionPluginObject
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
50
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
51 # 1. Protobuf compiler
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
52 if protobufExtensionPluginObject is None:
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
53 protocData = {
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
54 "programEntry": False,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
55 "header": QCoreApplication.translate(
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
56 "ProtobufExtensionPlugin", "Protobuf Compiler"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
57 ),
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
58 "text": QCoreApplication.translate(
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
59 "ProtobufExtensionPlugin",
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
60 "Protobuf and gRPC Support plugin is not activated",
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
61 ),
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
62 "version": QCoreApplication.translate(
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
63 "ProtobufExtensionPlugin", "(inactive)"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
64 ),
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
65 }
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
66 else:
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
67 exe = protobufExtensionPluginObject.getPreferences("protoc")
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
68 if not exe:
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
69 exe = "protoc.exe" if Globals.isWindowsPlatform() else "protoc"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
70
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
71 protocData = {
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
72 "programEntry": True,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
73 "header": QCoreApplication.translate(
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
74 "ProtobufExtensionPlugin", "Protobuf Compiler"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
75 ),
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
76 "exe": exe,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
77 "versionCommand": "--version",
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
78 "versionStartsWith": "libprotoc",
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
79 "versionRe": "",
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
80 "versionPosition": -1,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
81 "version": "",
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
82 "versionCleanup": None,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
83 "exeModule": None,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
84 }
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
85
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
86 # 2. grpc compiler
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
87 if protobufExtensionPluginObject is None:
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
88 grpcData = {
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
89 "programEntry": False,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
90 "header": QCoreApplication.translate(
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
91 "ProtobufExtensionPlugin", "gRPC Compiler"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
92 ),
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
93 "text": QCoreApplication.translate(
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
94 "ProtobufExtensionPlugin",
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
95 "Protobuf and gRPC Support plugin is not activated",
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
96 ),
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
97 "version": QCoreApplication.translate(
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
98 "ProtobufExtensionPlugin", "(inactive)"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
99 ),
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
100 }
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
101 else:
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
102 env = protobufExtensionPluginObject.getPreferences("grpcPythonEnv")
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
103 interpreter = (
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
104 ericApp().getObject("VirtualEnvManager").getVirtualenvInterpreter(env)
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
105 )
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
106 if not interpreter:
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
107 interpreter = Globals.getPythonExecutable()
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
108
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
109 grpcData = {
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
110 "programEntry": True,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
111 "header": QCoreApplication.translate(
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
112 "ProtobufExtensionPlugin", "gRPC Compiler"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
113 ),
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
114 "exe": interpreter,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
115 "versionCommand": "--version",
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
116 "versionStartsWith": "libprotoc",
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
117 "versionRe": "",
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
118 "versionPosition": -1,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
119 "version": "",
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
120 "versionCleanup": None,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
121 "exeModule": ["-m", "grpc_tools.protoc"],
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
122 }
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
123
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
124 return [protocData, grpcData]
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
125
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
126
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
127 def getConfigData():
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
128 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
129 Module function returning data as required by the configuration dialog.
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
130
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
131 @return dictionary containing the relevant data
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
132 @rtype dict
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
133 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
134 return {
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
135 "protobufPage": [
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
136 QCoreApplication.translate("ProtobufExtensionPlugin", "Protobuf and gRPC"),
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
137 os.path.join("ExtensionProtobuf", "icons", "protobuf"),
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
138 createProtobufPage,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
139 None,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
140 None,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
141 ],
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
142 }
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
143
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
144
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
145 def createProtobufPage(configDlg):
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
146 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
147 Module function to create the Protobuf configuration page.
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
148
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
149 @param configDlg reference to the configuration dialog
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
150 @type ConfigurationWidget
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
151 @return reference to the configuration page
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
152 @rtype CorbaPage
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
153 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
154 from ExtensionProtobuf.ConfigurationPage.ProtobufPage import ProtobufPage
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
155
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
156 # __IGNORE_WARNING_I102__
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
157
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
158 global protobufExtensionPluginObject
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
159
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
160 page = ProtobufPage(protobufExtensionPluginObject)
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
161 return page
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
162
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
163
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
164 def prepareUninstall():
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
165 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
166 Module function to prepare for an un-installation.
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
167 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
168 Preferences.getSettings().remove(ProtobufExtensionPlugin.PreferencesKey)
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
169
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
170
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
171 class ProtobufExtensionPlugin(QObject):
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
172 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
173 Class implementing a plugin to add support for Protobuf development.
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
174 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
175
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
176 PreferencesKey = "Corba"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
177
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
178 def __init__(self, ui):
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
179 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
180 Constructor
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
181
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
182 @param ui reference to the user interface object
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
183 @type UI.UserInterface
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
184 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
185 super().__init__(ui)
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
186 self.__ui = ui
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
187 self.__initialize()
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
188
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
189 self.__defaults = {
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
190 "protoc": "",
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
191 "grpcPythonEnv": "",
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
192 }
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
193
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
194 def __initialize(self):
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
195 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
196 Private slot to (re)initialize the plugin.
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
197 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
198 global protobufExtensionPluginObject
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
199 protobufExtensionPluginObject = None
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
200
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
201 self.__browser = None
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
202
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
203 def activate(self):
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
204 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
205 Public method to activate this plug-in.
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
206
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
207 @return tuple of None and activation status
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
208 @rtype bool
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
209 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
210 global error, protobufExtensionPluginObject
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
211 error = "" # clear previous error
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
212
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
213 if self.__ui.versionIsNewer("22.12"):
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
214 protobufExtensionPluginObject = self
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
215
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
216 self.__browser = ProjectProtocolsBrowser(self)
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
217
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
218 return None, True
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
219 else:
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
220 EricMessageBox.warning(
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
221 self.__ui,
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
222 self.tr("Protobuf and gRPC Extension"),
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
223 self.tr(
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
224 "The Protobuf and gRPC extension cannot be activated because it"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
225 " requires eric7 23.1 or newer."
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
226 ),
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
227 )
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
228 error = self.tr(
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
229 "The Protobuf and gRPC extension cannot be activated because it"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
230 " requires eric7 23.1 or newer."
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
231 )
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
232
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
233 return None, False
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
234
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
235 def deactivate(self):
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
236 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
237 Public method to deactivate this plug-in.
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
238 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
239 self.__browser.deactivate()
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
240
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
241 self.__initialize()
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
242
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
243 def __loadTranslator(self):
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
244 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
245 Private method to load the translation file.
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
246 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
247 if self.__ui is not None:
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
248 loc = self.__ui.getLocale()
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
249 if loc and loc != "C":
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
250 locale_dir = os.path.join(
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
251 os.path.dirname(__file__), "ExtensionProtobuf", "i18n"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
252 )
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
253 translation = "protobuf_{0}".format(loc)
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
254 translator = QTranslator(None)
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
255 loaded = translator.load(translation, locale_dir)
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
256 if loaded:
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
257 self.__translator = translator
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
258 ericApp().installTranslator(self.__translator)
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
259 else:
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
260 print(
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
261 "Warning: translation file '{0}' could not be"
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
262 " loaded.".format(translation)
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
263 )
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
264 print("Using default.")
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
265
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
266 def getPreferences(self, key):
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
267 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
268 Public method to retrieve the various settings values.
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
269
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
270 @param key the key of the value to get
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
271 @type str
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
272 @return the requested setting value
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
273 @rtype any
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
274 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
275 return Preferences.Prefs.settings.value(
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
276 self.PreferencesKey + "/" + key, self.__defaults[key]
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
277 )
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
278
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
279 def setPreferences(self, key, value):
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
280 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
281 Public method to store the various settings values.
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
282
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
283 @param key the key of the setting to be set
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
284 @type str
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
285 @param value the value to be set
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
286 @type any
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
287 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
288 Preferences.Prefs.settings.setValue(self.PreferencesKey + "/" + key, value)
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
289
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
290
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
291 def installDependencies(pipInstall):
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
292 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
293 Function to install dependencies of this plug-in.
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
294
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
295 @param pipInstall function to be called with a list of package names.
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
296 @type function
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
297 """
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
298 try:
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
299 import grpc_tools # __IGNORE_WARNING__
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
300 except ImportError:
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
301 pipInstall(["protobuf", "grpcio", "grpcio-tools"])
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
302
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
303
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
304 #
7157a39d4a0f First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
305 # eflag: noqa = M801

eric ide

mercurial