add cancelable status

This commit is contained in:
luoxueyi 2021-09-14 15:22:32 +08:00
parent 372d639a07
commit bdb5918f08
1 changed files with 7 additions and 3 deletions

View File

@ -112,12 +112,16 @@ class UpdateManagerDbusController(dbus.service.Object):
# 取消transaction
@dbus.service.method(INTERFACE, out_signature='bs')
def CancelDownload(self):
status = False
message = ""
try:
if self.transaction.cancellable == True:
self.transaction.cancel()
status = True
message = "success"
except Exception as e:
return (False,str(e))
return (True,"success")
return (status,str(e))
return (status, message)
#更新进度信息 0~100 进度信息 101为非预期的信号
@dbus.service.signal(INTERFACE,signature='is')
@ -142,7 +146,7 @@ class UpdateManagerDbusController(dbus.service.Object):
success,upgrade_group, error_string,error_desc)
#发送下载包信息
@dbus.service.signal(INTERFACE, signature='iiiiii')
@dbus.service.signal(INTERFACE, signature='iiiii')
def UpdateDownloadInfo(self, current_items, total_items, currenty_bytes, total_bytes, current_cps):
logging.info("current_items = %d, total_items = %d, currenty_bytes = %d, total_bytes = %d, current_cps = %d .",\
current_items, total_items, \