|
1 # -*- coding: utf-8 -*- |
|
2 |
|
3 # Copyright (c) 2017 Detlev Offenbach <detlev@die-offenbachs.de> |
|
4 # |
|
5 |
|
6 """ |
|
7 Module implementing the protobuf configuration page. |
|
8 """ |
|
9 |
|
10 from __future__ import unicode_literals |
|
11 |
|
12 from E5Gui.E5PathPicker import E5PathPickerModes |
|
13 |
|
14 from .ConfigurationPageBase import ConfigurationPageBase |
|
15 from .Ui_ProtobufPage import Ui_ProtobufPage |
|
16 |
|
17 import Preferences |
|
18 |
|
19 |
|
20 class ProtobufPage(ConfigurationPageBase, Ui_ProtobufPage): |
|
21 """ |
|
22 Class implementing the protobuf configuration page. |
|
23 """ |
|
24 def __init__(self): |
|
25 """ |
|
26 Constructor |
|
27 """ |
|
28 super(ProtobufPage, self).__init__() |
|
29 self.setupUi(self) |
|
30 self.setObjectName("ProtobufPage") |
|
31 |
|
32 self.protocPicker.setMode(E5PathPickerModes.OpenFileMode) |
|
33 self.protocPicker.setToolTip(self.tr( |
|
34 "Press to select the Protobuf compiler via a file selection" |
|
35 " dialog.")) |
|
36 |
|
37 # set initial values |
|
38 self.protocPicker.setText(Preferences.getProtobuf("protoc")) |
|
39 |
|
40 def save(self): |
|
41 """ |
|
42 Public slot to save the protobuf configuration. |
|
43 """ |
|
44 Preferences.setProtobuf("protoc", self.protocPicker.text()) |
|
45 |
|
46 |
|
47 def create(dlg): |
|
48 """ |
|
49 Module function to create the configuration page. |
|
50 |
|
51 @param dlg reference to the configuration dialog |
|
52 @return reference to the instantiated page (ConfigurationPageBase) |
|
53 """ |
|
54 page = ProtobufPage() |
|
55 return page |