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))
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") html = QWebView() html.load(QUrl(authorizationURL)) layout1.addWidget(label1a) layout2.addWidget(html) 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.config.write() 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))