Skip to content
Closed
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
12 changes: 8 additions & 4 deletions src/classes/language.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,18 @@ def init_language():
# Get app instance
app = QCoreApplication.instance()

# Path to installed Qt translations
qt_trans = QLibraryInfo.location(QLibraryInfo.LibraryLocation.TranslationsPath)

# Setup of our list of translators and paths
translator_types = (
# Default installed system translations
{"type": 'QT',
"prefix": 'qt_', # Older versions of Qt use this file (built-in translations)
"path": QLibraryInfo.location(QLibraryInfo.TranslationsPath)},
"prefix": 'qt_',
"path": qt_trans},
{"type": 'QT',
"prefix": 'qtbase_', # Newer versions of Qt use this file (built-in translations)
"path": QLibraryInfo.location(QLibraryInfo.TranslationsPath)},
"prefix": 'qtbase_',
"path": qt_trans},
{"type": 'QT',
"prefix": 'qt_',
"path": os.path.join(info.PATH, 'language')}, # Optional path where we package QT translations
Expand Down
42 changes: 21 additions & 21 deletions src/classes/ui_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,33 +106,33 @@ def get_default_icon(theme_name):


def make_dark_palette(darkPalette: QPalette) -> QPalette:
darkPalette.setColor(QPalette.Window, QColor(53, 53, 53))
darkPalette.setColor(QPalette.WindowText, Qt.white)
darkPalette.setColor(QPalette.Base, QColor(25, 25, 25))
darkPalette.setColor(QPalette.AlternateBase, QColor(53, 53, 53))
darkPalette.setColor(QPalette.Light, QColor(68, 68, 68))
darkPalette.setColor(QPalette.Text, Qt.white)
darkPalette.setColor(QPalette.Button, QColor(53, 53, 53))
darkPalette.setColor(QPalette.ButtonText, Qt.white)
darkPalette.setColor(QPalette.Highlight, QColor(42, 130, 218, 192))
darkPalette.setColor(QPalette.HighlightedText, Qt.black)
darkPalette.setColor(QPalette.ColorRole.Window, QColor(53, 53, 53))
darkPalette.setColor(QPalette.ColorRole.WindowText, Qt.GlobalColor.white)
darkPalette.setColor(QPalette.ColorRole.Base, QColor(25, 25, 25))
darkPalette.setColor(QPalette.ColorRole.AlternateBase, QColor(53, 53, 53))
darkPalette.setColor(QPalette.ColorRole.Light, QColor(68, 68, 68))
darkPalette.setColor(QPalette.ColorRole.Text, Qt.GlobalColor.white)
darkPalette.setColor(QPalette.ColorRole.Button, QColor(53, 53, 53))
darkPalette.setColor(QPalette.ColorRole.ButtonText, Qt.GlobalColor.white)
darkPalette.setColor(QPalette.ColorRole.Highlight, QColor(42, 130, 218, 192))
darkPalette.setColor(QPalette.ColorRole.HighlightedText, Qt.GlobalColor.black)
#
# Disabled palette
#
darkPalette.setColor(QPalette.Disabled, QPalette.WindowText, QColor(255, 255, 255, 128))
darkPalette.setColor(QPalette.Disabled, QPalette.Base, QColor(68, 68, 68))
darkPalette.setColor(QPalette.Disabled, QPalette.Text, QColor(255, 255, 255, 128))
darkPalette.setColor(QPalette.Disabled, QPalette.Button, QColor(53, 53, 53, 128))
darkPalette.setColor(QPalette.Disabled, QPalette.ButtonText, QColor(255, 255, 255, 128))
darkPalette.setColor(QPalette.Disabled, QPalette.Highlight, QColor(151, 151, 151, 192))
darkPalette.setColor(QPalette.Disabled, QPalette.HighlightedText, Qt.black)
darkPalette.setColor(QPalette.ColorGroup.Disabled, QPalette.ColorRole.WindowText, QColor(255, 255, 255, 128))
darkPalette.setColor(QPalette.ColorGroup.Disabled, QPalette.ColorRole.Base, QColor(68, 68, 68))
darkPalette.setColor(QPalette.ColorGroup.Disabled, QPalette.ColorRole.Text, QColor(255, 255, 255, 128))
darkPalette.setColor(QPalette.ColorGroup.Disabled, QPalette.ColorRole.Button, QColor(53, 53, 53, 128))
darkPalette.setColor(QPalette.ColorGroup.Disabled, QPalette.ColorRole.ButtonText, QColor(255, 255, 255, 128))
darkPalette.setColor(QPalette.ColorGroup.Disabled, QPalette.ColorRole.Highlight, QColor(151, 151, 151, 192))
darkPalette.setColor(QPalette.ColorGroup.Disabled, QPalette.ColorRole.HighlightedText, Qt.GlobalColor.black)

