summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-09-30 15:57:17 +0200
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2011-09-30 15:57:17 +0200
commitaf6f0e882f9d533dcb0271c1afbc7210532363b4 (patch)
treea0e5756077d3c9383a55f7cc2f48f20688b045bd
parentfixed name clash in C# (diff)
downloadpyload-af6f0e882f9d533dcb0271c1afbc7210532363b4.tar.xz
little GUI and API fixes
-rw-r--r--module/Api.py6
-rw-r--r--module/gui/Collector.py8
-rw-r--r--module/gui/connector.py6
-rwxr-xr-xpyLoadGui.py14
4 files changed, 22 insertions, 12 deletions
diff --git a/module/Api.py b/module/Api.py
index f4a252ac9..e3a0dffed 100644
--- a/module/Api.py
+++ b/module/Api.py
@@ -838,8 +838,8 @@ class Api(Iface):
return Destination.Queue if d == "queue" else Destination.Collector
for e in events:
- event = Event()
- event.event = e[0]
+ event = EventInfo()
+ event.eventname = e[0]
if e[0] in ("update", "remove", "insert"):
event.id = e[3]
event.type = ElementType.Package if e[2] == "pack" else ElementType.File
@@ -924,7 +924,7 @@ class Api(Iface):
:param userdata: dictionary of user data
:return: boolean
"""
- if userdata["role"] == ROLE.ADMIN or userdata == "local":
+ if userdata == "local" or userdata["role"] == ROLE.ADMIN:
return True
elif func in permMap and has_permission(userdata["permission"], permMap[func]):
return True
diff --git a/module/gui/Collector.py b/module/gui/Collector.py
index c569785e2..3ec4262f1 100644
--- a/module/gui/Collector.py
+++ b/module/gui/Collector.py
@@ -71,13 +71,13 @@ class CollectorModel(QAbstractItemModel):
called from main loop, pass events to the correct methods
"""
QMutexLocker(self.mutex)
- if event.event == "reload":
+ if event.eventname == "reload":
self.fullReload()
- elif event.event == "remove":
+ elif event.eventname == "remove":
self.removeEvent(event)
- elif event.event == "insert":
+ elif event.eventname == "insert":
self.insertEvent(event)
- elif event.event == "update":
+ elif event.eventname == "update":
self.updateEvent(event)
def fullReload(self):
diff --git a/module/gui/connector.py b/module/gui/connector.py
index 91f23dafb..74d791776 100644
--- a/module/gui/connector.py
+++ b/module/gui/connector.py
@@ -46,6 +46,7 @@ class Connector(QObject):
self.password = None
self.ssl = None
self.running = True
+ self.internal = False
self.proxy = self.Dummy()
def setConnectionData(self, host, port, user, password, ssl=False):
@@ -66,6 +67,8 @@ class Connector(QObject):
connect error signals,
check server version
"""
+ if self.internal: return True
+
err = None
try:
client = ThriftClient(self.host, self.port, self.user, self.password)
@@ -103,6 +106,9 @@ class Connector(QObject):
"""
dummy rpc proxy, to prevent errors
"""
+ def __nonzero__(self):
+ return False
+
def __getattr__(self, attr):
def dummy(*args, **kwargs):
return None
diff --git a/pyLoadGui.py b/pyLoadGui.py
index 44810b9b5..3a5d62e7b 100755
--- a/pyLoadGui.py
+++ b/pyLoadGui.py
@@ -426,10 +426,14 @@ class main(QObject):
config = CoreConfig() #create so at least default config exists
self.core = Core()
self.core.startedInGui = True
- thread.start_new_thread(self.core.start, (True, False))
+ thread.start_new_thread(self.core.start, (False, False))
while not self.core.running:
sleep(0.5)
- self.connector.setConnectionData("127.0.0.1", config.get("remote","port"), "anonymous", "anonymous")
+
+ self.connector.proxy = self.core.api
+ self.connector.internal = True
+
+ #self.connector.setConnectionData("127.0.0.1", config.get("remote","port"), "anonymous", "anonymous")
self.startMain()
# try:
@@ -646,14 +650,14 @@ class main(QObject):
if not events:
return
for event in events:
- if event.event == "account":
+ if event.eventname == "account":
self.mainWindow.emit(SIGNAL("reloadAccounts"), False)
- elif event.event == "config":
+ elif event.eventname == "config":
pass
elif event.destination == Destination.Queue:
self.queue.addEvent(event)
try:
- if event.event == "update" and event.type == ElementType.File:
+ if event.eventname == "update" and event.type == ElementType.File:
info = self.connector.getFileData(event.id)
if info.statusmsg == "finished":
self.emit(SIGNAL("showMessage"), _("Finished downloading of '%s'") % info.name)