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


Python QFile.close方法代码示例

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


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

示例1: __init__

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [as 别名]
	def __init__(self, parent=None):
		super(IPHelper, self).__init__(parent)
		f = QFile(os.path.join(os.path.split(__file__)[0], 'iphelper.ui'))
		loadUi(f, self)
		f.close()
		self.ipAddress = None
		
		# create validators
		validator = QRegExpValidator(QRegExp('\d{,3}'))
		self.uiFirstTetTXT.setValidator(validator)
		self.uiSecondTetTXT.setValidator(validator)
		self.uiThirdTetTXT.setValidator(validator)
		self.uiFourthTetTXT.setValidator(validator)
		
		# build a map of the buttons
		self.buttons = [None]*16
		self.signalMapper = QSignalMapper(self)
		self.signalMapper.mapped.connect(self.tetMap)
		for button in self.findChildren(QPushButton):
			match = re.findall(r'^uiTrellis(\d{,2})BTN$', button.objectName())
			if match:
				i = int(match[0])
				self.buttons[i] = button
				if i >= 12:
					self.signalMapper.setMapping(button, i)
					button.clicked.connect(self.signalMapper.map)
		self.tetMap(12)
开发者ID:MHendricks,项目名称:Motionbuilder-Remote,代码行数:29,代码来源:iphelper.py

示例2: findOrSaveConfig

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [as 别名]
 def findOrSaveConfig(self):
     infile = QFile('ui/config_path.ui')
     infile.open(QFile.ReadOnly)
     loader = QUiLoader()
     dialog = loader.load(infile, self.window)
     infile.close()
     
     def browse():
         path = QFileDialog.getSaveFileName(dialog, u"Choose or create a configuration file", dialog.pathBox.text())[0]
         if path != '':
             dialog.pathBox.setText(path)
     
     def cancel():
         dialog.hide()
     
     def ok():
         autodetectPort = dialog.autodetect.checkState() == Qt.Checked
         configPath = os.path.expanduser(dialog.pathBox.text())
         dialog.hide()
         self.start(configPath, autodetectPort)
     
     dialog.show()
     dialog.pathBox.setText(os.path.expanduser('~/.config/tangelo/tangelo.conf'))
     
     dialog.browseButton.clicked.connect(browse)
     dialog.cancelButton.clicked.connect(cancel)
     dialog.okButton.clicked.connect(ok)
开发者ID:XDATA-Year-2,项目名称:tangelo-wrapper,代码行数:29,代码来源:tangelo-wrapper.py

示例3: loadDialog

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [as 别名]
def loadDialog(file_name):
        loader = QUiLoader()
        the_file = QFile(file_name)
        the_file.open(QFile.ReadOnly)
        ret_val = loader.load(the_file)
        the_file.close()
        return ret_val
开发者ID:F-Secure,项目名称:dvmps,代码行数:9,代码来源:progress_dialog.py

示例4: testBasic

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [as 别名]
 def testBasic(self):
     '''QFile.getChar'''
     obj = QFile(self.filename)
     obj.open(QIODevice.ReadOnly)
     self.assertEqual(obj.getChar(), (True, 'a'))
     self.assertFalse(obj.getChar()[0])
     obj.close()
开发者ID:Hasimir,项目名称:PySide,代码行数:9,代码来源:qfile_test.py

示例5: main

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [as 别名]
def main(argv=None):
    if argv is None:
        argv = sys.argv

    app = QApplication(argv)
    engine = QScriptEngine()

    if HAS_DEBUGGER:
        debugger = QScriptEngineDebugger()
        debugger.attachTo(engine)
        debugWindow = debugger.standardWindow()
        debugWindow.resize(1024, 640)

    scriptFileName = './calculator.js'
    scriptFile = QFile(scriptFileName)
    scriptFile.open(QIODevice.ReadOnly)
    engine.evaluate(unicode(scriptFile.readAll()), scriptFileName)
    scriptFile.close()

    loader = QUiLoader()
    ui = loader.load(':/calculator.ui')

    ctor = engine.evaluate('Calculator')
    scriptUi = engine.newQObject(ui, QScriptEngine.ScriptOwnership)
    calc = ctor.construct([scriptUi])

    if HAS_DEBUGGER:
        display = ui.findChild(QLineEdit, 'display')
        display.connect(display, SIGNAL('returnPressed()'),
                        debugWindow, SLOT('show()'))

    ui.show()
    return app.exec_()
