Skip to content

Commit

Permalink
Merge pull request micro-manager#1958 from nicost/hcs3
Browse files Browse the repository at this point in the history
High Content Screening plugin: Fixes bug PositionList occassionally not being populated.
  • Loading branch information
nicost authored May 29, 2024
2 parents e8c7e7c + 85ba524 commit 456275d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ public DefaultPositionListManager(Studio studio) {
* Replaces the list in the PositionList Window
* It will open a position list dialog if it was not already open.
*
* @param pl PosiionLIst to be made the current one
* @param pl PosiionList to be made the current one
*/
@Override
public void setPositionList(PositionList pl) {
// use serialization to clone the PositionList object
if (posList_ == pl) {
return;
}
posList_ = pl;
studio_.events().post(new DefaultNewPositionListEvent(posList_));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,8 @@ public void onShutdownCommencing(InternalShutdownCommencingEvent event) {

@Subscribe
public void onNewPositionList(NewPositionListEvent nple) {
PositionList pl = nple.getPositionList();
if (this.getPositionList() != pl) { // Without this check we will enter an infinite loop.
// Without this check we will enter an infinite loop.
if (this.getPositionList() != nple.getPositionList()) {
this.setPositionList(nple.getPositionList());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -500,6 +500,9 @@ protected void loadPositionList() {
}

protected void updatePositionData() {
if (!SwingUtilities.isEventDispatchThread()) {
SwingUtilities.invokeLater(this::updatePositionData);
}
positionModel_.fireTableDataChanged();
updateMarkButtonText();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,9 @@ private void setPositionList(String betweenWellOrder, boolean replaceList) {

try {
if (studio_ != null) {
if (platePl.getNumberOfPositions() == 0) {
studio_.logs().showMessage("No sites selected");
}
studio_.positions().setPositionList(platePl);
studio_.app().showPositionList();
}
Expand Down Expand Up @@ -821,14 +824,20 @@ public void finishCalibration(Point2D.Double offset) {
private void regenerate() {
updateXySpacing();
PositionList sites = generateSitesInWell();
List<WellPositionList> selectedWells = null;
if (plate_.getID().equals(plateIDCombo_.getSelectedItem())) {
selectedWells = platePanel_.getSelectedWellPositions();
}
plate_.initialize((String) plateIDCombo_.getSelectedItem());
try {
platePanel_.refreshImagingSites(sites);
} catch (HCSException e) {
displayError(e.getMessage());
}

platePanel_.setSelectedWells(platePanel_.getSelectedWellPositions());
if (selectedWells != null) {
platePanel_.setSelectedWells(selectedWells);
}
platePanel_.repaint();
}

Expand Down

0 comments on commit 456275d

Please sign in to comment.