Python PySide.QtCore.QObject() Examples

The following are 30 code examples of PySide.QtCore.QObject(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module PySide.QtCore , or try the search function .
Example #1
Source File: universal_tool_template_v7.3.py    From universal_tool_template.py with MIT License 7 votes vote down vote up
def Establish_Connections(self):
        # loop button and menu action to link to functions
        for ui_name in self.uiList.keys():
            if ui_name.endswith('_btn'):
                QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("clicked()"), getattr(self, ui_name[:-4]+"_action", partial(self.default_action,ui_name)))
            elif ui_name.endswith('_atn'):
                QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("triggered()"), getattr(self, ui_name[:-4]+"_action", partial(self.default_action,ui_name)))
            elif ui_name.endswith('_btnMsg'):
                QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("clicked()"), getattr(self, ui_name[:-7]+"_message", partial(self.default_message,ui_name)))
            elif ui_name.endswith('_atnMsg'):
                QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("triggered()"), getattr(self, ui_name[:-7]+"_message", partial(self.default_message,ui_name)))
        # custom connection
    
    #=======================================
    # UI Response functions (custom + prebuilt functions)
    #=======================================
    #-- ui actions 
Example #2
Source File: _compat.py    From mGui with MIT License 6 votes vote down vote up
def _pyside2_as_qt_object(widget):
    from PySide2.QtCore import QObject
    from PySide2.QtWidgets import QWidget
    from PySide2 import QtWidgets
    from shiboken2 import wrapInstance
    if hasattr(widget, '__qt_object__'):
        return widget.__qt_object__
    ptr = _find_widget_ptr(widget)
    qobject = wrapInstance(long(ptr), QObject)
    meta = qobject.metaObject()
    _class = meta.className()
    _super = meta.superClass().className()
    qclass = getattr(QtWidgets, _class, getattr(QtWidgets, _super, QWidget))
    return wrapInstance(long(ptr), qclass) 
Example #3
Source File: _compat.py    From mGui with MIT License 6 votes vote down vote up
def _pyside_as_qt_object(widget):
    from PySide.QtCore import QObject
    from PySide.QtGui import QWidget
    from PySide import QtGui
    from shiboken import wrapInstance
    if hasattr(widget, '__qt_object__'):
        return widget.__qt_object__
    ptr = _find_widget_ptr(widget)
    qobject = wrapInstance(long(ptr), QObject)
    meta = qobject.metaObject()
    _class = meta.className()
    _super = meta.superClass().className()
    qclass = getattr(QtGui, _class, getattr(QtGui, _super, QWidget))
    return wrapInstance(long(ptr), qclass) 
Example #4
Source File: universal_tool_template_v8.1.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject) 
Example #5
Source File: ViewportPainter.py    From mViewportDrawOpenGL with MIT License 5 votes vote down vote up
def initializeCallback(self):

        #get current model panel
        self.currentModelPanel = cmds.getPanel(wf = 1)
        if "modelPanel" not in self.currentModelPanel:
            self.currentModelPanel = cmds.getPanel(vis = 1)
            for i in self.currentModelPanel:
                if "modelPanel" in i:
                    self.currentModelPanel = i


        #try removing old callbacks from memory
        try:
            OpenMayaUI.MUiMessage.removeCallback(self.callBack)
        except:
            pass

        #create a callback that is registered after a frame is drawn with a 3D content but before 2D content
        self.callback = OpenMayaUI.MUiMessage.add3dViewPostRenderMsgCallback(self.currentModelPanel, self.update)
        self.view3D.refresh(True, True)

        #create QT maya window event filter
        main_window_ptr = OpenMayaUI.MQtUtil.mainWindow()
        self.qt_Maya_Window = wrapInstance(long(main_window_ptr), QtCore.QObject)
        self.qt_Maya_Window.installEventFilter(self.userKeyboardEvents) 

        #create viewport event filter
        active_view_ptr = self.view3D.widget()
        self.qt_Active_View = wrapInstance(long(active_view_ptr), QtCore.QObject)
        self.qt_Active_View.installEventFilter(self.userMouseEvents)

        cmds.inViewMessage( amg='<hl>Tool:</hl> Use <hl>"Esc"</hl> to cancel the tool', pos='botLeft', fade=True )

        print "Initialized..." 
