Ejemplo n.º 1
0
import os
import time

from maya import OpenMayaUI

from omtk.libs import libPython

use_pyside = libPython.does_module_exist('PySide')
use_pyqt4 = libPython.does_module_exist('PyQt4')

print 'pyqt4' if use_pyqt4 else 'pyside'

# Import QtCore, QtGui & uic
if use_pyqt4:
    import sip
    from PyQt4 import QtCore, QtGui

    getMayaWindow = lambda: sip.wrapinstance(
        long(OpenMayaUI.MQtUtil.mainWindow()), QtCore.QObject)

elif use_pyside:
    from PySide import QtCore, QtGui
    import shiboken

    uic = shiboken
    getMayaWindow = lambda: shiboken.wrapInstance(
        long(OpenMayaUI.MQtUtil.mainWindow()), QtGui.QWidget)


# Return true if the .py associated with a .ui file is older or doesn't exist.
def _can_compile_ui(path):
Ejemplo n.º 2
0
import os
import time

from maya import OpenMayaUI

from omtk.libs import libPython

use_pyside = libPython.does_module_exist('PySide')
use_pyqt4 = libPython.does_module_exist('PyQt4')

print 'pyqt4' if use_pyqt4 else 'pyside'

# Import QtCore, QtGui & uic
if use_pyqt4:
    import sip
    from PyQt4 import QtCore, QtGui

    getMayaWindow = lambda: sip.wrapinstance(long(OpenMayaUI.MQtUtil.mainWindow()), QtCore.QObject)

elif use_pyside:
    from PySide import QtCore, QtGui
    import shiboken

    uic = shiboken
    getMayaWindow = lambda: shiboken.wrapInstance(long(OpenMayaUI.MQtUtil.mainWindow()), QtGui.QWidget)


# Return true if the .py associated with a .ui file is older or doesn't exist.
def _can_compile_ui(path):
    ui_dir = os.path.basedir(path)
    ui_name, ui_ext = os.path.splitext(path)
Ejemplo n.º 3
0
#
# Python/Xml/Yaml functionalities
#

from core import _dag_types, _basic_types
from core import import_json, import_json_file, export_json, export_json_file
from core import import_yaml, import_yaml_file, export_yaml, export_yaml_file

#
# Maya only functionalities
# This allow us to use libSerialization outside of maya.
#x


if libPython.does_module_exist("maya"):
    print 'in_maya'
    from pluginMaya import export_network, import_network, isNetworkInstanceOfClass, getNetworksByClass, getConnectedNetworks, getConnectedNetworksByHierarchy
    import pymel.core as pymel
    _dag_types.append(pymel.PyNode)
    _dag_types.append(pymel.Attribute)
    _basic_types.append(pymel.datatypes.Matrix)

#
# Unit testing
#
import unittest
class EmptyClass(object): pass
class TestSerialization(unittest.TestCase):
    def setUp(self):
        print self.shortDescription()