-
Notifications
You must be signed in to change notification settings - Fork 116
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Store flags as images #156
base: master
Are you sure you want to change the base?
Conversation
Thank you so much for the refactoring to make image-based flag rendering possible! This is a very significant update, and I'd like to ensure that I thoroughly understand everything before integrating. I appreciate your patience as we work toward incorporating these changes for the next release. |
hyfetch/termenv.py
Outdated
tty = importlib.import_module("tty") | ||
signal = importlib.import_module("signal") | ||
termios = importlib.import_module("termios") | ||
select = importlib.import_module("select").select |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here you can actually achieve the same effect by just moving the import statements inside the function. Dynamic importing using importlib is only required if the module name is a string that you don't know beforehand.
hyfetch/__init__.py
Outdated
from __future__ import annotations | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also please don't remove from __future__ import annotations
, they're required for Python 3.7-8 compatibility. Thanks!
Just added the fixes! |
hyfetch/flag_utils.py
Outdated
files = os.listdir('hyfetch/flags') | ||
# Remove file extensions | ||
files_no_ext = [f.split('.')[0] for f in os.listdir('hyfetch/flags')] | ||
# Get index of file in list of files without extensions, raise error if it doesn't exist |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Using relative directories like this actually wouldn't work when you're outside the hyfetch directory. For example, if you use pip install .
to install hyfetch and run hyfetch -c
outside of the hyfetch directory, it would raise a FileNotFound error. You should use paths relative to the current file instead. (e.g. Path(__file__).parent / 'flags'
)
hyfetch/helper_types.py
Outdated
from __future__ import annotations | ||
|
||
from typing_extensions import Literal | ||
|
||
AnsiMode = Literal['default', 'ansi', '8bit', 'rgb'] | ||
LightDark = Literal['light', 'dark'] | ||
BackendLiteral = Literal["neofetch", "fastfetch"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is already hyfetch/types.py
.
Updated! |
Applied merges! |
Is this still active? |
Description
The current system for storing flags only stores striped patterns. This pull request changes it to storing flags as images, allowing for non-stripe patterns and custom flags.
Relevant Links
This adds the demisexual flag #30 and allows for custom flags to be added #46.
Screenshots
Additional context
Future versions could add a command line utility for managing custom flags.