Skip to content

Commit

Permalink
Optimize option panel
Browse files Browse the repository at this point in the history
  • Loading branch information
albilu committed Sep 9, 2024
1 parent fa097d0 commit 5d2c17b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 23 deletions.
3 changes: 2 additions & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,12 @@ If applicable, add screenshots to help explain your problem.
**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- JDK Version [e.g. 22]
- Python version [e.g. 3.11.8]
- Netbeans Version: [e.g. 22]
- Python Plugin Version: [e.g. 22]

**Mandatory Logs**
Add any other context about the problem here.
[e.g. Netbeans stacktrace/logs: (View-> IDE Log)]
[e.g. LSP Server logs ${netbeans_userdir}/.pythonlsp/lsp_log_file]
[e.g. LSP Server logs ${netbeans_userdir}/.pythonlsp/lsp_log_file]
/!\: (this log is cleaned at Netbeans exit)
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ The project is driven by the need to bring to Netbeans similar support for Pytho

Support this project growth and maintenance by:

- Starring it [![](https://img.shields.io/github/stars/albilu/netbeansPython)]()
- Submiting [PR](https://github.com/albilu/netbeansPython/pulls) for issues in the backlog
- [Sponsoring it](https://github.com/sponsors/albilu)
- Submiting [PR](https://github.com/albilu/netbeansPython/pulls) for issues in the backlog
- Starring it [![](https://img.shields.io/github/stars/albilu/netbeansPython)]()

### Related Projects

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,14 @@
import org.openide.util.Exceptions;
import org.openide.util.NbPreferences;
import org.openide.util.Pair;
import org.openide.util.RequestProcessor;

final class PythonLspServerConfigsPanel extends javax.swing.JPanel {

private static final long serialVersionUID = 1L;

RequestProcessor RP = new RequestProcessor(this.getClass().getName(), 1);

public static String[] PACKAGES = {
"pylsp",
"pyls-isort",
Expand Down Expand Up @@ -231,33 +234,36 @@ private void lspListMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:eve
}//GEN-LAST:event_lspListMouseClicked

void load() {
if (errors != null && !errors.isEmpty()) {
return;
}
try {
lspServerCheckBox.setSelected(NbPreferences.root().getBoolean("autoUpdate", false));
lspServerLabel.setText(String.format("%s%s", "Current Version: ", PythonUtility.getServerVersion()));
lspPythonVersionLabel.setText(String.format("%s%s", "Python Version: ", PythonUtility.getVersion(PythonUtility.getLspPythonExe())));
String pipListOutput = PythonUtility.getPipList(PythonUtility.getLspPythonExe());
RP.post(() -> {
if (errors != null && !errors.isEmpty()) {
return;
}
try {
lspServerCheckBox.setSelected(NbPreferences.root().getBoolean("autoUpdate", false));
lspServerLabel.setText(String.format("%s%s", "Current Version: ", PythonUtility.getServerVersion()));
lspPythonVersionLabel.setText(String.format("%s%s", "Python Version: ", PythonUtility.getVersion(PythonUtility.getLspPythonExe())));
String pipListOutput = PythonUtility.getPipList(PythonUtility.getLspPythonExe());

DefaultListModel<Pair<String, Boolean>> model = new DefaultListModel<>();

DefaultListModel<Pair<String, Boolean>> model = new DefaultListModel<>();
for (String pipPackage : PACKAGES) {
if (pipListOutput.contains(pipPackage)) {
model.addElement(Pair.of(pipPackage, true));

for (String pipPackage : PACKAGES) {
if (pipListOutput.contains(pipPackage)) {
model.addElement(Pair.of(pipPackage, true));
} else {
model.addElement(Pair.of(pipPackage, false));

} else {
model.addElement(Pair.of(pipPackage, false));
}

}
lspList.setModel(model);

lspEditorPane.setText(Files.readString(PythonUtility.SETTINGS.toPath()));
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
lspList.setModel(model);

lspEditorPane.setText(Files.readString(PythonUtility.SETTINGS.toPath()));
} catch (IOException ex) {
Exceptions.printStackTrace(ex);
}
});

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
import java.nio.charset.Charset;
import java.nio.file.Paths;
import java.util.Map;
import org.netbeans.modules.python.project.PythonProject;
import org.netbeans.modules.python.PythonUtility;
import org.netbeans.modules.python.project.PythonProject;

/**
*
Expand Down

0 comments on commit 5d2c17b

Please sign in to comment.