Merge branch 'master' of ssh://172.17.66.163:10022/wangsong/kylin-update-manager_dist

This commit is contained in:
wangsong 2021-09-14 16:18:08 +08:00
commit a3da668f71
2 changed files with 14 additions and 7 deletions

View File

@ -112,12 +112,18 @@ 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"
elif self.transaction == None or self.transaction.cancellable == False:
message = "Can not Cancel"
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,12 +148,12 @@ class UpdateManagerDbusController(dbus.service.Object):
success,upgrade_group, error_string,error_desc)
#发送下载包信息
@dbus.service.signal(INTERFACE, signature='iiiiii')
def UpdateDownloadInfo(self, current_items, total_items, currenty_bytes, total_bytes, current_cps, eta):
logging.info("current_items = %d, total_items = %d, currenty_bytes = %d, total_bytes = %d, current_cps = %d, eta = %d .",\
@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, \
currenty_bytes, total_bytes,\
current_cps, eta)
current_cps)
# 信号是否可取消
@dbus.service.signal(INTERFACE, signature='b')

View File

@ -99,12 +99,13 @@ class InstallBackendAptdaemon(InstallBackend):
def _on_download_changed(self, trans, details):
logging.info(details)
# eta 下载速度不正确,取消掉
def _on_progress_download_changed(self,trans,current_items, total_items, currenty_bytes, total_bytes, current_cps, eta):
if self.action == self.ACTION_INSTALL:
self.window_main.dbusController.UpdateDownloadInfo(\
current_items, total_items, \
currenty_bytes, total_bytes, \
current_cps, eta)
current_cps)
def _on_cancellable_changed(self, trans, Cancelable):
self.window_main.dbusController.Cancelable(Cancelable)