當前位置: 首頁>>代碼示例>>Python>>正文


Python QtCore.QObject方法代碼示例

本文整理匯總了Python中PyQt4.QtCore.QObject方法的典型用法代碼示例。如果您正苦於以下問題:Python QtCore.QObject方法的具體用法?Python QtCore.QObject怎麽用?Python QtCore.QObject使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在PyQt4.QtCore的用法示例。


在下文中一共展示了QtCore.QObject方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Establish_Connections

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:19,代碼來源:universal_tool_template_v7.3.py

示例2: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QObject [as 別名]
def __init__(self, iface, settings):
        QtCore.QObject.__init__(self)

        self.iface = iface
        self.settings = settings
        #self.connection = None
        self.proj = QgsProject.instance()
        self.proj_settings = dict()
        self.datastore = {'name':'','type':0,'path':'','schema':'','crs':''}
        self.__loadSettings()

        self.dlg = ProjectDialog(self.iface, self.proj_settings, self.settings)

        # set up GUI signals
        #for the buttonbox we must use old style connections, or else use simple buttons
        self.dlg.saveDatastoreSettings.connect(self.writeSettings)
        self.settingsUpdated.connect(self.updateDatastore)
        self.iface.projectRead.connect(self.__loadSettings)
        self.iface.newProjectCreated.connect(self.__loadDefaults) 
開發者ID:SpaceGroupUCL,項目名稱:qgisSpaceSyntaxToolkit,代碼行數:21,代碼來源:ProjectManager.py

示例3: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QObject [as 別名]
def __init__(self, checkonly=False):
        QtCore.QObject.__init__(self)
        self.checkonly = checkonly
        self.added = 0
        self.updated = 0
        self.nochange = 0 
開發者ID:doctorguile,項目名稱:pyqtggpo,代碼行數:8,代碼來源:unsupportedsavestates.py

示例4: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QObject [as 別名]
def __init__(self,parent=None):
        super(QtCore.QObject, self).__init__(parent)

        pygame.init() #Do we need this? Or is it done already elsewhere
        pygame.camera.init()

        self.cam = None
        self.buffer = None
        self.size = (1280, 720)


        # Get new image from camera at cam fps
        self.camTimer = QtCore.QTimer(self)
        self.camTimer.timeout.connect(self.emitNextFrame) 
開發者ID:omwdunkley,項目名稱:crazyflieROS,代碼行數:16,代碼來源:cameraInput.py

示例5: BT_GetMayaWindow

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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) 
開發者ID:duncanskertchly,項目名稱:BlendTransforms,代碼行數:9,代碼來源:BlendTransforms.py

示例6: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QObject [as 別名]
def __init__(self):
      QtCore.QObject.__init__(self)
      # Socket to talk to server
      context = zmq.Context()
      self.socket = context.socket(zmq.SUB)
      self.socket.connect(ZMQ_SSOCK)
      self.socket.setsockopt(zmq.SUBSCRIBE, '')

      self.poller = zmq.Poller()
      self.poller.register(self.socket, zmq.POLLIN)

      self.running = True 
開發者ID:TheZ3ro,項目名稱:nsaway,代碼行數:14,代碼來源:tray.py

示例7: getMainWindow

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QObject [as 別名]
def getMainWindow():
	ptr = mui.MQtUtil.mainWindow()
	mainWin = sip.wrapinstance(long(ptr), QtCore.QObject)
	return mainWin 
開發者ID:justinfx,項目名稱:tutorials,代碼行數:6,代碼來源:mqtutil.py

示例8: getWidgetUnderPointer

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QObject [as 別名]
def getWidgetUnderPointer():
	panel = cmds.getPanel(underPointer=True)
	if not panel:
		return None

	ptr = mui.MQtUtil.findControl(panel)
	widget = sip.wrapinstance(long(ptr), QtCore.QObject)
	return widget 
開發者ID:justinfx,項目名稱:tutorials,代碼行數:10,代碼來源:mqtutil.py

示例9: getMayaWindow

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QObject [as 別名]
def getMayaWindow():
    """
    getMayaWindow()
        A helper function that finds the maya mainWindow
        and returns a proper PyQt4 QMainWindow object for
        us to reference.
    """
    ptr = mui.MQtUtil.mainWindow()
    return sip.wrapinstance(long(ptr), QtCore.QObject) 
開發者ID:justinfx,項目名稱:tutorials,代碼行數:11,代碼來源:assetImporterWin.py

示例10: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QObject [as 別名]
def __init__(self, view):
        assert isinstance(view, FlatCAMActivityView), \
            "Expected a FlatCAMActivityView, got %s" % type(view)

        FCProcessContainer.__init__(self)
        QtCore.QObject.__init__(self)

        self.view = view

        self.something_changed.connect(self.update_view) 
開發者ID:Denvi,項目名稱:FlatCAM,代碼行數:12,代碼來源:FlatCAMProcess.py

示例11: __init__

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.QtCore import QObject [as 別名]
def __init__(self, name):
        """

        :param name: Name of the object given by the user.
        :return: FlatCAMObj
        """
        QtCore.QObject.__init__(self)

        # View
        self.ui = None

        self.options = LoudDict(name=name)
        self.options.set_change_callback(self.on_options_change)

        self.form_fields = {}

        self.kind = None  # Override with proper name

        # self.shapes = ShapeCollection(parent=self.app.plotcanvas.vispy_canvas.view.scene)
        self.shapes = self.app.plotcanvas.new_shape_group()

        self.item = None  # Link with project view item

        self.muted_ui = False
        self.deleted = False

        self._drawing_tolerance = 0.01

        # assert isinstance(self.ui, ObjectUI)
        # self.ui.name_entry.returnPressed.connect(self.on_name_activate)
        # self.ui.offset_button.clicked.connect(self.on_offset_button_click)
        # self.ui.scale_button.clicked.connect(self.on_scale_button_click) 
開發者ID:Denvi,項目名稱:FlatCAM,代碼行數:34,代碼來源:FlatCAMObj.py

示例12: mui_to_qt

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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) 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:17,代碼來源:universal_tool_template_1116.py

示例13: Establish_Connections

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:17,代碼來源:UITranslator_v1.0.py

示例14: loadLang

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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 ) 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:43,代碼來源:UITranslator_v1.0.py

示例15: mui_to_qt

# 需要導入模塊: from PyQt4 import QtCore [as 別名]
# 或者: from PyQt4.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) 
開發者ID:shiningdesign,項目名稱:universal_tool_template.py,代碼行數:15,代碼來源:universal_tool_template_v7.3.py


注:本文中的PyQt4.QtCore.QObject方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。