更新提交

This commit is contained in:
wangsong 2021-09-02 09:03:39 +08:00
parent 8dce54cf34
commit 7f86123d3a
5 changed files with 15 additions and 16 deletions

View File

@ -505,8 +505,6 @@ class UpdateList():
except KeyError:
pass
print("")
#支持输出json文件 包含新安装 and 升级 and 移除
# pkgs_json = {"install": self.pkgs_install, "upgrade": self.pkgs_upgrade,"remove": self.pkgs_remove}

View File

@ -126,14 +126,12 @@ class UpdateManager():
#更新结束之后会调到此获取要升级的列表 and 安装完成后也会再重新调此方法更新cache
def start_available(self, cancelled_update=False):
self.refresh_cache()
self.is_updating = False
self.is_upgrading = False
logging.info("update finished ...")
def refresh_cache(self):
_success = True
header = None
desc = None
header = ''
desc = ''
try:
#第一次进入 之后update不进入
if self.cache is None:

View File

@ -98,7 +98,7 @@ class UpdateManagerDbusController(dbus.service.Object):
error_desc 产生的原因
'''
@dbus.service.signal(INTERFACE,signature='ibss')
def on_finished_signal(self,action, success, error_string=None,error_desc=None):
def on_finished_signal(self,action, success, error_string='',error_desc=''):
pass
#更新和升级的进度信息 0~101 进度信息

View File

@ -173,8 +173,8 @@ class InstallBackendAptdaemon(InstallBackend):
transaction.resolve_config_file_conflict(old, "keep")
def _on_finished(self, trans, status, action):
error_string = None
error_desc = None
error_string = ''
error_desc = ''
trans_failed = False
logging.info(status)
@ -204,13 +204,13 @@ class InstallBackendAptdaemon(InstallBackend):
if __name__ == "__main__":
import mock
options = mock.Mock()
data_dir = "/usr/share/update-manager"
# import mock
# options = mock.Mock()
# data_dir = "/usr/share/update-manager"
from UpdateManager.UpdateManager import UpdateManager
app = UpdateManager(data_dir, options)
# from UpdateManager.UpdateManager import UpdateManager
# app = UpdateManager(data_dir, options)
b = InstallBackendAptdaemon(app, None)
b.commit(["2vcard"], [], [])
# b = InstallBackendAptdaemon(app, None)
# b.commit(["2vcard"], [], [])
Gtk.main()

View File

@ -69,8 +69,10 @@ class InstallBackend():
#出现错误和更新升级完成都会调到此方法 进行处理
def _action_done(self, action, authorized, success, error_string,
error_desc, trans_failed=False):
#升级完成后走的分支
if action == self.ACTION_INSTALL:
self.window_main.is_upgrading = False
if success:
self.window_main.start_available()
elif error_string:
@ -78,6 +80,7 @@ class InstallBackend():
else:
pass
else:
self.window_main.is_updating = False
if error_string:
#失败的话直接退出
logging.warning(error_string + error_desc)