From f7a500a4c3344161227fb6016bc7277303094341 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Thu, 6 Aug 2020 16:51:51 -0400 Subject: [PATCH] Use resource file for curves, cursors --- src/windows/models/properties_model.py | 7 +++---- src/windows/video_widget.py | 24 +++++++++++------------ src/windows/views/properties_tableview.py | 9 +++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/src/windows/models/properties_model.py b/src/windows/models/properties_model.py index 4077108d68..c6de2cbf33 100644 --- a/src/windows/models/properties_model.py +++ b/src/windows/models/properties_model.py @@ -32,8 +32,7 @@ from PyQt5.QtCore import QMimeData, Qt, QLocale, QTimer from PyQt5.QtGui import * -from classes import updates -from classes import info +from classes import info, updates, openshot_rc from classes.query import Clip, Transition, Effect, File from classes.logger import log from classes.app import get_app @@ -672,7 +671,7 @@ def update_model(self, filter=""): col.setData((c.Id(), item_type)) if points > 1: # Apply icon to cell - my_icon = QPixmap(os.path.join(info.IMAGES_PATH, "keyframe-%s.png" % interpolation)) + my_icon = QPixmap(":/curves/keyframe-%s.png" % interpolation) col.setData(my_icon, Qt.DecorationRole) # Set the background color of the cell @@ -755,7 +754,7 @@ def update_model(self, filter=""): if points > 1: # Apply icon to cell - my_icon = QPixmap(os.path.join(info.IMAGES_PATH, "keyframe-%s.png" % interpolation)) + my_icon = QPixmap(":/curves/keyframe-%s.png" % interpolation) col.setData(my_icon, Qt.DecorationRole) # Set the background color of the cell diff --git a/src/windows/video_widget.py b/src/windows/video_widget.py index 2f595e6403..8623f7fb7c 100644 --- a/src/windows/video_widget.py +++ b/src/windows/video_widget.py @@ -30,11 +30,10 @@ from PyQt5.QtWidgets import QSizePolicy, QWidget, QPushButton import openshot # Python module for libopenshot (required video editing module installed separately) +from classes import info, updates, openshot_rc from classes.logger import log from classes.app import get_app from classes.query import Clip -from classes import updates -from classes import info import os import json @@ -803,16 +802,17 @@ def __init__(self, *args): self.resize_button.setMouseTracking(True) # Initialize cursors - self.cursors = { "move": QPixmap(os.path.join(info.IMAGES_PATH, "cursor_move.png")), - "resize_x": QPixmap(os.path.join(info.IMAGES_PATH, "cursor_resize_x.png")), - "resize_y": QPixmap(os.path.join(info.IMAGES_PATH, "cursor_resize_y.png")), - "resize_bdiag": QPixmap(os.path.join(info.IMAGES_PATH, "cursor_resize_bdiag.png")), - "resize_fdiag": QPixmap(os.path.join(info.IMAGES_PATH, "cursor_resize_fdiag.png")), - "rotate": QPixmap(os.path.join(info.IMAGES_PATH, "cursor_rotate.png")), - "shear_x": QPixmap(os.path.join(info.IMAGES_PATH, "cursor_shear_x.png")), - "shear_y": QPixmap(os.path.join(info.IMAGES_PATH, "cursor_shear_y.png")), - "hand": QPixmap(os.path.join(info.IMAGES_PATH, "cursor_hand.png")), - } + self.cursors = { + "move": QPixmap(":/cursors/cursor_move.png"), + "resize_x": QPixmap(":/cursors/cursor_resize_x.png"), + "resize_y": QPixmap(":/cursors/cursor_resize_y.png"), + "resize_bdiag": QPixmap(":/cursors/cursor_resize_bdiag.png"), + "resize_fdiag": QPixmap(":/cursors/cursor_resize_fdiag.png"), + "rotate": QPixmap(":/cursors/cursor_rotate.png"), + "shear_x": QPixmap(":/cursors/cursor_shear_x.png"), + "shear_y": QPixmap(":/cursors/cursor_shear_y.png"), + "hand": QPixmap(":/cursors/cursor_hand.png"), + } # Mutex lock self.mutex = QMutex() diff --git a/src/windows/views/properties_tableview.py b/src/windows/views/properties_tableview.py index 5ed6f08bde..d95f1a6612 100644 --- a/src/windows/views/properties_tableview.py +++ b/src/windows/views/properties_tableview.py @@ -46,10 +46,11 @@ def __init__(self, parent=None, *args): QItemDelegate.__init__(self, parent, *args) # pixmaps for curve icons - self.curve_pixmaps = {openshot.BEZIER: QPixmap(os.path.join(info.IMAGES_PATH, "keyframe-%s.png" % openshot.BEZIER)), - openshot.LINEAR: QPixmap(os.path.join(info.IMAGES_PATH, "keyframe-%s.png" % openshot.LINEAR)), - openshot.CONSTANT: QPixmap(os.path.join(info.IMAGES_PATH, "keyframe-%s.png" % openshot.CONSTANT)) - } + self.curve_pixmaps = { + openshot.BEZIER: QPixmap(":/curves/keyframe-%s.png" % openshot.BEZIER), + openshot.LINEAR: QPixmap(":/curves/keyframe-%s.png" % openshot.LINEAR), + openshot.CONSTANT: QPixmap(":/curves/keyframe-%s.png" % openshot.CONSTANT), + } def paint(self, painter, option, index): painter.save()