Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #47 & Improve Streamline Performance #48

Merged
merged 3 commits into from
Jan 28, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/density_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,7 @@ def setZmaxChanged(self, *args):
self.parent.SetPlotParam('set_v_max', self.setZmaxVar.get())

def TxtEnter(self, e):
streamlines.streamlines_callback(self, update_plot=True) # not updating plots because FieldsCallback forces an update no matter what
streamlines.streamlines_callback(self, update_plot=True)
self.FieldsCallback()
self.GammaCallback()

Expand Down
2 changes: 1 addition & 1 deletion src/fields_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -1508,7 +1508,7 @@ def Selector(self):
self.parent.SetPlotParam('show_z', self.ShowZVar.get())

def TxtEnter(self, e):
streamlines.streamlines_callback(self, update_plot=False) # not updating plots because FieldsCallback forces an update no matter what
streamlines.streamlines_callback(self, update_plot=False)
self.FieldsCallback()
self.GammaCallback()

Expand Down
21 changes: 13 additions & 8 deletions src/streamlines.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,12 +106,11 @@ def __show_streamline_handler(settings, panel):
"""
# Write value to the settings dictionary
settings.parent.SetPlotParam(
"show_streamlines", settings.show_streamlines.get(), update_plot=False
"show_streamlines", settings.show_streamlines.get(), update_plot=False, NeedsRedraw=True
)
# Either create the streamlines or remove them depending on the state of the checkbox
if settings.parent.GetPlotParam("show_streamlines"):
draw_streamlines(panel)
else:

# Remove streamlines if the checkbox is unchecked
if not settings.parent.GetPlotParam("show_streamlines"):
remove_streamlines(panel)

# Update everything
Expand All @@ -129,23 +128,29 @@ def streamlines_callback(settings, update_plot=True):
update_plot = False

# Handle streamline stride
if settings.streamlines_stride.get() != settings.streamlines_stride:
if settings.streamlines_stride.get() != settings.parent.plot_param_dict['streamlines_stride']:
settings.parent.plot_param_dict['streamlines_stride'] = settings.streamlines_stride.get()

settings.parent.SetPlotParam(
"streamlines_stride",
settings.streamlines_stride.get(),
update_plot=update_plot,
)

# Handle streamline density
if settings.streamlines_density.get() != settings.streamlines_density:
if settings.streamlines_density.get() != settings.parent.plot_param_dict['streamlines_density']:
settings.parent.plot_param_dict['streamlines_density'] = settings.streamlines_density.get()

settings.parent.SetPlotParam(
"streamlines_density",
settings.streamlines_density.get(),
update_plot=update_plot,
)

# Handle streamline color
if settings.streamlines_color.get() != settings.streamlines_color:
if settings.streamlines_color.get() != settings.parent.plot_param_dict['streamlines_color']:
settings.parent.plot_param_dict['streamlines_color'] = settings.streamlines_color.get()

settings.parent.SetPlotParam(
"streamlines_color",
settings.streamlines_color.get(),
Expand Down
Loading