<commit_before>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint:disable=unused-wildcard-import,wildcard-import,invalid-name,attribute-defined-outside-init
"""Advanced tab for the TKinter GUI."""
from __future__ import print_function, unicode_literals, absolute_import

from . import controls, binding
from .layout import GridLayouter
from .tab import Tab
import sys

from core import launcher, legends_processor
from core.lnp import lnp

if sys.version_info[0] == 3:  # Alternate import names
    # pylint:disable=import-error
    from tkinter import *
    from tkinter.ttk import *
    import tkinter.messagebox as messagebox
else:
    # pylint:disable=import-error
    from Tkinter import *
    from ttk import *
    import tkMessageBox as messagebox

#pylint: disable=too-many-public-methods
class AdvancedTab(Tab):
    """Advanced tab for the TKinter GUI."""
    def create_variables(self):
        self.volume_var = StringVar()
        self.fps_var = StringVar()
        self.gps_var = StringVar()
        self.winX_var = StringVar()
        self.winY_var = StringVar()
        self.fullX_var = StringVar()
        self.fullY_var = StringVar()

    def create_controls(self):
        Grid.columnconfigure(self, 0, weight=1)
        Grid.columnconfigure(self, 1, weight=1)

        main_grid = GridLayouter(2, pad=(4, 0))

        if lnp.settings.version_has_option('sound'):
            sound = controls.create_control_group(self, 'Sound')
            main_grid.add(sound)

            controls.create_option_button(
                sound, 'Sound', 'Turn game music on/off', 'sound').pack(
                    side=LEFT, fill=X, expand=Y)
            if lnp.settings.version_has_option('volume'):
                controls.create_numeric_entry(
                    sound, self.volume_var, 'volume',
                    'Music volume (0 to 255)').pack(side=LEFT, padx=(6, 0))
                Label(sound, text='/255').pack(side=LEFT)
        if lnp.settings.version_has_option('fpsCounter'):
            fps = controls.create_control_group(self, 'FPS')
            main_grid.add(fps, rowspan=2)

            controls.create_option_button(
                fps, 'FPS Counter', 'Whether or not to display your FPS',
                'fpsCounter').pack(fill=BOTH)
            if lnp.settings.version_has_option('fpsCap'):
                Label(fps, text='Calculation FPS Cap:').pack(anchor="w")
                controls.create_numeric_entry(
                    fps, self.fps_var, 'fpsCap', 'How fast the game runs').pack(
                        anchor="w")
            if lnp.settings.version_has_option('gpsCap'):
                Label(fps, text='Graphical FPS Cap:').pack(anchor="w")
                controls.create_numeric_entry(
                    fps, self.gps_var, 'gpsCap', 'How fast the game visually '
                    'updates.\nLower value may give small boost to FPS but '
                    'will be less reponsive.').pack(anchor="w")

        if lnp.settings.version_has_option('introMovie'):
            startup = controls.create_control_group(self, 'Startup')
            main_grid.add(startup)
            Grid.columnconfigure(startup, 0, weight=1)

            controls.create_option_button(
                startup, 'Intro Movie',
                'Do you want to see the beautiful ASCII intro movie?',
                'introMovie').grid(column=0, row=0, sticky="nsew")
            controls.create_option_button(
                startup, 'Windowed', 'Start windowed or fullscreen',
                'startWindowed').grid(column=0, row=1, sticky="nsew")

        resolution = controls.create_control_group(self, 'Resolution')
        main_grid.add(resolution, 2)
        resolution['pad'] = (4, 0, 4, 8)
        resolution.columnconfigure(5, weight=10)
        resolution.columnconfigure(0, weight=10)
        resolution.rowconfigure(2, minsize=3)

        Label(resolution, text='Windowed').grid(row=1, column=4, sticky='w')
        Label(resolution, text='Fullscreen').grid(row=3, column=4, sticky='w')
        Label(resolution, text='Width').grid(row=0, column=1)
        Label(resolution, text='Height').grid(row=0, column=3)
        Label(resolution, text='x').grid(row=1, column=2)
        Label(resolution, text='x').grid(row=3, column=2)
        controls.create_numeric_entry(
            resolution, self.winX_var, ('WINDOWEDX', 'GRAPHICS_WINDOWEDX'),<commit_msg>Improve FPS Cap display/entry.<commit_after>#!/usr/bin/env python
# -*- coding: utf-8 -*-
# pylint:disable=unused-wildcard-import,wildcard-import,invalid-name,attribute-defined-outside-init
"""Advanced tab for the TKinter GUI."""
from __future__ import print_function, unicode_literals, absolute_import

from . import controls, binding
from .layout import GridLayouter
from .tab import Tab
import sys

from core import launcher, legends_processor
from core.lnp import lnp

if sys.version_info[0] == 3:  # Alternate import names
    # pylint:disable=import-error
    from tkinter import *
    from tkinter.ttk import *
    import tkinter.messagebox as messagebox
else:
    # pylint:disable=import-error
    from Tkinter import *
    from ttk import *
    import tkMessageBox as messagebox

#pylint: disable=too-many-public-methods
class AdvancedTab(Tab):
    """Advanced tab for the TKinter GUI."""
    def create_variables(self):
        self.volume_var = StringVar()
        self.fps_var = StringVar()
        self.gps_var = StringVar()
        self.winX_var = StringVar()
        self.winY_var = StringVar()
        self.fullX_var = StringVar()
        self.fullY_var = StringVar()

    def create_controls(self):
        Grid.columnconfigure(self, 0, weight=1)
        Grid.columnconfigure(self, 1, weight=1)

        main_grid = GridLayouter(2, pad=(4, 0))

        if lnp.settings.version_has_option('sound'):
            sound = controls.create_control_group(self, 'Sound')
            main_grid.add(sound)

            controls.create_option_button(
                sound, 'Sound', 'Turn game music on/off', 'sound').pack(
                    side=LEFT, fill=X, expand=Y)
            if lnp.settings.version_has_option('volume'):
                controls.create_numeric_entry(
                    sound, self.volume_var, 'volume',
                    'Music volume (0 to 255)').pack(side=LEFT, padx=(6, 0))
                Label(sound, text='/255').pack(side=LEFT)
        if lnp.settings.version_has_option('fpsCounter'):
            fps = controls.create_control_group(self, 'FPS')
            main_grid.add(fps, rowspan=2)

            controls.create_option_button(
                fps, 'FPS Counter', 'Whether or not to display your FPS',
                'fpsCounter').pack(fill=BOTH)

            caps = controls.create_control_group(fps, 'FPS Caps')
            caps.rowconfigure((1, 2), weight=1)
            caps.columnconfigure((1, 3), weight=1)
            if lnp.settings.version_has_option('fpsCap'):
                Label(caps, text='Calculation ').grid(
                    row=1, column=1, sticky='e')
                controls.create_numeric_entry(
                    caps, self.fps_var, 'fpsCap',
                    'How fast the game runs').grid(
                        row=1, column=2)
                Label(caps, text='FPS').grid(row=1, column=3, sticky='w')
            if lnp.settings.version_has_option('gpsCap'):
                Label(caps, text='Graphical ').grid(row=2, column=1, sticky='e')
                controls.create_numeric_entry(
                    caps, self.gps_var, 'gpsCap', 'How fast the game visually '
                    'updates.\nLower value may give small boost to FPS but '
                    'will be less reponsive.').grid(
                        row=2, column=2, pady=(3, 0))
                Label(caps, text='FPS').grid(row=2, column=3, sticky='w')
            if caps.children:
                caps.pack(fill=BOTH, expand=Y)

        if lnp.settings.version_has_option('introMovie'):
            startup = controls.create_control_group(self, 'Startup')
            main_grid.add(startup)
            Grid.columnconfigure(startup, 0, weight=1)

            controls.create_option_button(
                startup, 'Intro Movie',
                'Do you want to see the beautiful ASCII intro movie?',
                'introMovie').grid(column=0, row=0, sticky="nsew")
            controls.create_option_button(
                startup, 'Windowed', 'Start windowed or fullscreen',
                'startWindowed').grid(column=0, row=1, sticky="nsew")

        resolution = controls.create_control_group(self, 'Resolution')
        main_grid.add(resolution, 2)
        resolution['pad'] = (4, 0, 4, 8)
        resolution.columnconfigure(5, weight=10)
        resolution.columnconfigure(0, weight=10)
        resolution.rowconfigure(2, minsize=3)

        Label(resolution, text='Windowed').grid(row=1, column=4, sticky='w')
        Label(resolution, text='Fullscreen').grid(row=3, column=4, sticky='w')
        Label(resolution, text='Width').grid(row=0, column=1)
        Label(resolution, text='Height').grid(row=0, column=3)
        Label(resolution, text='x').grid(row=1, column=2)
        Label(resolution, text='x').grid(row=3, column=2)
        controls.create_numeric_entry(
            resolution, self.winX_var, ('WINDOWEDX', 'GRAPHICS_WINDOWEDX'),
{'fraction_non_alphanumeric': 0.12149833637436944, 'fraction_numerical': 0.013094343672856069, 'mean_word_length': 2.4833644859813084, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3578139', 'n_tokens_mistral': 2924, 'n_tokens_neox': 2745, 'n_words': 590}