对词条做出修改,控制面板显示的内容全部由后端提供

This commit is contained in:
wangsong 2022-06-16 21:28:11 +08:00
parent 0eabb53912
commit d74c81534d
4 changed files with 47 additions and 38 deletions

View File

@ -3,6 +3,7 @@
"""enums - Enumerates for apt daemon dbus messages"""
__all__ = (
"ERROR_UPDATE_DEFAULT_FAILED",
"ERROR_UPDATE_SOURCE_FAILED","ERROR_NETWORK_FAILED","ERROR_NOT_GROUPS_CONFIG","ERROR_SOFTWARE_INDEX_RROKEN",
"ERROR_NOT_INIT_PACKAGESINFIO","ERROR_READ_IMPORTANTLIST_FAILED","ERROR_RESOLVER_FAILED","ERROR_NOT_UPGRADE_PACKAGES",
"ERROR_REMOVE_ESSENTIAL_PACKAGES","ERROR_NOT_DISK_SPACE",
@ -19,14 +20,16 @@ _ = gettext.gettext
PRIORITY_UPGRADE_SUCCCESSED = "priority-upgrade-successed"
#更新阶段
ERROR_UPDATE_DEFAULT_FAILED = "error-update-default-failed"
ERROR_UPDATE_KEY_SIGNATURES = "The following signatures"
ERROR_UPDATE_NET_AUTHENTICATION ="does the network require authentication?"
ERROR_UPDATE_NOTREAD_SOURCES = "The list of sources could not be read"
#自己的
ERROR_UPDATE_SOURCE_FAILED = "error-update-source-failed"
ERROR_NETWORK_FAILED = "error-network-failed"
ERROR_NOT_GROUPS_CONFIG = "error-not-groups-config"
#自己的
ERROR_SOFTWARE_INDEX_RROKEN = "error-software-index-broken"
ERROR_NOT_INIT_PACKAGESINFIO = "error-not-init-packagesinfo"
ERROR_READ_IMPORTANTLIST_FAILED = "error-read-importantlist-failed"
@ -37,40 +40,47 @@ ERROR_NOT_DISK_SPACE = "error-not-disk-space"
_STRINGS_ERROR = {
PRIORITY_UPGRADE_SUCCCESSED: _("Update Manager upgrade is complete, please restart the control panel before performing the system update"),
ERROR_UPDATE_SOURCE_FAILED: _("Unable to access the source management server"),
ERROR_NETWORK_FAILED: _("Please check your network connection and retry."),
ERROR_NOT_GROUPS_CONFIG: _("Unable to get group configuration package, please contact administrator to solve"),
ERROR_SOFTWARE_INDEX_RROKEN: _("Software index is broken"),
ERROR_NOT_INIT_PACKAGESINFIO: _("Could not initialize the package information"),
ERROR_READ_IMPORTANTLIST_FAILED: _("read important list failed"),
#update
ERROR_UPDATE_DEFAULT_FAILED: _("Check for update exceptions,please check your network connection and retry."),
ERROR_UPDATE_SOURCE_FAILED: ERROR_UPDATE_DEFAULT_FAILED,
ERROR_NETWORK_FAILED: ERROR_UPDATE_DEFAULT_FAILED,
ERROR_NOT_GROUPS_CONFIG: ERROR_UPDATE_DEFAULT_FAILED,
ERROR_UPDATE_KEY_SIGNATURES: ERROR_UPDATE_DEFAULT_FAILED,
ERROR_READ_IMPORTANTLIST_FAILED: ERROR_UPDATE_DEFAULT_FAILED,
ERROR_SOFTWARE_INDEX_RROKEN: ERROR_UPDATE_DEFAULT_FAILED,
ERROR_NOT_INIT_PACKAGESINFIO: ERROR_UPDATE_DEFAULT_FAILED,
#install
ERROR_RESOLVER_FAILED: _("Could not calculate the upgrade"),
ERROR_NOT_UPGRADE_PACKAGES: _("There is an exception in the update package."),
ERROR_REMOVE_ESSENTIAL_PACKAGES: _("There is an exception in the update package."),
ERROR_NOT_DISK_SPACE: _("Disk space is insufficient, please clean the disk and then upgrade")}
_DESCS_ERROR = {
ERROR_UPDATE_SOURCE_FAILED: _("Check your source management server config"),
#update
ERROR_UPDATE_SOURCE_FAILED: _("Unable to access the source management server"),
ERROR_NETWORK_FAILED: _("Please check your network connection and retry."),
ERROR_NOT_GROUPS_CONFIG: _("groups JSON ConfigPkgs install failed"),
ERROR_UPDATE_KEY_SIGNATURES: _("Check your source public key signature"),
ERROR_UPDATE_NOTREAD_SOURCES: _("Please check your source list and retry."),
ERROR_UPDATE_NET_AUTHENTICATION: _("Check if your network requires authentication?"),
ERROR_NOT_GROUPS_CONFIG: _("Unable to get group configuration package, please contact administrator to solve."),
ERROR_NOT_INIT_PACKAGESINFIO: _("An unresolvable problem occurred while "
"initializing the package information.\n\n"
"Please report this bug against the 'kylin-system-updater' "
"package and include the following error "
"message:\n"),
ERROR_SOFTWARE_INDEX_RROKEN: _("It is impossible to install or remove any software. "
ERROR_SOFTWARE_INDEX_RROKEN: _("Software index is broken") + _("It is impossible to install or remove any software. "
"Please use the package manager \"Synaptic\" or run "
"\"sudo apt-get install -f\" in a terminal to fix "
"this issue at first."),
ERROR_READ_IMPORTANTLIST_FAILED: _("tttttttttttttttttt"),
ERROR_READ_IMPORTANTLIST_FAILED: _("read important list failed"),
#install
ERROR_RESOLVER_FAILED: _("nothing"),
ERROR_NOT_UPGRADE_PACKAGES: _("This update cannot detect the upgradeable package."),
ERROR_REMOVE_ESSENTIAL_PACKAGES: _("You request the removal of a system-essential package."),
ERROR_NOT_DISK_SPACE: _("test"),
ERROR_UPDATE_KEY_SIGNATURES: _("Check your source public key signature"),
ERROR_UPDATE_NET_AUTHENTICATION: _("Check if your network requires authentication?"),
ERROR_UPDATE_NOTREAD_SOURCES: _("Please check your source list and retry.")
ERROR_NOT_DISK_SPACE: _("test")
}
#UPGRADE MONITOR STATUS

View File

@ -66,7 +66,8 @@ class UpdateManagerDbusController(dbus.service.Object):
self.parent.start_update_backend()
def _update_important_error(self,retval):
self.DistUpdateDetectFinished(False,[''],get_error_string_from_enum(ERROR_UPDATE_SOURCE_FAILED),str(retval))
logging.error(str(retval))
self.DistUpdateDetectFinished(False,[''],get_error_string_from_enum(ERROR_UPDATE_SOURCE_FAILED))
#更新important.list的本次升级的列表
def on_update_important_list(self):

View File

@ -500,20 +500,19 @@ class InstallBackend():
def _self_upgrade_finished(self,success,error_string='',error_desc=''):
if success:
error_string = get_error_string_from_enum(PRIORITY_UPGRADE_SUCCCESSED)
if self.window_main.configs.getWithDefault("SystemStatus", "priority_upgrade_restart", False) == True:
error_string = get_error_string_from_enum(PRIORITY_UPGRADE_SUCCCESSED)
if self.window_main.APTD_PKG_NAME in self.now_upgrade.upgrade_content:
self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,error_desc)
self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,'')
self.window_main.dbusController.make_aptdeamon_restart()
#当单包升级的时候 升级本身时,让程序退出,再重新启动
if self.window_main.FRONTEND_PKG_NAME in self.now_upgrade.upgrade_content:
self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,error_desc)
self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,'')
#当单包升级的时候 升级本身时,让程序退出,再重新启动
if self.window_main.BACKEND_PKG_NAME in self.now_upgrade.upgrade_content:
self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,error_desc)
self.window_main.dbusController.DistUpdateDetectFinished(False,[self.window_main.BACKEND_PKG_NAME],error_string,'')
#升级本身完成后 退出 有systemd 来进行重启服务
self.window_main.dbusController.Quit(None)
@ -526,16 +525,9 @@ class InstallBackend():
#只有安装配置文件包 才会走到此处
self.window_main.update_essential.update()
self.window_main.start_available()
return
else:
#当更新过程中安装配置包时 失败时发送错误信号
# 防止错误结果太长导致出现控制面板显示太多 目前最多20字符
if len(error_string + error_desc) > 20:
self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string,error_desc)
else:
self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string,error_desc)
return
default_string = get_error_string_from_enum(ERROR_UPDATE_DEFAULT_FAILED)
self.window_main.dbusController.DistUpdateDetectFinished(success,[],default_string,error_string +' '+error_desc)
#调用aptdeamon结束之后处理的地方 不管是出错还是正常都在此处理
def _action_done(self, action, is_cancelled,success, error_string,error_desc,error_code=''):
@ -660,12 +652,14 @@ class InstallBackend():
#开始生成列表
self.window_main.start_available()
else:
self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string,error_desc)
self.window_main.dbusController.DistUpdateDetectFinished(success,[''],\
get_error_string_from_enum(ERROR_UPDATE_DEFAULT_FAILED),error_string+' '+error_desc)
self.window_main.sqlite3_server.insert_into_display("check_time",get_east_8_time())
elif action == self.ACTION_UPDATE and self.action_mode == self.MODE_UPDATE_CACHE:
self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string,error_desc)
self.window_main.dbusController.DistUpdateDetectFinished(success,[''],\
get_error_string_from_enum(ERROR_UPDATE_DEFAULT_FAILED),error_string+' '+error_desc)
elif action == self.ACTION_FIX_BROKEN:
self.window_main.dbusController.FixBrokenStatusChanged(True,success,100,'',error_string,error_desc)
logging.warning("fix broken packages is complete...")
@ -674,7 +668,8 @@ class InstallBackend():
logging.info("Fix broken packages is complete to success...")
self.window_main.start_available()
else:
self.window_main.dbusController.DistUpdateDetectFinished(success,[],error_string,error_desc)
self.window_main.dbusController.DistUpdateDetectFinished(success,[],\
get_error_string_from_enum(ERROR_UPDATE_DEFAULT_FAILED),error_string+' '+error_desc)
logging.error("fix broken packages is complete to failed...")
elif action == self.ACTION_FIX_INCOMPLETE:

