env.ini[update]packages -> updates

master3.3
Mike Khiretskiy 10 years ago
parent d2568ecf85
commit 1d26be07e2

@ -29,6 +29,7 @@ from calculate.lib.utils.colortext.palette import TextState
from calculate.lib.utils.colortext import get_color_print from calculate.lib.utils.colortext import get_color_print
from calculate.update.emerge_parser import RevdepPercentBlock from calculate.update.emerge_parser import RevdepPercentBlock
from calculate.update.datavars import DataVarsUpdate from calculate.update.datavars import DataVarsUpdate
from calculate.update.update_info import UpdateInfo
import re import re
from collections import MutableSet from collections import MutableSet
@ -743,8 +744,7 @@ class Update:
""" """
Установить флаг: есть обновления Установить флаг: есть обновления
""" """
val = "on" if val else "off" UpdateInfo.set_update_ready(val)
SystemIni().setVar('update', {'packages': val})
return True return True
def _emerge_translate(self, s): def _emerge_translate(self, s):

@ -26,6 +26,8 @@ class UpdateInfo(object):
""" """
Информационный объект о процессе обновления Информационный объект о процессе обновления
""" """
section = "update"
varname = "updates"
def __init__(self, dv=None): def __init__(self, dv=None):
if dv is None: if dv is None:
@ -37,11 +39,16 @@ class UpdateInfo(object):
def need_update(self): def need_update(self):
return self.update_ready() or self.check_for_dispatch() return self.update_ready() or self.check_for_dispatch()
def update_ready(self): @classmethod
def update_ready(cls):
""" """
Проверить есть ли обновления по ini.env Проверить есть ли обновления по ini.env
""" """
return SystemIni().getVar('update', 'packages') == u'on' return SystemIni().getVar(cls.section, cls.varname) == u'on'
def set_update_ready(self, value):
SystemIni().setVar(self.section,
{self.varname:"on" if value else "off"})
def check_for_dispatch(self): def check_for_dispatch(self):
""" """

Loading…
Cancel
Save