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

Fixing more Sentry Errors #5577

Merged
merged 4 commits into from
Jul 9, 2024
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
32 changes: 20 additions & 12 deletions src/windows/add_to_timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,20 @@ def btnMoveUpClicked(self, checked):
if self.treeFiles.selected:
selected_index = self.treeFiles.selected.row()

# Ignore if empty files
# Ignore if empty files or no selection
if not files or selected_index is None:
return

# New index
new_index = max(selected_index - 1, 0)
log.info(new_index)
# Check if selected_index is within valid range
if 0 <= selected_index < len(files):
# New index
new_index = max(selected_index - 1, 0)

# Remove item and move it
files.insert(new_index, files.pop(selected_index))
# Remove item and move it
files.insert(new_index, files.pop(selected_index))
else:
log.warning(f"Invalid selected_index: {selected_index}, list length: {len(files)}")
return

# Refresh tree
self.treeFiles.refresh_view()
Expand All @@ -90,16 +94,20 @@ def btnMoveDownClicked(self, checked):
if self.treeFiles.selected:
selected_index = self.treeFiles.selected.row()

# Ignore if empty files
# Ignore if empty files or no selection
if not files or selected_index is None:
return

# New index
new_index = min(selected_index + 1, len(files) - 1)
log.info(new_index)
# Check if selected_index is within valid range
if 0 <= selected_index < len(files):
# New index
new_index = min(selected_index + 1, len(files) - 1)

# Remove item and move it
files.insert(new_index, files.pop(selected_index))
# Remove item and move it
files.insert(new_index, files.pop(selected_index))
else:
log.warning(f"Invalid selected_index: {selected_index}, list length: {len(files)}")
return

# Refresh tree
self.treeFiles.refresh_view()
Expand Down
6 changes: 4 additions & 2 deletions src/windows/models/properties_model.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class PropertiesModel(updates.UpdateInterface):
def changed(self, action):

# Handle change
if action.key and action.key[0] in ["clips", "effects"] and action.type in ["update", "insert"]:
if len(action.key) >= 1 and action.key[0] in ["clips", "effects"] and action.type in ["update", "insert"]:
log.debug(action.values)
# Update the model data
self.update_model(get_app().window.txtPropertyFilter.text())
Expand Down Expand Up @@ -702,7 +702,9 @@ def set_property(self, property, filter, c, item_type, object_id=None):

selected_choice = None
if choices:
selected_choice = [c for c in choices if c["selected"] is True][0]["name"]
selected_choices = [c for c in choices if c.get("selected") is True]
if selected_choices:
selected_choice = selected_choices[0]["name"]

# Hide filtered out properties
if filter and filter.lower() not in _(label).lower():
Expand Down
2 changes: 1 addition & 1 deletion src/windows/video_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class VideoWidget(QWidget, updates.UpdateInterface):
# This method is invoked by the UpdateManager each time a change happens (i.e UpdateInterface)
def changed(self, action):
# Handle change
if (action.key and action.key[0] in [
if (len(action.key) >= 1 and action.key[0] in [
"display_ratio", "pixel_ratio"
] or action.type in ["load"]):
# Update display ratio (if found)
Expand Down
3 changes: 2 additions & 1 deletion src/windows/views/properties_tableview.py
Original file line number Diff line number Diff line change
Expand Up @@ -779,7 +779,8 @@ def contextMenuEvent(self, event):
self.menu = self.build_menu(self.choices, menu)

# Show context menu (if any options present)
if self.menu.children():
# There is always at least 1 QAction in an empty menu though
if len(self.menu.children()) > 1:
self.menu.popup(event.globalPos())

def build_menu(self, data, parent_menu=None):
Expand Down
2 changes: 1 addition & 1 deletion src/windows/views/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def changed(self, action):
return

# Bail out if change unrelated to webview
if action.key and action.key[0] not in ["clips", "effects", "duration", "layers", "markers"]:
if len(action.key) >= 1 and action.key[0] not in ["clips", "effects", "duration", "layers", "markers"]:
log.debug(f"Skipping unneeded webview update for '{action.key[0]}'")
return

Expand Down
4 changes: 4 additions & 0 deletions src/windows/views/timeline_backend/qwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,10 @@ def get_html(self):

# This method is invoked by the UpdateManager each time a change happens (i.e UpdateInterface)
def changed(self, action):
# Ignore changes that don't affect this
if action and len(action.key) >= 1 and action.key[0].lower() in ["files", "history", "profile"]:
return

# Clear previous rects
self.clip_rects.clear()
self.clip_rects_selected.clear()
Expand Down
4 changes: 4 additions & 0 deletions src/windows/views/zoom_slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ class ZoomSlider(QWidget, updates.UpdateInterface):

# This method is invoked by the UpdateManager each time a change happens (i.e UpdateInterface)
def changed(self, action):
# Ignore changes that don't affect this
if action and len(action.key) >= 1 and action.key[0].lower() in ["files", "history", "profile"]:
return

# Clear previous rects
self.clip_rects.clear()
self.clip_rects_selected.clear()
Expand Down
Loading