Skip to content

Commit

Permalink
Remove Pytest Test results windows draft
Browse files Browse the repository at this point in the history
Package installer improvment
Fix incorrec venv console mode
  • Loading branch information
albilu committed Sep 30, 2024
1 parent 627f674 commit 3d36f5f
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@
import org.openide.util.LookupListener;
import org.openide.util.NbBundle;
import org.openide.util.Utilities;
import org.openide.windows.Mode;
import org.openide.windows.WindowManager;

/**
*
Expand Down Expand Up @@ -92,6 +94,12 @@ public void actionPerformed(ActionEvent ev) {
PythonProject get = lkpInfo.allInstances().stream().findFirst().get();
PythonVEnvConsoleActionTopComponent pythonVEnvConsoleActionTopComponent
= new PythonVEnvConsoleActionTopComponent(get, "venv");
for (Mode mode : WindowManager.getDefault().getModes()) {
if (mode.getName().equals("output") && mode.canDock(pythonVEnvConsoleActionTopComponent)) {
mode.dockInto(pythonVEnvConsoleActionTopComponent);
break;
}
}
pythonVEnvConsoleActionTopComponent.open();
pythonVEnvConsoleActionTopComponent.requestActive();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final class PythonLspServerConfigsPanel extends javax.swing.JPanel {

public static String[] PACKAGES = {
"pylsp",
"pyls-isort",
"python-lsp-isort",
"pylsp-mypy",
"pylsp-rope",
"black",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,21 @@ private void installButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN
switch (text) {
case "Install":
RP.post(() -> {
PythonUtility.processExecutor(new String[]{pyPath, "-m", "pip",
"install", name + "==" + versionsComboBox.getSelectedItem()
.toString()}, "Installing Package " + name);
PythonUtility.processExecutor(
new String[]{
pyPath,
"-m",
"pip",
"install",
String.format(
"%s%s",
name,
versionsComboBox.getSelectedItem() != null
? "==" + versionsComboBox.getSelectedItem().toString()
: "")
},
"Installing Package " + name
);
PythonPackagesModel.loadInstalled(pyPath);
});
break;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@
import org.netbeans.api.editor.EditorRegistry;
import org.netbeans.api.project.FileOwnerQuery;
import org.netbeans.api.project.Project;
import org.netbeans.api.settings.ConvertAsProperties;
import org.netbeans.modules.editor.NbEditorUtilities;
import org.openide.awt.ActionID;
import org.openide.awt.ActionReference;
import org.openide.filesystems.FileObject;
import org.openide.filesystems.FileUtil;
import org.openide.util.Exceptions;
Expand All @@ -31,16 +28,16 @@
/**
* Top component which displays something.
*/
@ConvertAsProperties(dtd = "-//org.netbeans.modules.python.testrunner//PythonTestResults//EN", autostore = false)
@TopComponent.Description(preferredID = "PythonTestResultsTopComponent", iconBase = "org/netbeans/modules/python/pytest.png", persistenceType = TopComponent.PERSISTENCE_ALWAYS)
@TopComponent.Registration(mode = "output", openAtStartup = false)
@ActionID(category = "Window", id = "org.netbeans.modules.python.testrunner.PythonTestResultsTopComponent")
@ActionReference(path = "Menu/Window/Tools", position = 255)
@TopComponent.OpenActionRegistration(displayName = "#CTL_PythonTestResultsAction", preferredID = "PythonTestResultsTopComponent")
//@ConvertAsProperties(dtd = "-//org.netbeans.modules.python.testrunner//PythonTestResults//EN", autostore = false)
//@TopComponent.Description(preferredID = "PythonTestResultsTopComponent", iconBase = "org/netbeans/modules/python/pytest.png", persistenceType = TopComponent.PERSISTENCE_ALWAYS)
//@TopComponent.Registration(mode = "output", openAtStartup = false)
//@ActionID(category = "Window", id = "org.netbeans.modules.python.testrunner.PythonTestResultsTopComponent")
//@ActionReference(path = "Menu/Window/Tools", position = 255)
//@TopComponent.OpenActionRegistration(displayName = "#CTL_PythonTestResultsAction", preferredID = "PythonTestResultsTopComponent")
@Messages({
"CTL_PythonTestResultsAction=PyTest Results",
"CTL_PythonTestResultsTopComponent=PyTest Results Window",
"HINT_PythonTestResultsTopComponent=This is a PyTest Results window"
"CTL_PythonTestResultsAction=PyTest Results",
"CTL_PythonTestResultsTopComponent=PyTest Results Window",
"HINT_PythonTestResultsTopComponent=This is a PyTest Results window"
})
public final class PythonTestResultsTopComponent extends TopComponent {

Expand Down Expand Up @@ -91,7 +88,7 @@ public void componentOpened() {
.getProjectDirectory()).toPath())
.map(Path::toFile)
.filter(file -> file.getName()
.equals("report.html"))
.equals("report.html"))
.collect(Collectors.toList());
collect.sort(LastModifiedFileComparator.LASTMODIFIED_REVERSE);
if (!collect.isEmpty()) {
Expand Down

0 comments on commit 3d36f5f

Please sign in to comment.