eric6/Project/ProjectProtocolsBrowser.py

Sat, 27 Feb 2021 12:08:23 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sat, 27 Feb 2021 12:08:23 +0100
changeset 8138
169e65a6787c
parent 7959
44e15eda6506
child 8143
2c730d5fd177
permissions
-rw-r--r--

Shell: added functionality to show a prompt when the main client process has exited (e.g. a script ended).

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
7923
91e843545d9a Updated copyright for 2021.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7780
diff changeset
3 # Copyright (c) 2017 - 2021 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
5968
c5112b5cb7a9 Started to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5726
diff changeset
7 Module implementing the a class used to display the protocols (protobuf) part
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
8 of the project.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
10
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
11 import os
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
12 import glob
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
13 import sys
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
14
3656
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
15 from PyQt5.QtCore import QThread, pyqtSignal, QProcess
441956d8fce5 Started porting eric5 to PyQt5.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3591
diff changeset
16 from PyQt5.QtWidgets import QDialog, QApplication, QMenu
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
17
55
b5c84934de9c Renamed E4Gui to E5Gui.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 53
diff changeset
18 from E5Gui.E5Application import e5App
536
6d8d39753c82 Started replaceing QMessageBox methods with own methods.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 501
diff changeset
19 from E5Gui import E5MessageBox
3071
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3038
diff changeset
20 from E5Gui.E5ProgressDialog import E5ProgressDialog
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
21
7266
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
22 from .ProjectBrowserModel import (
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
23 ProjectBrowserFileItem, ProjectBrowserSimpleDirectoryItem,
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
24 ProjectBrowserDirectoryItem, ProjectBrowserProtocolsType
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
25 )
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
26 from .ProjectBaseBrowser import ProjectBaseBrowser
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
27
7266
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
28 from UI.BrowserModel import (
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
29 BrowserFileItem, BrowserClassItem, BrowserMethodItem,
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
30 BrowserClassAttributeItem
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
31 )
2192
61b3849df76d Changed a few places to use the new notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
32 import UI.PixmapCache
7959
44e15eda6506 Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7955
diff changeset
33 from UI.NotificationWidget import NotificationTypes
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
34
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
35 import Preferences
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
36 import Utilities
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
37
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
38
5968
c5112b5cb7a9 Started to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5726
diff changeset
39 class ProjectProtocolsBrowser(ProjectBaseBrowser):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
40 """
5968
c5112b5cb7a9 Started to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5726
diff changeset
41 A class used to display the protocols (protobuf) part of the project.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
42
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
43 @signal appendStdout(str) emitted after something was received from
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
44 a QProcess on stdout
501
5c615a85241a Finished porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 500
diff changeset
45 @signal appendStderr(str) emitted after something was received from
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
46 a QProcess on stderr
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
47 @signal showMenu(str, QMenu) emitted when a menu is about to be shown.
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
48 The name of the menu and a reference to the menu are given.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
49 """
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
50 appendStdout = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
51 appendStderr = pyqtSignal(str)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
52 showMenu = pyqtSignal(str, QMenu)
476
121633976eca Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 470
diff changeset
53
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
54 def __init__(self, project, parent=None):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 @param project reference to the project object
5968
c5112b5cb7a9 Started to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5726
diff changeset
59 @type Project
c5112b5cb7a9 Started to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5726
diff changeset
60 @param parent parent widget of this browser
c5112b5cb7a9 Started to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5726
diff changeset
61 @type QWidget
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 """
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
63 ProjectBaseBrowser.__init__(self, project,
5968
c5112b5cb7a9 Started to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5726
diff changeset
64 ProjectBrowserProtocolsType, parent)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
7266
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
66 self.selectedItemsFilter = [ProjectBrowserFileItem,
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
67 ProjectBrowserSimpleDirectoryItem]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
68
5968
c5112b5cb7a9 Started to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5726
diff changeset
69 self.setWindowTitle(self.tr('Protocols (protobuf)'))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
70
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
71 self.setWhatsThis(self.tr(
5968
c5112b5cb7a9 Started to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5726
diff changeset
72 """<b>Project Protocols Browser</b>"""
c5112b5cb7a9 Started to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5726
diff changeset
73 """<p>This allows to easily see all protocols (protobuf files)"""
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
74 """ contained in the current project. Several actions can be"""
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
75 """ executed via the context menu.</p>"""
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
76 ))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
77
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
78 project.prepareRepopulateItem.connect(self._prepareRepopulateItem)
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
79 project.completeRepopulateItem.connect(self._completeRepopulateItem)
5968
c5112b5cb7a9 Started to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5726
diff changeset
80
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 def _createPopupMenus(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 Protected overloaded method to generate the popup menu.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 self.menuActions = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 self.multiMenuActions = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 self.dirMenuActions = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 self.dirMultiMenuActions = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 self.sourceMenu = QMenu(self)
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
91 self.sourceMenu.addAction(
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
92 self.tr('Compile protocol'), self.__compileProtocol)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
93 self.sourceMenu.addAction(
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
94 self.tr('Compile all protocols'),
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
95 self.__compileAllProtocols)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
96 self.sourceMenu.addSeparator()
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
97 self.sourceMenu.addAction(
5974
dfb291b5b620 Changed "grpc" to "gRPC" in visible strings and source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5970
diff changeset
98 self.tr('Compile protocol as gRPC'),
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
99 lambda: self.__compileProtocol(grpc=True))
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
100 self.sourceMenu.addAction(
5974
dfb291b5b620 Changed "grpc" to "gRPC" in visible strings and source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5970
diff changeset
101 self.tr('Compile all protocols as gRPC'),
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
102 lambda: self.__compileAllProtocols(grpc=True))
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
103 self.sourceMenu.addSeparator()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
104 self.sourceMenu.addAction(self.tr('Open'), self._openItem)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
105 self.sourceMenu.addSeparator()
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
106 act = self.sourceMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
107 self.tr('Rename file'), self._renameFile)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
108 self.menuActions.append(act)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
109 act = self.sourceMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
110 self.tr('Remove from project'), self._removeFile)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
111 self.menuActions.append(act)
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
112 act = self.sourceMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
113 self.tr('Delete'), self.__deleteFile)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 self.menuActions.append(act)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
115 self.sourceMenu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
116 self.sourceMenu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
117 self.tr('Add protocols...'), self.__addProtocolFiles)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
118 self.sourceMenu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
119 self.tr('Add protocols directory...'),
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
120 self.__addProtocolsDirectory)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
121 self.sourceMenu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
122 self.sourceMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
123 self.tr('Copy Path to Clipboard'), self._copyToClipboard)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
124 self.sourceMenu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
125 self.sourceMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
126 self.tr('Expand all directories'), self._expandAllDirs)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
127 self.sourceMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
128 self.tr('Collapse all directories'), self._collapseAllDirs)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
129 self.sourceMenu.addSeparator()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
130 self.sourceMenu.addAction(self.tr('Configure...'), self._configure)
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
131 self.sourceMenu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
132 self.tr('Configure Protobuf...'), self.__configureProtobuf)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
133
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
134 self.menu = QMenu(self)
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
135 self.menu.addAction(
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
136 self.tr('Compile protocol'), self.__compileProtocol)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
137 self.menu.addAction(
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
138 self.tr('Compile all protocols'),
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
139 self.__compileAllProtocols)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
140 self.menu.addSeparator()
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
141 self.menu.addAction(
5974
dfb291b5b620 Changed "grpc" to "gRPC" in visible strings and source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5970
diff changeset
142 self.tr('Compile protocol as gRPC'),
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
143 lambda: self.__compileProtocol(grpc=True))
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
144 self.menu.addAction(
5974
dfb291b5b620 Changed "grpc" to "gRPC" in visible strings and source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5970
diff changeset
145 self.tr('Compile all protocols as gRPC'),
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
146 lambda: self.__compileAllProtocols(grpc=True))
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
147 self.menu.addSeparator()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
148 self.menu.addAction(self.tr('Open'), self._openItem)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
149 self.menu.addSeparator()
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
150 self.menu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
151 self.tr('Add protocols...'), self.__addProtocolFiles)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
152 self.menu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
153 self.tr('Add protocols directory...'),
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
154 self.__addProtocolsDirectory)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
155 self.menu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
156 self.menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
157 self.tr('Expand all directories'), self._expandAllDirs)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
158 self.menu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
159 self.tr('Collapse all directories'), self._collapseAllDirs)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
160 self.menu.addSeparator()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
161 self.menu.addAction(self.tr('Configure...'), self._configure)
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
162 self.menu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
163 self.tr('Configure Protobuf...'), self.__configureProtobuf)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
164
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
165 self.backMenu = QMenu(self)
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
166 self.backMenu.addAction(
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
167 self.tr('Compile all protocols'),
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
168 self.__compileAllProtocols)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
169 self.backMenu.addSeparator()
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
170 self.backMenu.addAction(
5974
dfb291b5b620 Changed "grpc" to "gRPC" in visible strings and source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5970
diff changeset
171 self.tr('Compile all protocols as gRPC'),
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
172 lambda: self.__compileAllProtocols(grpc=True))
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
173 self.backMenu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
174 self.backMenu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
175 self.tr('Add protocols...'), self.project.addProtoFiles)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
176 self.backMenu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
177 self.tr('Add protocols directory...'), self.project.addProtoDir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
178 self.backMenu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
179 self.backMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
180 self.tr('Expand all directories'), self._expandAllDirs)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
181 self.backMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
182 self.tr('Collapse all directories'), self._collapseAllDirs)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
183 self.backMenu.addSeparator()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
184 self.backMenu.addAction(self.tr('Configure...'), self._configure)
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
185 self.backMenu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
186 self.tr('Configure Protobuf...'), self.__configureProtobuf)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
187 self.backMenu.setEnabled(False)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
188
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
189 # create the menu for multiple selected files
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
190 self.multiMenu = QMenu(self)
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
191 self.multiMenu.addAction(
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
192 self.tr('Compile protocols'),
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
193 self.__compileSelectedProtocols)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
194 self.multiMenu.addSeparator()
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
195 self.multiMenu.addAction(
5974
dfb291b5b620 Changed "grpc" to "gRPC" in visible strings and source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5970
diff changeset
196 self.tr('Compile protocols as gRPC'),
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
197 lambda: self.__compileSelectedProtocols(grpc=True))
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
198 self.multiMenu.addSeparator()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
199 self.multiMenu.addAction(self.tr('Open'), self._openItem)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
200 self.multiMenu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
201 act = self.multiMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
202 self.tr('Remove from project'), self._removeFile)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
203 self.multiMenuActions.append(act)
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
204 act = self.multiMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
205 self.tr('Delete'), self.__deleteFile)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
206 self.multiMenuActions.append(act)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
207 self.multiMenu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
208 self.multiMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
209 self.tr('Expand all directories'), self._expandAllDirs)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
210 self.multiMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
211 self.tr('Collapse all directories'), self._collapseAllDirs)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
212 self.multiMenu.addSeparator()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
213 self.multiMenu.addAction(self.tr('Configure...'), self._configure)
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
214 self.multiMenu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
215 self.tr('Configure Protobuf...'), self.__configureProtobuf)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
216
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
217 self.dirMenu = QMenu(self)
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
218 self.dirMenu.addAction(
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
219 self.tr('Compile all protocols'),
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
220 self.__compileAllProtocols)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
221 self.dirMenu.addSeparator()
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
222 self.dirMenu.addAction(
5974
dfb291b5b620 Changed "grpc" to "gRPC" in visible strings and source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5970
diff changeset
223 self.tr('Compile all protocols as gRPC'),
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
224 lambda: self.__compileAllProtocols(grpc=True))
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
225 act = self.dirMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
226 self.tr('Remove from project'), self._removeFile)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
227 self.dirMenuActions.append(act)
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
228 act = self.dirMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
229 self.tr('Delete'), self._deleteDirectory)
2540
f346433ea963 Added a context menu entry to delete the selected directory to the project viewers.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2408
diff changeset
230 self.dirMenuActions.append(act)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
231 self.dirMenu.addSeparator()
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
232 self.dirMenu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
233 self.tr('Add protocols...'), self.__addProtocolFiles)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
234 self.dirMenu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
235 self.tr('Add protocols directory...'),
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
236 self.__addProtocolsDirectory)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
237 self.dirMenu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
238 self.dirMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
239 self.tr('Copy Path to Clipboard'), self._copyToClipboard)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
240 self.dirMenu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
241 self.dirMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
242 self.tr('Expand all directories'), self._expandAllDirs)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
243 self.dirMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
244 self.tr('Collapse all directories'), self._collapseAllDirs)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
245 self.dirMenu.addSeparator()
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
246 self.dirMenu.addAction(self.tr('Configure...'), self._configure)
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
247 self.dirMenu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
248 self.tr('Configure Protobuf...'), self.__configureProtobuf)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
249
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
250 self.dirMultiMenu = QMenu(self)
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
251 self.dirMultiMenu.addAction(
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
252 self.tr('Compile all protocols'),
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
253 self.__compileAllProtocols)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
254 self.dirMultiMenu.addSeparator()
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
255 self.dirMultiMenu.addAction(
5974
dfb291b5b620 Changed "grpc" to "gRPC" in visible strings and source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5970
diff changeset
256 self.tr('Compile all protocols as gRPC'),
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
257 lambda: self.__compileAllProtocols(grpc=True))
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
258 self.dirMultiMenu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
259 self.tr('Add protocols...'), self.project.addProtoFiles)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
260 self.dirMultiMenu.addAction(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
261 self.tr('Add protocols directory...'), self.project.addProtoDir)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
262 self.dirMultiMenu.addSeparator()
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
263 self.dirMultiMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
264 self.tr('Expand all directories'), self._expandAllDirs)
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
265 self.dirMultiMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
266 self.tr('Collapse all directories'), self._collapseAllDirs)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
267 self.dirMultiMenu.addSeparator()
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
268 self.dirMultiMenu.addAction(
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
269 self.tr('Configure...'), self._configure)
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
270 self.dirMultiMenu.addAction(self.tr('Configure Protobuf...'),
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
271 self.__configureProtobuf)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
272
461
34528aaedf1c Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 427
diff changeset
273 self.sourceMenu.aboutToShow.connect(self.__showContextMenu)
34528aaedf1c Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 427
diff changeset
274 self.multiMenu.aboutToShow.connect(self.__showContextMenuMulti)
34528aaedf1c Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 427
diff changeset
275 self.dirMenu.aboutToShow.connect(self.__showContextMenuDir)
34528aaedf1c Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 427
diff changeset
276 self.dirMultiMenu.aboutToShow.connect(self.__showContextMenuDirMulti)
34528aaedf1c Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 427
diff changeset
277 self.backMenu.aboutToShow.connect(self.__showContextMenuBack)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
278 self.mainMenu = self.sourceMenu
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
279
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
280 def _contextMenuRequested(self, coord):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
281 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
282 Protected slot to show the context menu.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
283
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
284 @param coord the position of the mouse pointer (QPoint)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
285 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
286 if not self.project.isOpen():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
287 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
288
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
289 try:
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
290 categories = self.getSelectedItemsCountCategorized(
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
291 [ProjectBrowserFileItem, BrowserClassItem,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
292 BrowserMethodItem, ProjectBrowserSimpleDirectoryItem])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
293 cnt = categories["sum"]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
294 if cnt <= 1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
295 index = self.indexAt(coord)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
296 if index.isValid():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
297 self._selectSingleItem(index)
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
298 categories = self.getSelectedItemsCountCategorized(
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
299 [ProjectBrowserFileItem, BrowserClassItem,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
300 BrowserMethodItem, ProjectBrowserSimpleDirectoryItem])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
301 cnt = categories["sum"]
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
302
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
303 bfcnt = categories[str(ProjectBrowserFileItem)]
7266
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
304 cmcnt = (
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
305 categories[str(BrowserClassItem)] +
3038
7fe9a53280bd Fixed a bunch of indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3034
diff changeset
306 categories[str(BrowserMethodItem)]
7266
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
307 )
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
308 sdcnt = categories[str(ProjectBrowserSimpleDirectoryItem)]
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
309 if cnt > 1 and cnt == bfcnt:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
310 self.multiMenu.popup(self.mapToGlobal(coord))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
311 elif cnt > 1 and cnt == sdcnt:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
312 self.dirMultiMenu.popup(self.mapToGlobal(coord))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
313 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
314 index = self.indexAt(coord)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
315 if cnt == 1 and index.isValid():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
316 if bfcnt == 1 or cmcnt == 1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
317 itm = self.model().item(index)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
318 if isinstance(itm, ProjectBrowserFileItem):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
319 self.sourceMenu.popup(self.mapToGlobal(coord))
7266
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
320 elif isinstance(
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
321 itm,
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
322 (BrowserClassItem, BrowserMethodItem)
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
323 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
324 self.menu.popup(self.mapToGlobal(coord))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
325 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
326 self.backMenu.popup(self.mapToGlobal(coord))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
327 elif sdcnt == 1:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
328 self.dirMenu.popup(self.mapToGlobal(coord))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
329 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
330 self.backMenu.popup(self.mapToGlobal(coord))
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
331 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
332 self.backMenu.popup(self.mapToGlobal(coord))
7628
f904d0eef264 Checked the reported security related issue reports generated by the new security checker.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7533
diff changeset
333 except Exception: # secok
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
334 pass
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
335
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
336 def __showContextMenu(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
337 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
338 Private slot called by the menu aboutToShow signal.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
339 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
340 ProjectBaseBrowser._showContextMenu(self, self.menu)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
341
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
342 self.showMenu.emit("Main", self.menu)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
343
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
344 def __showContextMenuMulti(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
345 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
346 Private slot called by the multiMenu aboutToShow signal.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
347 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
348 ProjectBaseBrowser._showContextMenuMulti(self, self.multiMenu)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
349
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
350 self.showMenu.emit("MainMulti", self.multiMenu)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
351
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
352 def __showContextMenuDir(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
353 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
354 Private slot called by the dirMenu aboutToShow signal.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
355 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
356 ProjectBaseBrowser._showContextMenuDir(self, self.dirMenu)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
357
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
358 self.showMenu.emit("MainDir", self.dirMenu)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
359
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
360 def __showContextMenuDirMulti(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
361 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
362 Private slot called by the dirMultiMenu aboutToShow signal.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
363 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
364 ProjectBaseBrowser._showContextMenuDirMulti(self, self.dirMultiMenu)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
365
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
366 self.showMenu.emit("MainDirMulti", self.dirMultiMenu)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
367
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
368 def __showContextMenuBack(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
369 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
370 Private slot called by the backMenu aboutToShow signal.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
371 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
372 ProjectBaseBrowser._showContextMenuBack(self, self.backMenu)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
373
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
374 self.showMenu.emit("MainBack", self.backMenu)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
375
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
376 def _openItem(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
377 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
378 Protected slot to handle the open popup menu entry.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
379 """
564
b3d966393ba9 Did some code cleanup.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 537
diff changeset
380 itmList = self.getSelectedItems(
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
381 [BrowserFileItem, BrowserClassItem, BrowserMethodItem,
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
382 BrowserClassAttributeItem])
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
383
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
384 for itm in itmList:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
385 if isinstance(itm, BrowserFileItem):
476
121633976eca Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 470
diff changeset
386 self.sourceFile[str].emit(itm.fileName())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
387 elif isinstance(itm, BrowserClassItem):
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
388 self.sourceFile[str, int].emit(
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
389 itm.fileName(), itm.classObject().lineno)
945
8cd4d08fa9f6 Made code mostly PEP 8 compliant (except all whitespace and line length).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 791
diff changeset
390 elif isinstance(itm, BrowserMethodItem):
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
391 self.sourceFile[str, int].emit(
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
392 itm.fileName(), itm.functionObject().lineno)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
393 elif isinstance(itm, BrowserClassAttributeItem):
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
394 self.sourceFile[str, int].emit(
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
395 itm.fileName(), itm.attributeObject().lineno)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
396
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
397 def __addProtocolFiles(self):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
398 """
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
399 Private method to add protocol files to the project.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
400 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
401 itm = self.model().item(self.currentIndex())
7266
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
402 if isinstance(
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
403 itm,
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
404 (ProjectBrowserFileItem, BrowserClassItem, BrowserMethodItem)
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
405 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
406 dn = os.path.dirname(itm.fileName())
7266
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
407 elif isinstance(
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
408 itm,
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
409 (ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem)
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
410 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
411 dn = itm.dirName()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
412 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
413 dn = None
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
414 self.project.addFiles('protocol', dn)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
415
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
416 def __addProtocolsDirectory(self):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
417 """
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
418 Private method to add protocol files of a directory to the project.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
419 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
420 itm = self.model().item(self.currentIndex())
7266
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
421 if isinstance(
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
422 itm,
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
423 (ProjectBrowserFileItem, BrowserClassItem, BrowserMethodItem)
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
424 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
425 dn = os.path.dirname(itm.fileName())
7266
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
426 elif isinstance(
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
427 itm,
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
428 (ProjectBrowserSimpleDirectoryItem, ProjectBrowserDirectoryItem)
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
429 ):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
430 dn = itm.dirName()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
431 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
432 dn = None
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
433 self.project.addDirectory('protocol', dn)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
434
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
435 def __deleteFile(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
436 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
437 Private method to delete files from the project.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
438 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
439 itmList = self.getSelectedItems()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
440
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
441 files = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
442 fullNames = []
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
443 for itm in itmList:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
444 fn2 = itm.fileName()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
445 fullNames.append(fn2)
248
f4561c24989a Changed code to better deal with project relative paths on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
446 fn = self.project.getRelativePath(fn2)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
447 files.append(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
448
7266
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
449 from UI.DeleteFilesConfirmationDialog import (
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
450 DeleteFilesConfirmationDialog
7266
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
451 )
3030
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
452 dlg = DeleteFilesConfirmationDialog(
4a0a82ddd9d2 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3020
diff changeset
453 self.parent(),
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
454 self.tr("Delete Protocols"),
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
455 self.tr("Do you really want to delete these protocol files from"
3190
a9a94491c4fd Changed the code to use QObject.tr() instead of QObject.trUtf8().
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3160
diff changeset
456 " the project?"),
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
457 files)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
458
7759
51aa6c6b66f7 Changed calls to exec_() into exec() (remainder of Python2 elimination).
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7628
diff changeset
459 if dlg.exec() == QDialog.Accepted:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
460 for fn2, fn in zip(fullNames, files):
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
461 self.closeSourceWindow.emit(fn2)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
462 self.project.deleteFile(fn)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
463
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
464 ###########################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
465 ## Methods to handle the various compile commands
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
466 ###########################################################################
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
467
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
468 def __getCompilerCommand(self, grpc):
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
469 """
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
470 Private method to get the compiler command.
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
471
5974
dfb291b5b620 Changed "grpc" to "gRPC" in visible strings and source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5970
diff changeset
472 @param grpc flag indicating to get a gRPC command
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
473 @type bool
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
474 @return tuple giving the executable and its parameter list
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
475 @rtype tuple of (str, list of str)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
476 """
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
477 exe = None
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
478 exeArgs = []
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
479
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
480 if grpc:
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
481 exe = Preferences.getProtobuf("grpcPython")
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
482 if exe == "":
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
483 exe = sys.executable
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
484 exeArgs = ['-m', 'grpc_tools.protoc']
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
485 else:
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
486 exe = Preferences.getProtobuf("protoc")
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
487 if exe == "":
7266
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
488 exe = (
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
489 Utilities.isWindowsPlatform() and
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
490 "protoc.exe" or "protoc"
7266
d001bc703c29 Continued to resolve code style issue M841.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7229
diff changeset
491 )
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
492 if not Utilities.isinpath(exe):
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
493 exe = None
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
494
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
495 return exe, exeArgs
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
496
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
497 def __readStdout(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
498 """
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
499 Private slot to handle the readyReadStandardOutput signal of the
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
500 protoc process.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
501 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
502 if self.compileProc is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
503 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
504
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
505 ioEncoding = Preferences.getSystem("IOEncoding")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
506
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
507 self.compileProc.setReadChannel(QProcess.StandardOutput)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
508 while self.compileProc and self.compileProc.canReadLine():
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
509 s = 'protoc: '
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
510 output = str(self.compileProc.readLine(), ioEncoding, 'replace')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
511 s += output
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
512 self.appendStdout.emit(s)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
513
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
514 def __readStderr(self):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
515 """
2995
63d874899b8b Continued to shorten the code lines to max. 79 characters.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2771
diff changeset
516 Private slot to handle the readyReadStandardError signal of the
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
517 protoc process.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
518 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
519 if self.compileProc is None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
520 return
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
521
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
522 ioEncoding = Preferences.getSystem("IOEncoding")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
523
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
524 self.compileProc.setReadChannel(QProcess.StandardError)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
525 while self.compileProc and self.compileProc.canReadLine():
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
526 s = 'protoc: '
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
527 error = str(self.compileProc.readLine(), ioEncoding, 'replace')
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
528 s += error
500
c3abc7895a01 Continued porting signal/slot usage to the new API.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 476
diff changeset
529 self.appendStderr.emit(s)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
530
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
531 def __compileProtoDone(self, exitCode, exitStatus, grpc):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
532 """
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
533 Private slot to handle the finished signal of the protoc process.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
534
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
535 @param exitCode exit code of the process
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
536 @type int
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
537 @param exitStatus exit status of the process
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
538 @type QProcess.ExitStatus
5974
dfb291b5b620 Changed "grpc" to "gRPC" in visible strings and source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5970
diff changeset
539 @param grpc flag indicating to compile as gRPC files
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
540 @type bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
541 """
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
542 self.__compileRunning = False
2192
61b3849df76d Changed a few places to use the new notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
543 ui = e5App().getObject("UserInterface")
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
544 if exitStatus == QProcess.NormalExit and exitCode == 0:
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
545 path = os.path.dirname(self.__protoFile)
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
546 fileList = glob.glob(os.path.join(path, "*_pb2.py"))
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
547 if grpc:
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
548 fileList += glob.glob(os.path.join(path, "*_pb2_grpc.py"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
549 for file in fileList:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
550 self.project.appendFile(file)
7955
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
551 if grpc:
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
552 icon = UI.PixmapCache.getPixmap("gRPC48")
2192
61b3849df76d Changed a few places to use the new notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
553 else:
7955
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
554 icon = UI.PixmapCache.getPixmap("protobuf48")
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
555 ui.showNotification(
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
556 icon,
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
557 self.tr("Protocol Compilation"),
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
558 self.tr(
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
559 "The compilation of the protocol file was"
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
560 " successful."))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
561 else:
7955
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
562 if grpc:
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
563 icon = UI.PixmapCache.getPixmap("gRPC48")
2192
61b3849df76d Changed a few places to use the new notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 1509
diff changeset
564 else:
7955
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
565 icon = UI.PixmapCache.getPixmap("protobuf48")
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
566 ui.showNotification(
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
567 icon,
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
568 self.tr("Protocol Compilation"),
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
569 self.tr(
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
570 "The compilation of the protocol file failed."),
7959
44e15eda6506 Improved the Notification system by supporting colored notifications.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7955
diff changeset
571 kind=NotificationTypes.Critical,
7955
567f2ec958c3 Changed code to always use the reworked notification system.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 7923
diff changeset
572 timeout=0)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
573 self.compileProc = None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
574
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
575 def __compileProto(self, fn, noDialog=False, progress=None, grpc=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
576 """
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
577 Private method to compile a .proto file to Python.
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
578
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
579 @param fn filename of the .proto file to be compiled
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
580 @type str
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
581 @param noDialog flag indicating silent operations
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
582 @type bool
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
583 @param progress reference to the progress dialog
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
584 @type E5ProgressDialog
5974
dfb291b5b620 Changed "grpc" to "gRPC" in visible strings and source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5970
diff changeset
585 @param grpc flag indicating to compile as gRPC files
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
586 @type bool
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
587 @return reference to the compile process
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
588 @rtype QProcess
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
589 """
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
590 exe, exeArgs = self.__getCompilerCommand(grpc)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
591 if exe:
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
592 self.compileProc = QProcess()
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
593 args = []
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
594
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
595 fn = os.path.join(self.project.ppath, fn)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
596 self.__protoFile = fn
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
597
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
598 srcPath = os.path.dirname(fn)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
599 args.append("--proto_path={0}".format(srcPath))
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
600 args.append("--python_out={0}".format(srcPath))
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
601 if grpc:
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
602 args.append("--grpc_python_out={0}".format(srcPath))
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
603 args.append(fn)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
604
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
605 self.compileProc.finished.connect(
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
606 lambda c, s: self.__compileProtoDone(c, s, grpc))
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
607 self.compileProc.readyReadStandardOutput.connect(self.__readStdout)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
608 self.compileProc.readyReadStandardError.connect(self.__readStderr)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
609
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
610 self.noDialog = noDialog
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
611 self.compileProc.start(exe, exeArgs + args)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
612 procStarted = self.compileProc.waitForStarted(5000)
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
613 if procStarted:
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
614 self.__compileRunning = True
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
615 return self.compileProc
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
616 else:
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
617 self.__compileRunning = False
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
618 if progress is not None:
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
619 progress.cancel()
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
620 E5MessageBox.critical(
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
621 self,
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
622 self.tr('Process Generation Error'),
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
623 self.tr(
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
624 '<p>Could not start {0}.<br>'
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
625 'Ensure that it is in the search path.</p>'
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
626 ).format(exe))
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
627 return None
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
628 else:
3020
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2995
diff changeset
629 E5MessageBox.critical(
542e97d4ecb3 Fixed a bunch of visible indentation issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 2995
diff changeset
630 self,
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
631 self.tr('Compiler Invalid'),
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
632 self.tr('The configured compiler is invalid.'))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
633 return None
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
634
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
635 def __compileProtocol(self, grpc=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
636 """
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
637 Private method to compile a protocol to Python.
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
638
5974
dfb291b5b620 Changed "grpc" to "gRPC" in visible strings and source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5970
diff changeset
639 @param grpc flag indicating to compile as gRPC files
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
640 @type bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
641 """
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
642 if self.__getCompilerCommand(grpc)[0] is not None:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
643 itm = self.model().item(self.currentIndex())
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
644 fn2 = itm.fileName()
248
f4561c24989a Changed code to better deal with project relative paths on Windows systems.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 97
diff changeset
645 fn = self.project.getRelativePath(fn2)
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
646 self.__compileProto(fn, grpc=grpc)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
647
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
648 def __compileAllProtocols(self, grpc=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
649 """
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
650 Private method to compile all protocols to Python.
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
651
5974
dfb291b5b620 Changed "grpc" to "gRPC" in visible strings and source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5970
diff changeset
652 @param grpc flag indicating to compile as gRPC files
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
653 @type bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
654 """
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
655 if self.__getCompilerCommand(grpc)[0] is not None:
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
656 numProtos = len(self.project.pdata["PROTOCOLS"])
3071
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3038
diff changeset
657 progress = E5ProgressDialog(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
658 self.tr("Compiling Protocols..."),
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
659 self.tr("Abort"), 0, numProtos,
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
660 self.tr("%v/%m Protocols"), self)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
661 progress.setModal(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
662 progress.setMinimumDuration(0)
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
663 progress.setWindowTitle(self.tr("Protocols"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
664 i = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
665
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
666 for fn in self.project.pdata["PROTOCOLS"]:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
667 progress.setValue(i)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
668 if progress.wasCanceled():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
669 break
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
670 proc = self.__compileProto(fn, True, progress, grpc=grpc)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
671 if proc is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
672 while proc.state() == QProcess.Running:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
673 QApplication.processEvents()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
674 QThread.msleep(300)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
675 QApplication.processEvents()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
676 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
677 break
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
678 i += 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
679
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
680 progress.setValue(numProtos)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
681
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
682 def __compileSelectedProtocols(self, grpc=False):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
683 """
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
684 Private method to compile selected protocols to Python.
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
685
5974
dfb291b5b620 Changed "grpc" to "gRPC" in visible strings and source docu.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5970
diff changeset
686 @param grpc flag indicating to compile as gRPC files
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
687 @type bool
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
688 """
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
689 if self.__getCompilerCommand(grpc)[0] is not None:
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
690 items = self.getSelectedItems()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
691
3034
7ce719013078 Fixed various coding style issues.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3030
diff changeset
692 files = [self.project.getRelativePath(itm.fileName())
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
693 for itm in items]
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
694 numProtos = len(files)
3071
83d066710d60 Added an extended progress dialog to make the progress bar label more descriptive.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 3038
diff changeset
695 progress = E5ProgressDialog(
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
696 self.tr("Compiling Protocols..."),
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
697 self.tr("Abort"), 0, numProtos,
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
698 self.tr("%v/%m Protocols"), self)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
699 progress.setModal(True)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
700 progress.setMinimumDuration(0)
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
701 progress.setWindowTitle(self.tr("Protocols"))
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
702 i = 0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
703
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
704 for fn in files:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
705 progress.setValue(i)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
706 if progress.wasCanceled():
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
707 break
5970
411f7ba577d5 Continued to add support for Google protobuf protocol files. Added support for gRPC.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5969
diff changeset
708 proc = self.__compileProto(fn, True, progress, grpc=grpc)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
709 if proc is not None:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
710 while proc.state() == QProcess.Running:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
711 QApplication.processEvents()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
712 QThread.msleep(300)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
713 QApplication.processEvents()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
714 else:
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
715 break
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
716 i += 1
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
717
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
718 progress.setValue(numProtos)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
719
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
720 def __configureProtobuf(self):
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
721 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
722 Private method to open the configuration dialog.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
723 """
5969
584c21b6587a Continued to add support for Google protobuf protocol files.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 5968
diff changeset
724 e5App().getObject("UserInterface").showPreferences("protobufPage")

eric ide

mercurial