View File

@ -616,8 +616,8 @@ msgid "Checking package manager"
msgstr "正在检查软件包管理器"
#: ../DistUpgrade/DistUpgradeController.py:1593
msgid "Unable to get group configuration package, please contact administrator to solve"
msgstr "无法获取组配置软件包,请联系管理员解决"
msgid "Unable to get group configuration package, please contact administrator to solve."
msgstr "无法获取组配置软件包,请联系管理员解决"
#: ../DistUpgrade/DistUpgradeController.py:1594
msgid ""
@ -2599,7 +2599,7 @@ msgid "Installation failed, about to shut down"
msgstr "安装失败,即将关机"
msgid "groups JSON ConfigPkgs install failed"
msgstr "无法安装分组配置文件,请稍后再试"
msgstr "无法安装分组配置文件"
msgid "Installtion timeout to exit Due to inactivity"
msgstr "安装超时退出由于"
@ -2622,6 +2622,9 @@ msgstr "依赖关系不满足"
msgid "Disk space is insufficient, please clean the disk and then upgrade"
msgstr "磁盘空间不足,请清理磁盘后进行升级更新"
msgid "Check for update exceptions,please check your network connection and retry."
msgstr "检查更新异常,请检查您的网络连接后再试。"
msgid "Please check your network connection and retry."
msgstr "请检查您的网络连接后再试。"