예제 #1
0
def change_overclock_value(config, board_name=None):
    board = get_board_props(board_name=board_name)

    if not board:
        logger.error("Could not get overclocking settings for board")
        return

    try:
        values = board.CLOCKING['values'][config]
    except KeyError:
        logger.error(
            "kano-settings: set_overclock: SetOverclock: set_overclock(): " \
            "was called with an invalid overclock setting={}"
            .format(config)
        )
        return

    logger.info(
        u"set_overclock / apply_changes: " \
        "config:{} arm_freq:{arm_freq} " \
        "core_freq:{core_freq} " \
        "sdram_freq:{sdram_freq} " \
        "over_voltage:{over_voltage}"
        .format(config, **values)
    )

    # Apply changes
    for val in values:
        set_config_value(val, values[val])

    # Update config
    set_setting('Overclocking', config)
예제 #2
0
    def __init__(self, win):
        self._board_props = get_board_props()
        self._board_clocking = self._board_props.CLOCKING

        options = []
        for mode in self._board_clocking['modes']:
            options.append([
                mode, "{arm_freq}HZ ARM, "
                "{core_freq}HZ CORE, "
                "{sdram_freq}MHZ SDRAM, "
                "{over_voltage} OVERVOLT".format(
                    **self._board_clocking['values'][mode])
            ])

        RadioButtonTemplate.__init__(
            self, _("Overclock your processor"),
            _("Make your computer's brain think faster, but run hotter."),
            _("APPLY CHANGES"), options)

        self.win = win
        self.win.set_main_widget(self)

        # Show the current setting by electing the appropriate radio button
        self.current_setting()
        self.selected_button = self.initial_button
        self.get_button(self.initial_button).set_active(True)

        self.win.top_bar.enable_prev()
        self.win.change_prev_callback(self.win.go_to_home)

        self.kano_button.connect('button-release-event', self.set_overclock)
        self.kano_button.connect('key-release-event', self.set_overclock)

        self.win.show_all()
예제 #3
0
def change_overclock_value(config, board_name=None):
    board = get_board_props(board_name=board_name)

    if not board:
        logger.error("Could not get overclocking settings for board")
        return

    try:
        values = board.CLOCKING['values'][config]
    except KeyError:
        logger.error(
            "kano-settings: set_overclock: SetOverclock: set_overclock(): " \
            "was called with an invalid overclock setting={}"
            .format(config)
        )
        return

    logger.info(
        u"set_overclock / apply_changes: " \
        "config:{} arm_freq:{arm_freq} " \
        "core_freq:{core_freq} " \
        "sdram_freq:{sdram_freq} " \
        "over_voltage:{over_voltage}"
        .format(config, **values)
    )

    # Apply changes
    for val in values:
        set_config_value(val, values[val])

    # Update config
    set_setting('Overclocking', config)
예제 #4
0
def is_dangerous_overclock_value(config, board_name=None):
    board = get_board_props(board_name=board_name)

    if not board:
        logger.error("Could not get overclocking settings for board")
        return

    return config in board.CLOCKING['warning']
예제 #5
0
def set_default_overclock_values(board_name=None):
    board = get_board_props(board_name=board_name)

    if not board:
        logger.error("Could not get overclocking settings for board")
        return

    change_overclock_value(board.CLOCKING['default'], board_name)
예제 #6
0
def is_dangerous_overclock_value(config, board_name=None):
    board = get_board_props(board_name=board_name)

    if not board:
        logger.error("Could not get overclocking settings for board")
        return

    return config in board.CLOCKING['warning']
예제 #7
0
def set_default_overclock_values(board_name=None):
    board = get_board_props(board_name=board_name)

    if not board:
        logger.error("Could not get overclocking settings for board")
        return

    change_overclock_value(board.CLOCKING['default'], board_name)
예제 #8
0
def match_overclock_value(board_name):
    """ which overlock gui setting matches our current set of values?"""
    curr = {}
    for key in CLOCK_KEYS:
        curr[key] = get_config_value(key)

    board = get_board_props(board_name)

    if not board:
        logger.error("Could not get overclocking settings for board")
        return

    values = board.CLOCKING['values']

    for row in values:
        if values_equal(values[row], curr):
            return row
    return None
예제 #9
0
def match_overclock_value(board_name):
    """ which overlock gui setting matches our current set of values?"""
    curr = {}
    for key in CLOCK_KEYS:
        curr[key] = get_config_value(key)

    board = get_board_props(board_name)

    if not board:
        logger.error("Could not get overclocking settings for board")
        return

    values = board.CLOCKING['values']

    for row in values:
        if values_equal(values[row], curr):
            return row
    return None
