Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #4255 from ynput/feature/OP-4634_Use-qtpy-in-tools
Browse files Browse the repository at this point in the history
General: Update MacOs to PySide6
  • Loading branch information
iLLiCiTiT authored Jan 17, 2023
2 parents 3e74a27 + 0994795 commit 37a4ec6
Show file tree
Hide file tree
Showing 201 changed files with 5,957 additions and 2,411 deletions.
25 changes: 13 additions & 12 deletions openpype/lib/applications.py
Original file line number Diff line number Diff line change
Expand Up @@ -908,24 +908,25 @@ def __init__(self, application, executable, env_group=None, **data):
self.launch_args.extend(self.data.pop("app_args"))

# Handle launch environemtns
env = self.data.pop("env", None)
if env is not None and not isinstance(env, dict):
src_env = self.data.pop("env", None)
if src_env is not None and not isinstance(src_env, dict):
self.log.warning((
"Passed `env` kwarg has invalid type: {}. Expected: `dict`."
" Using `os.environ` instead."
).format(str(type(env))))
env = None
).format(str(type(src_env))))
src_env = None

if env is None:
env = os.environ
if src_env is None:
src_env = os.environ

# subprocess.Popen keyword arguments
self.kwargs = {
"env": {
key: str(value)
for key, value in env.items()
}
ignored_env = {"QT_API", }
env = {
key: str(value)
for key, value in src_env.items()
if key not in ignored_env
}
# subprocess.Popen keyword arguments
self.kwargs = {"env": env}

if platform.system().lower() == "windows":
# Detach new process from currently running process on Windows
Expand Down
2 changes: 1 addition & 1 deletion openpype/modules/log_viewer/tray/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ def __init__(self, parent=None, placeholder=""):
super(SearchComboBox, self).__init__(parent)

self.setEditable(True)
self.setInsertPolicy(self.NoInsert)
self.setInsertPolicy(QtWidgets.QComboBox.NoInsert)
self.lineEdit().setPlaceholderText(placeholder)

# Apply completer settings
Expand Down
12 changes: 8 additions & 4 deletions openpype/modules/sync_server/tray/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,10 @@ def refresh(self):
if selected_index and \
selected_index.isValid() and \
not self._selection_changed:
mode = QtCore.QItemSelectionModel.Select | \
QtCore.QItemSelectionModel.Rows
mode = (
QtCore.QItemSelectionModel.Select
| QtCore.QItemSelectionModel.Rows
)
self.project_list.selectionModel().select(selected_index, mode)

if self.current_project:
Expand Down Expand Up @@ -271,8 +273,10 @@ def _set_selection(self):
for selected_id in self._selected_ids:
index = self.model.get_index(selected_id)
if index and index.isValid():
mode = QtCore.QItemSelectionModel.Select | \
QtCore.QItemSelectionModel.Rows
mode = (
QtCore.QItemSelectionModel.Select
| QtCore.QItemSelectionModel.Rows
)
self.selection_model.select(index, mode)
existing_ids.add(selected_id)

Expand Down
2 changes: 1 addition & 1 deletion openpype/plugins/load/copy_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def load(self, context, name=None, namespace=None, data=None):

@staticmethod
def copy_file_to_clipboard(path):
from Qt import QtCore, QtWidgets
from qtpy import QtCore, QtWidgets

clipboard = QtWidgets.QApplication.clipboard()
assert clipboard, "Must have running QApplication instance"
Expand Down
2 changes: 1 addition & 1 deletion openpype/plugins/load/copy_file_path.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def load(self, context, name=None, namespace=None, data=None):

@staticmethod
def copy_path_to_clipboard(path):
from Qt import QtWidgets
from qtpy import QtWidgets

clipboard = QtWidgets.QApplication.clipboard()
assert clipboard, "Must have running QApplication instance"
Expand Down
2 changes: 1 addition & 1 deletion openpype/plugins/load/delete_old_versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import clique
from pymongo import UpdateOne
import qargparse
from Qt import QtWidgets, QtCore
from qtpy import QtWidgets, QtCore

from openpype import style
from openpype.client import get_versions, get_representations
Expand Down
2 changes: 1 addition & 1 deletion openpype/plugins/load/delivery.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import copy
from collections import defaultdict

from Qt import QtWidgets, QtCore, QtGui
from qtpy import QtWidgets, QtCore, QtGui

from openpype.client import get_representations
from openpype.pipeline import load, Anatomy
Expand Down
2 changes: 1 addition & 1 deletion openpype/scripts/non_python_host_launch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

def show_error_messagebox(title, message, detail_message=None):
"""Function will show message and process ends after closing it."""
from Qt import QtWidgets, QtCore
from qtpy import QtWidgets, QtCore
from openpype import style

app = QtWidgets.QApplication([])
Expand Down
2 changes: 1 addition & 1 deletion openpype/style/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ def _load_stylesheet():

def _load_font():
"""Load and register fonts into Qt application."""
from Qt import QtGui
from qtpy import QtGui

# Check if font ids are still loaded
if _Cache.font_ids is not None:
Expand Down
2 changes: 1 addition & 1 deletion openpype/style/color_defs.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def create_qcolor(*args):
*args (tuple): It is possible to pass initialization arguments for
Qcolor.
"""
from Qt import QtGui
from qtpy import QtGui

return QtGui.QColor(*args)

Expand Down
Loading

0 comments on commit 37a4ec6

Please sign in to comment.