1.0.40 (Increased limits on the menu function) and 1.0.41 (Windows "Support")
This commit is contained in:
parent
969446bed6
commit
1f13093f38
3 changed files with 230 additions and 169 deletions
|
@ -1,7 +1,9 @@
|
||||||
# Firepup650
|
# Firepup650
|
||||||
Package containing various shorthand things I use, and a few imports I almost always use
|
Package containing various shorthand things I use, and a few imports I almost always use
|
||||||
### Change log:
|
### Change log:
|
||||||
#### v.1.0.39:
|
#### v.1.0.41:
|
||||||
|
Windows "Support"
|
||||||
|
#### v.1.0.40:
|
||||||
Add offset mapping all the way up to 10 Billion, which exceeds the integer limit.
|
Add offset mapping all the way up to 10 Billion, which exceeds the integer limit.
|
||||||
#### v.1.0.39:
|
#### v.1.0.39:
|
||||||
Add offset mappings for exceeding 1 Million options, new limit is 10 Million options
|
Add offset mappings for exceeding 1 Million options, new limit is 10 Million options
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "firepup650"
|
name = "firepup650"
|
||||||
version = "1.0.39"
|
version = "1.0.41"
|
||||||
authors = ["Firepup650 <firepyp650@gmail.com>"]
|
authors = ["Firepup650 <firepyp650@gmail.com>"]
|
||||||
description = "Package containing various shorthand things I use, and a few imports I almost always use"
|
description = "Package containing various shorthand things I use, and a few imports I almost always use"
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
@ -1,10 +1,19 @@
|
||||||
"""Firepup650's PYPI Package"""
|
"""Firepup650's PYPI Package"""
|
||||||
|
|
||||||
import os, sys, termios, tty, time, sqlite3, ast, pydoc # type: ignore[import]
|
fkey, termios, tty = None, None, None
|
||||||
import random as r
|
|
||||||
import fkeycapture as fkey
|
|
||||||
import fpsql as fql
|
|
||||||
from warnings import warn as ww
|
from warnings import warn as ww
|
||||||
|
|
||||||
|
try:
|
||||||
|
import termios, tty, fkeycapture as fkey
|
||||||
|
except ImportError:
|
||||||
|
ww(
|
||||||
|
"Warning! This module has reduced functionality on Windows! I hope you know what you're doing!",
|
||||||
|
stackLevel=2,
|
||||||
|
)
|
||||||
|
|
||||||
|
import os, sys, time, sqlite3, ast, pydoc # type: ignore[import]
|
||||||
|
import random as r
|
||||||
|
import fpsql as fql
|
||||||
from typing import NoReturn, TypeVar, Type, Optional, List, Any, Union
|
from typing import NoReturn, TypeVar, Type, Optional, List, Any, Union
|
||||||
from collections.abc import Iterable
|
from collections.abc import Iterable
|
||||||
|
|
||||||
|
@ -32,11 +41,15 @@ def alias(func):
|
||||||
return decorator
|
return decorator
|
||||||
|
|
||||||
|
|
||||||
__VERSION__ = "1.0.34"
|
__VERSION__ = "1.0.41"
|
||||||
__NEW__ = "Adds methods to hide/show the cursor and a menu system"
|
__NEW__ = 'Windows "Support"'
|
||||||
__LICENSE__ = "MIT"
|
__LICENSE__ = "MIT"
|
||||||
|
|
||||||
|
|
||||||
|
class NotImplementedOnWindowsException(NotImplementedException):
|
||||||
|
"""Exception raised when a Linux only method is called on a Windows machine"""
|
||||||
|
|
||||||
|
|
||||||
def flushPrint(*args) -> None:
|
def flushPrint(*args) -> None:
|
||||||
"""# Function: flushPrint
|
"""# Function: flushPrint
|
||||||
Prints and flushes the provided args.
|
Prints and flushes the provided args.
|
||||||
|
@ -124,6 +137,20 @@ def gp(
|
||||||
allowDelete: bool = False,
|
allowDelete: bool = False,
|
||||||
filler: str = "-",
|
filler: str = "-",
|
||||||
) -> Union[str, bytes]:
|
) -> Union[str, bytes]:
|
||||||
|
raise NotImplementedOnWindowsException(
|
||||||
|
"This method is not implemented for Windows machines"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if fkey:
|
||||||
|
|
||||||
|
def gp(
|
||||||
|
keycount: int = 1,
|
||||||
|
chars: list = ["1", "2"],
|
||||||
|
bytes: bool = False,
|
||||||
|
allowDelete: bool = False,
|
||||||
|
filler: str = "-",
|
||||||
|
) -> Union[str, bytes]:
|
||||||
"""# Function: gp
|
"""# Function: gp
|
||||||
Get keys and print them.
|
Get keys and print them.
|
||||||
# Inputs:
|
# Inputs:
|
||||||
|
@ -166,6 +193,21 @@ def gh(
|
||||||
allowDelete: bool = False,
|
allowDelete: bool = False,
|
||||||
filler: str = "-",
|
filler: str = "-",
|
||||||
) -> Union[str, bytes]:
|
) -> Union[str, bytes]:
|
||||||
|
raise NotImplementedOnWindowsException(
|
||||||
|
"This method is not implemented for Windows machines"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if fkey:
|
||||||
|
|
||||||
|
def gh(
|
||||||
|
keycount: int = 1,
|
||||||
|
chars: list = ["1", "2"],
|
||||||
|
char: str = "*",
|
||||||
|
bytes: bool = False,
|
||||||
|
allowDelete: bool = False,
|
||||||
|
filler: str = "-",
|
||||||
|
) -> Union[str, bytes]:
|
||||||
"""# Function: gh
|
"""# Function: gh
|
||||||
Get keys and print `char` in their place.
|
Get keys and print `char` in their place.
|
||||||
# Inputs:
|
# Inputs:
|
||||||
|
@ -202,6 +244,14 @@ def gh(
|
||||||
|
|
||||||
|
|
||||||
def printt(text: str, delay: float = 0.1, newline: bool = True) -> None:
|
def printt(text: str, delay: float = 0.1, newline: bool = True) -> None:
|
||||||
|
raise NotImplementedOnWindowsException(
|
||||||
|
"This method is not implemented for Windows machines"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if fkey:
|
||||||
|
|
||||||
|
def printt(text: str, delay: float = 0.1, newline: bool = True) -> None:
|
||||||
"""# Function: printt
|
"""# Function: printt
|
||||||
Print out animated text!
|
Print out animated text!
|
||||||
# Inputs:
|
# Inputs:
|
||||||
|
@ -633,11 +683,12 @@ class console:
|
||||||
# Raises:
|
# Raises:
|
||||||
None"""
|
None"""
|
||||||
ind = 1
|
ind = 1
|
||||||
while warning in console.__warnings__:
|
warn = warning
|
||||||
warning = f"{warning}({ind})"
|
while warn in console.__warnings__:
|
||||||
|
warn = f"{warning}({ind})"
|
||||||
ind += 1
|
ind += 1
|
||||||
console.__warnings__.append(warning)
|
console.__warnings__.append(warn)
|
||||||
ww(warning, class_, 2)
|
ww(warn, class_, 2)
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def error(*args, **kwargs) -> None:
|
def error(*args, **kwargs) -> None:
|
||||||
|
@ -855,8 +906,16 @@ def hidden(func):
|
||||||
return wrapper
|
return wrapper
|
||||||
|
|
||||||
|
|
||||||
@hidden
|
|
||||||
def menu(options: dict, title: str = "") -> object:
|
def menu(options: dict, title: str = "") -> object:
|
||||||
|
raise NotImplementedOnWindowsException(
|
||||||
|
"This method is not implemented for Windows machines"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
if fkey:
|
||||||
|
|
||||||
|
@hidden
|
||||||
|
def menu(options: dict, title: str = "") -> object:
|
||||||
"""# Function: menu
|
"""# Function: menu
|
||||||
Uses a nice interactive for the provided options
|
Uses a nice interactive for the provided options
|
||||||
# Inputs:
|
# Inputs:
|
||||||
|
@ -902,7 +961,7 @@ def menu(options: dict, title: str = "") -> object:
|
||||||
indicatorOffset = -7
|
indicatorOffset = -7
|
||||||
case (
|
case (
|
||||||
21
|
21
|
||||||
): # 1000000000=9999999999 options (Ten Billion rolls over) (This exceeds integer limits, so if we get over this I've got no clue how.)
|
): # 1000000000-9999999999 options (Ten Billion rolls over) (This exceeds integer limits, so if we get over this I've got no clue how.)
|
||||||
indicatorOffset = -8
|
indicatorOffset = -8
|
||||||
case _:
|
case _:
|
||||||
raise ValueError(
|
raise ValueError(
|
||||||
|
|
Loading…
Reference in a new issue