Example #6
Source File: universal_tool_template_0903.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject) 
Example #7
Source File: universal_tool_template_0803.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject) 
Example #8
Source File: universal_tool_template_0904.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject) 
Example #9
Source File: universal_tool_template_v7.3.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def loadLang(self):
        self.quickMenu(['language_menu;&Language'])
        cur_menu = self.uiList['language_menu']
        self.quickMenuAction('langDefault_atnLang', 'Default','','langDefault.png', cur_menu)
        cur_menu.addSeparator()
        QtCore.QObject.connect( self.uiList['langDefault_atnLang'], QtCore.SIGNAL("triggered()"), partial(self.setLang, 'default') )
        # store default language
        self.memoData['lang']={}
        self.memoData['lang']['default']={}
        for ui_name in self.uiList:
            ui_element = self.uiList[ui_name]
            if type(ui_element) in [ QtGui.QLabel, QtGui.QPushButton, QtGui.QAction, QtGui.QCheckBox ]:
                # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                self.memoData['lang']['default'][ui_name] = str(ui_element.text())
            elif type(ui_element) in [ QtGui.QGroupBox, QtGui.QMenu ]:
                # uiType: QMenu, QGroupBox
                self.memoData['lang']['default'][ui_name] = str(ui_element.title())
            elif type(ui_element) in [ QtGui.QTabWidget]:
                # uiType: QTabWidget
                tabCnt = ui_element.count()
                tabNameList = []
                for i in range(tabCnt):
                    tabNameList.append(str(ui_element.tabText(i)))
                self.memoData['lang']['default'][ui_name]=';'.join(tabNameList)
            elif type(ui_element) == str:
                # uiType: string for msg
                self.memoData['lang']['default'][ui_name] = self.uiList[ui_name]
        
        # try load other language
        lang_path = os.path.dirname(self.location) # better in packed than(os.path.abspath(__file__))
        baseName = os.path.splitext( os.path.basename(self.location) )[0]
        for fileName in os.listdir(lang_path):
            if fileName.startswith(baseName+"_lang_"):
                langName = fileName.replace(baseName+"_lang_","").split('.')[0].replace(" ","")
                self.memoData['lang'][ langName ] = self.readRawFile( os.path.join(lang_path,fileName) )
                self.quickMenuAction(langName+'_atnLang', langName.upper(),'',langName + '.png', cur_menu)
                QtCore.QObject.connect( self.uiList[langName+'_atnLang'], QtCore.SIGNAL("triggered()"), partial(self.setLang, langName) )
        # if no language file detected, add export default language option
        if len(self.memoData['lang']) == 1:
            self.quickMenuAction('langExport_atnLang', 'Export Default Language','','langExport.png', cur_menu)
            QtCore.QObject.connect( self.uiList['langExport_atnLang'], QtCore.SIGNAL("triggered()"), self.exportLang ) 
