Merge branch 'master' of github.com:jeena/Tentia
This commit is contained in:
commit
0263e1666d
2 changed files with 35 additions and 20 deletions
|
|
@ -13,7 +13,7 @@ class Tentia:
|
|||
self.preferences = Windows.Preferences(self)
|
||||
self.preferences.show()
|
||||
|
||||
self.timeline = Windows.Timeline(self)
|
||||
#self.timeline = Windows.Timeline(self)
|
||||
self.mentions = Windows.Timeline(self, "mentions", "Mentions")
|
||||
|
||||
if self.controller.stringForKey("user_access_token") != "":
|
||||
|
|
@ -37,7 +37,7 @@ class Tentia:
|
|||
self.init_web_views()
|
||||
|
||||
def init_web_views(self):
|
||||
self.timeline.show()
|
||||
#self.timeline.show()
|
||||
self.mentions.show()
|
||||
|
||||
|
||||
|
|
@ -81,6 +81,31 @@ class Controller(QtCore.QObject):
|
|||
def loggedIn(self):
|
||||
self.app.authentification_succeded()
|
||||
|
||||
def unreadMentions(self, count):
|
||||
i = int(count)
|
||||
if i == 0:
|
||||
self.app.timeline.setWindowTitle("Tentia (^" + count + ")")
|
||||
else:
|
||||
self.app.timeline.setWindowTitle("Tentia")
|
||||
|
||||
def notificateUserAboutMention(self, text, name, post_id, entity):
|
||||
print "notificateUserAboutMention is not implemented yet"
|
||||
|
||||
def openNewMessageWidow(self, entity, status_id, string):
|
||||
print "openNewMessageWidow is not implemented yet"
|
||||
|
||||
def showConversation(self, id, entity):
|
||||
print "showConversation is not implemented yet"
|
||||
|
||||
def authentificationDidNotSucceed(self, errorMessage):
|
||||
print "authentificationDidNotSucceed is not implemented yet"
|
||||
|
||||
def alertTitleWithMessage(self, title, message):
|
||||
print "alertTitleWithMessage is not implemented yet"
|
||||
|
||||
def logout(self, sender):
|
||||
print "logout is not implemented yet"
|
||||
|
||||
|
||||
class Console(QtCore.QObject):
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from PyQt4 import QtCore, QtGui, QtWebKit
|
||||
import Helper, urllib
|
||||
import Helper, urllib, urllib2
|
||||
|
||||
class Preferences:
|
||||
|
||||
|
|
@ -116,28 +116,18 @@ class Oauth:
|
|||
|
||||
old_manager = self.auth_view.page().networkAccessManager()
|
||||
new_manager = Helper.NetworkAccessManager(old_manager, self.tentia_callback)
|
||||
new_manager.authenticationRequired.connect(self.authentication_required)
|
||||
self.auth_view.page().setNetworkAccessManager(new_manager)
|
||||
|
||||
self.auth_view.show()
|
||||
|
||||
if self.is_basic_auth(url):
|
||||
print "Basic auth"
|
||||
else:
|
||||
self.auth_view.load_url(url)
|
||||
|
||||
|
||||
def is_basic_auth(self, url):
|
||||
url_opener = urllib.URLopener()
|
||||
|
||||
try:
|
||||
url_opener.open(url)
|
||||
except IOError, error_code:
|
||||
if error_code[0] == "http error" :
|
||||
if error_code[1] == 401:
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def authentication_required(self, reply, authenticator):
|
||||
|
||||
authenticator.setUser("jeena")
|
||||
authenticator.setPassword("")
|
||||
|
||||
def tentia_callback(self, url):
|
||||
script = "tentia_instance.requestAccessToken('" + url.toString() + "');"
|
||||
self.core.page().mainFrame().evaluateJavaScript(script)
|
||||
|
||||
|
|
|
|||
Reference in a new issue