Skip to content
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

Open
wants to merge 32 commits into
base: master
Choose a base branch
from
Open

Conversation

j4d35t0n3
Copy link

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

Screenshot_1
Screenshot_2
Screenshot_3

Additional context

Future versions could add a command line utility for managing custom flags.

@hykilpikonna
Copy link
Owner

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.

Comment on lines 88 to 91
tty = importlib.import_module("tty")
signal = importlib.import_module("signal")
termios = importlib.import_module("termios")
select = importlib.import_module("select").select
Copy link
Owner

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.

Comment on lines 1 to 2
from __future__ import annotations

Copy link
Owner

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!

@j4d35t0n3
Copy link
Author

Just added the fixes!

Comment on lines 52 to 56
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
Copy link
Owner

@hykilpikonna hykilpikonna Aug 17, 2023

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')

image

Comment on lines 1 to 7
from __future__ import annotations

from typing_extensions import Literal

AnsiMode = Literal['default', 'ansi', '8bit', 'rgb']
LightDark = Literal['light', 'dark']
BackendLiteral = Literal["neofetch", "fastfetch"]
Copy link
Owner

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.

@j4d35t0n3
Copy link
Author

Updated!

@j4d35t0n3
Copy link
Author

Applied merges!

@j4d35t0n3 j4d35t0n3 reopened this Sep 14, 2023
@RocketRace
Copy link

Is this still active?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants