本文整理汇总了Python中PySide.QtCore.QObject方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.QObject方法的具体用法?Python QtCore.QObject怎么用?Python QtCore.QObject使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtCore
的用法示例。
在下文中一共展示了QtCore.QObject方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Establish_Connections
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QObject [as 别名]
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
示例2: initializeCallback
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QObject [as 别名]
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..."
示例3: BT_GetMayaWindow
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QObject [as 别名]
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)
示例4: _pyside2_as_qt_object
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QObject [as 别名]
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)
示例5: _pyside_as_qt_object
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QObject [as 别名]
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)
示例6: __init__
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QObject [as 别名]
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()
示例7: mui_to_qt
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QObject [as 别名]
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)
示例8: Establish_Connections
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QObject [as 别名]
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
示例9: loadLang
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QObject [as 别名]
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 )
示例10: mui_to_qt
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QObject [as 别名]
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)
示例11: main
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QObject [as 别名]
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
示例12: __init__
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QObject [as 别名]
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)
示例13: __init__
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QObject [as 别名]
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
示例14: __init__
# 需要导入模块: from PySide import QtCore [as 别名]
# 或者: from PySide.QtCore import QObject [as 别名]
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)