15 from PyQt5.QtCore import pyqtSlot |
15 from PyQt5.QtCore import pyqtSlot |
16 from PyQt5.QtWidgets import QDialog, QComboBox |
16 from PyQt5.QtWidgets import QDialog, QComboBox |
17 |
17 |
18 from E5Gui.E5Completers import E5DirCompleter |
18 from E5Gui.E5Completers import E5DirCompleter |
19 from E5Gui.E5PathPicker import E5PathPickerModes |
19 from E5Gui.E5PathPicker import E5PathPickerModes |
|
20 from E5Gui.E5Application import e5App |
20 |
21 |
21 from .Ui_DebuggerPropertiesDialog import Ui_DebuggerPropertiesDialog |
22 from .Ui_DebuggerPropertiesDialog import Ui_DebuggerPropertiesDialog |
22 |
23 |
23 |
24 |
24 from eric6config import getConfig |
25 from eric6config import getConfig |
53 QComboBox.AdjustToMinimumContentsLength) |
54 QComboBox.AdjustToMinimumContentsLength) |
54 self.debugClientPicker.setPathsList(debugClientsHistory) |
55 self.debugClientPicker.setPathsList(debugClientsHistory) |
55 self.debugClientClearHistoryButton.setIcon( |
56 self.debugClientClearHistoryButton.setIcon( |
56 UI.PixmapCache.getIcon("editDelete.png")) |
57 UI.PixmapCache.getIcon("editDelete.png")) |
57 |
58 |
58 interpreterHistory = Preferences.getProject( |
59 self.venvComboBox.addItem("") |
59 "DebuggerInterpreterHistory") |
60 self.venvComboBox.addItems( |
60 self.interpreterPicker.setMode(E5PathPickerModes.OpenFileMode) |
61 sorted(e5App().getObject("VirtualEnvManager") |
61 self.interpreterPicker.setInsertPolicy(QComboBox.InsertAtTop) |
62 .getVirtualenvNames())) |
62 self.interpreterPicker.setSizeAdjustPolicy( |
|
63 QComboBox.AdjustToMinimumContentsLength) |
|
64 self.interpreterPicker.setPathsList(interpreterHistory) |
|
65 self.interpreterClearHistoryButton.setIcon( |
|
66 UI.PixmapCache.getIcon("editDelete.png")) |
|
67 |
63 |
68 self.translationLocalCompleter = E5DirCompleter( |
64 self.translationLocalCompleter = E5DirCompleter( |
69 self.translationLocalEdit) |
65 self.translationLocalEdit) |
70 |
66 |
71 self.project = project |
67 self.project = project |
72 |
68 |
73 if self.project.debugProperties["INTERPRETER"]: |
69 if self.project.debugProperties["VIRTUALENV"]: |
74 self.interpreterPicker.setText( |
70 venvIndex = max(0, self.venvComboBox.findText( |
75 self.project.debugProperties["INTERPRETER"]) |
71 self.project.debugProperties["VIRTUALENV"])) |
76 else: |
72 else: |
77 if self.project.pdata["PROGLANGUAGE"] in \ |
73 if self.project.pdata["PROGLANGUAGE"] in ["Python", "Python2"]: |
78 ["Python", "Python2", "Python3"]: |
74 venvName = Preferences.getDebugger("Python2VirtualEnv") |
79 self.interpreterPicker.setText(sys.executable) |
75 elif self.project.pdata["PROGLANGUAGE"] == "Python3": |
80 elif self.project.pdata["PROGLANGUAGE"] == "Ruby": |
76 venvName = Preferences.getDebugger("Python3VirtualEnv") |
81 self.interpreterPicker.setText("/usr/bin/ruby") |
77 else: |
|
78 venvName = "" |
|
79 if venvName: |
|
80 venvIndex = max(0, self.venvComboBox.findText(venvName)) |
|
81 else: |
|
82 venvIndex = 0 |
|
83 self.venvComboBox.setCurrentIndex(venvIndex) |
82 if self.project.debugProperties["DEBUGCLIENT"]: |
84 if self.project.debugProperties["DEBUGCLIENT"]: |
83 self.debugClientPicker.setText( |
85 self.debugClientPicker.setText( |
84 self.project.debugProperties["DEBUGCLIENT"]) |
86 self.project.debugProperties["DEBUGCLIENT"]) |
85 else: |
87 else: |
86 if self.project.pdata["PROGLANGUAGE"] in ["Python", "Python2", |
88 if self.project.pdata["PROGLANGUAGE"] in ["Python", "Python2", |
132 |
134 |
133 def storeData(self): |
135 def storeData(self): |
134 """ |
136 """ |
135 Public method to store the entered/modified data. |
137 Public method to store the entered/modified data. |
136 """ |
138 """ |
137 self.project.debugProperties["INTERPRETER"] = \ |
139 self.project.debugProperties["VIRTUALENV"] = \ |
138 self.interpreterPicker.text() |
140 self.venvComboBox.currentText() |
139 if not self.project.debugProperties["INTERPRETER"]: |
141 if not self.project.debugProperties["INTERPRETER"]: |
140 if self.project.pdata["PROGLANGUAGE"] in \ |
142 if self.project.pdata["PROGLANGUAGE"] in \ |
141 ["Python", "Python2", "Python3"]: |
143 ["Python", "Python2", "Python3"]: |
142 self.project.debugProperties["INTERPRETER"] = sys.executable |
144 self.project.debugProperties["INTERPRETER"] = sys.executable |
143 elif self.project.pdata["PROGLANGUAGE"] == "Ruby": |
145 elif self.project.pdata["PROGLANGUAGE"] == "Ruby": |
191 debugClientsHistory = self.debugClientPicker.getPathItems() |
193 debugClientsHistory = self.debugClientPicker.getPathItems() |
192 if debugClient not in debugClientsHistory: |
194 if debugClient not in debugClientsHistory: |
193 debugClientsHistory.insert(0, debugClient) |
195 debugClientsHistory.insert(0, debugClient) |
194 Preferences.setProject("DebugClientsHistory", |
196 Preferences.setProject("DebugClientsHistory", |
195 debugClientsHistory) |
197 debugClientsHistory) |
196 |
|
197 interpreter = self.interpreterPicker.text() |
|
198 interpreterHistory = self.interpreterPicker.getPathItems() |
|
199 if interpreter not in interpreterHistory: |
|
200 interpreterHistory.insert(0, interpreter) |
|
201 Preferences.setProject("DebuggerInterpreterHistory", |
|
202 interpreterHistory) |
|
203 |
198 |
204 @pyqtSlot() |
199 @pyqtSlot() |
205 def on_debugClientClearHistoryButton_clicked(self): |
200 def on_debugClientClearHistoryButton_clicked(self): |
206 """ |
201 """ |
207 Private slot to clear the debug clients history. |
202 Private slot to clear the debug clients history. |