Skip to content

Fold directories to hide contents if they have too many files #24

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

Merged
merged 1 commit into from
Oct 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions create_requirement_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def make_line(
)

def make_header(position, project_files, files_and_libs):
# pylint: disable=too-many-locals
# pylint: disable=too-many-locals, too-many-branches
# Static files
make_line(
"CIRCUITPY",
Expand Down Expand Up @@ -198,8 +198,7 @@ def make_header(position, project_files, files_and_libs):
icon=file_icon,
)

# TODO: Add settings.toml if it's needed

# Add settings.toml if it's needed
if settings_required(files_and_libs):
make_line(
"settings.toml",
Expand Down Expand Up @@ -247,6 +246,10 @@ def make_header(position, project_files, files_and_libs):

extra_rows = 0
for i, file in enumerate(sorted(project_folders_to_draw.keys())):
if len(project_folders_to_draw[file]) > 0:
triangle_to_use = down_triangle
else:
triangle_to_use = right_triangle
make_line(
file,
(
Expand All @@ -257,7 +260,7 @@ def make_header(position, project_files, files_and_libs):
* (begin_y_offset + i + len(project_files_to_draw) + extra_rows)
),
),
triangle_icon=down_triangle,
triangle_icon=triangle_to_use,
)
rows_added += 1
for sub_file in sorted(project_folders_to_draw[file]):
Expand Down
7 changes: 5 additions & 2 deletions get_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
BUNDLE_DATA = "latest_bundle_data.json"
BUNDLE_TAG = "latest_bundle_tag.json"

SUBDIRECTORY_FILECOUNT_LIMIT = 10

LEARN_GUIDE_REPO = os.environ.get(
"LEARN_GUIDE_REPO", "../Adafruit_Learning_System_Guides/"
)
Expand Down Expand Up @@ -141,8 +143,9 @@ def get_files_for_project(project_name):
if cur_tuple[0].split("/")[-1] == _dir:
for _sub_dir in cur_tuple[1]:
dir_tuple = (dir_tuple[0], dir_tuple[1] + (_sub_dir,))
for _sub_file in cur_tuple[2]:
dir_tuple = (dir_tuple[0], dir_tuple[1] + (_sub_file,))
if len(cur_tuple[2]) < SUBDIRECTORY_FILECOUNT_LIMIT:
for _sub_file in cur_tuple[2]:
dir_tuple = (dir_tuple[0], dir_tuple[1] + (_sub_file,))

# e.g. ("dir_name", ("file_1.txt", "file_2.txt"))
found_files.add(dir_tuple)
Expand Down
Loading