同步自动更新状态按钮

This commit is contained in:
Xueyi Luo 2022-06-17 10:35:24 +08:00
parent 68a7a8b7cc
commit 1888c1fd63
1 changed files with 12 additions and 6 deletions

View File

@ -482,7 +482,7 @@ class UpdateManagerDbusController(dbus.service.Object):
self.parent.sqlite3_server.insert_into_display("download_limit","true")
self.parent.sqlite3_server.insert_into_display("download_limit_value",str(speed))
#发送信号
self.DownloadSpeedChanged(str(speed))
self.ButtonStatusChange("speed" , str(speed))
return True
except Exception as e:
logging.error(e)
@ -491,11 +491,11 @@ class UpdateManagerDbusController(dbus.service.Object):
if os.path.exists("/etc/apt/apt.conf.d/80apt-download"):
os.remove("/etc/apt/apt.conf.d/80apt-download")
self.parent.sqlite3_server.insert_into_display("download_limit","false")
self.DownloadSpeedChanged("0")
self.ButtonStatusChange("speed", "0")
return True
else:
self.parent.sqlite3_server.insert_into_display("download_limit","false")
self.DownloadSpeedChanged("0")
self.ButtonStatusChange("speed", "0")
return True
# # dbus接口获取apt下载速度
@ -556,11 +556,16 @@ class UpdateManagerDbusController(dbus.service.Object):
try:
if state:
self.parent.uuconfigs.setValue("autoUpgradePolicy", "autoUpgradeState", "on", True)
self.parent.sqlite3_server.insert_into_display("autoupdate_allow", "true")
self.ButtonStatusChange("autoUpgradeStatus", "true")
else :
self.parent.uuconfigs.setValue("autoUpgradePolicy", "autoUpgradeState", "off", True)
# self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadMode", "manual", True)
# self.parent.uuconfigs.setValue("autoUpgradePolicy", "installMode", "manual", True)
self.parent.sqlite3_server.insert_into_display("autoupdate_allow", "false")
self.ButtonStatusChange("autoUpgradeStatus", "false")
self.ChangeUpgradePolicy()
except Exception as e:
logging.error(str(e))
return False
@ -575,6 +580,7 @@ class UpdateManagerDbusController(dbus.service.Object):
self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadMode", "timing", True)
self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadTime", str(time), True)
self.parent.uuconfigs.setValue("autoUpgradePolicy", "installMode", "timing", True)
self.ButtonStatusChange("autoUpgradeTime", str(time))
elif mode == UU_UPGRADE_MODE_BEFORE_SHUTDOWN:
self.parent.uuconfigs.setValue("autoUpgradePolicy", "downloadMode", "timing", True)
self.parent.uuconfigs.setValue("autoUpgradePolicy", "installMode", "bshutdown", True)
@ -877,9 +883,9 @@ class UpdateManagerDbusController(dbus.service.Object):
logging.info(COLORLOG_PREFIX + "Emitting"+ COLORLOG_SUFFIX + " RebootLogoutRequired required_status = %s",required_status)\
#限速修改信号
@dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='s')
def DownloadSpeedChanged(self,limit_value=''):
logging.info(COLORLOG_PREFIX + "Emitting"+ COLORLOG_SUFFIX + " DownloadSpeedChanged limit_value = %s",limit_value)
@dbus.service.signal(UPDATER_DBUS_INTERFACE,signature='ss')
def ButtonStatusChange(self, signal_types = '', value=''):
logging.info(COLORLOG_PREFIX + "Emitting"+ COLORLOG_SUFFIX + " ButtonStatusChange signal_types = %s, value = %s.",signal_types, value)
# dbus 信号:用于发送立即更新信号
@dbus.service.signal(UPDATER_DBUS_INTERFACE)