X-Git-Url: http://git.ipfire.org/?p=collecty.git;a=blobdiff_plain;f=src%2Fcollecty%2Fbus.py;h=fe22fea157da491bd618f2256c4c80247321be9c;hp=d67332f082742f3d2a58b31b5b67c403a944171f;hb=a386481247af3ce6f554162a4c3632afe2513b89;hpb=f37913e898441be3b86180daf329cb40f362f2f3 diff --git a/src/collecty/bus.py b/src/collecty/bus.py index d67332f..fe22fea 100644 --- a/src/collecty/bus.py +++ b/src/collecty/bus.py @@ -78,14 +78,25 @@ class GraphGenerator(dbus.service.Object): self.collecty = collecty - @dbus.service.method(BUS_DOMAIN, in_signature="sa{sv}", out_signature="ay") + @dbus.service.method(BUS_DOMAIN, in_signature="sa{sv}", out_signature="a{sv}") def GenerateGraph(self, template_name, kwargs): """ Returns a graph generated from the given template and object. """ graph = self.collecty.generate_graph(template_name, **kwargs) - return dbus.ByteArray(graph or []) + # Convert the graph back to normal Python format + if graph: + graph["image"] = dbus.ByteArray(graph["image"] or []) + + return graph + + @dbus.service.method(BUS_DOMAIN, in_signature="", out_signature="a{sv}") + def GraphInfo(self, template_name, kwargs): + """ + Returns a dictionary with information about the graph. + """ + return self.collecty.graph_info(template_name, **kwargs) @dbus.service.method(BUS_DOMAIN, in_signature="", out_signature="as") def ListTemplates(self): @@ -93,3 +104,7 @@ class GraphGenerator(dbus.service.Object): Returns a list of all available templates """ return [t.name for t in self.collecty.templates] + + @dbus.service.method(BUS_DOMAIN, in_signature="", out_signature="s") + def Version(self): + return COLLECTY_VERSION