예제 #1
0
파일: utils.py 프로젝트: pdinsky/make-snake
def print_themes(show_default=True, terminate=True):
    # List of default themes
    default_themes = "{{3Default themes}}: "
    for l in DEFAULT_THEMES:
        default_themes += '{{2' + l + "}} | "
    default_themes = default_themes[:-2]
    # List of custom themes
    custom_themes = "{{3Custom themes}}: "
    theme_list = update_theme_list()
    for l in theme_list:
        # Remove .xml extension
        l = os.path.splitext(l)[0]
        custom_themes += '{{2' + l + "}} | "
    custom_themes = custom_themes[:-2]
    # Print info
    # NB 'junk' used here instead of  '_' here to avoid problems with i18n.
    default_themes, junk1, junk2 = run_cmd('colour_echo "%s"' % default_themes)
    custom_themes, junk1, junk2 = run_cmd('colour_echo "%s"' % custom_themes)
    # Print default themes
    print "\n"
    if show_default:
        print "    " + default_themes.strip('\n')
    # Print custom themes
    print "    " + custom_themes.strip('\n') + '\n'
    if terminate:
        exit(2)
예제 #2
0
def print_themes(show_default=True, terminate=True):
    # List of default themes
    default_themes = "{{3Default themes}}: "
    for l in DEFAULT_THEMES:
        default_themes += '{{2' + l + "}} | "
    default_themes = default_themes[:-2]
    # List of custom themes
    custom_themes = "{{3Custom themes}}: "
    theme_list = update_theme_list()
    for l in theme_list:
        # Remove .xml extension
        l = os.path.splitext(l)[0]
        custom_themes += '{{2' + l + "}} | "
    custom_themes = custom_themes[:-2]
    # Print info
    default_themes, _, _ = run_cmd('colour_echo "%s"' % default_themes)
    custom_themes, _, _ = run_cmd('colour_echo "%s"' % custom_themes)
    # Print default themes
    print "\n"
    if show_default:
        print "    " + default_themes.strip('\n')
    # Print custom themes
    print "    " + custom_themes.strip('\n') + '\n'
    if terminate:
        exit(2)
예제 #3
0
def check_valid_theme(theme):
    if theme in DEFAULT_THEMES:
        return
    theme_list = update_theme_list()
    if not theme.endswith('.xml'):
        theme += '.xml'
    if theme not in theme_list:
        coloured_error, _, _ = run_cmd('colour_echo "{{8 x }} {{7 error: }}"')
        print "\n    " + coloured_error.strip('\n') + \
              'Theme %s not found (names are case sensitive)\n' % theme
        exit(2)
예제 #4
0
def check_valid_theme(theme):
    if theme in DEFAULT_THEMES:
        return
    theme_list = update_theme_list()
    if not theme.endswith('.xml'):
        theme += '.xml'
    if theme not in theme_list:
        coloured_error, _, _ = run_cmd('colour_echo "{{8 x }} {{7 error: }}"')
        print "\n    " + coloured_error.strip('\n') + \
              'Theme %s not found (names are case sensitive)\n' % theme
        exit(2)