the channel chooser of `Display Sequence` plugin is now properly populated at startup

fixes #9
This commit is contained in:
Guillaume Raffy 2022-01-25 17:11:27 +01:00
parent 5b107236c9
commit d5f948d304
2 changed files with 9 additions and 5 deletions

View File

@ -7,7 +7,7 @@ TEMP_PATH:=$(shell echo ~/work/lipase/tmp)
TESTS_OUTPUT_DATA_PATH:=$(TEMP_PATH)
LIB_SRC_FILES=$(shell find ./src/lipase -name "*.py")
PLUGINS_SRC_FILES=$(shell find ./src/ij-plugins -name "*.py")
LIPASE_VERSION=1.07
LIPASE_VERSION=1.08
BUILD_ROOT_PATH:=$(TEMP_PATH)/build
PACKAGE_FILE_PATH=$(BUILD_ROOT_PATH)/lipase-$(LIPASE_VERSION).zip

View File

@ -48,6 +48,11 @@ from java.awt.event import ItemListener
class SequenceChoiceListener(ItemListener):
def __init__(self, channel_choice, catalog):
"""
Args:
channel_choice (java.awt.Choice): The widget used for choosing the channel
catalog (Catalog): The catalog of sequences
"""
ItemListener.__init__(self)
self.channel_choice = channel_choice
self.catalog = catalog
@ -61,10 +66,9 @@ class SequenceChoiceListener(ItemListener):
logger.debug("SequenceChoiceListener : type(event.item) : %s" % str(type(event.item)))
selected_sequence_id = event.item
selected_sequence = self.catalog.sequences[selected_sequence_id]
channel_ids = selected_sequence.get_channel_names()
channel_ids = ['all'] + selected_sequence.get_channel_names()
self.channel_choice.removeAll()
self.channel_choice.add('all')
for channel_id in channel_ids:
self.channel_choice.add(channel_id)
@ -77,8 +81,8 @@ def ask_for_sequence(catalog):
assert len(sequence_ids) > 0
default_sequence_id = sequence_ids[0]
gd.addChoice('sequence', sequence_ids, default_sequence_id)
channel_ids = catalog.sequences[default_sequence_id].get_channel_names()
gd.addChoice('channel', channel_ids, channel_ids[0])
channel_ids = ['all'] + catalog.sequences[default_sequence_id].get_channel_names()
gd.addChoice('channel', channel_ids, 'all')
choices = gd.getChoices()
logger.debug("choices = %s" % choices)
sequence_choice = choices[0]