Пример #1
0
def macos_option_as_alt(x: str) -> int:
    x = x.lower()
    if x == 'both':
        return 0b11
    if x == 'left':
        return 0b10
    if x == 'right':
        return 0b01
    if to_bool(x):
        return 0b11
    return 0
Пример #2
0
def deprecated_hide_window_decorations_aliases(key: str, val: str,
                                               ans: Dict[str, Any]) -> None:
    if not hasattr(deprecated_hide_window_decorations_aliases, key):
        setattr(deprecated_hide_window_decorations_aliases, key, True)
        log_error(
            f'The option {key} is deprecated. Use hide_window_decorations instead.'
        )
    if to_bool(val):
        if is_macos and key == 'macos_hide_titlebar' or (
                not is_macos and key == 'x11_hide_window_decorations'):
            ans['hide_window_decorations'] = True
Пример #3
0
 def __init__(self, data: Dict[str, str]):
     try:
         self.full_size = int(data.get('full_size', 1))
     except Exception:
         self.full_size = 1
     self.full_size = fs = max(1, min(self.full_size, 100))
     try:
         b = int(data.get('bias', 50)) / 100
     except Exception:
         b = 0.5
     b = max(0.1, min(b, 0.9))
     self.bias = tuple(repeat(b / fs, fs)) + (1.0 - b, )
     self.mirrored = to_bool(data.get('mirrored', 'false'))
Пример #4
0
def deprecated_macos_show_window_title_in_menubar_alias(key: str, val: str, ans: Dict[str, Any]) -> None:
    if not hasattr(deprecated_macos_show_window_title_in_menubar_alias, key):
        setattr(deprecated_macos_show_window_title_in_menubar_alias, 'key', True)
        log_error(f'The option {key} is deprecated. Use macos_show_window_title_in menubar instead.')
    macos_show_window_title_in = ans.get('macos_show_window_title_in', 'all')
    if to_bool(val):
        if macos_show_window_title_in == 'none':
            macos_show_window_title_in = 'menubar'
        elif macos_show_window_title_in == 'window':
            macos_show_window_title_in = 'all'
    else:
        if macos_show_window_title_in == 'all':
            macos_show_window_title_in = 'window'
        elif macos_show_window_title_in == 'menubar':
            macos_show_window_title_in = 'none'
    ans['macos_show_window_title_in'] = macos_show_window_title_in
Пример #5
0
def clear_all_shortcuts(val: str, dict_with_parse_results: Optional[Dict[str, Any]] = None) -> bool:
    ans = to_bool(val)
    if ans and dict_with_parse_results is not None:
        dict_with_parse_results['map'] = [None]
    return ans
Пример #6
0
def allow_hyperlinks(x: str) -> int:
    if x == 'ask':
        return 0b11
    return 1 if to_bool(x) else 0
Пример #7
0
def allow_remote_control(x: str) -> str:
    if x != 'socket-only':
        x = 'y' if to_bool(x) else 'n'
    return x
Пример #8
0
def hide_window_decorations(x: str) -> int:
    if x == 'titlebar-only':
        return 0b10
    if to_bool(x):
        return 0b01
    return 0b00
Пример #9
0
 def share_connections(self, val: str,
                       ans: typing.Dict[str, typing.Any]) -> None:
     ans['share_connections'] = to_bool(val)