fixed (OS X) so you can log in and out without restarting, added Add photo

This commit is contained in:
Jeena Paradies 2012-12-28 02:33:16 +01:00
parent be1d72cd6a
commit e5704ddda7
11 changed files with 133 additions and 50 deletions

View file

@ -14,6 +14,8 @@ class Tentia:
self.preferences = Windows.Preferences(self)
self.preferences.show()
self.oauth_implementation = Windows.Oauth(self)
if self.controller.stringForKey("user_access_token") != "":
self.authentification_succeded()
@ -27,7 +29,7 @@ class Tentia:
def login_with_entity(self, entity):
self.controller.setStringForKey(entity, "entity")
self.oauth_implementation = Windows.Oauth(self)
self.oauth_implementation.login()
def authentification_succeded(self):
self.preferences.hide()

View file

@ -35,7 +35,6 @@ class Preferences:
# text field
self.text_field = QtGui.QLineEdit(self.window)
# self.text_field.setText("http://jeena.net")
self.text_field.setPlaceholderText("https://example.tent.is")
self.text_field.setGeometry(194, 84, 262, 22)
self.window.connect(self.text_field, QtCore.SIGNAL('returnPressed()'), self.on_login_button_clicked)
@ -177,6 +176,10 @@ class Oauth:
script = "function HostAppGo() { start('oauth'); }"
self.core.page().mainFrame().evaluateJavaScript(script)
def login(self):
script = "tentia_instance.authenticate();"
self.core.page().mainFrame().evaluateJavaScript(script)
def handle_authentication(self, url):
self.auth_view = Helper.WebViewCreator(self.app)
self.auth_view.setWindowTitle("Authentication")
@ -207,7 +210,8 @@ class Oauth:
self.core.page().mainFrame().evaluateJavaScript(script)
def hide(self):
self.auth_view.hide()
if hasattr(self, "auth_view"):
self.auth_view.hide()
class Login(QtGui.QDialog):