7 Module implementing the Debugger Python3 configuration page. |
7 Module implementing the Debugger Python3 configuration page. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt5.QtCore import pyqtSlot |
12 from E5Gui.E5PathPicker import E5PathPickerModes |
13 |
|
14 from E5Gui.E5Completers import E5FileCompleter |
|
15 from E5Gui import E5FileDialog |
|
16 |
13 |
17 from .ConfigurationPageBase import ConfigurationPageBase |
14 from .ConfigurationPageBase import ConfigurationPageBase |
18 from .Ui_DebuggerPython3Page import Ui_DebuggerPython3Page |
15 from .Ui_DebuggerPython3Page import Ui_DebuggerPython3Page |
19 |
16 |
20 import Preferences |
17 import Preferences |
21 import Utilities |
|
22 import UI.PixmapCache |
|
23 |
18 |
24 |
19 |
25 class DebuggerPython3Page(ConfigurationPageBase, Ui_DebuggerPython3Page): |
20 class DebuggerPython3Page(ConfigurationPageBase, Ui_DebuggerPython3Page): |
26 """ |
21 """ |
27 Class implementing the Debugger Python3 configuration page. |
22 Class implementing the Debugger Python3 configuration page. |
32 """ |
27 """ |
33 super(DebuggerPython3Page, self).__init__() |
28 super(DebuggerPython3Page, self).__init__() |
34 self.setupUi(self) |
29 self.setupUi(self) |
35 self.setObjectName("DebuggerPython3Page") |
30 self.setObjectName("DebuggerPython3Page") |
36 |
31 |
37 self.interpreterButton.setIcon(UI.PixmapCache.getIcon("open.png")) |
32 self.interpreterPicker.setMode(E5PathPickerModes.OpenFileMode) |
38 self.debugClientButton.setIcon(UI.PixmapCache.getIcon("open.png")) |
33 self.interpreterPicker.setToolTip(self.tr( |
|
34 "Press to select the Python3 interpreter via a file selection" |
|
35 " dialog")) |
39 |
36 |
40 self.interpreterCompleter = E5FileCompleter(self.interpreterEdit) |
37 self.debugClientPicker.setMode(E5PathPickerModes.OpenFileMode) |
41 self.debugClientCompleter = E5FileCompleter(self.debugClientEdit) |
38 self.debugClientPicker.setToolTip(self.tr( |
|
39 "Press to select the Debug Client via a file selection dialog")) |
42 |
40 |
43 # set initial values |
41 # set initial values |
44 self.interpreterEdit.setText( |
42 self.interpreterPicker.setText( |
45 Preferences.getDebugger("Python3Interpreter")) |
43 Preferences.getDebugger("Python3Interpreter")) |
46 dct = Preferences.getDebugger("DebugClientType3") |
44 dct = Preferences.getDebugger("DebugClientType3") |
47 if dct == "standard": |
45 if dct == "standard": |
48 self.standardButton.setChecked(True) |
46 self.standardButton.setChecked(True) |
49 elif dct == "threaded": |
47 elif dct == "threaded": |
50 self.threadedButton.setChecked(True) |
48 self.threadedButton.setChecked(True) |
51 else: |
49 else: |
52 self.customButton.setChecked(True) |
50 self.customButton.setChecked(True) |
53 self.debugClientEdit.setText( |
51 self.debugClientPicker.setText( |
54 Preferences.getDebugger("DebugClient3")) |
52 Preferences.getDebugger("DebugClient3")) |
55 self.pyRedirectCheckBox.setChecked( |
53 self.pyRedirectCheckBox.setChecked( |
56 Preferences.getDebugger("Python3Redirect")) |
54 Preferences.getDebugger("Python3Redirect")) |
57 self.pyNoEncodingCheckBox.setChecked( |
55 self.pyNoEncodingCheckBox.setChecked( |
58 Preferences.getDebugger("Python3NoEncoding")) |
56 Preferences.getDebugger("Python3NoEncoding")) |
63 """ |
61 """ |
64 Public slot to save the Debugger Python configuration. |
62 Public slot to save the Debugger Python configuration. |
65 """ |
63 """ |
66 Preferences.setDebugger( |
64 Preferences.setDebugger( |
67 "Python3Interpreter", |
65 "Python3Interpreter", |
68 self.interpreterEdit.text()) |
66 self.interpreterPicker.text()) |
69 if self.standardButton.isChecked(): |
67 if self.standardButton.isChecked(): |
70 dct = "standard" |
68 dct = "standard" |
71 elif self.threadedButton.isChecked(): |
69 elif self.threadedButton.isChecked(): |
72 dct = "threaded" |
70 dct = "threaded" |
73 else: |
71 else: |
74 dct = "custom" |
72 dct = "custom" |
75 Preferences.setDebugger("DebugClientType3", dct) |
73 Preferences.setDebugger("DebugClientType3", dct) |
76 Preferences.setDebugger( |
74 Preferences.setDebugger( |
77 "DebugClient3", |
75 "DebugClient3", |
78 self.debugClientEdit.text()) |
76 self.debugClientPicker.text()) |
79 Preferences.setDebugger( |
77 Preferences.setDebugger( |
80 "Python3Redirect", |
78 "Python3Redirect", |
81 self.pyRedirectCheckBox.isChecked()) |
79 self.pyRedirectCheckBox.isChecked()) |
82 Preferences.setDebugger( |
80 Preferences.setDebugger( |
83 "Python3NoEncoding", |
81 "Python3NoEncoding", |
84 self.pyNoEncodingCheckBox.isChecked()) |
82 self.pyNoEncodingCheckBox.isChecked()) |
85 Preferences.setDebugger( |
83 Preferences.setDebugger( |
86 "Python3Extensions", |
84 "Python3Extensions", |
87 self.sourceExtensionsEdit.text()) |
85 self.sourceExtensionsEdit.text()) |
88 |
|
89 @pyqtSlot() |
|
90 def on_interpreterButton_clicked(self): |
|
91 """ |
|
92 Private slot to handle the Python interpreter selection. |
|
93 """ |
|
94 file = E5FileDialog.getOpenFileName( |
|
95 self, |
|
96 self.tr("Select Python interpreter for Debug Client"), |
|
97 self.interpreterEdit.text(), |
|
98 "") |
|
99 |
|
100 if file: |
|
101 self.interpreterEdit.setText( |
|
102 Utilities.toNativeSeparators(file)) |
|
103 |
|
104 @pyqtSlot() |
|
105 def on_debugClientButton_clicked(self): |
|
106 """ |
|
107 Private slot to handle the Debug Client selection. |
|
108 """ |
|
109 file = E5FileDialog.getOpenFileName( |
|
110 None, |
|
111 self.tr("Select Debug Client"), |
|
112 self.debugClientEdit.text(), |
|
113 self.tr("Python Files (*.py *.py3)")) |
|
114 |
|
115 if file: |
|
116 self.debugClientEdit.setText( |
|
117 Utilities.toNativeSeparators(file)) |
|
118 |
86 |
119 |
87 |
120 def create(dlg): |
88 def create(dlg): |
121 """ |
89 """ |
122 Module function to create the configuration page. |
90 Module function to create the configuration page. |