13 import sys |
13 import sys |
14 |
14 |
15 from PyQt5.QtCore import pyqtSlot |
15 from PyQt5.QtCore import pyqtSlot |
16 from PyQt5.QtWidgets import QDialog |
16 from PyQt5.QtWidgets import QDialog |
17 |
17 |
18 from E5Gui.E5Completers import E5FileCompleter, E5DirCompleter |
18 from E5Gui.E5Completers import E5DirCompleter |
19 from E5Gui import E5FileDialog |
19 from E5Gui.E5PathPicker import E5PathPickerModes |
20 |
20 |
21 from .Ui_DebuggerPropertiesDialog import Ui_DebuggerPropertiesDialog |
21 from .Ui_DebuggerPropertiesDialog import Ui_DebuggerPropertiesDialog |
22 |
22 |
23 import Utilities |
|
24 import UI.PixmapCache |
|
25 |
23 |
26 from eric6config import getConfig |
24 from eric6config import getConfig |
27 |
25 |
28 |
26 |
29 class DebuggerPropertiesDialog(QDialog, Ui_DebuggerPropertiesDialog): |
27 class DebuggerPropertiesDialog(QDialog, Ui_DebuggerPropertiesDialog): |
42 super(DebuggerPropertiesDialog, self).__init__(parent) |
40 super(DebuggerPropertiesDialog, self).__init__(parent) |
43 if name: |
41 if name: |
44 self.setObjectName(name) |
42 self.setObjectName(name) |
45 self.setupUi(self) |
43 self.setupUi(self) |
46 |
44 |
47 self.debugClientButton.setIcon(UI.PixmapCache.getIcon("open.png")) |
45 self.debugClientPicker.setMode(E5PathPickerModes.OpenFileMode) |
48 self.interpreterButton.setIcon(UI.PixmapCache.getIcon("open.png")) |
46 self.interpreterPicker.setMode(E5PathPickerModes.OpenFileMode) |
49 |
47 |
50 self.debugClientCompleter = E5FileCompleter(self.debugClientEdit) |
|
51 self.interpreterCompleter = E5FileCompleter(self.interpreterEdit) |
|
52 self.translationLocalCompleter = E5DirCompleter( |
48 self.translationLocalCompleter = E5DirCompleter( |
53 self.translationLocalEdit) |
49 self.translationLocalEdit) |
54 |
50 |
55 self.project = project |
51 self.project = project |
56 |
52 |
57 if self.project.debugProperties["INTERPRETER"]: |
53 if self.project.debugProperties["INTERPRETER"]: |
58 self.interpreterEdit.setText( |
54 self.interpreterPicker.setText( |
59 self.project.debugProperties["INTERPRETER"]) |
55 self.project.debugProperties["INTERPRETER"]) |
60 else: |
56 else: |
61 if self.project.pdata["PROGLANGUAGE"][0] in \ |
57 if self.project.pdata["PROGLANGUAGE"][0] in \ |
62 ["Python", "Python2", "Python3"]: |
58 ["Python", "Python2", "Python3"]: |
63 self.interpreterEdit.setText(sys.executable) |
59 self.interpreterPicker.setText(sys.executable) |
64 elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": |
60 elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": |
65 self.interpreterEdit.setText("/usr/bin/ruby") |
61 self.interpreterPicker.setText("/usr/bin/ruby") |
66 if self.project.debugProperties["DEBUGCLIENT"]: |
62 if self.project.debugProperties["DEBUGCLIENT"]: |
67 self.debugClientEdit.setText( |
63 self.debugClientPicker.setText( |
68 self.project.debugProperties["DEBUGCLIENT"]) |
64 self.project.debugProperties["DEBUGCLIENT"]) |
69 else: |
65 else: |
70 if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2"]: |
66 if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2"]: |
71 debugClient = os.path.join( |
67 debugClient = os.path.join( |
72 getConfig('ericDir'), |
68 getConfig('ericDir'), |
79 debugClient = os.path.join( |
75 debugClient = os.path.join( |
80 getConfig('ericDir'), |
76 getConfig('ericDir'), |
81 "DebugClients", "Ruby", "DebugClient.rb") |
77 "DebugClients", "Ruby", "DebugClient.rb") |
82 else: |
78 else: |
83 debugClient = "" |
79 debugClient = "" |
84 self.debugClientEdit.setText(debugClient) |
80 self.debugClientPicker.setText(debugClient) |
85 self.debugEnvironmentOverrideCheckBox.setChecked( |
81 self.debugEnvironmentOverrideCheckBox.setChecked( |
86 self.project.debugProperties["ENVIRONMENTOVERRIDE"]) |
82 self.project.debugProperties["ENVIRONMENTOVERRIDE"]) |
87 self.debugEnvironmentEdit.setText( |
83 self.debugEnvironmentEdit.setText( |
88 self.project.debugProperties["ENVIRONMENTSTRING"]) |
84 self.project.debugProperties["ENVIRONMENTSTRING"]) |
89 self.remoteDebuggerGroup.setChecked( |
85 self.remoteDebuggerGroup.setChecked( |
107 self.noEncodingCheckBox.setChecked( |
103 self.noEncodingCheckBox.setChecked( |
108 self.project.debugProperties["NOENCODING"]) |
104 self.project.debugProperties["NOENCODING"]) |
109 |
105 |
110 msh = self.minimumSizeHint() |
106 msh = self.minimumSizeHint() |
111 self.resize(max(self.width(), msh.width()), msh.height()) |
107 self.resize(max(self.width(), msh.width()), msh.height()) |
112 |
|
113 @pyqtSlot() |
|
114 def on_interpreterButton_clicked(self): |
|
115 """ |
|
116 Private slot to handle the interpreter selection. |
|
117 """ |
|
118 file = E5FileDialog.getOpenFileName( |
|
119 self, |
|
120 self.tr("Select interpreter for Debug Client"), |
|
121 self.interpreterEdit.text(), |
|
122 "") |
|
123 |
|
124 if file: |
|
125 self.interpreterEdit.setText(Utilities.toNativeSeparators(file)) |
|
126 |
108 |
127 @pyqtSlot() |
109 @pyqtSlot() |
128 def on_debugClientButton_clicked(self): |
110 def on_debugClientPicker_aboutToShowPathPickerDialog(self): |
129 """ |
111 """ |
130 Private slot to handle the Debug Client selection. |
112 Private slot to perform actions before the debug client selection |
|
113 dialog is shown. |
131 """ |
114 """ |
132 filters = self.project.dbgFilters[ |
115 filters = self.project.dbgFilters[ |
133 self.project.pdata["PROGLANGUAGE"][0]] |
116 self.project.pdata["PROGLANGUAGE"][0]] |
134 filters += self.tr("All Files (*)") |
117 filters += self.tr("All Files (*)") |
135 file = E5FileDialog.getOpenFileName( |
118 self.debugClientPicker.setFilters(filters) |
136 self, |
|
137 self.tr("Select Debug Client"), |
|
138 self.debugClientEdit.text(), |
|
139 filters) |
|
140 |
|
141 if file: |
|
142 self.debugClientEdit.setText(Utilities.toNativeSeparators(file)) |
|
143 |
119 |
144 def storeData(self): |
120 def storeData(self): |
145 """ |
121 """ |
146 Public method to store the entered/modified data. |
122 Public method to store the entered/modified data. |
147 """ |
123 """ |
148 self.project.debugProperties["INTERPRETER"] = \ |
124 self.project.debugProperties["INTERPRETER"] = \ |
149 self.interpreterEdit.text() |
125 self.interpreterPicker.text() |
150 if not self.project.debugProperties["INTERPRETER"]: |
126 if not self.project.debugProperties["INTERPRETER"]: |
151 if self.project.pdata["PROGLANGUAGE"][0] in \ |
127 if self.project.pdata["PROGLANGUAGE"][0] in \ |
152 ["Python", "Python2", "Python3"]: |
128 ["Python", "Python2", "Python3"]: |
153 self.project.debugProperties["INTERPRETER"] = sys.executable |
129 self.project.debugProperties["INTERPRETER"] = sys.executable |
154 elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": |
130 elif self.project.pdata["PROGLANGUAGE"][0] == "Ruby": |
155 self.project.debugProperties["INTERPRETER"] = "/usr/bin/ruby" |
131 self.project.debugProperties["INTERPRETER"] = "/usr/bin/ruby" |
156 |
132 |
157 self.project.debugProperties["DEBUGCLIENT"] = \ |
133 self.project.debugProperties["DEBUGCLIENT"] = \ |
158 self.debugClientEdit.text() |
134 self.debugClientPicker.text() |
159 if not self.project.debugProperties["DEBUGCLIENT"]: |
135 if not self.project.debugProperties["DEBUGCLIENT"]: |
160 if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2"]: |
136 if self.project.pdata["PROGLANGUAGE"][0] in ["Python", "Python2"]: |
161 debugClient = os.path.join( |
137 debugClient = os.path.join( |
162 getConfig('ericDir'), |
138 getConfig('ericDir'), |
163 "DebugClients", "Python", "DebugClient.py") |
139 "DebugClients", "Python", "DebugClient.py") |