开发者ID:AmerGit,项目名称:Examples,代码行数:35,代码来源:calculator.py

示例6: TestQFileSignalBlocking

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [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)
开发者ID:Hasimir,项目名称:PySide,代码行数:37,代码来源:blocking_signals_test.py

示例7: __init__

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [as 别名]
 def __init__(self):
     self.loader = QUiLoader()
     infile = QFile("resources/loading.ui")
     infile.open(QFile.ReadOnly)
     self.window = self.loader.load(infile, None)
     infile.close()
     
     self.overrides = {'personID':self.window.personID,
                      'paID':self.window.paID,
                      'maID':self.window.maID,
                      'sex':self.window.sex,
                      'affected':self.window.affected,
                      'n_local_aff':self.window.n_local_aff,
                      'n_local_desc':self.window.n_local_desc,
                      'nicki_d':self.window.nicki_d,
                      'is_root':self.window.is_root,
                      'is_leaf':self.window.is_leaf,
                      'generation':self.window.generation}
     self.requiredForCalculateD = set(['personID','paID','maID','sex','affected'])
     self.header = []
     self.lowerHeader = []
     
     self.window.browseInputButton.clicked.connect(self.browseInput)
     self.window.inputField.textChanged.connect(self.switchPrograms)
     self.window.browseOutputButton.clicked.connect(self.browseOutput)
     self.window.outputField.textChanged.connect(self.switchPrograms)
     self.window.programBox.currentIndexChanged.connect(self.switchPrograms)
     self.window.runButton.clicked.connect(self.go)
     
     self.switchPrograms()
     self.window.buttonBox.setEnabled(False)
     
     self.window.show()
开发者ID:alex-r-bigelow,项目名称:updb-explorer,代码行数:35,代码来源:updb-explorer.py

示例8: loadWindowFromFile

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [as 别名]
def loadWindowFromFile(file_name):
    '''Load the window definition from the resource ui file'''
    loader = QUiLoader()
    ui_file = QFile(file_name)
    ui_file.open(QFile.ReadOnly)
    the_window = loader.load(ui_file)
    ui_file.close()
    return the_window
开发者ID:F-Secure,项目名称:dvmps,代码行数:10,代码来源:kvm_ui.py

示例9: save_to_disk

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [as 别名]
 def save_to_disk(self, filename, data):
     f = QFile(filename)
     if not f.open(QIODevice.WriteOnly):
         print "could not open %s for writing" % filename
         return False
     f.write(data.readAll())
     f.close()
     return True
开发者ID:bordstein,项目名称:hamster,代码行数:10,代码来源:downloader.py

示例10: loadHyperlinkDialog

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [as 别名]
 def loadHyperlinkDialog(self):
     ''' Load dialog from ui file for defining hyperlink '''
     loader = QUiLoader()
     ui_file = QFile(':/hyperlink.ui')  # UI_DIALOG_FILE)
     ui_file.open(QFile.ReadOnly)
     self.hyperlink_dialog = loader.load(ui_file)
     ui_file.close()
     self.hyperlink_dialog.accepted.connect(self.hyperlinkChanged)
     self.hlink_field = self.hyperlink_dialog.findChild(QLineEdit, 'hlink')
开发者ID:blipvert,项目名称:opengeode,代码行数:11,代码来源:genericSymbols.py

示例11: createWidget

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [as 别名]
 def createWidget(self):
     # Override the existing widget
     # TODO: Do I need to delete anything explicitly?
     infile = QFile('ui/process_widget.ui')
     infile.open(QFile.ReadOnly)
     loader = QUiLoader()
     self.widget = loader.load(infile, Globals.mainWindow.window)
     infile.close()
     
     self.updateWidget(True)
开发者ID:XDATA-Year-2,项目名称:tangelo-wrapper,代码行数:12,代码来源:tangelo-wrapper.py

示例12: testBug909

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [as 别名]
    def testBug909(self):
        fileName = QFile(adjust_filename('bug_909.ui', __file__))
        loader = QUiLoader()
        main_win = loader.load(fileName)
        self.assertEqual(sys.getrefcount(main_win), 2)
        fileName.close()

        tw = QTabWidget(main_win)
        main_win.setCentralWidget(tw)
        main_win.show()