Example #10
Source File: universal_tool_template_v7.3.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def mui_to_qt(self, mui_name):
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode == 0:
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtGui.QWidget)
            elif qtMode == 1:
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject) 
Example #11
Source File: universal_tool_template_v7.3.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def main(mode=0):
    parentWin = None
    app = None
    if deskMode == 0:
        if qtMode == 0:
            # ==== for pyside ====
            parentWin = shiboken.wrapInstance(long(mui.MQtUtil.mainWindow()), QtGui.QWidget)
        elif qtMode == 1:
            # ==== for PyQt====
            parentWin = sip.wrapinstance(long(mui.MQtUtil.mainWindow()), QtCore.QObject)
    if deskMode == 1:
        app = QtGui.QApplication(sys.argv)
    
    # single UI window code, so no more duplicate window instance when run this function
    global single_TMP_UniversalToolUI_TND
    if single_TMP_UniversalToolUI_TND is None:
        single_TMP_UniversalToolUI_TND = TMP_UniversalToolUI_TND(parentWin, mode) # extra note: in Maya () for no parent; (parentWin,0) for extra mode input
    single_TMP_UniversalToolUI_TND.show()
    
    if deskMode == 1:
        sys.exit(app.exec_())
    
    # example: show ui stored
    # print(single_TMP_UniversalToolUI_TND.uiList.keys())
    return single_TMP_UniversalToolUI_TND
    
# If you want to be able to load multiple windows of the same ui in Maya, use code below 
Example #12
Source File: UITranslator_v1.0.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def loadLang(self):
        self.quickMenu(['language_menu;&Language'])
        cur_menu = self.uiList['language_menu']
        self.quickMenuAction('langDefault_atnLang', 'Default','','langDefault.png', cur_menu)
        cur_menu.addSeparator()
        QtCore.QObject.connect( self.uiList['langDefault_atnLang'], QtCore.SIGNAL("triggered()"), partial(self.setLang, 'default') )
        # store default language
        self.memoData['lang']={}
        self.memoData['lang']['default']={}
        for ui_name in self.uiList:
            ui_element = self.uiList[ui_name]
            if type(ui_element) in [ QtGui.QLabel, QtGui.QPushButton, QtGui.QAction, QtGui.QCheckBox ]:
                # uiType: QLabel, QPushButton, QAction(menuItem), QCheckBox
                self.memoData['lang']['default'][ui_name] = str(ui_element.text())
            elif type(ui_element) in [ QtGui.QGroupBox, QtGui.QMenu ]:
                # uiType: QMenu, QGroupBox
                self.memoData['lang']['default'][ui_name] = str(ui_element.title())
            elif type(ui_element) in [ QtGui.QTabWidget]:
                # uiType: QTabWidget
                tabCnt = ui_element.count()
                tabNameList = []
                for i in range(tabCnt):
                    tabNameList.append(str(ui_element.tabText(i)))
                self.memoData['lang']['default'][ui_name]=';'.join(tabNameList)
            elif type(ui_element) == str:
                # uiType: string for msg
                self.memoData['lang']['default'][ui_name] = self.uiList[ui_name]
        
        # try load other language
        lang_path = os.path.dirname(self.location) # better in packed than(os.path.abspath(__file__))
        baseName = os.path.splitext( os.path.basename(self.location) )[0]
        for fileName in os.listdir(lang_path):
            if fileName.startswith(baseName+"_lang_"):
                langName = fileName.replace(baseName+"_lang_","").split('.')[0].replace(" ","")
                self.memoData['lang'][ langName ] = self.readRawFile( os.path.join(lang_path,fileName) )
                self.quickMenuAction(langName+'_atnLang', langName.upper(),'',langName + '.png', cur_menu)
                QtCore.QObject.connect( self.uiList[langName+'_atnLang'], QtCore.SIGNAL("triggered()"), partial(self.setLang, langName) )
        # if no language file detected, add export default language option
        if len(self.memoData['lang']) == 1:
            self.quickMenuAction('langExport_atnLang', 'Export Default Language','','langExport.png', cur_menu)
            QtCore.QObject.connect( self.uiList['langExport_atnLang'], QtCore.SIGNAL("triggered()"), self.exportLang ) 
