From a63c028ce2d99f499b1c4fb9e337b99eee4740d8 Mon Sep 17 00:00:00 2001 From: carlosuc3m <100329787@alumnos.uc3m.es> Date: Fri, 22 Nov 2024 18:02:39 +0100 Subject: [PATCH] keep improving --- src/main/java/ai/nets/samj/gui/ImageSelection.java | 2 ++ .../java/ai/nets/samj/gui/components/ModelDrawerPanel.java | 5 ----- src/main/java/ai/nets/samj/ui/ConsumerInterface.java | 2 ++ 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/main/java/ai/nets/samj/gui/ImageSelection.java b/src/main/java/ai/nets/samj/gui/ImageSelection.java index 29b25a9..6eb874d 100644 --- a/src/main/java/ai/nets/samj/gui/ImageSelection.java +++ b/src/main/java/ai/nets/samj/gui/ImageSelection.java @@ -39,6 +39,8 @@ protected static ImageSelection create(ConsumerInterface consumer, ImageSelectio } protected Object getSelectedObject() { + if (this.cmbBox.getSelectedItem() == null) + return null; return ((ComboBoxItem) this.cmbBox.getSelectedItem()).getValue(); } diff --git a/src/main/java/ai/nets/samj/gui/components/ModelDrawerPanel.java b/src/main/java/ai/nets/samj/gui/components/ModelDrawerPanel.java index 0d4cc50..62c2335 100644 --- a/src/main/java/ai/nets/samj/gui/components/ModelDrawerPanel.java +++ b/src/main/java/ai/nets/samj/gui/components/ModelDrawerPanel.java @@ -124,14 +124,12 @@ private void installModel() { this.model.getInstallationManger().installEverything(); SwingUtilities.invokeLater(() -> { listener.setGUIEnabled(true); - listener.setGoButtonEnabled(true); }); } catch (IOException | InterruptedException | ArchiveException | URISyntaxException | MambaInstallException e) { e.printStackTrace(); SwingUtilities.invokeLater(() -> { listener.setGUIEnabled(true); - listener.setGoButtonEnabled(false); }); } }); @@ -144,7 +142,6 @@ private void uninstallModel() { this.model.getInstallationManger().uninstall(); SwingUtilities.invokeLater(() -> { listener.setGUIEnabled(true); - listener.setGoButtonEnabled(false); }); }); } @@ -152,8 +149,6 @@ private void uninstallModel() { public interface ModelDrawerPanelListener { void setGUIEnabled(boolean enabled); - - void setGoButtonEnabled(boolean installed); } } diff --git a/src/main/java/ai/nets/samj/ui/ConsumerInterface.java b/src/main/java/ai/nets/samj/ui/ConsumerInterface.java index 16de87f..bdccac9 100644 --- a/src/main/java/ai/nets/samj/ui/ConsumerInterface.java +++ b/src/main/java/ai/nets/samj/ui/ConsumerInterface.java @@ -71,6 +71,8 @@ public abstract class ConsumerInterface { public abstract void setFocusedImage(Object image); + public abstract void deselectImage(); + public void setModel(SAMModel model) { this.selectedModel = model; }