Mon, 30 Oct 2023 09:01:50 +0100
Prepared a new release.
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 | |
22
ed2d8f5eaa66
Updated copyright for 2023.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
20
diff
changeset
|
3 | # Copyright (c) 2022 - 2023 Detlev Offenbach <detlev@die-offenbachs.de> |
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
|
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 | |
12
8ddcd9d47bdf
Changed some import statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10
diff
changeset
|
14 | from eric7 import Preferences |
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
|
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 |
12
8ddcd9d47bdf
Changed some import statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10
diff
changeset
|
17 | from eric7.SystemUtilities import OSUtilities, PythonUtilities |
10
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
18 | from ExtensionProtobuf import protoclbr |
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
|
19 | 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
|
20 | |
7157a39d4a0f
First incarnation of 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 | # 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
|
22 | 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
|
23 | 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
|
24 | 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
|
25 | deactivateable = True |
27
5e9a61e7d7d0
Added the context menu action "New protocol file..." to give a more concise way to create a new protocol file.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
25
diff
changeset
|
26 | version = "10.1.7" |
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
|
27 | 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
|
28 | 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
|
29 | 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
|
30 | 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
|
31 | "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
|
32 | " 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
|
33 | ) |
7157a39d4a0f
First incarnation of 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 | 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
|
35 | 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
|
36 | # 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
|
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 | 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
|
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 | 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
|
41 | |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | 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
|
46 | |
7157a39d4a0f
First incarnation of 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 | @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
|
48 | 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
|
49 | @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
|
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 | 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
|
52 | |
7157a39d4a0f
First incarnation of 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 | # 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
|
54 | 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
|
55 | 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
|
56 | "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
|
57 | "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
|
58 | "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
|
59 | ), |
7157a39d4a0f
First incarnation of 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 | "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
|
61 | "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
|
62 | "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
|
63 | ), |
7157a39d4a0f
First incarnation of 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 | "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
|
65 | "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
|
66 | ), |
7157a39d4a0f
First incarnation of 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 | } |
7157a39d4a0f
First incarnation of 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 | 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
|
69 | 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
|
70 | if not exe: |
12
8ddcd9d47bdf
Changed some import statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10
diff
changeset
|
71 | exe = "protoc.exe" if OSUtilities.isWindowsPlatform() else "protoc" |
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
|
72 | |
7157a39d4a0f
First incarnation of 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 | 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
|
74 | "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
|
75 | "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
|
76 | "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
|
77 | ), |
7157a39d4a0f
First incarnation of 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 | "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
|
79 | "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
|
80 | "versionStartsWith": "libprotoc", |
25
55f3e6aac88c
Fixed an issue preventing the grpc compiler version to be detected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
23
diff
changeset
|
81 | "versionRe": None, |
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
|
82 | "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
|
83 | "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
|
84 | "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
|
85 | "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
|
86 | } |
7157a39d4a0f
First incarnation of 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 | |
7157a39d4a0f
First incarnation of 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 | # 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
|
89 | 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
|
90 | 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
|
91 | "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
|
92 | "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
|
93 | "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
|
94 | ), |
7157a39d4a0f
First incarnation of 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 | "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
|
96 | "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
|
97 | "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
|
98 | ), |
7157a39d4a0f
First incarnation of 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 | "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
|
100 | "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
|
101 | ), |
7157a39d4a0f
First incarnation of 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 | } |
7157a39d4a0f
First incarnation of 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 | 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
|
104 | 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
|
105 | 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
|
106 | 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
|
107 | ) |
7157a39d4a0f
First incarnation of 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 | if not interpreter: |
12
8ddcd9d47bdf
Changed some import statements.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
10
diff
changeset
|
109 | interpreter = PythonUtilities.getPythonExecutable() |
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
|
110 | |
7157a39d4a0f
First incarnation of 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 | 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
|
112 | "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
|
113 | "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
|
114 | "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
|
115 | ), |
7157a39d4a0f
First incarnation of 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 | "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
|
117 | "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
|
118 | "versionStartsWith": "libprotoc", |
25
55f3e6aac88c
Fixed an issue preventing the grpc compiler version to be detected.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
23
diff
changeset
|
119 | "versionRe": None, |
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
|
120 | "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
|
121 | "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
|
122 | "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
|
123 | "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
|
124 | } |
7157a39d4a0f
First incarnation of 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 | 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
|
127 | |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | 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
|
132 | |
7157a39d4a0f
First incarnation of 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 | @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
|
134 | @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
|
135 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
137 | "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
|
138 | 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
|
139 | 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
|
140 | 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
|
141 | 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
|
142 | 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
|
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 | |
7157a39d4a0f
First incarnation of 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 | |
28
ddee2e1e4198
Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
27
diff
changeset
|
147 | def createProtobufPage(configDlg): # noqa: U100 |
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
|
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 | 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
|
150 | |
7157a39d4a0f
First incarnation of 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 | @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
|
152 | @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
|
153 | @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
|
154 | @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
|
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 | 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
|
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 | # __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
|
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 | 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
|
161 | |
7157a39d4a0f
First incarnation of 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 | 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
|
163 | 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
|
164 | |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | 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
|
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 | 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
|
171 | |
7157a39d4a0f
First incarnation of 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 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
|
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 | 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
|
176 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | 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
|
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 | 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
|
183 | |
7157a39d4a0f
First incarnation of 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 | @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
|
185 | @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
|
186 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
188 | 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
|
189 | 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
|
190 | |
7157a39d4a0f
First incarnation of 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 | 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
|
192 | "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
|
193 | "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
|
194 | } |
7157a39d4a0f
First incarnation of 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 | |
3
31678035389a
Added missing code to load the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
196 | self.__translator = None |
31678035389a
Added missing code to load the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
197 | self.__loadTranslator() |
31678035389a
Added missing code to load the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
198 | |
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
|
199 | 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
|
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 | 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
|
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 | 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
|
204 | 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
|
205 | |
7157a39d4a0f
First incarnation of 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 | 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
|
207 | |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | 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
|
211 | |
7157a39d4a0f
First incarnation of 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 | @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
|
213 | @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
|
214 | """ |
10
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
215 | from eric7.QScintilla import Lexers |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
216 | from eric7.Utilities import ClassBrowsers |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
217 | |
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
|
218 | 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
|
219 | 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
|
220 | |
7157a39d4a0f
First incarnation of 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 | 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
|
222 | 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
|
223 | |
7157a39d4a0f
First incarnation of 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 | 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
|
225 | |
10
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
226 | Lexers.registerLexer( |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
227 | "Protocol Buffer", |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
228 | self.tr("Protocol Buffer (protobuf)"), |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
229 | "dummy.proto", |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
230 | self.getLexer, |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
231 | [self.tr("Protocol Buffer Files (*.proto)")], |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
232 | [self.tr("Protocol Buffer Files (*.proto)")], |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
233 | ["*.proto"], |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
234 | os.path.join("ExtensionProtobuf", "icons", "protobuf"), |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
235 | ) |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
236 | |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
237 | ClassBrowsers.registerClassBrowser( |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
238 | "Protocol Buffer", |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
239 | protoclbr.readmodule_ex, |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
240 | protoclbr.scan, |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
241 | self.getFileIcon, |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
242 | [".proto"], |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
243 | ) |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
244 | |
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
|
245 | 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
|
246 | 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
|
247 | 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
|
248 | 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
|
249 | 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
|
250 | 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
|
251 | "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
|
252 | " 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
|
253 | ), |
7157a39d4a0f
First incarnation of 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 | ) |
7157a39d4a0f
First incarnation of 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 | 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
|
256 | "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
|
257 | " 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
|
258 | ) |
7157a39d4a0f
First incarnation of 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 | |
7157a39d4a0f
First incarnation of 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 | 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
|
261 | |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | 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
|
265 | """ |
10
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
266 | from eric7.QScintilla import Lexers |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
267 | from eric7.Utilities import ClassBrowsers |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
268 | |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
269 | Lexers.unregisterLexer("Protocol Buffer") |
14
2ceb629eedcd
Fixed an issue deactivating the plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
12
diff
changeset
|
270 | ClassBrowsers.unregisterClassBrowser("Protocol Buffer") |
10
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
271 | |
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
|
272 | 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
|
273 | |
7157a39d4a0f
First incarnation of 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 | 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
|
275 | |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | 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
|
279 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
281 | 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
|
282 | 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
|
283 | 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
|
284 | 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
|
285 | ) |
7157a39d4a0f
First incarnation of 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 | 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
|
287 | 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
|
288 | 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
|
289 | 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
|
290 | 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
|
291 | 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
|
292 | 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
|
293 | 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
|
294 | "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
|
295 | " 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
|
296 | ) |
7157a39d4a0f
First incarnation of 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 | 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
|
298 | |
7157a39d4a0f
First incarnation of 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 | 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
|
300 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | @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
|
304 | @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
|
305 | @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
|
306 | @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
|
307 | """ |
7157a39d4a0f
First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
308 | 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
|
309 | 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
|
310 | ) |
7157a39d4a0f
First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
311 | |
7157a39d4a0f
First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
312 | 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
|
313 | """ |
7157a39d4a0f
First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
314 | 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
|
315 | |
7157a39d4a0f
First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
316 | @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
|
317 | @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
|
318 | @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
|
319 | @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
|
320 | """ |
7157a39d4a0f
First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
321 | 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
|
322 | |
10
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
323 | def getLexer(self, parent=None): |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
324 | """ |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
325 | Public method to instantiate a Pygments Protocol Buffer lexer object. |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
326 | |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
327 | @param parent reference to the parent object |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
328 | @type QObject |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
329 | @return reference to the instanciated lexer object |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
330 | @rtype QsciLexer |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
331 | """ |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
332 | from eric7.QScintilla.Lexers.LexerPygments import LexerPygments |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
333 | |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
334 | lexer = LexerPygments(parent, name="Protocol Buffer") |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
335 | if lexer.canStyle(): |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
336 | return lexer |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
337 | else: |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
338 | return None |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
339 | |
28
ddee2e1e4198
Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
27
diff
changeset
|
340 | def getFileIcon(self, filename=""): # noqa: U100 |
10
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
341 | """ |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
342 | Public method to get the name of a file icon. |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
343 | |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
344 | @param filename file name (defaults to "") |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
345 | @type str (optional) |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
346 | @return name of a file icon |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
347 | @rtype str |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
348 | """ |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
349 | return os.path.join("ExtensionProtobuf", "icons", "protobuf") |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
350 | |
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
|
351 | |
7157a39d4a0f
First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
352 | 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
|
353 | """ |
7157a39d4a0f
First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
354 | 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
|
355 | |
7157a39d4a0f
First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
356 | @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
|
357 | @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
|
358 | """ |
7157a39d4a0f
First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
359 | 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
|
360 | 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
|
361 | 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
|
362 | 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
|
363 | |
7157a39d4a0f
First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
364 | |
7157a39d4a0f
First incarnation of the Protobuf and gRPC support plugin, that was an integral part of eric7 previously.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
0
diff
changeset
|
365 | # |
28
ddee2e1e4198
Corrected some code style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
27
diff
changeset
|
366 | # eflag: noqa = M801, U200 |