Mon, 12 Dec 2022 16:55:43 +0100
Moved the Protobuf class browser to this plugin.
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 |
10
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
17 | 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
|
18 | 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
|
19 | |
7157a39d4a0f
First incarnation of 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 | # 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
|
21 | 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
|
22 | 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
|
23 | 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
|
24 | deactivateable = True |
10
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
25 | version = "10.1.0" |
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
|
26 | 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
|
27 | 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
|
28 | 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
|
29 | 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
|
30 | "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
|
31 | " 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
|
32 | ) |
7157a39d4a0f
First incarnation of 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 | 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
|
34 | 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
|
35 | # 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
|
36 | |
7157a39d4a0f
First incarnation of 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 | 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
|
38 | |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | |
7157a39d4a0f
First incarnation of 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 | 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
|
43 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
45 | |
7157a39d4a0f
First incarnation of 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 | @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
|
47 | 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
|
48 | @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
|
49 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
51 | |
7157a39d4a0f
First incarnation of 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 | # 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
|
53 | 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
|
54 | 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
|
55 | "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
|
56 | "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
|
57 | "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
|
58 | ), |
7157a39d4a0f
First incarnation of 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 | "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
|
60 | "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
|
61 | "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
|
62 | ), |
7157a39d4a0f
First incarnation of 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 | "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
|
64 | "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
|
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 | } |
7157a39d4a0f
First incarnation of 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 | 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
|
68 | 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
|
69 | 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
|
70 | 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
|
71 | |
7157a39d4a0f
First incarnation of 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 | 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
|
73 | "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
|
74 | "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
|
75 | "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
|
76 | ), |
7157a39d4a0f
First incarnation of 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 | "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
|
78 | "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
|
79 | "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
|
80 | "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
|
81 | "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
|
82 | "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
|
83 | "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
|
84 | "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
|
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 | |
7157a39d4a0f
First incarnation of 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 | # 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
|
88 | 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
|
89 | 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
|
90 | "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
|
91 | "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
|
92 | "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
|
93 | ), |
7157a39d4a0f
First incarnation of 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 | "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
|
95 | "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
|
96 | "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
|
97 | ), |
7157a39d4a0f
First incarnation of 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 | "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
|
99 | "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
|
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 | } |
7157a39d4a0f
First incarnation of 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 | 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
|
103 | 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
|
104 | 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
|
105 | 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
|
106 | ) |
7157a39d4a0f
First incarnation of 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 | 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
|
108 | 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
|
109 | |
7157a39d4a0f
First incarnation of 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 | 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
|
111 | "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
|
112 | "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
|
113 | "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
|
114 | ), |
7157a39d4a0f
First incarnation of 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 | "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
|
116 | "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
|
117 | "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
|
118 | "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
|
119 | "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
|
120 | "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
|
121 | "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
|
122 | "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
|
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 | |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | |
7157a39d4a0f
First incarnation of 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 | 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
|
129 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
131 | |
7157a39d4a0f
First incarnation of 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 | @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
|
133 | @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
|
134 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
136 | "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
|
137 | 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
|
138 | 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
|
139 | 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
|
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 | 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 | ], |
7157a39d4a0f
First incarnation of 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 | 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
|
147 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
149 | |
7157a39d4a0f
First incarnation of 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 | @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
|
151 | @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
|
152 | @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
|
153 | @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
|
154 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
156 | |
7157a39d4a0f
First incarnation of 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 | # __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
|
158 | |
7157a39d4a0f
First incarnation of 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 | 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
|
160 | |
7157a39d4a0f
First incarnation of 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 | 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
|
162 | 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
|
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 | |
7157a39d4a0f
First incarnation of 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 | 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
|
166 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
168 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | |
7157a39d4a0f
First incarnation of 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 | 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
|
173 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | |
7157a39d4a0f
First incarnation of 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 | 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
|
178 | |
7157a39d4a0f
First incarnation of 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 | 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
|
180 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
182 | |
7157a39d4a0f
First incarnation of 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 | @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
|
184 | @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
|
185 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
187 | 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
|
188 | 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
|
189 | |
7157a39d4a0f
First incarnation of 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 | 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
|
191 | "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
|
192 | "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
|
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 | |
3
31678035389a
Added missing code to load the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
195 | self.__translator = None |
31678035389a
Added missing code to load the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
196 | self.__loadTranslator() |
31678035389a
Added missing code to load the translations.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
1
diff
changeset
|
197 | |
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
|
198 | 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
|
199 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
201 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
203 | 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
|
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 | 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
|
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 | 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
|
208 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
210 | |
7157a39d4a0f
First incarnation of 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 | @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
|
212 | @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
|
213 | """ |
10
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
214 | from eric7.QScintilla import Lexers |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
215 | from eric7.Utilities import ClassBrowsers |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
216 | |
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
|
217 | 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
|
218 | 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
|
219 | |
7157a39d4a0f
First incarnation of 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 | 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
|
221 | 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
|
222 | |
7157a39d4a0f
First incarnation of 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.__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
|
224 | |
10
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
225 | Lexers.registerLexer( |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
226 | "Protocol Buffer", |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
227 | self.tr("Protocol Buffer (protobuf)"), |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
228 | "dummy.proto", |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
229 | self.getLexer, |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
230 | [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
|
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 | ["*.proto"], |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
233 | 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
|
234 | ) |
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 | ClassBrowsers.registerClassBrowser( |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
237 | "Protocol Buffer", |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
238 | protoclbr.readmodule_ex, |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
239 | protoclbr.scan, |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
240 | self.getFileIcon, |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
241 | [".proto"], |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
242 | ) |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
243 | |
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
|
244 | 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
|
245 | 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
|
246 | 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
|
247 | 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
|
248 | 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
|
249 | 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
|
250 | "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
|
251 | " 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
|
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 | ) |
7157a39d4a0f
First incarnation of 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 | 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
|
255 | "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
|
256 | " 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
|
257 | ) |
7157a39d4a0f
First incarnation of 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 | 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
|
260 | |
7157a39d4a0f
First incarnation of 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 | 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
|
262 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
264 | """ |
10
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
265 | from eric7.QScintilla import Lexers |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
266 | from eric7.Utilities import ClassBrowsers |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
267 | |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
268 | Lexers.unregisterLexer("Protocol Buffer") |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
269 | ClassBrowsers.registerClassBrowser("Protocol Buffer") |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
270 | |
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
|
271 | 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
|
272 | |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | 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
|
276 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | 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
|
280 | 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
|
281 | 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
|
282 | 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
|
283 | 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
|
284 | ) |
7157a39d4a0f
First incarnation of 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 | 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
|
286 | 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
|
287 | 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
|
288 | 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
|
289 | 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
|
290 | 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
|
291 | 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
|
292 | 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
|
293 | "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
|
294 | " 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
|
295 | ) |
7157a39d4a0f
First incarnation of 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 | 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
|
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 | 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
|
299 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
301 | |
7157a39d4a0f
First incarnation of 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 | @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
|
303 | @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
|
304 | @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
|
305 | @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
|
306 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
308 | 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
|
309 | ) |
7157a39d4a0f
First incarnation of 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 | 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
|
312 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
314 | |
7157a39d4a0f
First incarnation of 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 | @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
|
316 | @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
|
317 | @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
|
318 | @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
|
319 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
321 | |
10
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
322 | def getLexer(self, parent=None): |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
323 | """ |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
324 | 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
|
325 | |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
326 | @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
|
327 | @type QObject |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
328 | @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
|
329 | @rtype QsciLexer |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
330 | """ |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
331 | 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
|
332 | |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
333 | 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
|
334 | if lexer.canStyle(): |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
335 | return lexer |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
336 | else: |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
337 | return None |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
338 | |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
339 | def getFileIcon(self, filename=""): |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
340 | """ |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
341 | 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
|
342 | |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
343 | @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
|
344 | @type str (optional) |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
345 | @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
|
346 | @rtype str |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
347 | """ |
362689624e2d
Moved the Protobuf class browser to this plugin.
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
8
diff
changeset
|
348 | 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
|
349 | |
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
|
350 | |
7157a39d4a0f
First incarnation of 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 | 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
|
352 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
354 | |
7157a39d4a0f
First incarnation of 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 | @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
|
356 | @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
|
357 | """ |
7157a39d4a0f
First incarnation of 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 | 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
|
359 | 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
|
360 | 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
|
361 | 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
|
362 | |
7157a39d4a0f
First incarnation of 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 | # eflag: noqa = M801 |