开发者ID:Hasimir,项目名称:PySide,代码行数:12,代码来源:bug_909.py

示例13: __load_ui

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [as 别名]
    def __load_ui(self):
        ui_path = os.path.dirname(__file__)
        ui_path = os.path.join(ui_path, "MainWindow.ui")
        ui_file = QFile(ui_path)
        ui_file.open(QFile.ReadOnly)
        ui_loader = QtUiTools.QUiLoader()
        self.__ui = ui_loader.load(ui_file, None)
        ui_file.close()

        self.__ui.answerTableWidget.setHorizontalHeaderLabels([self.tr("Question"), self.tr("Answer")])
开发者ID:qvoiriot,项目名称:ia_expert_system,代码行数:12,代码来源:Application.py

示例14: testPhrase

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [as 别名]
    def testPhrase(self):
        #Test loading of quote.txt resource
        f = open(adjust_filename('quoteEnUS.txt', __file__), "r")
        orig = f.read()
        f.close()

        f = QFile(':/quote.txt')
        f.open(QIODevice.ReadOnly) #|QIODevice.Text)
        print("Error:", f.errorString())
        copy = f.readAll()
        f.close()
        self.assertEqual(orig, copy)
开发者ID:Hasimir,项目名称:PySide,代码行数:14,代码来源:qresource_test.py

示例15: findTangelo

# 需要导入模块: from PySide.QtCore import QFile [as 别名]
# 或者: from PySide.QtCore.QFile import close [as 别名]
 def findTangelo():
     infile = QFile('ui/find_tangelo.ui')
     infile.open(QFile.ReadOnly)
     loader = QUiLoader()
     dialog = loader.load(infile, None)
     infile.close()
     
     if sys.platform.startswith('win'):
         Globals.pythonPath = subprocess.Popen(['where', 'python'], stdout=subprocess.PIPE).communicate()[0].strip()
         Globals.tangeloPath = subprocess.Popen(['where', 'tangelo'], stdout=subprocess.PIPE).communicate()[0].strip()
     else:
         Globals.pythonPath = subprocess.Popen(['which', 'python'], stdout=subprocess.PIPE).communicate()[0].strip()
         Globals.tangeloPath = subprocess.Popen(['which', 'tangelo'], stdout=subprocess.PIPE).communicate()[0].strip()
     
     if os.path.exists(Globals.pythonPath):
         dialog.pythonPathBox.setText(Globals.pythonPath)
     if os.path.exists(Globals.tangeloPath):
         dialog.tangeloPathBox.setText(Globals.tangeloPath)
     
     def pythonBrowse():
         path = QFileDialog.getOpenFileName(dialog, u"Find python", dialog.pythonPathBox.text())[0]
         if path != '':
             dialog.pythonPathBox.setText(path)
     
     def tangeloBrowse():
         path = QFileDialog.getOpenFileName(dialog, u"Find tangelo", dialog.tangeloPathBox.text())[0]
         if path != '':
             dialog.tangeloPathBox.setText(path)
     
     def cancel():
         dialog.hide()
         sys.exit()
     
     def ok():
         Globals.pythonPath = os.path.expanduser(dialog.pythonPathBox.text())
         Globals.tangeloPath = os.path.expanduser(dialog.tangeloPathBox.text())
         
         if not os.path.exists(Globals.pythonPath):
             Globals.criticalError("Sorry, that python interpreter doesn't exist.")
             return
         if not os.path.exists(Globals.tangeloPath):
             Globals.criticalError("Sorry, that tangelo executable doesn't exist.")
             return
         
         Globals.mainWindow = Overview()
         Globals.mainWindow.refresh()
         dialog.hide()
     dialog.show()
     
     dialog.tangeloBrowse.clicked.connect(tangeloBrowse)
     dialog.pythonBrowse.clicked.connect(pythonBrowse)
     dialog.cancelButton.clicked.connect(cancel)
     dialog.okButton.clicked.connect(ok)
开发者ID:XDATA-Year-2,项目名称:tangelo-wrapper,代码行数:55,代码来源:tangelo-wrapper.py


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