Conversation
Tests passing on
GUI manual testing:Image loading
Network
GUI: display
GUI: mouse/ROIs
GUI: menus
Filtering
|
|
Verified that |
.views state, fix gradZ 3D GUI display.views & .color states, fix gradZ 3D GUI display
|
Verified that update plot is only called once per interaction 👍 Good to merge |
| self.view = 0 # 0=image, 1=flowsXY, 2=flowsZ, 3=cellprob | ||
| self.color = 0 # 0=RGB, 1=gray, 2=R, 3=G, 4=B |
There was a problem hiding this comment.
removes the .view and .color state so we only reference the checkbox state. This way we can use qt signals from the checkbox easily
| self.RGBDropDown.addItems( | ||
| ["RGB", "red=R", "green=G", "blue=B", "gray", "spectral"]) | ||
| self.RGBDropDown.name_map = { | ||
| "rgb" : "rgb", | ||
| "red" : "red=r", | ||
| "green" : "green=g", | ||
| "blue" : "blue=b", | ||
| "gray" : "gray", | ||
| "spectral": "spectral", | ||
| } |
There was a problem hiding this comment.
convience maps to get the correct drop down setting. These can be extended
| @@ -662,62 +673,75 @@ def level_change(self, r): | |||
| self.update_plot() | |||
|
|
|||
| def keyPressEvent(self, event): | |||
There was a problem hiding this comment.
modified this method to use qt events and event propagation instead of updated flag
| if not updated: | ||
| self.update_plot() |
There was a problem hiding this comment.
removed unnecessary update. use the event accepted flag instead
|
|
||
| self.update_plot() |
There was a problem hiding this comment.
removed unnecessary update. only really matters at startup
| self.draw_layer() | ||
| self.update_layer() | ||
| if self.loaded: | ||
| self.update_plot() |
There was a problem hiding this comment.
removed unnecessary update. Toggling the checkbox is wired to update_plot via a signal
| self.enable_restored_view(False) | ||
| if self.view == 'restored': | ||
| self.view = 'image' |
There was a problem hiding this comment.
a good example of the gained clarity when using the new properties
| self.sliders[r].setValue([ | ||
| self.saturation[r][self.currentZ][0], | ||
| self.saturation[r][self.currentZ][1] | ||
| ]) |
There was a problem hiding this comment.
the sliders were wired to fire a signal that connected to update_plot() previously. Now, this signal is blocked
| print("GUI_INFO: resizing flows to original image size") | ||
| for j in range(len(flows_new)): | ||
| flow0 = flows_new[j] | ||
| for flows0 in flows_new: |
There was a problem hiding this comment.
just a simplification/clarification
|
|
||
| def go_next_previous_dropdown(self, dropdown, increment=1): | ||
| """ Go to the next dropdown element using `increment` """ | ||
|
|
||
| # skip disabled views | ||
| num_items = dropdown.count() | ||
| enabled = [] | ||
| for i in range(num_items): | ||
| enabled.append(dropdown.model().item(i).isEnabled()) | ||
|
|
||
| if not any(enabled): | ||
| self.logger.error('No available dropdown items are enabled. Cannot adjust view.') | ||
| return | ||
|
|
||
| idx = dropdown.currentIndex() + increment | ||
|
|
||
| for _ in range(num_items): | ||
| idx %= num_items | ||
| if enabled[idx]: | ||
| dropdown.setCurrentIndex(idx) | ||
| return | ||
| idx += increment | ||
|
|
||
| self.logger.error('Could not find an emabled dropdown item.') No newline at end of file |
There was a problem hiding this comment.
allows indexing a dropdown by increment and skips disabled items
is used for RGB and views dropdowns
| if event.key() == QtCore.Qt.Key_Minus or event.key() == QtCore.Qt.Key_Equal: | ||
| self.p0.keyPressEvent(event) | ||
| event.accept() | ||
| return | ||
|
|
||
| # propagate unhandled events to MainW | ||
| if not event.isAccepted(): | ||
| super().keyPressEvent(event) |
There was a problem hiding this comment.
deduplicated key press logic in gui3d so 2d gui takes care of it
Moved the main gui's
.viewand.colorattributes to a stateless property that just looks at the actual drop down state. Setting the attribute/property is backwards compatible to use indexes or strings for convenience.Also, using more intuitive variables for the update_plot function.
Also, removed duplicated code from 3d GUI
keyPressEventthat is now delegated toMainWclass.Fix gradZ displaying in 3d GUI.