Skip to content

Commit

Permalink
Misc Fix PySide6 errors: Flex #430
Browse files Browse the repository at this point in the history
  • Loading branch information
miquelcampos committed Nov 26, 2024
1 parent 18daf5c commit d5fe464
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 17 deletions.
2 changes: 1 addition & 1 deletion release/scripts/mgear/flex/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

__author__ = 'Jerome Drese'
__email__ = 'jeromed@gmail.com'
__version__ = '1.1.0'
__version__ = '1.1.1'

logger = logging.getLogger("mGear.flex")
logger.setLevel(logging.DEBUG)
16 changes: 9 additions & 7 deletions release/scripts/mgear/flex/analyze_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@


# imports
from PySide2 import QtWidgets, QtGui, QtCore
from mgear.vendor.Qt import QtCore
from mgear.vendor.Qt import QtWidgets
from mgear.vendor.Qt import QtGui

from mgear.flex import logger
from mgear.flex.colors import YELLOW
Expand Down Expand Up @@ -56,7 +58,7 @@ def __init__(self, parent=None):

# creates layout
layout = QtWidgets.QVBoxLayout()
layout.setMargin(0)
layout.setContentsMargins(0, 0, 0, 0)

# setup table
self.setLayout(layout)
Expand Down Expand Up @@ -91,11 +93,11 @@ def __create_table(self):
h_header.setPalette(YELLOW)
h_header.setFixedHeight(21)
h_header.setDefaultSectionSize(40)
h_header.setSectionResizeMode(h_header.Stretch)
h_header.setSectionResizeMode(2, h_header.Fixed)
h_header.setSectionResizeMode(3, h_header.Fixed)
h_header.setSectionResizeMode(4, h_header.Fixed)
h_header.setSectionResizeMode(5, h_header.Fixed)
h_header.setSectionResizeMode(QtWidgets.QHeaderView.Stretch)
h_header.setSectionResizeMode(2, QtWidgets.QHeaderView.Fixed)
h_header.setSectionResizeMode(3, QtWidgets.QHeaderView.Fixed)
h_header.setSectionResizeMode(4, QtWidgets.QHeaderView.Fixed)
h_header.setSectionResizeMode(5, QtWidgets.QHeaderView.Fixed)
h_header.setSectionsClickable(False)

# hides vertical header
Expand Down
2 changes: 1 addition & 1 deletion release/scripts/mgear/flex/colors.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"""

# imports
from PySide2 import QtGui
from mgear.vendor.Qt import QtGui


# colors
Expand Down
10 changes: 5 additions & 5 deletions release/scripts/mgear/flex/flex.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
# imports
from __future__ import absolute_import

from PySide2 import QtWidgets
from mgear.vendor.Qt import QtWidgets
from mgear.vendor.Qt import QtCompat
from maya import OpenMayaUI, cmds
from shiboken2 import wrapInstance
from mgear.flex import logger
from mgear.flex.analyze import analyze_groups
from mgear.flex.analyze_widget import FLEX_ANALYZE_NAME
Expand Down Expand Up @@ -124,7 +124,7 @@ def __kill_analyze_instance():
return

# go through flex widgets to find analyze widget
qt_object = wrapInstance(long(widget), QtWidgets.QDialog)
qt_object = QtCompat.wrapInstance(long(widget), QtWidgets.QDialog)
for child in qt_object.children():
if child.objectName() == FLEX_ANALYZE_NAME:
Flex.__kill_widget(child)
Expand All @@ -140,7 +140,7 @@ def __kill_flex_instance():
if not widget:
return

qt_object = wrapInstance(long(widget), QtWidgets.QDialog)
qt_object = QtCompat.wrapInstance(long(widget), QtWidgets.QDialog)
Flex.__kill_widget(qt_object)

@staticmethod
Expand Down Expand Up @@ -287,7 +287,7 @@ def __warp_maya_window():

# gets Maya main window object
maya_window = OpenMayaUI.MQtUtil.mainWindow()
return wrapInstance(long(maya_window), QtWidgets.QMainWindow)
return QtCompat.wrapInstance(long(maya_window), QtWidgets.QMainWindow)

def analyze_groups(self, update_ui=False):
""" Scans the shapes inside the source and target group
Expand Down
7 changes: 4 additions & 3 deletions release/scripts/mgear/flex/flex_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"""

# imports
from PySide2 import QtWidgets, QtCore
from mgear.vendor.Qt import QtCore
from mgear.vendor.Qt import QtWidgets
from mgear.flex import logger
from mgear.flex.colors import RED, GREEN, BLUE, YELLOW

Expand Down Expand Up @@ -102,13 +103,13 @@ def layout_widgets(self):

# layout widgets
main_vertical_layout = QtWidgets.QVBoxLayout()
main_vertical_layout.setMargin(0)
main_vertical_layout.setContentsMargins(0, 0, 0, 0)
self.setLayout(main_vertical_layout)

# frame
model_frame = QtWidgets.QFrame()
self.widgets_layout = QtWidgets.QVBoxLayout()
self.widgets_layout.setMargin(0)
self.widgets_layout.setContentsMargins(0, 0, 0, 0)
self.widgets_layout.setSpacing(10)
model_frame.setLayout(self.widgets_layout)

Expand Down

0 comments on commit d5fe464

Please sign in to comment.