当前位置: 首页>>代码示例>>Python>>正文


Python QtCore.pyqtRestoreInputHook方法代码示例

本文整理汇总了Python中PyQt4.QtCore.pyqtRestoreInputHook方法的典型用法代码示例。如果您正苦于以下问题:Python QtCore.pyqtRestoreInputHook方法的具体用法?Python QtCore.pyqtRestoreInputHook怎么用?Python QtCore.pyqtRestoreInputHook使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PyQt4.QtCore的用法示例。


在下文中一共展示了QtCore.pyqtRestoreInputHook方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: fit_component

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import pyqtRestoreInputHook [as 别名]
    def fit_component(self,component):
        '''Fit the component and save values'''
        from astropy.modeling import fitting
        # Generate Fit line
        fit_line = AbsLine(component.init_wrest,
            linelist=self.llist[self.llist['List']])
        fit_line.analy['vlim'] = component.vlim
        fit_line.analy['spec'] = self.spec
        fit_line.attrib['z'] = component.zcomp
        fit_line.measure_aodm()
        # Guesses
        fmin = np.argmin(self.spec.flux[fit_line.analy['pix']])
        zguess = self.spec.dispersion[fit_line.analy['pix'][fmin]]/component.init_wrest - 1.
        bguess = (component.vlim[1]-component.vlim[0])/2.
        Nguess = fit_line.attrib['logN']
        # Voigt model
        fitvoigt = xsv.single_voigt_model(logN=Nguess,b=bguess.value,
                                z=zguess, wrest=component.init_wrest.value,
                                gamma=fit_line.data['gamma'].value, 
                                f=fit_line.data['f'], fwhm=self.fwhm)
        # Restrict z range
        try:
            fitvoigt.z.min = component.zcomp+component.vlim[0].value/3e5/(1+component.zcomp)
        except TypeError:
            QtCore.pyqtRemoveInputHook()
            xdb.set_trace()
            QtCore.pyqtRestoreInputHook()
        fitvoigt.z.max = component.zcomp+component.vlim[1].value/3e5/(1+component.zcomp)
        #QtCore.pyqtRemoveInputHook()
        #xdb.set_trace()
        #QtCore.pyqtRestoreInputHook()
        # Fit
        fitter = fitting.LevMarLSQFitter()
        parm = fitter(fitvoigt,self.spec.dispersion[fit_line.analy['pix']],
            self.spec.flux[fit_line.analy['pix']].value)

        # Save and sync
        component.attrib['N'] = parm.logN.value
        component.attrib['z'] = parm.z.value
        component.attrib['b'] = parm.b.value * u.km/u.s
        component.sync_lines()
开发者ID:jsribaud,项目名称:xastropy,代码行数:43,代码来源:igmguesses.py

示例2: enable_qt4

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import pyqtRestoreInputHook [as 别名]
    def enable_qt4(self, app=False):
        """Enable event loop integration with PyQt4.
        
        Parameters
        ----------
        app : bool
            Create a running application object or not.

        Notes
        -----
        This methods sets the PyOS_InputHook for PyQt4, which allows
        the PyQt4 to integrate with terminal based applications like
        IPython.

        If ``app`` is True, we create an :class:`QApplication` as follows::

            from PyQt4 import QtCore
            app = QtGui.QApplication(sys.argv)

        But, we first check to see if an application has already been 
        created.  If so, we simply return that instance.
        """
        from PyQt4 import QtCore
        # PyQt4 has had this since 4.3.1.  In version 4.2, PyOS_InputHook
        # was set when QtCore was imported, but if it ever got removed,
        # you couldn't reset it.  For earlier versions we can
        # probably implement a ctypes version.
        try:
            QtCore.pyqtRestoreInputHook()
        except AttributeError:
            pass
        self._current_gui = GUI_QT4
        if app:
            from PyQt4 import QtGui
            app = QtCore.QCoreApplication.instance()
            if app is None:
                app = QtGui.QApplication(sys.argv)
                self._apps[GUI_QT4] = app
            return app
开发者ID:becomingGuru,项目名称:ipython,代码行数:41,代码来源:inputhook.py

示例3: out_qtrace

# 需要导入模块: from PyQt4 import QtCore [as 别名]
# 或者: from PyQt4.QtCore import pyqtRestoreInputHook [as 别名]
def out_qtrace():
  from PyQt4 import QtCore
  QtCore.pyqtRestoreInputHook()
    
#if __name__ == "__main__":
  
开发者ID:johnfoundations,项目名称:energyplus-frontend,代码行数:7,代码来源:zonetab.py


注:本文中的PyQt4.QtCore.pyqtRestoreInputHook方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。