def exportshow_done(self, call): reply = QtDBus.QDBusPendingReply(call) if reply.isError(): self.show_status.emit(False, "DBUS error:" + str(reply.error().message())) else: ts = (reply.argumentAt(0).toPyObject()[0].toULongLong()[0], reply.argumentAt(0).toPyObject()[1].toULongLong()[0]) exports = [] for export in reply.argumentAt(1).toPyObject(): ex = export.toPyObject() lasttime = ex[9].toPyObject() exp = Export(ExportID=ex[0].toInt()[0], ExportPath=str(ex[1].toString()), HasNFSv3=ex[2].toBool(), HasMNT=ex[3].toBool(), HasNLM4=ex[4].toBool(), HasRQUOTA=ex[5].toBool(), HasNFSv40=ex[6].toBool(), HasNFSv41=ex[7].toBool(), Has9P=ex[8].toBool(), LastTime=(lasttime[0].toPyObject(), lasttime[1].toPyObject())) exports.append(exp) self.show_exports.emit(ts, exports)
def exportrm_done(self, call): reply = QtDBus.QDBusPendingReply(call) if reply.isError(): self.show_status.emit(False, "Error:" + str(reply.error().message())) else: self.show_status.emit(True, "Done")
def clientshow_done(self, call): reply = QtDBus.QDBusPendingReply(call) if reply.isError(): self.show_status.emit(False, "DBUS error:" + str(reply.error().message())) else: ts = (reply.argumentAt(0).toPyObject()[0].toULongLong()[0], reply.argumentAt(0).toPyObject()[1].toULongLong()[0]) interval_nsecs = ts[0] * 1000000000L + ts[1] clients = [] for client in reply.argumentAt(1).toPyObject(): cl = client.toPyObject() lasttime = cl[8].toPyObject() clt = Client(ClientIP=str(cl[0].toString()), HasNFSv3=cl[1].toBool(), HasMNT=cl[2].toBool(), HasNLM4=cl[3].toBool(), HasRQUOTA=cl[4].toBool(), HasNFSv40=cl[5].toBool(), HasNFSv41=cl[6].toBool(), Has9P=cl[7].toBool(), LastTime=(lasttime[0].toPyObject(), lasttime[1].toPyObject())) clients.append(clt) self.show_clients.emit(ts, clients)
def Get_done(self, call): reply = QtDBus.QDBusPendingReply(call) if reply.isError(): self.show_status.emit(False, "DBUS error:" + str(reply.error().message())) else: level = str(reply.value().toPyObject().toString()) self.show_level.emit(level)
def exportadd_done(self, call): reply = QtDBus.QDBusPendingReply(call) if reply.isError(): self.show_status.emit(False, "Error:" + str(reply.error().message())) else: message = reply.argumentAt(0).toPyObject() self.show_status.emit(True, "Done: " + message)
def admin_done(self, call): reply = QtDBus.QDBusPendingReply(call) if reply.isError(): self.show_status.emit(False, "DBUS error:" + str(reply.error().message())) else: status = reply.argumentAt(0).toPyObject() msg = reply.argumentAt(1).toPyObject() self.show_status.emit(status, msg)
def exportdisplay_done(self, call): reply = QtDBus.QDBusPendingReply(call) if reply.isError(): self.show_status.emit(False, "Error:" + str(reply.error().message())) else: id = reply.argumentAt(0).toPyObject() fullpath = reply.argumentAt(1).toPyObject() pseudopath = reply.argumentAt(2).toPyObject() tag = reply.argumentAt(3).toPyObject() self.display_export.emit(id, fullpath, pseudopath, tag)
def GetAll_done(self, call): reply = QtDBus.QDBusPendingReply(call) if reply.isError(): self.show_status.emit(False, "DBus error:" + str(reply.error().message())) else: # what follows is DBus+Qt magic. We get a Variant object back # which contains a "map", aka "dict" in python. Each item in # the map has a variant as a key and a variant as the value # first unwrap the top variant into d... # then walk d, unwrap the variant key to store the unwrapped # variant value into a string value. prop_dict = {} d = reply.value().toPyObject() for key in d.keys(): prop_dict[str(key.toString())] = str(d[key].toPyObject().toString()) self.show_components.emit(prop_dict)