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


Python QWizardPage.registerField方法代码示例

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


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

示例1: runConfigWizard

# 需要导入模块: from PyQt4.QtGui import QWizardPage [as 别名]
# 或者: from PyQt4.QtGui.QWizardPage import registerField [as 别名]
    def runConfigWizard(self):
        try:
            oAuthHandler = tweepy.OAuthHandler(self.options_string['hidden_application_key'],
                                               self.options_string['hidden_application_secret'])
            authorizationURL = oAuthHandler.get_authorization_url(True)

            self.wizard.setWindowTitle('Twitter plugin configuration wizard')
            page1 = QWizardPage()
            page2 = QWizardPage()
            layout1 = QVBoxLayout()
            layout2 = QVBoxLayout()
            layoutInputPin = QHBoxLayout()

            label1a = QLabel(
                'Click next to connect to twitter.com . Please login with your account and follow the instructions in '
                'order to authorize creepy')
            label2a = QLabel(
                'Copy the PIN that you will receive once you authorize cree.py in the field below and click finish')
            pinLabel = QLabel('PIN')
            inputPin = QLineEdit()
            inputPin.setObjectName('inputPin')

            analysisHtml = QWebView()
            analysisHtml.load(QUrl(authorizationURL))

            layout1.addWidget(label1a)
            layout2.addWidget(analysisHtml)
            layout2.addWidget(label2a)
            layoutInputPin.addWidget(pinLabel)
            layoutInputPin.addWidget(inputPin)
            layout2.addLayout(layoutInputPin)

            page1.setLayout(layout1)
            page2.setLayout(layout2)
            page2.registerField('inputPin*', inputPin)
            self.wizard.addPage(page1)
            self.wizard.addPage(page2)
            self.wizard.resize(800, 600)

            if self.wizard.exec_():
                try:
                    oAuthHandler.get_access_token(str(self.wizard.field('inputPin').toString()).strip())
                    self.options_string['hidden_access_token'] = oAuthHandler.access_token
                    self.options_string['hidden_access_token_secret'] = oAuthHandler.access_token_secret
                    self.saveConfiguration(self.config)
                except Exception, err:
                    logger.error(err)
                    self.showWarning('Error completing the wizard',
                                     'We were unable to obtain the access token for your account, please try to run '
                                     'the wizard again. Error was {0}'.format(err.message))

        except Exception, err:
            logger.error(err)
            self.showWarning('Error completing the wizard', 'Error was: {0}'.format(err.message))
开发者ID:Symph0nyZer0,项目名称:creepy,代码行数:56,代码来源:twitter.py


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