fixed auth window, connected to a webview

This commit is contained in:
Jeena Paradies 2012-11-14 03:19:29 +01:00
parent 7e358e4950
commit ced63f7ce9
5 changed files with 87 additions and 125 deletions

View file

@ -1,4 +1,5 @@
#!/usr/bin/env python
import os
import sys
from PyQt4 import QtCore, QtGui
import TentiaWindows
@ -7,7 +8,8 @@ class Tentia:
def __init__(self):
self.app = QtGui.QApplication(sys.argv)
self.controller = Controller(self)
self.controller = Controller()
self.console = Console()
self.setup_windows()
self.preferences.show()
@ -24,6 +26,10 @@ class Tentia:
def resources_path(self):
return "../"
def resources_uri(self):
return "file://localhost" + os.path.abspath(os.path.join(os.path.dirname(__file__), '..', "WebKit"))
def login_with_entity(self, entity):
self.controller.setStringForKey("entity", entity)
self.oauth_implementation = TentiaWindows.OauthImplementation(self)
@ -32,17 +38,33 @@ class Tentia:
return self.controller;
class Controller:
class Controller(QtCore.QObject):
def __init__(self, app):
self.app = app
self.user_defaults = {}
user_defaults = {}
@QtCore.pyqtSlot(str, str)
def setStringForKey(self, string, key):
self.user_defaults[string] = key
def getStringForKey(self, key):
return self.user_defaults[key]
def stringForKey(self, key):
if key in self.user_defaults:
return self.user_defaults[key]
class Console(QtCore.QObject):
@QtCore.pyqtSlot(str)
def log(self, string):
print "<js>: " + string
@QtCore.pyqtSlot(str)
def warn(self, string):
print "<js WARN>: " + string
@QtCore.pyqtSlot(str)
def error(self, string):
print "<js ERROR>: " + string
if __name__ == "__main__":
Tentia()