python类QObject()的实例源码

personview.py 文件源码 项目:guiQML 作者: gramps-project 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __build_main_window(self, engine):
        """
        Builds the QML interface
        """
        parentcontext = engine.rootContext()
        #Create a context for the family tree list
        self.qmlpersonlistcontext = QtDeclarative.QDeclarativeContext(parentcontext)
        #Create ListModel to use
        personlistmodel = QMLPersonListModel(self.dbstate.db)

        #register them in the context
        self.qmlpersonlistcontext.setContextProperty('Const', self.const)
        self.qmlpersonlistcontext.setContextProperty('QMLPersonList', self)
        self.qmlpersonlistcontext.setContextProperty('QMLPersonListModel', personlistmodel)

        #create a Component to show
        self.qmlpersonlist = QtDeclarative.QDeclarativeComponent(engine)
        self.qmlpersonlist.loadUrl(QtCore.QUrl.fromLocalFile(
                os.path.join(ROOT_DIR, "guiQML", 'views', 'peopleview.qml')))
        #and obtain the QObject of it
        self.Qpersonlist = self.qmlpersonlist.create(self.qmlpersonlistcontext)
dbman.py 文件源码 项目:guiQML 作者: gramps-project 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, dbstate, engine, onselectcallback):
        """
        The manager is initialised with a dbstate on which GRAMPS is
        working, and the engine to use context from.
        """
        self.__busy = False
        self.__onselect = onselectcallback
        QtCore.QObject.__init__(self)
        CLIDbManager.__init__(self, dbstate)
        #constants needed in the QML
        self.const = {
            'titlelabel': "Gramps - %s" % _("Family Trees"),
            'addbtnlbl': _("Add a Family Tree"),
            'famtreeicon': FAMTREE_ICONPATH
            }
        #there is one DeclarativeEngine for global settings
        self.__build_main_window(engine)
centralview.py 文件源码 项目:guiQML 作者: gramps-project 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __build_main_window(self, engine):
        """
        Builds the QML interface
        """
        parentcontext = engine.rootContext()
        #Create a context for the family tree list
        self.centralviewcontext = QtDeclarative.QDeclarativeContext(parentcontext)
        #Create ListModel to use
        detviews = DetViewSumModel([DetailView('People')])

        #register them in the context
        self.centralviewcontext.setContextProperty('Const', self.const)
        self.centralviewcontext.setContextProperty('CentralView', self)
        self.centralviewcontext.setContextProperty('DetViewSumModel', detviews)

        #create a Component to show
        self.centralview = QtDeclarative.QDeclarativeComponent(engine)
        self.centralview.loadUrl(QtCore.QUrl.fromLocalFile(
                os.path.join(ROOT_DIR, "guiQML", 'views', 'centralview.qml')))
        #and obtain the QObject of it
        self.Qcentralview = self.centralview.create(self.centralviewcontext)
universal_tool_template_v7.3.py 文件源码 项目:universal_tool_template.py 作者: shiningdesign 项目源码 文件源码 阅读 26 收藏 0 点赞 0 评论 0
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
sandbox_model.py 文件源码 项目:kite 作者: pyrocko 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, scene_model, *args, **kwargs):
        QtCore.QObject.__init__(self, *args, **kwargs)
        self.worker_thread = QtCore.QThread()
        self.moveToThread(self.worker_thread)
        self.worker_thread.start()

        self.model = None
        self.log = SceneLogModel(self)
        self.sources = SourceModel(self)

        self._log_handler = logging.Handler()
        self._log_handler.emit = self.sigLogRecord.emit

        self.cursor_tracker = CursorTracker()

        self.setModel(scene_model)
tab_covariance.py 文件源码 项目:kite 作者: pyrocko 项目源码 文件源码 阅读 23 收藏 0 点赞 0 评论 0
def __init__(self, model, parent):
        QtCore.QObject.__init__(self)
        self.sigCalculateWeightMatrix.connect(
            model.calculateWeightMatrix)

        ret = QtGui.QMessageBox.information(
            parent,
            'Calculate full weight matrix',
            '''<html><head/><body><p>
This will calculate the quadtree's full weight matrix
(<span style='font-family: monospace'>Covariance.weight_matrix</span>)
for this noise/covariance configuration.</p><p>
The calculation is expensive and may take several minutes.
</p></body></html>
''', buttons=(QtGui.QMessageBox.Ok | QtGui.QMessageBox.Cancel))
        if ret == QtGui.QMessageBox.Ok:
            self.sigCalculateWeightMatrix.emit()
scene_model.py 文件源码 项目:kite 作者: pyrocko 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def __init__(self):
        QtCore.QObject.__init__(self)

        self.scene = None
        self.frame = None
        self.quadtree = None
        self.covariance = None
        self.log = SceneLogModel(self)

        self._ = SignalProxy(self._sigQuadtreeChanged,
                             rateLimit=5,
                             delay=0,
                             slot=lambda: self.sigQuadtreeChanged.emit())

        self._log_handler = logging.Handler()
        self._log_handler.emit = self.sigLogRecord.emit

        self.qtproxy = QSceneQuadtreeProxy(self)

        self.worker_thread = QtCore.QThread()
        self.moveToThread(self.worker_thread)
        self.worker_thread.start()
facedraw.py 文件源码 项目:freecad-nurbs 作者: microelly2 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self):
        QtCore.QObject.__init__(self)
        self.mouseWheel=0
        self.enterleave=False
        self.enterleave=True
        self.keyPressed2=False
        self.editmode=False
        self.key='x'
        self.posx=-1
        self.posy=-1
        self.lasttime=time.time()
        self.lastkey='#'
        self.colorA=0
        self.colors=[]
        self.pts=[]
        self.ptsm=[]
        self.mode='n'