예제 #10
0
    def __init__(self, win):
        self._board_props = get_board_props()
        self._board_clocking = self._board_props.CLOCKING

        options = []
        for mode in self._board_clocking['modes']:
            options.append([
                mode,
                "{arm_freq}HZ ARM, "
                "{core_freq}HZ CORE, "
                "{sdram_freq}MHZ SDRAM, "
                "{over_voltage} OVERVOLT"
                .format(**self._board_clocking['values'][mode])
            ])

        RadioButtonTemplate.__init__(
            self,
            _("Overclock your processor"),
            _("Make your computer's brain think faster, but run hotter."),
            _("APPLY CHANGES"),
            options
        )

        self.win = win
        self.win.set_main_widget(self)

        # Show the current setting by electing the appropriate radio button
        self.current_setting()
        self.selected_button = self.initial_button
        self.get_button(self.initial_button).set_active(True)

        self.win.top_bar.enable_prev()
        self.win.change_prev_callback(self.win.go_to_home)

        self.kano_button.connect('button-release-event', self.set_overclock)
        self.kano_button.connect('key-release-event', self.set_overclock)

        self.win.show_all()
예제 #11
0
def get_matching_board_profile():
    curr = {}
    for key in CLOCK_KEYS:
        curr[key] = get_config_value(key)

    def does_board_match(board):
        values = board.CLOCKING['values']

        for oc_setting in values.itervalues():
            if values_equal(oc_setting, curr):
                return True

        return False

    for board_key in BOARD_PROPERTIES.iterkeys():
        board_props = get_board_props(board_key)

        if does_board_match(board_props):
            logger.debug("Matched the board {} with the current settings"
                         .format(board_key))
            return get_board_property(board_key, 'cpu_profile')

    return False
예제 #12
0
def get_matching_board_profile():
    curr = {}
    for key in CLOCK_KEYS:
        curr[key] = get_config_value(key)

    def does_board_match(board):
        values = board.CLOCKING['values']

        for oc_setting in values.itervalues():
            if values_equal(oc_setting, curr):
                return True

        return False

    for board_key in BOARD_PROPERTIES.iterkeys():
        board_props = get_board_props(board_key)

        if does_board_match(board_props):
            logger.debug(
                "Matched the board {} with the current settings".format(
                    board_key))
            return get_board_property(board_key, 'cpu_profile')

    return False
예제 #13
0
    'Keyboard-continent-human': "america",
    'Keyboard-country-human': _("United States"),
    'Keyboard-variant-human': _("Generic"),
    'Audio': _("Analogue"),
    'Wifi': '',
    'Wifi-connection-attempted': False,
    'Mouse': _("Normal"),
    'Font': _("Normal"),
    'Wallpaper': 'kanux-background',
    'Parental-level': 0,
    'Locale': 'en_US',
    'LED-Speaker-anim': True,
    'Use_GLX': False
}

DEFAULTS = merge_dicts(DEFAULT_CONFIG, get_board_props().DEFAULT_CONFIG)


def file_replace(fname, pat, s_after):
    logger.debug("config_file / file_replace {} \"{}\" \"{}\"".format(fname, pat, s_after))
    if not os.path.exists(fname):
        logger.debug("config_file / file_replace file doesn't exists")
        return -1

    # if escape:
        # pat = re.escape(pat)
        # logger.debug('config_file / file_replace replacing pattern, new pattern: "{}"'.format(pat))

    # See if the pattern is even in the file.
    with open(fname) as f:
        if not any(re.search(pat, line) for line in f):
예제 #14
0
    'Keyboard-continent-human': "america",
    'Keyboard-country-human': _("United States"),
    'Keyboard-variant-human': _("Generic"),
    'Audio': _("Analogue"),
    'Wifi': '',
    'Wifi-connection-attempted': False,
    'Mouse': _("Normal"),
    'Font': _("Normal"),
    'Wallpaper': 'kanux-background',
    'Parental-level': 0,
    'Locale': 'en_US',
    'LED-Speaker-anim': True,
    'Use_GLX': False
}

DEFAULTS = merge_dicts(DEFAULT_CONFIG, get_board_props().DEFAULT_CONFIG)


def file_replace(fname, pat, s_after):
    logger.debug("config_file / file_replace {} \"{}\" \"{}\"".format(fname, pat, s_after))
    if not os.path.exists(fname):
        logger.debug("config_file / file_replace file doesn't exists")
        return -1

    # if escape:
        # pat = re.escape(pat)
        # logger.debug('config_file / file_replace replacing pattern, new pattern: "{}"'.format(pat))

    # See if the pattern is even in the file.
    with open(fname) as f:
        if not any(re.search(pat, line) for line in f):