# Tooltips
darkPalette.setColor(QPalette.ToolTipBase, QColor(42, 130, 218))
darkPalette.setColor(QPalette.ToolTipText, Qt.white)
darkPalette.setColor(QPalette.ColorRole.ToolTipBase, QColor(42, 130, 218))
darkPalette.setColor(QPalette.ColorRole.ToolTipText, Qt.GlobalColor.white)
# Links
darkPalette.setColor(QPalette.Link, QColor(85, 170, 255))
darkPalette.setColor(QPalette.LinkVisited, QColor(136, 85, 255))
darkPalette.setColor(QPalette.ColorRole.Link, QColor(85, 170, 255))
darkPalette.setColor(QPalette.ColorRole.LinkVisited, QColor(136, 85, 255))

return darkPalette

Expand Down
6 changes: 3 additions & 3 deletions src/launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
try:
# This apparently has to be done before loading QtQuick
# (via QtWebEgine) AND before creating the QApplication instance
QApplication.setAttribute(Qt.AA_ShareOpenGLContexts)
QApplication.setAttribute(Qt.ApplicationAttribute.AA_ShareOpenGLContexts)
from OpenGL import GL # noqa
except (ImportError, AttributeError):
pass
Expand All @@ -65,8 +65,8 @@

try:
# Enable High-DPI resolutions
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
QApplication.setAttribute(Qt.AA_UseHighDpiPixmaps)
QApplication.setAttribute(Qt.ApplicationAttribute.AA_EnableHighDpiScaling)
QApplication.setAttribute(Qt.ApplicationAttribute.AA_UseHighDpiPixmaps)
except AttributeError:
pass # Quietly fail for older Qt5 versions

Expand Down
2 changes: 1 addition & 1 deletion src/windows/about.py
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ def __init__(self):
libopenshot_version = "libopenshot: %s" % openshot.OPENSHOT_VERSION_FULL
self.txtversion.setText(
"<b>%s</b><br/>%s%s" % (openshot_qt_version, libopenshot_version, frozen_version_label))
self.txtversion.setAlignment(Qt.AlignCenter)
self.txtversion.setAlignment(Qt.AlignmentFlag.AlignCenter)

# Track metrics
track_metric_screen("about-screen")
Expand Down
4 changes: 2 additions & 2 deletions src/windows/animated_title.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def __init__(self, *args, **kwargs):
# Add render controls
self.btnRender = QPushButton(_('Render'))
self.btnCancel = QPushButton(_('Cancel'))
self.buttonBox.addButton(self.btnRender, QDialogButtonBox.AcceptRole)
self.buttonBox.addButton(self.btnCancel, QDialogButtonBox.RejectRole)
self.buttonBox.addButton(self.btnRender, QDialogButtonBox.ButtonRole.AcceptRole)
self.buttonBox.addButton(self.btnCancel, QDialogButtonBox.ButtonRole.RejectRole)

# Hide render progress until needed
self.statusContainer.hide()
Expand Down
8 changes: 4 additions & 4 deletions src/windows/color_picker.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def __init__(self, initial_color: QColor, callback, extra_options=0,
super().__init__(parent=parent, *args, **kwargs)
self.setObjectName("ColorPicker")
# Merge any additional user-supplied options with our own
options = QColorDialog.DontUseNativeDialog
options = QColorDialog.ColorDialogOption.DontUseNativeDialog
if extra_options > 0:
options = options | extra_options
# Set up non-modal color dialog (to avoid blocking the eyedropper)
Expand All @@ -52,7 +52,7 @@ def __init__(self, initial_color: QColor, callback, extra_options=0,
self.dialog.setObjectName("CPDialog")
if title:
self.dialog.setWindowTitle(title)
self.dialog.setWindowFlags(Qt.Tool)
self.dialog.setWindowFlags(Qt.WindowType.Tool)
self.dialog.setOptions(options)
# Avoid signal loops
self.dialog.blockSignals(True)
Expand Down Expand Up @@ -134,7 +134,7 @@ def build_pattern(self) -> QPixmap:
n = self.checkerboard_size
pat = QPixmap(2 * n, 2 * n)
p = QPainter(pat)
p.setPen(Qt.NoPen)
p.setPen(Qt.PenStyle.NoPen)
# Paint a checkerboard pattern for the color to be overlaid on
self.bg0 = QColor("#aaa")
self.bg1 = QColor("#ccc")
Expand All @@ -148,7 +148,7 @@ def paintEvent(self, event):
"""Show the current color, with checkerboard alpha"""
event.accept()
p = QPainter(self)
p.setPen(Qt.NoPen)
p.setPen(Qt.PenStyle.NoPen)
if self.color.alphaF() < 1.0:
# Draw a checkerboard pattern under the color
p.drawTiledPixmap(event.rect(), self.pattern, QPoint(4,4))
Expand Down
3 changes: 2 additions & 1 deletion src/windows/cutting.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,8 @@ def __init__(self, file=None, preview=False):

# Add Video Widget
self.videoPreview = VideoWidget()
self.videoPreview.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
self.videoPreview.setSizePolicy(
QSizePolicy.Policy.Preferred, QSizePolicy.Policy.Expanding)
self.verticalLayout.insertWidget(0, self.videoPreview)

# Set max size of video preview (for speed)
Expand Down
18 changes: 9 additions & 9 deletions src/windows/export.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,9 +88,9 @@ def __init__(self, *args, **kwargs):
self.cancel_button = QPushButton(_('Cancel'))
self.export_button = QPushButton(_('Export Video'))
self.close_button = QPushButton(_('Done'))
self.buttonBox.addButton(self.close_button, QDialogButtonBox.RejectRole)
self.buttonBox.addButton(self.export_button, QDialogButtonBox.AcceptRole)
self.buttonBox.addButton(self.cancel_button, QDialogButtonBox.RejectRole)
self.buttonBox.addButton(self.close_button, QDialogButtonBox.ButtonRole.RejectRole)
self.buttonBox.addButton(self.export_button, QDialogButtonBox.ButtonRole.AcceptRole)
self.buttonBox.addButton(self.cancel_button, QDialogButtonBox.ButtonRole.RejectRole)
self.close_button.setVisible(False)
self.exporting = False

Expand Down Expand Up @@ -739,7 +739,7 @@ def titlestring(sec, fps, mess):
ret = QMessageBox.question(self,
_("Export Video"),
_("%s is an input file.\nPlease choose a different name.") % file_name_with_ext,
QMessageBox.Ok)
QMessageBox.StandardButton.Ok)
self.enableControls()
self.exporting = False
return
Expand All @@ -750,8 +750,8 @@ def titlestring(sec, fps, mess):
ret = QMessageBox.question(self,
_("Export Video"),
_("%s already exists.\nDo you want to replace it?") % file_name_with_ext,
QMessageBox.No | QMessageBox.Yes)
if ret == QMessageBox.No:
QMessageBox.StandardButton.No | QMessageBox.StandardButton.Yes)
if ret == QMessageBox.StandardButton.No:
# Stop and don't do anything
# Re-enable controls
self.enableControls()
Expand Down Expand Up @@ -1009,7 +1009,7 @@ def titlestring(sec, fps, mess):
# Make progress bar green (to indicate we are done)
from PyQt5.QtGui import QPalette
p = QPalette()
p.setColor(QPalette.Highlight, Qt.green)
p.setColor(QPalette.Highlight, Qt.GlobalColor.green)
self.progressExportVideo.setPalette(p)

