Skip to content

Commit

Permalink
v2024.2.24 - fixing issues detected during CI run wip
Browse files Browse the repository at this point in the history
  • Loading branch information
royerloic committed Feb 25, 2024
1 parent beea312 commit c4dc3a8
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/napari_chatgpt/_tests/test_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def test_omega_q_widget(make_napari_viewer, capsys):
viewer.add_image(np.random.random((100, 100)))

# create our widget, passing in the viewer
my_widget = OmegaQWidget(viewer)
my_widget = OmegaQWidget(viewer, add_code_editor=False)

# read captured output and check that it's as we expected
captured = capsys.readouterr()
Expand Down
16 changes: 12 additions & 4 deletions src/napari_chatgpt/_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class OmegaQWidget(QWidget):
# in one of two ways:
# 1. use a parameter called `napari_viewer`, as done here
# 2. use a type annotation of 'napari.viewer.Viewer' for any parameter
def __init__(self, napari_viewer):
def __init__(self, napari_viewer, add_code_editor=True):
super().__init__()
aprint("OmegaQWidget instantiated!")

Expand Down Expand Up @@ -82,11 +82,15 @@ def __init__(self, napari_viewer):
self._verbose()

# Instantiate the MicroPluginMainWindow:
self.micro_plugin_main_window = MicroPluginMainWindow(napari_viewer=napari_viewer)
if add_code_editor:
self.micro_plugin_main_window = MicroPluginMainWindow(napari_viewer=napari_viewer)

# Add the start Omega and SHow editor buttons to the layout:
# Add the start Omega:
self._start_omega_button()
self._show_editor_button()

# Add the show editor button:
if add_code_editor:
self._show_editor_button()

# Set the layout on the application's window
self.setLayout(self.layout)
Expand Down Expand Up @@ -484,6 +488,10 @@ def _start_omega(self):

def _show_editor(self):
try:
if not self.micro_plugin_main_window:
aprint("MicroPluginMainWindow not instantiated.")
return

with asection("Showing editor now!"):

# Set LLM parameters to self.micro_plugin_main_window:
Expand Down
17 changes: 0 additions & 17 deletions test_notebook.ipynb

This file was deleted.

0 comments on commit c4dc3a8

Please sign in to comment.