Exemple #1
0
 def doLogon(self):
     time0 = time.time()
     print 'STARTING TO LOGIN'
     statusdict = get_database_data( )
     print 'FINISHED LOGIN STUFF IN %0.3f SECONDS: %s' % (
         time.time() - time0, statusdict['message'] )
     if statusdict['message'] != 'SUCCESS':
         self.lw.setFromStatus( statusdict )
         self.lw.show()
     else:
         self.cookies = statusdict['cookies']
         email = statusdict['email']
         password = statusdict['password']
         data = get_article_data( email, password, self.cookies )
         self.pushData( data['articles'], data['ids_ordered'] )
                self.statusLabel.setText(
                    "ERROR, COULD NOT CHECK READABILITY ACCOUNT")
                return None
            status = response.json()['status']
            if 'FAILURE' in status:
                self.statusLabel.setText(
                    "ERROR, NEED TO CREATE READABILITY ACCOUNT")
                self.chooseCreate.toggle()
                return
            self.statusLabel.setText("SUCCESS, LOGGED IN AS USER")
            self.parent.pushDataFromCreds(dbEmail, dbPasswd, response.cookies)

    def chooseStateCreate(self, enabled):
        if enabled:
            self.rdEmailLineEdit.setEnabled(True)
            self.rdPasswdLineEdit.setEnabled(True)

    def chooseStateJustLogin(self, enabled):
        if enabled:
            self.rdEmailLineEdit.setEnabled(False)
            self.rdPasswdLineEdit.setEnabled(False)


if __name__ == '__main__':
    statusdict = get_database_data()
    print 'message = %s' % statusdict['message']
    qApp = QApplication(sys.argv)
    lw = LoginWindow()
    lw.setFromStatus(statusdict)
    sys.exit(qApp.exec_())
Exemple #3
0
                self.statusLabel.setText("ERROR, COULD NOT CHECK READABILITY ACCOUNT")
                return None
            if response.status_code != 200:
                self.statusLabel.setText("ERROR, COULD NOT CHECK READABILITY ACCOUNT")
                return None
            status = response.json()['status']
            if 'FAILURE' in status:
                self.statusLabel.setText("ERROR, NEED TO CREATE READABILITY ACCOUNT")
                self.chooseCreate.toggle()
                return
            self.statusLabel.setText("SUCCESS, LOGGED IN AS USER")
            self.parent.pushDataFromCreds( dbEmail, dbPasswd, response.cookies )
                        
    def chooseStateCreate( self, enabled ):
        if enabled:
            self.rdEmailLineEdit.setEnabled( True )
            self.rdPasswdLineEdit.setEnabled( True )

    def chooseStateJustLogin( self, enabled ):
        if enabled:
            self.rdEmailLineEdit.setEnabled( False )
            self.rdPasswdLineEdit.setEnabled( False )

if __name__=='__main__':
    statusdict = get_database_data( )
    print 'message = %s' % statusdict['message']
    qApp = QApplication( sys.argv )
    lw = LoginWindow( )
    lw.setFromStatus( statusdict )
    sys.exit( qApp.exec_() )