menataur 1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of menataur might be problematic. Click here for more details.
- menataur-1.0/LICENSE +9 -0
- menataur-1.0/Menataur_V1/__init__.py +1 -0
- menataur-1.0/Menataur_V1/menataur.py +192 -0
- menataur-1.0/Menataur_V1/setup.py +23 -0
- menataur-1.0/PKG-INFO +109 -0
- menataur-1.0/README.md +94 -0
- menataur-1.0/menataur.egg-info/PKG-INFO +109 -0
- menataur-1.0/menataur.egg-info/SOURCES.txt +10 -0
- menataur-1.0/menataur.egg-info/dependency_links.txt +1 -0
- menataur-1.0/menataur.egg-info/top_level.txt +1 -0
- menataur-1.0/pyproject.toml +23 -0
- menataur-1.0/setup.cfg +4 -0
menataur-1.0/LICENSE
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Gratonic (https://github.com/Gratonic/Minotaur) and FailurePoint (https://github.com/FailurePoint)
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this Module and associated documentation files (the "Module"), to deal in the Module without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Module, and to permit persons to whom the Module is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
1. The above copyright notice shall be included in all copies or substantial portions of the Module.
|
|
8
|
+
|
|
9
|
+
2. THE Module IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE MODULE OR THE USE OR OTHER DEALINGS IN THE MODULE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
from .menataur import Minotaur # Import the Minotaur class from menataur.py
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
# :: Imports :: #
|
|
2
|
+
|
|
3
|
+
# Colorama - Copyright (c) 2013-2023, Anthony Sottile, All Rights Reserved
|
|
4
|
+
import colorama
|
|
5
|
+
|
|
6
|
+
# :: Global Variables :: #
|
|
7
|
+
|
|
8
|
+
# Color objects, used for nicer output
|
|
9
|
+
reset = colorama.Fore.RESET
|
|
10
|
+
blue = colorama.Fore.BLUE
|
|
11
|
+
light_blue = colorama.Fore.LIGHTBLUE_EX
|
|
12
|
+
cyan = colorama.Fore.CYAN
|
|
13
|
+
light_cyan = colorama.Fore.LIGHTCYAN_EX
|
|
14
|
+
red = colorama.Fore.RED
|
|
15
|
+
light_red = colorama.Fore.LIGHTRED_EX
|
|
16
|
+
green = colorama.Fore.GREEN
|
|
17
|
+
light_green = colorama.Fore.LIGHTGREEN_EX
|
|
18
|
+
yellow = colorama.Fore.YELLOW
|
|
19
|
+
light_yellow = colorama.Fore.LIGHTYELLOW_EX
|
|
20
|
+
magenta = colorama.Fore.MAGENTA
|
|
21
|
+
light_magenta = colorama.Fore.LIGHTMAGENTA_EX
|
|
22
|
+
white = colorama.Fore.WHITE
|
|
23
|
+
grey = colorama.Fore.LIGHTBLACK_EX
|
|
24
|
+
black = colorama.Fore.BLACK
|
|
25
|
+
|
|
26
|
+
# Used to reset the highlight color
|
|
27
|
+
highlight_reset = colorama.Back.RESET
|
|
28
|
+
|
|
29
|
+
# Used to check the provided colors
|
|
30
|
+
supported_colors = {
|
|
31
|
+
"blue": blue, "light_blue": light_blue,
|
|
32
|
+
"cyan": cyan, "light_cyan": light_cyan,
|
|
33
|
+
"red": red, "light_red": light_red,
|
|
34
|
+
"green": green, "light_green": light_green,
|
|
35
|
+
"yellow": yellow, "light_yellow": light_yellow,
|
|
36
|
+
"magenta": magenta, "light_magenta": light_magenta,
|
|
37
|
+
"black": black, "white": white, "grey": grey
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
# Validates the colors provided by the user
|
|
41
|
+
def validate_color(color: str) -> str:
|
|
42
|
+
color = color.lower()
|
|
43
|
+
if color in supported_colors:
|
|
44
|
+
return supported_colors[color]
|
|
45
|
+
else:
|
|
46
|
+
print(f"{red}[!] Minotaur Error: {light_red}One or more color(s) is/are not valid or is/are unsupported.{reset}")
|
|
47
|
+
print(f"{green}The following colors are supported:{reset}")
|
|
48
|
+
for color_str in supported_colors.keys():
|
|
49
|
+
print(f"{blue}{color_str}{reset}")
|
|
50
|
+
raise ValueError("Invalid color provided.")
|
|
51
|
+
|
|
52
|
+
# Validates the higlight color provided by the user
|
|
53
|
+
def validate_highlight_color(high_color: str) -> str:
|
|
54
|
+
if high_color.lower() in supported_colors and high_color == "blue":
|
|
55
|
+
high_color = colorama.Back.BLUE
|
|
56
|
+
return high_color
|
|
57
|
+
elif high_color.lower() in supported_colors and high_color == "light_blue":
|
|
58
|
+
high_color = colorama.Back.LIGHTBLUE_EX
|
|
59
|
+
return high_color
|
|
60
|
+
elif high_color.lower() in supported_colors and high_color == "cyan":
|
|
61
|
+
high_color = colorama.Back.CYAN
|
|
62
|
+
return high_color
|
|
63
|
+
elif high_color.lower() in supported_colors and high_color == "light_cyan":
|
|
64
|
+
high_color = colorama.Back.LIGHTCYAN_EX
|
|
65
|
+
return high_color
|
|
66
|
+
elif high_color.lower() in supported_colors and high_color == "red":
|
|
67
|
+
high_color = colorama.Back.RED
|
|
68
|
+
return high_color
|
|
69
|
+
elif high_color.lower() in supported_colors and high_color == "light_red":
|
|
70
|
+
high_color = colorama.Back.LIGHTRED_EX
|
|
71
|
+
return high_color
|
|
72
|
+
elif high_color.lower() in supported_colors and high_color == "green":
|
|
73
|
+
high_color = colorama.Back.GREEN
|
|
74
|
+
return high_color
|
|
75
|
+
elif high_color.lower() in supported_colors and high_color == "light_green":
|
|
76
|
+
high_color = colorama.Back.LIGHTGREEN_EX
|
|
77
|
+
return high_color
|
|
78
|
+
elif high_color.lower() in supported_colors and high_color == "yellow":
|
|
79
|
+
high_color = colorama.Back.YELLOW
|
|
80
|
+
return high_color
|
|
81
|
+
elif high_color.lower() in supported_colors and high_color == "light_yellow":
|
|
82
|
+
high_color = colorama.Back.LIGHTYELLOW_EX
|
|
83
|
+
return high_color
|
|
84
|
+
elif high_color.lower() in supported_colors and high_color == "magenta":
|
|
85
|
+
high_color = colorama.Back.MAGENTA
|
|
86
|
+
return high_color
|
|
87
|
+
elif high_color.lower() in supported_colors and high_color == "light_magenta":
|
|
88
|
+
high_color = colorama.Back.LIGHTMAGENTA_EX
|
|
89
|
+
return high_color
|
|
90
|
+
elif high_color.lower() in supported_colors and high_color == "white":
|
|
91
|
+
high_color = colorama.Back.WHITE
|
|
92
|
+
return high_color
|
|
93
|
+
elif high_color.lower() in supported_colors and high_color == "black":
|
|
94
|
+
high_color = colorama.Back.BLACK
|
|
95
|
+
return high_color
|
|
96
|
+
elif high_color.lower() in supported_colors and high_color == "grey":
|
|
97
|
+
high_color = colorama.Back.LIGHTBLACK_EX
|
|
98
|
+
return high_color
|
|
99
|
+
else:
|
|
100
|
+
print(f"{red}[!] Minotaur Error (line 79): {yellow}{high_color}{highlight_reset} {light_red} is not a valid color or is unsupported.{reset}")
|
|
101
|
+
print(f"{green}The following colors are supported:{reset}")
|
|
102
|
+
for color_str in supported_colors:
|
|
103
|
+
print(f"{blue}{color_str}{reset}")
|
|
104
|
+
exit()
|
|
105
|
+
|
|
106
|
+
# Menu Builder Class
|
|
107
|
+
class Menataur():
|
|
108
|
+
def __init__(self):
|
|
109
|
+
self._placeholder = ""
|
|
110
|
+
self._header = "{ascii_art_title}\n{title_bar}\n{program_version_color}{small_title} v{program_version_num}\n{os_support_message}{reset}"
|
|
111
|
+
self._body = "{accent_color}{menu_option_number}) {menu_option_color}{menu_option}{reset}"
|
|
112
|
+
self._paragraph = "{text_color}{text}{reset}"
|
|
113
|
+
self._footer = "{text_color}{text}{reset}"
|
|
114
|
+
# Formally adds an element to the menu interface
|
|
115
|
+
def _include(self, element):
|
|
116
|
+
self._placeholder = self._placeholder + f"{element}\n"
|
|
117
|
+
# Adds a header element (title, os support info, etc.) to the menu interface
|
|
118
|
+
def add_header(self, ascii_art_title: str, small_title: str, title_colors: list, title_bar_width: int, title_bar: list, program_version_color: str, program_version_num: str, os_support_message_color: str, os_support_highlight_color: str, os_support_color: str, os_support_info: list) -> None:
|
|
119
|
+
# Validates the colors in the title colors list and gets the real color if they are valid
|
|
120
|
+
validated_title_colors = [validate_color(color) for color in title_colors]
|
|
121
|
+
# Creates a colorful title using the provided ascii_art_title and title colors
|
|
122
|
+
colorful_title = ''.join(validated_title_colors[char % len(validated_title_colors)] + ascii_art_title[char] for char in range(len(ascii_art_title)))
|
|
123
|
+
# Creates the title bar using the title bar width
|
|
124
|
+
title_bar = f"{title_bar[0] * (title_bar_width - 1)}{title_bar[1]}"
|
|
125
|
+
# Validates the os_support_color
|
|
126
|
+
os_support_color = validate_color(os_support_color)
|
|
127
|
+
# Validates the os_support_highlight_color and sets its value
|
|
128
|
+
os_support_highlight_color = validate_highlight_color(os_support_highlight_color)
|
|
129
|
+
# Creates the os support message using the os support info list, os support highlight color, and os_support_color
|
|
130
|
+
os_support_message = f"{os_support_color}This Program Supports:"
|
|
131
|
+
|
|
132
|
+
for os in os_support_info:
|
|
133
|
+
if os != os_support_info[-1]:
|
|
134
|
+
os_support_message = os_support_message + f" {os_support_highlight_color}{os}{highlight_reset},"
|
|
135
|
+
else:
|
|
136
|
+
os_support_message = os_support_message + f" {os_support_highlight_color}{os}{highlight_reset}"
|
|
137
|
+
|
|
138
|
+
self._include(self._header.format(
|
|
139
|
+
ascii_art_title=colorful_title,
|
|
140
|
+
small_title=small_title,
|
|
141
|
+
title_bar=title_bar,
|
|
142
|
+
program_version_color=validate_color(program_version_color),
|
|
143
|
+
program_version_num=program_version_num,
|
|
144
|
+
os_support_message=os_support_message,
|
|
145
|
+
reset=reset
|
|
146
|
+
))
|
|
147
|
+
# Adds a body element (menu option) to the menu interface
|
|
148
|
+
def add_body(self, accent_color: str, menu_option_number: int, menu_option_color: str, menu_option: str) -> None:
|
|
149
|
+
self._include(self._body.format(
|
|
150
|
+
accent_color=validate_color(accent_color),
|
|
151
|
+
menu_option_number=menu_option_number,
|
|
152
|
+
menu_option_color=validate_color(menu_option_color),
|
|
153
|
+
menu_option=menu_option,
|
|
154
|
+
reset=reset
|
|
155
|
+
))
|
|
156
|
+
# Adds a paragraph (description) to the menu interface
|
|
157
|
+
def add_paragraph(self, text_color: str, text: str, title_width=5) -> None:
|
|
158
|
+
self._include(self._paragraph.format(
|
|
159
|
+
text_color=validate_color(text_color),
|
|
160
|
+
text=text,
|
|
161
|
+
reset=reset
|
|
162
|
+
))
|
|
163
|
+
# Adds a footer element (thank you or warning message) to the menu interface
|
|
164
|
+
def add_footer(self, text_color: str, text: str, title_width=5) -> None:
|
|
165
|
+
if not isinstance(title_width, int):
|
|
166
|
+
print(f"{red}[!] Minotaur Error: {yellow}title_width {light_red}must be type: {yellow}int{reset}")
|
|
167
|
+
raise ValueError("title_width must be an integer.")
|
|
168
|
+
|
|
169
|
+
text = f"{' ' * (title_width // 2)}{text}{' ' * (title_width // 2)}"
|
|
170
|
+
self._include(self._paragraph.format(
|
|
171
|
+
text_color=validate_color(text_color),
|
|
172
|
+
text=text,
|
|
173
|
+
reset=reset
|
|
174
|
+
))
|
|
175
|
+
# Finishes the UX menu, displays it, and returns the users choice
|
|
176
|
+
def execute(self, prompt_color: str, input_prompt_message: str) -> int:
|
|
177
|
+
# Validates the prompt color and sets it
|
|
178
|
+
prompt_color = validate_color(prompt_color)
|
|
179
|
+
# Prints the main portion of the menu
|
|
180
|
+
print(self._placeholder)
|
|
181
|
+
while True:
|
|
182
|
+
try:
|
|
183
|
+
# Aks the user to choose an option from the menu
|
|
184
|
+
user_choice = int(input(f"\n{prompt_color}{input_prompt_message}{reset}"))
|
|
185
|
+
# Returns the users choice
|
|
186
|
+
return user_choice
|
|
187
|
+
except ValueError:
|
|
188
|
+
print(f"\n{red}[!] Error: {light_red}You must enter a number.{reset}")
|
|
189
|
+
except KeyboardInterrupt:
|
|
190
|
+
# In order to avoid an issue with the CLI on linux
|
|
191
|
+
print("\n")
|
|
192
|
+
exit()
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
from setuptools import setup, find_packages
|
|
2
|
+
|
|
3
|
+
setup(
|
|
4
|
+
name='Menataur',
|
|
5
|
+
version='1.0',
|
|
6
|
+
packages=find_packages(),
|
|
7
|
+
license='MIT',
|
|
8
|
+
author='Gratonic',
|
|
9
|
+
author_email='Gratonic@proton.me',
|
|
10
|
+
description='Menu Interface Builder for Python',
|
|
11
|
+
long_description=open('README.md').read(),
|
|
12
|
+
long_description_content_type='text/markdown',
|
|
13
|
+
url='https://github.com/Gratonic/Menataur',
|
|
14
|
+
classifiers=[
|
|
15
|
+
'Programming Language :: Python :: 3',
|
|
16
|
+
'License :: OSI Approved :: MIT License',
|
|
17
|
+
'Operating System :: Any',
|
|
18
|
+
],
|
|
19
|
+
python_requires='>=3.6', # Minimum Python version required
|
|
20
|
+
install_requires=[
|
|
21
|
+
'colorama', # Specify colorama as a dependency
|
|
22
|
+
],
|
|
23
|
+
)
|
menataur-1.0/PKG-INFO
ADDED
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: menataur
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Summary: Menu Interface Builder for Python
|
|
5
|
+
Author-email: Gratonic <Gratonic@proton.me>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Gratonic/Menataur
|
|
8
|
+
Project-URL: Issues, https://github.com/Gratonic/Menataur/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# :: Author Information and Program Details :: #
|
|
17
|
+
|
|
18
|
+
Module Name: Menataur (Menataur/menataur.py) |
|
|
19
|
+
Author: Gratonic (https://github.com/Gratonic) |
|
|
20
|
+
Contributing Author: FailurePoint (https://github.com/FailurePoint) |
|
|
21
|
+
Written In: Python 3.10.12 |
|
|
22
|
+
Dependencie(s): colorama |
|
|
23
|
+
Last Modified: February 9th, 2025
|
|
24
|
+
|
|
25
|
+
# :: Description :: #
|
|
26
|
+
|
|
27
|
+
This Module is used to build a menu interface with an ASCII Art Title.
|
|
28
|
+
The add_header() function is used to build the header portion of a menu (ASCII Art Title, OS Support Information, etc.). The add_body() function is used to
|
|
29
|
+
add a menu option to the menu. The add_paragraph() function is used to add a description to the menu. The add_footer()
|
|
30
|
+
function is used to add a sentence/description at a desired location on the menu (likely the bottom) with padding. The color
|
|
31
|
+
validation function are used to validate the colors passed to the function by checking the given color or colors against a
|
|
32
|
+
dictionary of the colors supported by the program and then set the color to the chosen colors actual value. When add_header(),
|
|
33
|
+
add_body(), add_paragraph(), and_footer() are called, the parameters are used to format place holder strings which are then added
|
|
34
|
+
to the _placeholder format string (the actual menu) with the _include() function, which is responsible for tacking the pieces
|
|
35
|
+
of the menu onto the menu. Think of this program like a lego project, each piece of the menu is like a lego structure and the
|
|
36
|
+
pieces of that lego structure are the configuration settings for that lego structure, and think of the _include() function as the
|
|
37
|
+
function that attaches that lego structure to the lego project. Alternatively, you can think of it sort of like a webpage written
|
|
38
|
+
in just HTML and CSS.
|
|
39
|
+
|
|
40
|
+
# :: Example Usage :: #
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
import menataur
|
|
44
|
+
menu = menataur.Menataur()
|
|
45
|
+
menu.add_header(
|
|
46
|
+
ascii_art_title=ascii_art_title,
|
|
47
|
+
small_title=small_title,
|
|
48
|
+
title_colors=title_colors,
|
|
49
|
+
title_bar=title_bar,
|
|
50
|
+
program_version_color=program_version_color,
|
|
51
|
+
program_version_num=program_version_num,
|
|
52
|
+
os_support_message_color=os_support_message_color,
|
|
53
|
+
os_support_highlight_color=os_support_highlight_color,
|
|
54
|
+
os_support_color=os_support_color,
|
|
55
|
+
os_support_info=os_support_info
|
|
56
|
+
)
|
|
57
|
+
menu.add_paragraph(text_color="grey", text="Have some fun at a party")
|
|
58
|
+
menu.add_body(accent_color="magenta", menu_option_number=1, menu_option_color="light_cyan", menu_option="Party")
|
|
59
|
+
menu.add_paragraph(text_color="grey", text="Drink way too much")
|
|
60
|
+
menu.add_body(accent_color="magenta", menu_option_number=2, menu_option_color="light_cyan", menu_option="Get Drunk")
|
|
61
|
+
menu.add_paragraph(text_color="grey", text="Go to bed and sleep")
|
|
62
|
+
menu.add_body(accent_color="magenta", menu_option_number=3, menu_option_color="light_cyan", menu_option="Sleep")
|
|
63
|
+
menu.add_paragraph(text_color="grey", text="All three")
|
|
64
|
+
menu.add_body(accent_color="magenta", menu_option_number=4, menu_option_color="light_cyan", menu_option="The Works")
|
|
65
|
+
menu.add_footer(text_color="light_yellow", text="Thank you for using Minotaur!")
|
|
66
|
+
menu.execute()
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
NOTE: multipule menu obects can be created and used at once, ie: `main_menu = menataur.Menataur()`, `pageone = menataur.Menataur()`
|
|
70
|
+
, `pagetwo = menataur.Menataur()`
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# Breakdown
|
|
74
|
+
|
|
75
|
+
## Imports the module
|
|
76
|
+
import menataur
|
|
77
|
+
|
|
78
|
+
## Creates an instance of Menataur (the menu class)
|
|
79
|
+
menu = menataur.Menataur()
|
|
80
|
+
|
|
81
|
+
## Add the header to the menu
|
|
82
|
+
menu.add_header(
|
|
83
|
+
ascii_art_title=ascii_art_title,
|
|
84
|
+
small_title=small_title,
|
|
85
|
+
title_colors=title_colors,
|
|
86
|
+
title_bar=title_bar,
|
|
87
|
+
program_version_color=program_version_color,
|
|
88
|
+
program_version_num=program_version_num,
|
|
89
|
+
os_support_message_color=os_support_message_color,
|
|
90
|
+
os_support_highlight_color=os_support_highlight_color,
|
|
91
|
+
os_support_color=os_support_color,
|
|
92
|
+
os_support_info=os_support_info
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
## Add body elements (menu options)
|
|
96
|
+
menu.add_paragraph(text_color="grey", text="Have some fun at a party")
|
|
97
|
+
menu.add_body(accent_color="magenta", menu_option_number=1, menu_option_color="light_cyan", menu_option="Party")
|
|
98
|
+
menu.add_paragraph(text_color="grey", text="Drink way too much")
|
|
99
|
+
menu.add_body(accent_color="magenta", menu_option_number=2, menu_option_color="light_cyan", menu_option="Get Drunk")
|
|
100
|
+
menu.add_paragraph(text_color="grey", text="Go to bed and sleep")
|
|
101
|
+
menu.add_body(accent_color="magenta", menu_option_number=3, menu_option_color="light_cyan", menu_option="Sleep")
|
|
102
|
+
menu.add_paragraph(text_color="grey", text="All three")
|
|
103
|
+
menu.add_body(accent_color="magenta", menu_option_number=4, menu_option_color="light_cyan", menu_option="The Works")
|
|
104
|
+
|
|
105
|
+
## Add a footer (thank you message)
|
|
106
|
+
menu.add_footer(text_color="light_yellow", text="Thank you for using Menataur!")
|
|
107
|
+
|
|
108
|
+
## Completes and calls the menu
|
|
109
|
+
menu.execute()
|
menataur-1.0/README.md
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# :: Author Information and Program Details :: #
|
|
2
|
+
|
|
3
|
+
Module Name: Menataur (Menataur/menataur.py) |
|
|
4
|
+
Author: Gratonic (https://github.com/Gratonic) |
|
|
5
|
+
Contributing Author: FailurePoint (https://github.com/FailurePoint) |
|
|
6
|
+
Written In: Python 3.10.12 |
|
|
7
|
+
Dependencie(s): colorama |
|
|
8
|
+
Last Modified: February 9th, 2025
|
|
9
|
+
|
|
10
|
+
# :: Description :: #
|
|
11
|
+
|
|
12
|
+
This Module is used to build a menu interface with an ASCII Art Title.
|
|
13
|
+
The add_header() function is used to build the header portion of a menu (ASCII Art Title, OS Support Information, etc.). The add_body() function is used to
|
|
14
|
+
add a menu option to the menu. The add_paragraph() function is used to add a description to the menu. The add_footer()
|
|
15
|
+
function is used to add a sentence/description at a desired location on the menu (likely the bottom) with padding. The color
|
|
16
|
+
validation function are used to validate the colors passed to the function by checking the given color or colors against a
|
|
17
|
+
dictionary of the colors supported by the program and then set the color to the chosen colors actual value. When add_header(),
|
|
18
|
+
add_body(), add_paragraph(), and_footer() are called, the parameters are used to format place holder strings which are then added
|
|
19
|
+
to the _placeholder format string (the actual menu) with the _include() function, which is responsible for tacking the pieces
|
|
20
|
+
of the menu onto the menu. Think of this program like a lego project, each piece of the menu is like a lego structure and the
|
|
21
|
+
pieces of that lego structure are the configuration settings for that lego structure, and think of the _include() function as the
|
|
22
|
+
function that attaches that lego structure to the lego project. Alternatively, you can think of it sort of like a webpage written
|
|
23
|
+
in just HTML and CSS.
|
|
24
|
+
|
|
25
|
+
# :: Example Usage :: #
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
import menataur
|
|
29
|
+
menu = menataur.Menataur()
|
|
30
|
+
menu.add_header(
|
|
31
|
+
ascii_art_title=ascii_art_title,
|
|
32
|
+
small_title=small_title,
|
|
33
|
+
title_colors=title_colors,
|
|
34
|
+
title_bar=title_bar,
|
|
35
|
+
program_version_color=program_version_color,
|
|
36
|
+
program_version_num=program_version_num,
|
|
37
|
+
os_support_message_color=os_support_message_color,
|
|
38
|
+
os_support_highlight_color=os_support_highlight_color,
|
|
39
|
+
os_support_color=os_support_color,
|
|
40
|
+
os_support_info=os_support_info
|
|
41
|
+
)
|
|
42
|
+
menu.add_paragraph(text_color="grey", text="Have some fun at a party")
|
|
43
|
+
menu.add_body(accent_color="magenta", menu_option_number=1, menu_option_color="light_cyan", menu_option="Party")
|
|
44
|
+
menu.add_paragraph(text_color="grey", text="Drink way too much")
|
|
45
|
+
menu.add_body(accent_color="magenta", menu_option_number=2, menu_option_color="light_cyan", menu_option="Get Drunk")
|
|
46
|
+
menu.add_paragraph(text_color="grey", text="Go to bed and sleep")
|
|
47
|
+
menu.add_body(accent_color="magenta", menu_option_number=3, menu_option_color="light_cyan", menu_option="Sleep")
|
|
48
|
+
menu.add_paragraph(text_color="grey", text="All three")
|
|
49
|
+
menu.add_body(accent_color="magenta", menu_option_number=4, menu_option_color="light_cyan", menu_option="The Works")
|
|
50
|
+
menu.add_footer(text_color="light_yellow", text="Thank you for using Minotaur!")
|
|
51
|
+
menu.execute()
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
NOTE: multipule menu obects can be created and used at once, ie: `main_menu = menataur.Menataur()`, `pageone = menataur.Menataur()`
|
|
55
|
+
, `pagetwo = menataur.Menataur()`
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
# Breakdown
|
|
59
|
+
|
|
60
|
+
## Imports the module
|
|
61
|
+
import menataur
|
|
62
|
+
|
|
63
|
+
## Creates an instance of Menataur (the menu class)
|
|
64
|
+
menu = menataur.Menataur()
|
|
65
|
+
|
|
66
|
+
## Add the header to the menu
|
|
67
|
+
menu.add_header(
|
|
68
|
+
ascii_art_title=ascii_art_title,
|
|
69
|
+
small_title=small_title,
|
|
70
|
+
title_colors=title_colors,
|
|
71
|
+
title_bar=title_bar,
|
|
72
|
+
program_version_color=program_version_color,
|
|
73
|
+
program_version_num=program_version_num,
|
|
74
|
+
os_support_message_color=os_support_message_color,
|
|
75
|
+
os_support_highlight_color=os_support_highlight_color,
|
|
76
|
+
os_support_color=os_support_color,
|
|
77
|
+
os_support_info=os_support_info
|
|
78
|
+
)
|
|
79
|
+
|
|
80
|
+
## Add body elements (menu options)
|
|
81
|
+
menu.add_paragraph(text_color="grey", text="Have some fun at a party")
|
|
82
|
+
menu.add_body(accent_color="magenta", menu_option_number=1, menu_option_color="light_cyan", menu_option="Party")
|
|
83
|
+
menu.add_paragraph(text_color="grey", text="Drink way too much")
|
|
84
|
+
menu.add_body(accent_color="magenta", menu_option_number=2, menu_option_color="light_cyan", menu_option="Get Drunk")
|
|
85
|
+
menu.add_paragraph(text_color="grey", text="Go to bed and sleep")
|
|
86
|
+
menu.add_body(accent_color="magenta", menu_option_number=3, menu_option_color="light_cyan", menu_option="Sleep")
|
|
87
|
+
menu.add_paragraph(text_color="grey", text="All three")
|
|
88
|
+
menu.add_body(accent_color="magenta", menu_option_number=4, menu_option_color="light_cyan", menu_option="The Works")
|
|
89
|
+
|
|
90
|
+
## Add a footer (thank you message)
|
|
91
|
+
menu.add_footer(text_color="light_yellow", text="Thank you for using Menataur!")
|
|
92
|
+
|
|
93
|
+
## Completes and calls the menu
|
|
94
|
+
menu.execute()
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: menataur
|
|
3
|
+
Version: 1.0
|
|
4
|
+
Summary: Menu Interface Builder for Python
|
|
5
|
+
Author-email: Gratonic <Gratonic@proton.me>
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Gratonic/Menataur
|
|
8
|
+
Project-URL: Issues, https://github.com/Gratonic/Menataur/issues
|
|
9
|
+
Classifier: Programming Language :: Python :: 3
|
|
10
|
+
Classifier: Operating System :: OS Independent
|
|
11
|
+
Requires-Python: >=3.8
|
|
12
|
+
Description-Content-Type: text/markdown
|
|
13
|
+
License-File: LICENSE
|
|
14
|
+
Dynamic: license-file
|
|
15
|
+
|
|
16
|
+
# :: Author Information and Program Details :: #
|
|
17
|
+
|
|
18
|
+
Module Name: Menataur (Menataur/menataur.py) |
|
|
19
|
+
Author: Gratonic (https://github.com/Gratonic) |
|
|
20
|
+
Contributing Author: FailurePoint (https://github.com/FailurePoint) |
|
|
21
|
+
Written In: Python 3.10.12 |
|
|
22
|
+
Dependencie(s): colorama |
|
|
23
|
+
Last Modified: February 9th, 2025
|
|
24
|
+
|
|
25
|
+
# :: Description :: #
|
|
26
|
+
|
|
27
|
+
This Module is used to build a menu interface with an ASCII Art Title.
|
|
28
|
+
The add_header() function is used to build the header portion of a menu (ASCII Art Title, OS Support Information, etc.). The add_body() function is used to
|
|
29
|
+
add a menu option to the menu. The add_paragraph() function is used to add a description to the menu. The add_footer()
|
|
30
|
+
function is used to add a sentence/description at a desired location on the menu (likely the bottom) with padding. The color
|
|
31
|
+
validation function are used to validate the colors passed to the function by checking the given color or colors against a
|
|
32
|
+
dictionary of the colors supported by the program and then set the color to the chosen colors actual value. When add_header(),
|
|
33
|
+
add_body(), add_paragraph(), and_footer() are called, the parameters are used to format place holder strings which are then added
|
|
34
|
+
to the _placeholder format string (the actual menu) with the _include() function, which is responsible for tacking the pieces
|
|
35
|
+
of the menu onto the menu. Think of this program like a lego project, each piece of the menu is like a lego structure and the
|
|
36
|
+
pieces of that lego structure are the configuration settings for that lego structure, and think of the _include() function as the
|
|
37
|
+
function that attaches that lego structure to the lego project. Alternatively, you can think of it sort of like a webpage written
|
|
38
|
+
in just HTML and CSS.
|
|
39
|
+
|
|
40
|
+
# :: Example Usage :: #
|
|
41
|
+
|
|
42
|
+
```python
|
|
43
|
+
import menataur
|
|
44
|
+
menu = menataur.Menataur()
|
|
45
|
+
menu.add_header(
|
|
46
|
+
ascii_art_title=ascii_art_title,
|
|
47
|
+
small_title=small_title,
|
|
48
|
+
title_colors=title_colors,
|
|
49
|
+
title_bar=title_bar,
|
|
50
|
+
program_version_color=program_version_color,
|
|
51
|
+
program_version_num=program_version_num,
|
|
52
|
+
os_support_message_color=os_support_message_color,
|
|
53
|
+
os_support_highlight_color=os_support_highlight_color,
|
|
54
|
+
os_support_color=os_support_color,
|
|
55
|
+
os_support_info=os_support_info
|
|
56
|
+
)
|
|
57
|
+
menu.add_paragraph(text_color="grey", text="Have some fun at a party")
|
|
58
|
+
menu.add_body(accent_color="magenta", menu_option_number=1, menu_option_color="light_cyan", menu_option="Party")
|
|
59
|
+
menu.add_paragraph(text_color="grey", text="Drink way too much")
|
|
60
|
+
menu.add_body(accent_color="magenta", menu_option_number=2, menu_option_color="light_cyan", menu_option="Get Drunk")
|
|
61
|
+
menu.add_paragraph(text_color="grey", text="Go to bed and sleep")
|
|
62
|
+
menu.add_body(accent_color="magenta", menu_option_number=3, menu_option_color="light_cyan", menu_option="Sleep")
|
|
63
|
+
menu.add_paragraph(text_color="grey", text="All three")
|
|
64
|
+
menu.add_body(accent_color="magenta", menu_option_number=4, menu_option_color="light_cyan", menu_option="The Works")
|
|
65
|
+
menu.add_footer(text_color="light_yellow", text="Thank you for using Minotaur!")
|
|
66
|
+
menu.execute()
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
NOTE: multipule menu obects can be created and used at once, ie: `main_menu = menataur.Menataur()`, `pageone = menataur.Menataur()`
|
|
70
|
+
, `pagetwo = menataur.Menataur()`
|
|
71
|
+
|
|
72
|
+
|
|
73
|
+
# Breakdown
|
|
74
|
+
|
|
75
|
+
## Imports the module
|
|
76
|
+
import menataur
|
|
77
|
+
|
|
78
|
+
## Creates an instance of Menataur (the menu class)
|
|
79
|
+
menu = menataur.Menataur()
|
|
80
|
+
|
|
81
|
+
## Add the header to the menu
|
|
82
|
+
menu.add_header(
|
|
83
|
+
ascii_art_title=ascii_art_title,
|
|
84
|
+
small_title=small_title,
|
|
85
|
+
title_colors=title_colors,
|
|
86
|
+
title_bar=title_bar,
|
|
87
|
+
program_version_color=program_version_color,
|
|
88
|
+
program_version_num=program_version_num,
|
|
89
|
+
os_support_message_color=os_support_message_color,
|
|
90
|
+
os_support_highlight_color=os_support_highlight_color,
|
|
91
|
+
os_support_color=os_support_color,
|
|
92
|
+
os_support_info=os_support_info
|
|
93
|
+
)
|
|
94
|
+
|
|
95
|
+
## Add body elements (menu options)
|
|
96
|
+
menu.add_paragraph(text_color="grey", text="Have some fun at a party")
|
|
97
|
+
menu.add_body(accent_color="magenta", menu_option_number=1, menu_option_color="light_cyan", menu_option="Party")
|
|
98
|
+
menu.add_paragraph(text_color="grey", text="Drink way too much")
|
|
99
|
+
menu.add_body(accent_color="magenta", menu_option_number=2, menu_option_color="light_cyan", menu_option="Get Drunk")
|
|
100
|
+
menu.add_paragraph(text_color="grey", text="Go to bed and sleep")
|
|
101
|
+
menu.add_body(accent_color="magenta", menu_option_number=3, menu_option_color="light_cyan", menu_option="Sleep")
|
|
102
|
+
menu.add_paragraph(text_color="grey", text="All three")
|
|
103
|
+
menu.add_body(accent_color="magenta", menu_option_number=4, menu_option_color="light_cyan", menu_option="The Works")
|
|
104
|
+
|
|
105
|
+
## Add a footer (thank you message)
|
|
106
|
+
menu.add_footer(text_color="light_yellow", text="Thank you for using Menataur!")
|
|
107
|
+
|
|
108
|
+
## Completes and calls the menu
|
|
109
|
+
menu.execute()
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Menataur_V1
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
[project]
|
|
2
|
+
name = "menataur"
|
|
3
|
+
version = "1.0"
|
|
4
|
+
authors = [
|
|
5
|
+
{ name="Gratonic", email="Gratonic@proton.me" },
|
|
6
|
+
]
|
|
7
|
+
description = "Menu Interface Builder for Python"
|
|
8
|
+
readme = "README.md"
|
|
9
|
+
requires-python = ">=3.8"
|
|
10
|
+
classifiers = [
|
|
11
|
+
"Programming Language :: Python :: 3",
|
|
12
|
+
"Operating System :: OS Independent",
|
|
13
|
+
]
|
|
14
|
+
license = "MIT"
|
|
15
|
+
license-files = ["LICEN[CS]E*"]
|
|
16
|
+
|
|
17
|
+
[project.urls]
|
|
18
|
+
Homepage = "https://github.com/Gratonic/Menataur"
|
|
19
|
+
Issues = "https://github.com/Gratonic/Menataur/issues"
|
|
20
|
+
|
|
21
|
+
[build-system]
|
|
22
|
+
requires = ["colorama", "setuptools >= 77.0.3"]
|
|
23
|
+
build-backend = "setuptools.build_meta"
|
menataur-1.0/setup.cfg
ADDED