personview.py 文件源码 项目:guiQML 作者: gramps-project 项目源码 文件源码 阅读 28 收藏 0 点赞 0 评论 0
def __init__(self, db, personhandle):
        QtCore.QObject.__init__(self)
        self.__handle = personhandle
        self.__db = db
personview.py 文件源码 项目:guiQML 作者: gramps-project 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
def __init__(self, dbstate, engine):
        """
        The manager is initialised with a dbstate on which GRAMPS is
        working, and the engine to use context from.
        """
        self.dbstate = dbstate
        QtCore.QObject.__init__(self)
        self.const = {
            'titlelabel': "%s" % self.dbstate.db.get_dbname(),
            }
        #there is one DeclarativeEngine for global settings
        self.__build_main_window(engine)
dbman.py 文件源码 项目:guiQML 作者: gramps-project 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self, thing, dbman):
        QtCore.QObject.__init__(self)
        self.__dbman = dbman
        self.__name = thing[CLIDbManager.IND_NAME]
        self.__path = thing[CLIDbManager.IND_PATH]
        self.__path_namefile = thing[CLIDbManager.IND_PATH_NAMEFILE]
        self.__last_access = thing[CLIDbManager.IND_TVAL_STR]
        self.__use_icon = thing[CLIDbManager.IND_USE_ICON_BOOL]
        self.__icon = thing[CLIDbManager.IND_STOCK_ID]
centralview.py 文件源码 项目:guiQML 作者: gramps-project 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self, name):
        QtCore.QObject.__init__(self)
        self.__name = name
centralview.py 文件源码 项目:guiQML 作者: gramps-project 项目源码 文件源码 阅读 24 收藏 0 点赞 0 评论 0
def __init__(self, dbstate, engine, viewshow):
        """
        The manager is initialised with a dbstate on which GRAMPS is
        working, and the engine to use context from.
        """
        self.dbstate = dbstate
        self.__viewshow = viewshow
        QtCore.QObject.__init__(self)
        self.const = {
            'titlelabel': str("%s" % self.dbstate.db.get_dbname()),
            }
        print(self.const['titlelabel'])
        #there is one DeclarativeEngine for global settings
        self.__build_main_window(engine)
BlendTransforms.py 文件源码 项目:BlendTransforms 作者: duncanskertchly 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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)
BlendTransforms.py 文件源码 项目:BlendTransforms 作者: duncanskertchly 项目源码 文件源码 阅读 25 收藏 0 点赞 0 评论 0
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)
BlendTransforms.py 文件源码 项目:BlendTransforms 作者: duncanskertchly 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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)
BlendTransforms.py 文件源码 项目:BlendTransforms 作者: duncanskertchly 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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)
Node.py 文件源码 项目:BrainModulyzer 作者: sugeerth 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self):
        QtCore.QObject.__init__(self)
packs.py 文件源码 项目:HearthPacks 作者: Arzaroth 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self):
        QtCore.QObject.__init__(self)
        self.pool = QtCore.QThreadPool()
        self.pool.setMaxThreadCount(5)
        self.cards = []
        self.result = {}
        self.tmpdir = tempfile.mkdtemp()
CustomWebView.py 文件源码 项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
def __init__(self,WebView,startval=42):
        QtCore.QObject.__init__(self)
        self.Start= startval 
        self.WebView = WebView
        self.sendTimeStepFromSankey.connect(self.WebView.sendTimeStepFromSankey)
CustomWebView.py 文件源码 项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def signalConnection(self):
        self.connect(self.page().mainFrame(), QtCore.SIGNAL("javaScriptWindowObjectCleared ()"), self.javaScriptWindowObjectCleared)
        self.settings().setAttribute(QtWebKit.QWebSettings.WebAttribute.DeveloperExtrasEnabled, True)
        QtCore.QObject.connect(self.page(), QtCore.SIGNAL('selectionChanged()'), self.selectionChanged)
Node.py 文件源码 项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码 阅读 27 收藏 0 点赞 0 评论 0
def __init__(self):
        QtCore.QObject.__init__(self)
ElectrodeView.py 文件源码 项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
def __init__(self):
        QtCore.QObject.__init__(self)
main.py 文件源码 项目:Electrify 作者: jyapayne 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def find_child_by_name(self, name):
        return self.findChild(QtCore.QObject, name)
main.py 文件源码 项目:Electrify 作者: jyapayne 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
def find_all_children(self, names):
        children = []
        for child in self.find_children(QtCore.QObject):
            if child.object_name() in names:
                children.append(child)

        return children
universal_tool_template_1020.py 文件源码 项目:universal_tool_template.py 作者: shiningdesign 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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)
UITranslator.py 文件源码 项目:universal_tool_template.py 作者: shiningdesign 项目源码 文件源码 阅读 20 收藏 0 点赞 0 评论 0
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)
GearBox_template_1010.py 文件源码 项目:universal_tool_template.py 作者: shiningdesign 项目源码 文件源码 阅读 21 收藏 0 点赞 0 评论 0
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)
universal_tool_template_v7.3.py 文件源码 项目:universal_tool_template.py 作者: shiningdesign 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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)
universal_tool_template_v7.3.py 文件源码 项目:universal_tool_template.py 作者: shiningdesign 项目源码 文件源码 阅读 22 收藏 0 点赞 0 评论 0
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


问题


面经


文章

微信
公众号

扫码关注公众号