增加插入display表的接口

This commit is contained in:
luoxueyi 2021-10-30 17:52:53 +08:00
parent e8afc67969
commit b86c85752f
1 changed files with 20 additions and 11 deletions

View File

@ -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 successfullyoptions%svalue%s" % (item, value))
except Exception as e:
logging.error("Database insert failedoptions%svalue%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