Example #13
Source File: universal_tool_template_1010.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject) 
Example #14
Source File: ui.py    From CSGO-Market-Float-Finder with MIT License 5 votes vote down vote up
def __init__(self):
        QtCore.QObject.__init__(self)
        self.WorkerThread = WorkerThread(self)
        self.t = QtCore.QThread(self, objectName='workerThread')
        self.WorkerThread.moveToThread(self.t)
        self.t.start()
        self.PassedHere = False
        self.currency = None
        self.soldcount = 0
        self.start = 0
        self.logging = 0

        self.WorkerThread.progresscount = 0
        self.WorkerThread.SetStatus.connect(lambda x: self.StatusLabel.setText(x))
        self.WorkerThread.progressSignal.connect(lambda x: self.progressBar_2.setProperty("value", x))
        self.WorkerThread.StartEn.connect(lambda x: self.StartButton.setEnabled(x))
        self.WorkerThread.StartDis.connect(lambda x: self.StartButton.setDisabled(x))
        self.WorkerThread.PauseEn.connect(lambda x: self.PauseButton.setEnabled(x))
        self.WorkerThread.PauseDis.connect(lambda x: self.PauseButton.setDisabled(x))
        self.WorkerThread.RetrieveEn.connect(lambda x: self.RetrieveButton.setEnabled(x))
        self.WorkerThread.RetrieveDis.connect(lambda x: self.RetrieveButton.setDisabled(x))
        self.WorkerThread.TableSorting.connect(lambda x: self.tableWidget.setSortingEnabled(x))
        self.WorkerThread.NewRow.connect(lambda x: self.tableWidget.insertRow(x))
        self.WorkerThread.SetTableItem.connect(self.SetTable)

        self.WorkerThread.ShowError.connect(self.showError)
        self.WorkerThread.ShowInfo.connect(self.showInfo)
        self.WorkerThread.SetCurrHeader.connect(self.setCurrHeader)

        self.WorkerThread.display_error.connect(lambda x: self.display_error(x))
        self.WorkerThread.log_event.connect(lambda x: self.logEvent(x))
        self.WorkerThread.MainLogin.connect(self.login)

        self.init_login.emit(True) 
Example #15
Source File: ui.py    From CSGO-Market-Float-Finder with MIT License 5 votes vote down vote up
def __init__(self, parent):
        QtCore.QObject.__init__(self)
        self.parent = parent
        self.parent.processItems.connect(self.ProcessItems)
        self.parent.getMarketData.connect(self.GetMarketData)
        self.parent._process_single.connect(self.process_single)

        self.parent._worker_login.connect(self.login)
        self.parent._disconnect_user.connect(self.disconnect_user)
        self.parent.init_login.connect(self.init_login)

        self.progresscount = None
        self.marketdata = None
        self.singlelink = None
        self.delay = None
        self.pause = False

        self.soldcount = 0
        self.currency = None
        self.currencysym = None
        self.count = 0

        self.UserObject = None
        self.username = None
        self.password = None
        self.sharedsecret = None
        self.auth_code = None
        self.auth_type = None

        self.loggedin = False
        self.loginstatus = None

        self.idle = False 
Example #16
Source File: Keyboard.py    From Animation with GNU General Public License v2.0 5 votes vote down vote up
def __init__(self,ctl=None):
		QtCore.QObject.__init__(self)
		self.V=ctl.src
		self.ctl=ctl

		self.keypressed=False
		self.stack=[]
		self.editmode=False
		self.pos=None
		#self.debug=False
		self.debug=FreeCAD.ParamGet('User parameter:Plugins').GetBool('EventFilterDebug')
		self.debug=True 
Example #17
Source File: plotWidget.py    From PySimulator with GNU Lesser General Public License v3.0 5 votes vote down vote up
def __init__(self, obj, timeout=0):
        QtCore.QObject.__init__(self)
        self.obj = obj
        timer = QtCore.QTimer(self)
        timer.timeout.connect(self.update)
        timer.start(timeout) 