# Raise the window
Expand All @@ -1026,8 +1026,8 @@ def reject(self):
self,
_("Export Video"),
_("Are you sure you want to cancel the export?"),
QMessageBox.No | QMessageBox.Yes)
if result == QMessageBox.No:
QMessageBox.StandardButton.No | QMessageBox.StandardButton.Yes)
if result == QMessageBox.StandardButton.No:
# Resume export
return

Expand Down
19 changes: 14 additions & 5 deletions src/windows/export_clips.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def __init__(self, export_clips_arg, *args, **kwargs):
def _getDestination(self):
settings = get_app().get_settings()
fd = QFileDialog()
fd.setOption(QFileDialog.ShowDirsOnly)
fd.setOption(QFileDialog.Option.ShowDirsOnly)
fd.setDirectory(
settings.getDefaultPath(settings.actionType.EXPORT)
)
Expand All @@ -171,12 +171,21 @@ def _createWidgets(self):
# Make progress bar look like the one in the export dialog
from PyQt5.QtGui import QPalette
p = QPalette()
p.setColor(QPalette.Highlight, Qt.green)
p.setColor(QPalette.ColorRole.Highlight, Qt.GlobalColor.green)
self.progressExportVideo.setPalette(p)

self.buttonBox.addButton(self.cancel_button, QDialogButtonBox.ActionRole)
self.buttonBox.addButton(self.export_button, QDialogButtonBox.ActionRole)
self.buttonBox.addButton(self.done_button, QDialogButtonBox.ActionRole)
box = self.button_box
self.cancel_button = box.addButton(
QDialogButtonBox.StandardButton.Cancel,
QDialogButtonBox.ButtonRole.RejectRole)
self.export_button = box.addButton(
_("Export"), QDialogButtonBox.ButtonRole.ActionRole)
self.done_button = box.addButton(
QDialogButtonBox.StandardButton.Close)
self.export_button.clicked.connect(self._exportPressed)
self.done_button.clicked.connect(self.done)
self.cancel_button.clicked.connect(self._cancelButtonClicked)

self.done_button.setHidden(True)
self.progressExportVideo.setValue(0)

Expand Down
4 changes: 2 additions & 2 deletions src/windows/file_properties.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def __init__(self, file):

# Add buttons to interface
self.update_button = QPushButton(_('Update'))
self.buttonBox.addButton(self.update_button, QDialogButtonBox.AcceptRole)
self.buttonBox.addButton(QPushButton(_('Cancel')), QDialogButtonBox.RejectRole)
self.buttonBox.addButton(self.update_button, QDialogButtonBox.ButtonRole.AcceptRole)
self.buttonBox.addButton(QPushButton(_('Cancel')), QDialogButtonBox.ButtonRole.RejectRole)

# Dynamically load tabs from settings data
self.settings_data = self.s.get_all_settings()
Expand Down
Loading