完善增加卸载相关的信号
This commit is contained in:
parent
f1a2bf3469
commit
72a94119d0
|
@ -245,19 +245,20 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
return False,e
|
||||
|
||||
#卸载包
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='as',out_signature='bs')
|
||||
@dbus.service.method(UPDATER_DBUS_INTERFACE,in_signature='as',out_signature='b')
|
||||
def PurgePackages(self,_purge_list):
|
||||
try:
|
||||
purge_list = [str(pkg) for pkg in _purge_list]
|
||||
|
||||
#处于更新和升级中的话 不进行升级
|
||||
# 处于更新和升级中的话 不进行升级
|
||||
if self.parent.is_working != InstallBackend.ACTION_DEFUALT_STATUS:
|
||||
self.PurgePackagesFinished(False,_("Other tasks are being updated and upgraded, please uninstall them later."),_(""))
|
||||
logging.warning('PurgePackages In the process of updating or Upgrading...')
|
||||
return False,'In the process of updating or Upgrading...'
|
||||
return False
|
||||
else:
|
||||
logging.info(COLORMETHOR_PREFIX+'method'+COLORLOG_SUFFIX+' DistPurgePackages and purge list is:%s...',purge_list)
|
||||
self.parent.start_purge_pkgs(purge_list)
|
||||
return True,'success'
|
||||
return True
|
||||
except Exception as e:
|
||||
return False,str(e)
|
||||
|
||||
|
@ -473,3 +474,15 @@ class UpdateManagerDbusController(dbus.service.Object):
|
|||
def FixBrokenStatusChanged(self,finished,success,progress,status,error_string='',error_desc=''):
|
||||
logging.info(COLORLOG_PREFIX+"emit"+COLORLOG_SUFFIX+" FixBrokenStatusChanged finished = %r , success = %r,progress = %d , status = %s,error_string = %s , error_desc = %s",\
|
||||
finished,success,progress,status,error_string,error_desc)
|
||||
|
||||
#卸载完成的信号
|
||||
@dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='bss')
|
||||
def PurgePackagesFinished(self, success,error_string='',error_desc=''):
|
||||
logging.info(COLORLOG_PREFIX + "emit"+ COLORLOG_SUFFIX + " PurgePackagesFinished success = %r , error_string = %s , error_desc = %s ",\
|
||||
success,error_string,error_desc)
|
||||
|
||||
#卸载进度信息 0~100 进度信息 101为非预期的信号
|
||||
@dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='iss')
|
||||
def PurgePkgStatusChanged(self,progress,status,current_details):
|
||||
logging.info(COLORLOG_PREFIX + "emit" + COLORLOG_SUFFIX +" PurgePkgStatusChanged progress = %d , status = %s ,current_details = %s",\
|
||||
progress,status,current_details)
|
||||
|
|
|
@ -289,6 +289,8 @@ class InstallBackendAptdaemon(InstallBackend):
|
|||
self.window_main.dbusController.UpdateDloadAndInstStaChanged(upgrade_content,progress,status,details)
|
||||
elif action == self.ACTION_FIX_BROKEN:
|
||||
self.window_main.dbusController.FixBrokenStatusChanged(False,True,progress,status,'','')
|
||||
elif action == self.ACTION_REMOVE_PACKAGES:
|
||||
self.window_main.dbusController.PurgePkgStatusChanged(progress,status,details)
|
||||
else:
|
||||
logging.info("Other Action:progress = %d , status = %s ,details = %s",progress,status,details)
|
||||
|
||||
|
@ -307,7 +309,7 @@ class InstallBackendAptdaemon(InstallBackend):
|
|||
currenty_bytes, total_bytes, \
|
||||
current_cps)
|
||||
else:
|
||||
if self.action == self.ACTION_UPDATE:
|
||||
if self.action == self.ACTION_UPDATE or self.action == self.ACTION_REMOVE_PACKAGES:
|
||||
return
|
||||
logging.info("Other Action:current_items = %d, total_items = %d, currenty_bytes = %s, total_bytes = %s, current_cps = %s/s",\
|
||||
current_items, total_items, \
|
||||
|
@ -315,6 +317,9 @@ class InstallBackendAptdaemon(InstallBackend):
|
|||
humanize_size(current_cps))
|
||||
|
||||
def _on_cancellable_changed(self, trans, Cancelable):
|
||||
if self.action == self.ACTION_REMOVE_PACKAGES:
|
||||
return
|
||||
|
||||
logging.info("\033[43;1m" + "emit" + "\033[0m" +" Cancelable: %r",Cancelable)
|
||||
self.window_main.dbusController.Cancelable(Cancelable)
|
||||
#增加取消信号的频发机制
|
||||
|
@ -357,8 +362,10 @@ class InstallBackendAptdaemon(InstallBackend):
|
|||
elif status == EXIT_CANCELLED:
|
||||
error_string = _("Failed to fetch")
|
||||
error_desc = _("_Cancel Upgrade")
|
||||
elif status == EXIT_SUCCESS:
|
||||
elif status == EXIT_SUCCESS and action == self.ACTION_INSTALL:
|
||||
error_string = _("System upgrade is complete.")
|
||||
elif status == EXIT_SUCCESS and action == self.ACTION_REMOVE_PACKAGES:
|
||||
error_string = _("Uninstallation completed")
|
||||
|
||||
is_success = (status == EXIT_SUCCESS)
|
||||
try:
|
||||
|
|
|
@ -432,9 +432,8 @@ class InstallBackend():
|
|||
else:
|
||||
logging.warning("fix incomplete install failed.")
|
||||
|
||||
elif action == self.ACTION_INSTALL_DEB:
|
||||
pass
|
||||
# unLockedEnableShutdown()
|
||||
elif action == self.ACTION_REMOVE_PACKAGES:
|
||||
self.window_main.dbusController.PurgePackagesFinished(success,error_string,error_desc)
|
||||
|
||||
def _make_insert_info(self,success,is_cancelled,upgrade_mode,error_string,error_desc):
|
||||
try:
|
||||
|
|
|
@ -2595,6 +2595,12 @@ msgstr "更新源摸板中"
|
|||
msgid "Update Manager upgrade is complete, please restart the control panel before performing the system update"
|
||||
msgstr "更新管理器升级完成,请重启控制面板后再进行系统更新"
|
||||
|
||||
msgid "Uninstallation completed"
|
||||
msgstr "卸载完成。"
|
||||
|
||||
msgid "Other tasks are being updated and upgraded, please uninstall them later."
|
||||
msgstr "其他任务正在更新升级中,请稍后再卸载。"
|
||||
|
||||
#: ../aptdaemon/worker/aptworker.py:1353
|
||||
msgid "The following packages have unmet dependencies:"
|
||||
msgstr "下列软件包未满足的依赖关系:"
|
||||
|
|
Loading…
Reference in New Issue