Skip to content

Commit

Permalink
[cuegui] Use the QtPy library instead of PySide directly. (#1238)
Browse files Browse the repository at this point in the history
  • Loading branch information
bcipriano committed Feb 10, 2023
1 parent ce22531 commit 1c5dce4
Show file tree
Hide file tree
Showing 87 changed files with 357 additions and 303 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/testing-pipeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,15 @@ jobs:
chown -R aswfuser:aswfgroup .
su -c "cd cuebot && ./gradlew build --stacktrace --info" aswfuser
test_pyside6:
name: Run CueGUI Tests using PySide6
runs-on: ubuntu-latest
container: almalinux:9
steps:
- uses: actions/checkout@v2
- name: Run CueGUI Tests
run: ci/test_pyside6.sh

lint_python:
name: Lint Python Code
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion VERSION.in
Original file line number Diff line number Diff line change
@@ -1 +1 @@
0.21
0.22
8 changes: 7 additions & 1 deletion ci/run_gui_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,14 @@
# > OK
#

py="$(command -v python3)"
if [[ -z "$py" ]]; then
py="$(command -v python)"
fi
echo "Using Python binary ${py}"

test_log="/tmp/cuegui_result.log"
PYTHONPATH=pycue xvfb-run -d python cuegui/setup.py test | tee ${test_log}
PYTHONPATH=pycue xvfb-run -d "${py}" cuegui/setup.py test | tee ${test_log}

grep -Pz 'Ran \d+ tests in [0-9\.]+s\n\nOK' ${test_log}
if [ $? -eq 0 ]; then
Expand Down
36 changes: 36 additions & 0 deletions ci/test_pyside6.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# Script for testing CueGUI with PySide6.
#
# This script is written to be run within an almalinux environment in the OpenCue
# GitHub Actions environment. See .github/workflows/testing-pipeline.yml.

set -e

# Install needed packages.
yum -y install \
dbus-libs \
fontconfig \
gcc \
libxkbcommon-x11 \
mesa-libEGL-devel \
python-devel \
which \
xcb-util-keysyms \
xcb-util-image \
xcb-util-renderutil \
xcb-util-wm \
Xvfb

# Install Python requirements.
python3 -m pip install --user -r requirements.txt -r requirements_gui.txt
# Replace PySide2 with PySide6.
python3 -m pip uninstall -y PySide2
python3 -m pip install --user PySide6==6.3.2

# Fix compiled proto code for Python 3.
python3 -m grpc_tools.protoc -I=proto/ --python_out=pycue/opencue/compiled_proto --grpc_python_out=pycue/opencue/compiled_proto proto/*.proto
2to3 -wn -f import pycue/opencue/compiled_proto/*_pb2*.py

# Run tests.
ci/run_gui_test.sh
4 changes: 2 additions & 2 deletions cuegui/cuegui/AbstractDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from __future__ import absolute_import
from builtins import str

from PySide2 import QtCore
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtWidgets


class AbstractDialog(QtWidgets.QDialog):
Expand Down
4 changes: 2 additions & 2 deletions cuegui/cuegui/AbstractDockWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
from __future__ import print_function
from __future__ import division

from PySide2 import QtCore
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtWidgets

import cuegui.Plugins

Expand Down
6 changes: 3 additions & 3 deletions cuegui/cuegui/AbstractTreeWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@
from builtins import range
import time

from PySide2 import QtCore
from PySide2 import QtGui
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets

import cuegui.AbstractWidgetItem
import cuegui.Constants
Expand Down
4 changes: 2 additions & 2 deletions cuegui/cuegui/AbstractWidgetItem.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@

from builtins import str

from PySide2 import QtCore
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtWidgets

import cuegui.Constants
import cuegui.Logger
Expand Down
4 changes: 2 additions & 2 deletions cuegui/cuegui/Action.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from __future__ import print_function
from __future__ import division

from PySide2 import QtGui
from PySide2 import QtWidgets
from qtpy import QtGui
from qtpy import QtWidgets

import cuegui.Constants

Expand Down
4 changes: 2 additions & 2 deletions cuegui/cuegui/App.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

"""Module for CueGUI's custom QApplication and associated helper functions."""

from PySide2 import QtCore
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtWidgets

import cuegui.Exception

Expand Down
4 changes: 2 additions & 2 deletions cuegui/cuegui/Comments.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
from builtins import str
import pickle

from PySide2 import QtCore
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtWidgets

import cuegui.Utils

Expand Down
6 changes: 3 additions & 3 deletions cuegui/cuegui/ConfirmationDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@
from __future__ import division
from __future__ import absolute_import

from PySide2 import QtCore
from PySide2 import QtGui
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets


class ConfirmationDialog(QtWidgets.QDialog):
Expand Down
4 changes: 2 additions & 2 deletions cuegui/cuegui/Constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
import os
import platform

from PySide2 import QtGui
from PySide2 import QtWidgets
from qtpy import QtGui
from qtpy import QtWidgets
import yaml

import opencue
Expand Down
4 changes: 2 additions & 2 deletions cuegui/cuegui/CreateShowDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@
from __future__ import division


from PySide2 import QtCore
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtWidgets

import opencue

Expand Down
2 changes: 1 addition & 1 deletion cuegui/cuegui/CreatorDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from builtins import str
from builtins import zip

from PySide2 import QtWidgets
from qtpy import QtWidgets

import opencue

Expand Down
6 changes: 3 additions & 3 deletions cuegui/cuegui/CueJobMonitorTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
from collections import namedtuple
import time

from PySide2 import QtCore
from PySide2 import QtGui
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets

import opencue
import opencue.compiled_proto.job_pb2
Expand Down
6 changes: 3 additions & 3 deletions cuegui/cuegui/CueStateBarWidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
import time
import weakref

from PySide2 import QtCore
from PySide2 import QtGui
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets

import cuegui.Logger

Expand Down
4 changes: 2 additions & 2 deletions cuegui/cuegui/DarkPalette.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@

import platform

from PySide2 import QtGui
from PySide2 import QtWidgets
from qtpy import QtGui
from qtpy import QtWidgets

import cuegui.Constants

Expand Down
4 changes: 2 additions & 2 deletions cuegui/cuegui/DependDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@
from __future__ import print_function
from __future__ import division

from PySide2 import QtCore
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtWidgets

import cuegui.DependMonitorTree
import cuegui.Logger
Expand Down
2 changes: 1 addition & 1 deletion cuegui/cuegui/DependMonitorTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

from builtins import map

from PySide2 import QtWidgets
from qtpy import QtWidgets

from opencue.compiled_proto import depend_pb2
import opencue.exception
Expand Down
4 changes: 2 additions & 2 deletions cuegui/cuegui/DependWizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@
from builtins import range
import re

from PySide2 import QtCore
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtWidgets

import FileSequence
import opencue
Expand Down
6 changes: 3 additions & 3 deletions cuegui/cuegui/EmailDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,9 @@
pass
import smtplib

from PySide2 import QtCore
from PySide2 import QtGui
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets

import opencue

Expand Down
8 changes: 4 additions & 4 deletions cuegui/cuegui/FilterDialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
from builtins import map
from builtins import str

from PySide2 import QtCore
from PySide2 import QtGui
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets

import opencue
import opencue.compiled_proto.filter_pb2
Expand Down Expand Up @@ -63,7 +63,7 @@ def __init__(self, show, parent=None):
:type show: opencue.wrappers.show.Show
:param show: the show to manage filters for
:type parent: PySide2.QtWidgets.QWidget.QWidget
:type parent: qtpy.QtWidgets.QWidget.QWidget
:param parent: the parent widget
"""
QtWidgets.QDialog.__init__(self, parent)
Expand Down
6 changes: 3 additions & 3 deletions cuegui/cuegui/FrameMonitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@
from copy import deepcopy
import math

from PySide2 import QtCore
from PySide2 import QtGui
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets

import FileSequence
from opencue.compiled_proto import job_pb2
Expand Down
6 changes: 3 additions & 3 deletions cuegui/cuegui/FrameMonitorTree.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
import re
import time

from PySide2 import QtCore
from PySide2 import QtGui
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets

import opencue
from opencue.compiled_proto import job_pb2
Expand Down
18 changes: 9 additions & 9 deletions cuegui/cuegui/FrameRangeSelection.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
from builtins import range
import math

from PySide2 import QtCore
from PySide2 import QtGui
from PySide2 import QtWidgets
from qtpy import QtCore
from qtpy import QtGui
from qtpy import QtWidgets


class FrameRangeSelectionWidget(QtWidgets.QWidget):
Expand Down Expand Up @@ -303,7 +303,7 @@ def __paintLabels(self, painter):
oldPen = painter.pen()

# draw hatches for labelled frames
painter.setPen(self.palette().color(QtGui.QPalette.Foreground))
painter.setPen(self.palette().color(QtGui.QPalette.WindowText))
for frame in frames:
xPos = self.__getTickArea(frame).left()
painter.drawLine(xPos, -labelHeight, xPos, 0)
Expand All @@ -313,15 +313,15 @@ def __paintLabels(self, painter):
metric = QtGui.QFontMetrics(painter.font())
yPos = metric.ascent() + 1
rightEdge = -10000
width = metric.width(str(frames[-1]))
width = metric.horizontalAdvance(str(frames[-1]))
farEdge = self.__getTickArea(frames[-1]).right() - width // 2

farEdge -= 4

for frame in frames:
xPos = self.__getTickArea(frame).left()
frameString = str(frame)
width = metric.width(frameString)
width = metric.horizontalAdvance(frameString)
xPos = xPos - width // 2
if (xPos > rightEdge and xPos + width < farEdge) or frame is frames[-1]:
painter.drawText(xPos, yPos, frameString)
Expand All @@ -337,7 +337,7 @@ def __paintStartTime(self, painter):

metric = QtGui.QFontMetrics(painter.font())
frameString = str(int(startFrame))
xPos = timeExtent.left() - metric.width(frameString) // 2
xPos = timeExtent.left() - metric.horizontalAdvance(frameString) // 2
yPos = metric.ascent() + 1
painter.drawText(xPos, yPos, frameString)
painter.setPen(oldPen)
Expand All @@ -351,7 +351,7 @@ def __paintEndTime(self, painter):

metric = QtGui.QFontMetrics(painter.font())
frameString = str(int(endFrame))
xPos = timeExtent.left() - metric.width(frameString) // 2
xPos = timeExtent.left() - metric.horizontalAdvance(frameString) // 2
yPos = metric.ascent() + 1
painter.drawText(xPos, yPos, frameString)
painter.setPen(oldPen)
Expand All @@ -372,7 +372,7 @@ def __paintFloatTime(self, painter):
painter.setPen(QtGui.QColor(128, 128, 128))
metric = QtGui.QFontMetrics(painter.font())
frameString = str(self.__floatTime)
xPos = timeExtent.left() - metric.width(frameString) // 2
xPos = timeExtent.left() - metric.horizontalAdvance(frameString) // 2
yPos = timeExtent.top() + metric.ascent()
painter.drawText(xPos, yPos, frameString)
painter.setPen(oldPen)
Expand Down
2 changes: 1 addition & 1 deletion cuegui/cuegui/GarbageCollector.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

import gc

from PySide2 import QtCore
from qtpy import QtCore


class GarbageCollector(QtCore.QObject):
Expand Down

0 comments on commit 1c5dce4

Please sign in to comment.