Skip to content

Commit

Permalink
Sentry fix: protect from null project scale, and handle project scale…
Browse files Browse the repository at this point in the history
… consistently
  • Loading branch information
jonoomph committed Dec 5, 2022
1 parent 5e26cc7 commit ef046ac
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/windows/main_window.py
Expand Up @@ -2795,7 +2795,7 @@ def setup_toolbars(self):
self.caption_model_row = None

# Get project's initial zoom value
initial_scale = get_app().project.get("scale") or 15.0
initial_scale = float(get_app().project.get("scale") or 15.0)

# Setup Zoom Slider widget
from windows.views.zoom_slider import ZoomSlider
Expand Down
4 changes: 2 additions & 2 deletions src/windows/views/webview.py
Expand Up @@ -230,7 +230,7 @@ def changed(self, action):
# Reset the scale when loading new JSON
if action.type == "load":
# Set the scale again (to project setting)
initial_scale = get_app().project.get("scale") or 15.0
initial_scale = float(get_app().project.get("scale") or 15.0)
self.window.sliderZoomWidget.setZoomFactor(initial_scale)

@pyqtSlot(str, bool, bool, bool)
Expand Down Expand Up @@ -2829,7 +2829,7 @@ def update_zoom(self, newScale):
self.redraw_audio_timer.start()

# Only update scale if different
current_scale = float(get_app().project.get("scale"))
current_scale = float(get_app().project.get("scale") or 15.0)

# Save current zoom
if newScale != current_scale:
Expand Down

0 comments on commit ef046ac

Please sign in to comment.