# Path: dragonpy/constants.py
# DRAGON32 = "Dragon32"
# DRAGON64 = "Dragon64"
# COCO2B = "CoCo2b"
# SBC09 = "sbc09"
# SIMPLE6809 = "Simple6809"
# MULTICOMP6809 = "Multicomp6809"
# VECTREX = "Vectrex"
# 
# Path: dragonpy/core/configs.py
# class MachineDict(dict):
# class DummyMemInfo:
# class AddressAreas(dict):
# class BaseConfig:
#     DEFAULT = None
#     BURST_COUNT = 10000
#     DEFAULT_ROMS = {}
#     def register(self, name, cls, default=False):
#     def get_shortest(self, *args):
#     def __call__(self, *args):
#     def __init__(self, areas):
#     def add_area(self, start_addr, end_addr, txt):
#     def __init__(self, cfg_dict):
#     def _get_initial_Memory(self, size):
#     def get_initial_RAM(self):
#     def get_initial_ROM(self):
#     def print_debug_info(self):
# 
# Path: dragonpy/utils/humanize.py
# def get_python_info():
#     implementation = platform.python_implementation()
#     if implementation == "CPython":
#         return f"{implementation} v{platform.python_version()} [{platform.python_compiler()}]"
#         # e.g.: CPython v2.7.6 [GCC 4.8.2]
#     elif implementation == "PyPy":
#         ver_info = sys.version.split("(", 1)[0]
#         ver_info += sys.version.split("\n")[-1]
#         return f"Python {ver_info}"
#         # e.g.: Python 2.7.6 [PyPy 2.3.1 with GCC 4.8.2]
#     else:
#         return "{} {}".format(
#             sys.executable,
#             sys.version.replace("\n", " ")
#         )


import atexit
import logging
import tkinter as tk
import dragonpy
from dev_shell.utils.colorful import bright_blue
from dev_shell.utils.subprocess_utils import verbose_check_call
from MC6809.cli import DEFAULT_LOOPS, DEFAULT_MULTIPLY
from MC6809.core.bechmark import run_benchmark
from dragonpy import constants
from dragonpy.core.configs import machine_dict
from dragonpy.utils.humanize import get_python_info

assert VERBOSITY_DEFAULT is not None
assert VERBOSITY_DICT2[VERBOSITY_DEFAULT] == VERBOSITY_DEFAULT_VALUE


class SettingsFrame(tk.LabelFrame):
    def __init__(self, master, **kwargs):
        tk.LabelFrame.__init__(self, master, text="Settings")
        self.grid(**kwargs)

        self.var_verbosity = tk.StringVar()
        self.var_verbosity.set(VERBOSITY_DEFAULT)
        w = tk.Label(self, text="Verbosity:")
        w.grid(row=0, column=1, sticky=tk.E)
        w = tk.OptionMenu(
            self, self.var_verbosity,
            *VERBOSITY_STRINGS
        )
        w.config(width=20)
        w.grid(row=0, column=2, sticky=tk.W)


class RunButtonsFrame(tk.LabelFrame):
    def __init__(self, master, **kwargs):
        tk.LabelFrame.__init__(self, master, text="Run machines")
        self.grid(**kwargs)

        self.machine_dict = master.machine_dict

        self.var_machine = tk.StringVar()

# Path: dragonpy/constants.py
# DRAGON32 = "Dragon32"
# DRAGON64 = "Dragon64"
# COCO2B = "CoCo2b"
# SBC09 = "sbc09"
# SIMPLE6809 = "Simple6809"
# MULTICOMP6809 = "Multicomp6809"
# VECTREX = "Vectrex"
# 
# Path: dragonpy/core/configs.py
# class MachineDict(dict):
# class DummyMemInfo:
# class AddressAreas(dict):
# class BaseConfig:
#     DEFAULT = None
#     BURST_COUNT = 10000
#     DEFAULT_ROMS = {}
#     def register(self, name, cls, default=False):
#     def get_shortest(self, *args):
#     def __call__(self, *args):
#     def __init__(self, areas):
#     def add_area(self, start_addr, end_addr, txt):
#     def __init__(self, cfg_dict):
#     def _get_initial_Memory(self, size):
#     def get_initial_RAM(self):
#     def get_initial_ROM(self):
#     def print_debug_info(self):
# 
# Path: dragonpy/utils/humanize.py
# def get_python_info():
#     implementation = platform.python_implementation()
#     if implementation == "CPython":
#         return f"{implementation} v{platform.python_version()} [{platform.python_compiler()}]"
#         # e.g.: CPython v2.7.6 [GCC 4.8.2]
#     elif implementation == "PyPy":
#         ver_info = sys.version.split("(", 1)[0]
#         ver_info += sys.version.split("\n")[-1]
#         return f"Python {ver_info}"
#         # e.g.: Python 2.7.6 [PyPy 2.3.1 with GCC 4.8.2]
#     else:
#         return "{} {}".format(
#             sys.executable,
#             sys.version.replace("\n", " ")
#         )


# Path: dragonpy/core/gui_starter.py
import atexit
import logging
import tkinter as tk
import dragonpy
from dev_shell.utils.colorful import bright_blue
from dev_shell.utils.subprocess_utils import verbose_check_call
from MC6809.cli import DEFAULT_LOOPS, DEFAULT_MULTIPLY
from MC6809.core.bechmark import run_benchmark
from dragonpy import constants
from dragonpy.core.configs import machine_dict
from dragonpy.utils.humanize import get_python_info


assert VERBOSITY_DEFAULT is not None
assert VERBOSITY_DICT2[VERBOSITY_DEFAULT] == VERBOSITY_DEFAULT_VALUE


class SettingsFrame(tk.LabelFrame):
    def __init__(self, master, **kwargs):
        tk.LabelFrame.__init__(self, master, text="Settings")
        self.grid(**kwargs)

        self.var_verbosity = tk.StringVar()
        self.var_verbosity.set(VERBOSITY_DEFAULT)
        w = tk.Label(self, text="Verbosity:")
        w.grid(row=0, column=1, sticky=tk.E)
        w = tk.OptionMenu(
            self, self.var_verbosity,
            *VERBOSITY_STRINGS
        )
        w.config(width=20)
        w.grid(row=0, column=2, sticky=tk.W)


class RunButtonsFrame(tk.LabelFrame):
    def __init__(self, master, **kwargs):
        tk.LabelFrame.__init__(self, master, text="Run machines")
        self.grid(**kwargs)

        self.machine_dict = master.machine_dict

        self.var_machine = tk.StringVar()

        self.var_machine.set(constants.DRAGON64)