本文整理汇总了Python中PySide.QtCore.QFile.blockSignals方法的典型用法代码示例。如果您正苦于以下问题:Python QFile.blockSignals方法的具体用法?Python QFile.blockSignals怎么用?Python QFile.blockSignals使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PySide.QtCore.QFile
的用法示例。
在下文中一共展示了QFile.blockSignals方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: TestQFileSignalBlocking
# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import blockSignals [as 别名]
class TestQFileSignalBlocking(unittest.TestCase):
'''Test case for blocking the signal QIODevice.aboutToClose()'''
def setUp(self):
#Set up the needed resources - A temp file and a QFile
self.called = False
handle, self.filename = mkstemp()
os.close(handle)
self.qfile = QFile(self.filename)
def tearDown(self):
#Release acquired resources
os.remove(self.filename)
del self.qfile
def callback(self):
#Default callback
self.called = True
def testAboutToCloseBlocking(self):
#QIODevice.aboutToClose() blocking
QObject.connect(self.qfile, SIGNAL('aboutToClose()'), self.callback)
self.assert_(self.qfile.open(QFile.ReadOnly))
self.qfile.close()
self.assert_(self.called)
self.called = False
self.qfile.blockSignals(True)
self.assert_(self.qfile.open(QFile.ReadOnly))
self.qfile.close()
self.assert_(not self.called)