mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Create an option for selecting PyQt backend while debugging (PY-24114)
This commit is contained in:
@@ -351,7 +351,8 @@ public class PyDebugRunner extends GenericProgramRunner {
|
||||
}
|
||||
|
||||
if (PyDebuggerOptionsProvider.getInstance(project).isSupportQtDebugging()) {
|
||||
debugParams.addParameter("--qt-support");
|
||||
String pyQtBackend = PyDebuggerOptionsProvider.getInstance(project).getPyQtBackend().toLowerCase();
|
||||
debugParams.addParameter(String.format("--qt-support=%s", pyQtBackend));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -3,12 +3,12 @@
|
||||
<grid id="27dc6" binding="myMainPanel" layout-manager="GridLayoutManager" row-count="2" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="572" height="303"/>
|
||||
<xy x="20" y="20" width="585" height="303"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<grid id="62c2a" layout-manager="GridLayoutManager" row-count="4" column-count="4" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<grid id="62c2a" layout-manager="GridLayoutManager" row-count="4" column-count="6" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
|
||||
@@ -18,7 +18,7 @@
|
||||
<children>
|
||||
<component id="36ff9" class="javax.swing.JCheckBox" binding="myAttachToSubprocess">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="0" column="0" row-span="1" col-span="5" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Attach to subprocess automatically while debugging"/>
|
||||
@@ -26,7 +26,7 @@
|
||||
</component>
|
||||
<component id="39b74" class="javax.swing.JCheckBox" binding="mySaveSignatures">
|
||||
<constraints>
|
||||
<grid row="1" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<actionCommand value="Save call signatures"/>
|
||||
@@ -36,7 +36,7 @@
|
||||
</component>
|
||||
<component id="34fab" class="javax.swing.JButton" binding="myClearCacheButton">
|
||||
<constraints>
|
||||
<grid row="1" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="4" row-span="1" col-span="1" vsize-policy="0" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Clear caches"/>
|
||||
@@ -44,12 +44,12 @@
|
||||
</component>
|
||||
<hspacer id="f4dfd">
|
||||
<constraints>
|
||||
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="5" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
</hspacer>
|
||||
<component id="c79a5" class="javax.swing.JCheckBox" binding="mySupportGevent">
|
||||
<constraints>
|
||||
<grid row="2" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="2" column="0" row-span="1" col-span="5" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Gevent compatible"/>
|
||||
@@ -65,10 +65,24 @@
|
||||
</component>
|
||||
<component id="b392f" class="com.intellij.ui.components.JBLabel" binding="warningIcon" custom-create="true">
|
||||
<constraints>
|
||||
<grid row="1" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
<grid row="1" column="3" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="0" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="f0d4d" class="com.intellij.openapi.ui.ComboBox" binding="myPyQtBackend">
|
||||
<constraints>
|
||||
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="0" hsize-policy="2" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<component id="23e2" class="com.intellij.ui.components.JBLabel">
|
||||
<constraints>
|
||||
<grid row="3" column="2" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="4" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value=" "/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</grid>
|
||||
<vspacer id="5915a">
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.intellij.openapi.options.Configurable;
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.options.SearchableConfigurable;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.ui.TooltipWithClickableLinks;
|
||||
import com.intellij.ui.components.JBCheckBox;
|
||||
import com.intellij.ui.components.JBLabel;
|
||||
@@ -29,6 +30,11 @@ import org.jetbrains.annotations.NotNull;
|
||||
import javax.swing.*;
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.ActionListener;
|
||||
import java.awt.event.ItemEvent;
|
||||
import java.awt.event.ItemListener;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static com.jetbrains.python.debugger.PyDebugSupportUtils.DEBUGGER_WARNING_MESSAGE;
|
||||
|
||||
@@ -44,12 +50,22 @@ public class PyDebuggerConfigurable implements SearchableConfigurable, Configura
|
||||
private JCheckBox mySupportGevent;
|
||||
private JBCheckBox mySupportQt;
|
||||
private JBLabel warningIcon;
|
||||
private ComboBox<String> myPyQtBackend;
|
||||
private List<String> myPyQtBackendsList = new ArrayList<>(Arrays.asList("Auto", "PyQt4", "PyQt5", "PySide"));
|
||||
|
||||
private final Project myProject;
|
||||
|
||||
public PyDebuggerConfigurable(Project project, final PyDebuggerOptionsProvider settings) {
|
||||
myProject = project;
|
||||
mySettings = settings;
|
||||
myPyQtBackendsList.forEach(e -> myPyQtBackend.addItem(e));
|
||||
|
||||
mySupportQt.addItemListener(new ItemListener() {
|
||||
@Override
|
||||
public void itemStateChanged(ItemEvent e) {
|
||||
myPyQtBackend.setEnabled(mySupportQt.isSelected());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public String getDisplayName() {
|
||||
@@ -79,7 +95,8 @@ public class PyDebuggerConfigurable implements SearchableConfigurable, Configura
|
||||
return myAttachToSubprocess.isSelected() != mySettings.isAttachToSubprocess() ||
|
||||
mySaveSignatures.isSelected() != mySettings.isSaveCallSignatures() ||
|
||||
mySupportGevent.isSelected() != mySettings.isSupportGeventDebugging() ||
|
||||
mySupportQt.isSelected() != mySettings.isSupportQtDebugging();
|
||||
mySupportQt.isSelected() != mySettings.isSupportQtDebugging() ||
|
||||
!myPyQtBackend.getSelectedItem().equals(mySettings.getPyQtBackend());
|
||||
}
|
||||
|
||||
public void apply() throws ConfigurationException {
|
||||
@@ -87,6 +104,7 @@ public class PyDebuggerConfigurable implements SearchableConfigurable, Configura
|
||||
mySettings.setSaveCallSignatures(mySaveSignatures.isSelected());
|
||||
mySettings.setSupportGeventDebugging(mySupportGevent.isSelected());
|
||||
mySettings.setSupportQtDebugging(mySupportQt.isSelected());
|
||||
mySettings.setPyQtBackend(myPyQtBackendsList.get(myPyQtBackend.getSelectedIndex()));
|
||||
}
|
||||
|
||||
public void reset() {
|
||||
@@ -94,6 +112,7 @@ public class PyDebuggerConfigurable implements SearchableConfigurable, Configura
|
||||
mySaveSignatures.setSelected(mySettings.isSaveCallSignatures());
|
||||
mySupportGevent.setSelected(mySettings.isSupportGeventDebugging());
|
||||
mySupportQt.setSelected(mySettings.isSupportQtDebugging());
|
||||
myPyQtBackend.setSelectedItem(mySettings.getPyQtBackend());
|
||||
}
|
||||
|
||||
public void disposeUIResources() {
|
||||
|
||||
@@ -53,6 +53,7 @@ public class PyDebuggerOptionsProvider implements PersistentStateComponent<PyDeb
|
||||
myState.mySaveCallSignatures = state.mySaveCallSignatures;
|
||||
myState.mySupportGeventDebugging = state.mySupportGeventDebugging;
|
||||
myState.mySupportQtDebugging = state.mySupportQtDebugging;
|
||||
myState.myPyQtBackend = state.myPyQtBackend;
|
||||
}
|
||||
|
||||
public static class State {
|
||||
@@ -60,6 +61,7 @@ public class PyDebuggerOptionsProvider implements PersistentStateComponent<PyDeb
|
||||
public boolean mySaveCallSignatures = false;
|
||||
public boolean mySupportGeventDebugging = false;
|
||||
public boolean mySupportQtDebugging = true;
|
||||
public String myPyQtBackend = "auto";
|
||||
}
|
||||
|
||||
|
||||
@@ -94,5 +96,13 @@ public class PyDebuggerOptionsProvider implements PersistentStateComponent<PyDeb
|
||||
public void setSupportQtDebugging(boolean supportQtDebugging) {
|
||||
myState.mySupportQtDebugging = supportQtDebugging;
|
||||
}
|
||||
|
||||
public String getPyQtBackend() {
|
||||
return myState.myPyQtBackend;
|
||||
}
|
||||
|
||||
public void setPyQtBackend(String backend) {
|
||||
myState.myPyQtBackend = backend;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user