Preferences/ConfigurationPages/DebuggerPythonPage.py

changeset 4575
464a6b049f89
parent 4021
195a471c327b
child 4631
5c1a96925da4
equal deleted inserted replaced
4574:86647045bc03 4575:464a6b049f89
7 Module implementing the Debugger Python configuration page. 7 Module implementing the Debugger Python 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_DebuggerPythonPage import Ui_DebuggerPythonPage 15 from .Ui_DebuggerPythonPage import Ui_DebuggerPythonPage
19 16
20 import Preferences 17 import Preferences
21 import Utilities
22 import UI.PixmapCache
23 18
24 19
25 class DebuggerPythonPage(ConfigurationPageBase, Ui_DebuggerPythonPage): 20 class DebuggerPythonPage(ConfigurationPageBase, Ui_DebuggerPythonPage):
26 """ 21 """
27 Class implementing the Debugger Python configuration page. 22 Class implementing the Debugger Python configuration page.
32 """ 27 """
33 super(DebuggerPythonPage, self).__init__() 28 super(DebuggerPythonPage, self).__init__()
34 self.setupUi(self) 29 self.setupUi(self)
35 self.setObjectName("DebuggerPythonPage") 30 self.setObjectName("DebuggerPythonPage")
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 Python 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"))
40 self.debugClientPicker.setFilters(self.tr("Python Files (*.py *.py2)"))
42 41
43 # set initial values 42 # set initial values
44 self.interpreterEdit.setText( 43 self.interpreterPicker.setText(
45 Preferences.getDebugger("PythonInterpreter")) 44 Preferences.getDebugger("PythonInterpreter"))
46 dct = Preferences.getDebugger("DebugClientType") 45 dct = Preferences.getDebugger("DebugClientType")
47 if dct == "standard": 46 if dct == "standard":
48 self.standardButton.setChecked(True) 47 self.standardButton.setChecked(True)
49 elif dct == "threaded": 48 elif dct == "threaded":
50 self.threadedButton.setChecked(True) 49 self.threadedButton.setChecked(True)
51 else: 50 else:
52 self.customButton.setChecked(True) 51 self.customButton.setChecked(True)
53 self.debugClientEdit.setText( 52 self.debugClientPicker.setText(
54 Preferences.getDebugger("DebugClient")) 53 Preferences.getDebugger("DebugClient"))
55 self.pyRedirectCheckBox.setChecked( 54 self.pyRedirectCheckBox.setChecked(
56 Preferences.getDebugger("PythonRedirect")) 55 Preferences.getDebugger("PythonRedirect"))
57 self.pyNoEncodingCheckBox.setChecked( 56 self.pyNoEncodingCheckBox.setChecked(
58 Preferences.getDebugger("PythonNoEncoding")) 57 Preferences.getDebugger("PythonNoEncoding"))
63 """ 62 """
64 Public slot to save the Debugger Python configuration. 63 Public slot to save the Debugger Python configuration.
65 """ 64 """
66 Preferences.setDebugger( 65 Preferences.setDebugger(
67 "PythonInterpreter", 66 "PythonInterpreter",
68 self.interpreterEdit.text()) 67 self.interpreterPicker.text())
69 if self.standardButton.isChecked(): 68 if self.standardButton.isChecked():
70 dct = "standard" 69 dct = "standard"
71 elif self.threadedButton.isChecked(): 70 elif self.threadedButton.isChecked():
72 dct = "threaded" 71 dct = "threaded"
73 else: 72 else:
74 dct = "custom" 73 dct = "custom"
75 Preferences.setDebugger("DebugClientType", dct) 74 Preferences.setDebugger("DebugClientType", dct)
76 Preferences.setDebugger( 75 Preferences.setDebugger(
77 "DebugClient", 76 "DebugClient",
78 self.debugClientEdit.text()) 77 self.debugClientPicker.text())
79 Preferences.setDebugger( 78 Preferences.setDebugger(
80 "PythonRedirect", 79 "PythonRedirect",
81 self.pyRedirectCheckBox.isChecked()) 80 self.pyRedirectCheckBox.isChecked())
82 Preferences.setDebugger( 81 Preferences.setDebugger(
83 "PythonNoEncoding", 82 "PythonNoEncoding",
84 self.pyNoEncodingCheckBox.isChecked()) 83 self.pyNoEncodingCheckBox.isChecked())
85 Preferences.setDebugger( 84 Preferences.setDebugger(
86 "PythonExtensions", 85 "PythonExtensions",
87 self.sourceExtensionsEdit.text()) 86 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 *.py2)"))
114
115 if file:
116 self.debugClientEdit.setText(
117 Utilities.toNativeSeparators(file))
118 87
119 88
120 def create(dlg): 89 def create(dlg):
121 """ 90 """
122 Module function to create the configuration page. 91 Module function to create the configuration page.

eric ide

mercurial