Skip to content

Commit

Permalink
Merge pull request #48 from bcaddy/main-iss47
Browse files Browse the repository at this point in the history
Fix #47 & Improve Streamline Performance
  • Loading branch information
bcaddy authored Jan 28, 2025
2 parents 15b9f04 + bb0f2ba commit bc496d1
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
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

0 comments on commit bc496d1

Please sign in to comment.