diff --git a/backend/SystemUpdater/UpdateManagerDbus.py b/backend/SystemUpdater/UpdateManagerDbus.py index a1b6da0..17e780f 100755 --- a/backend/SystemUpdater/UpdateManagerDbus.py +++ b/backend/SystemUpdater/UpdateManagerDbus.py @@ -204,16 +204,25 @@ class UpdateManagerDbusController(dbus.service.Object): logging.error(False, str(e)) return (False, str(e)) - # 操作数据库的接口 - @dbus.service.method(UPDATER_DBUS_INTERFACE, out_signature='b') - def DataBaseOpt(self, action='check',table='', cid=19): - if action == 'check': - try: - self.parent.sqlite3_server.find_msg_from_datebase(action, table, cid) - except Exception as e: - logging.error(str(e)) - return False - return True + # # 操作数据库的接口 + # @dbus.service.method(UPDATER_DBUS_INTERFACE, out_signature='b') + # def DataBaseOpt(self, action='check',table='', cid=19): + # if action == 'check': + # try: + # self.parent.sqlite3_server.find_msg_from_datebase(action, table, cid) + # except Exception as e: + # logging.error(str(e)) + # return False + # return True + + # dbus接口:向数据库display表中插入数据 + @dbus.service.method(UPDATER_DBUS_INTERFACE, in_signature='ss', sender_keyword='sender') + def insert_install_state(self, item, value, sender=None): + try: + self.parent.sqlite3_server.insert_into_display(item, value) + logging.info("Database inserted successfully,options:%s,value:%s" % (item, value)) + except Exception as e: + logging.error("Database insert failed,options:%s,value:%s" % (item, value)) # # download certain package and its dependencies @dbus.service.method(UPDATER_DBUS_INTERFACE, in_signature='asi', out_signature='b') @@ -254,7 +263,7 @@ class UpdateManagerDbusController(dbus.service.Object): try: f = open("/etc/apt/apt.conf.d/80apt-download", "r") value = f.readline().split() - return True, int(value[1][1:-2]) + return True, str(value[1][1:-2]) except: return False, 0