Example #18
Source File: GearBox_template_1010.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject) 
Example #19
Source File: BlendTransforms.py    From BlendTransforms with The Unlicense 5 votes vote down vote up
def BT_GetMayaWindow():
    ptr = apiUI.MQtUtil.mainWindow()
    if ptr is not None:
        if BT_MayaVersionNumber < 2014:
            return wrapinstance(long(ptr), QtCore.QObject)
        else:
            return wrapInstance(long(ptr), QtGui.QWidget) 
Example #20
Source File: BlendTransforms.py    From BlendTransforms with The Unlicense 5 votes vote down vote up
def BT_GetMayaWindow():
    ptr = apiUI.MQtUtil.mainWindow()
    if ptr is not None:
        if BT_MayaVersionNumber < 2014:
            return wrapinstance(long(ptr), QtCore.QObject)
        else:
            return wrapInstance(long(ptr), QtGui.QWidget) 
Example #21
Source File: BlendTransforms.py    From BlendTransforms with The Unlicense 5 votes vote down vote up
def BT_GetMayaWindow():
    ptr = apiUI.MQtUtil.mainWindow()
    if ptr is not None:
        if BT_MayaVersionNumber < 2014:
            return wrapinstance(long(ptr), QtCore.QObject)
        else:
            return wrapInstance(long(ptr), QtGui.QWidget) 
Example #22
Source File: BlendTransforms.py    From BlendTransforms with The Unlicense 5 votes vote down vote up
def BT_GetMayaWindow():
    ptr = apiUI.MQtUtil.mainWindow()
    if ptr is not None:
        if BT_MayaVersionNumber < 2014:
            return wrapinstance(long(ptr), QtCore.QObject)
        else:
            return wrapInstance(long(ptr), QtGui.QWidget) 
Example #23
Source File: AppObject.py    From pcloudpy with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
def __init__(self):

        super(AppObject, self).__init__()
        self._current_view = None
        self._current_layer = None

        class QObj(QObject):
            def __init__(self):
                super(QObj, self).__init__()
            layerAdded = Signal()

        self._QObj = QObj() 
Example #24
Source File: universal_tool_template_1116.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject) 
Example #25
Source File: universal_tool_template_1020.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject) 
Example #26
Source File: UITranslator_v1.0.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def Establish_Connections(self):
        # loop button and menu action to link to functions
        for ui_name in self.uiList.keys():
            if ui_name.endswith('_btn'):
                QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("clicked()"), getattr(self, ui_name[:-4]+"_action", partial(self.default_action,ui_name)))
            if ui_name.endswith('_atn'):
                QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("triggered()"), getattr(self, ui_name[:-4]+"_action", partial(self.default_action,ui_name)))
            if ui_name.endswith('_atnMsg') or ui_name.endswith('_btnMsg'):
                QtCore.QObject.connect(self.uiList[ui_name], QtCore.SIGNAL("triggered()"), getattr(self, ui_name[:-7]+"_message", partial(self.default_message,ui_name)))
        QtCore.QObject.connect(self.uiList["dict_table"].horizontalHeader(), QtCore.SIGNAL("sectionDoubleClicked(int)"), self.changeTableHeader)
        
    #############################################
    # UI Response functions
    ##############################################
    #-- ui actions 
Example #27
Source File: UITranslator.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject) 
Example #28
Source File: universal_tool_template_1112.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject) 
Example #29
Source File: universal_tool_template_1100.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject) 
Example #30
Source File: universal_tool_template_1110.py    From universal_tool_template.py with MIT License 5 votes vote down vote up
def mui_to_qt(self, mui_name):
        if hostMode != "maya":
            return
        ptr = mui.MQtUtil.findControl(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findLayout(mui_name)
        if ptr is None:
            ptr = mui.MQtUtil.findMenuItem(mui_name)
        if ptr is not None:
            if qtMode in (0,2):
                # ==== for pyside ====
                return shiboken.wrapInstance(long(ptr), QtWidgets.QWidget)
            elif qtMode in (1,3):
                # ==== for PyQt====
                return sip.wrapinstance(long(ptr), QtCore.QObject)