octotui 0.1.1__py3-none-any.whl → 0.1.2__py3-none-any.whl
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 octotui might be problematic. Click here for more details.
- octotui/git_diff_viewer.py +70 -0
- {octotui-0.1.1.dist-info → octotui-0.1.2.dist-info}/METADATA +1 -1
- {octotui-0.1.1.dist-info → octotui-0.1.2.dist-info}/RECORD +6 -6
- {octotui-0.1.1.data → octotui-0.1.2.data}/data/octotui/style.tcss +0 -0
- {octotui-0.1.1.dist-info → octotui-0.1.2.dist-info}/WHEEL +0 -0
- {octotui-0.1.1.dist-info → octotui-0.1.2.dist-info}/entry_points.txt +0 -0
octotui/git_diff_viewer.py
CHANGED
|
@@ -425,6 +425,76 @@ class GitDiffViewer(App):
|
|
|
425
425
|
# If we can't populate branches, that's okay - continue without it
|
|
426
426
|
pass
|
|
427
427
|
|
|
428
|
+
def populate_file_tree(self) -> None:
|
|
429
|
+
"""Populate the file tree sidebar with all files and their git status."""
|
|
430
|
+
if not self.git_sidebar.repo:
|
|
431
|
+
return
|
|
432
|
+
|
|
433
|
+
try:
|
|
434
|
+
# Get the tree widget
|
|
435
|
+
tree = self.query_one("#file-tree", Tree)
|
|
436
|
+
|
|
437
|
+
# Clear existing tree
|
|
438
|
+
tree.clear()
|
|
439
|
+
|
|
440
|
+
# Automatically expand the root node
|
|
441
|
+
tree.root.expand()
|
|
442
|
+
|
|
443
|
+
# Get all files in the repository with their statuses
|
|
444
|
+
file_data = self.git_sidebar.collect_file_data()
|
|
445
|
+
file_tree = self.git_sidebar.get_file_tree()
|
|
446
|
+
|
|
447
|
+
# Sort file_tree so directories are processed first
|
|
448
|
+
file_tree.sort(key=lambda x: (x[1] != "directory", x[0]))
|
|
449
|
+
|
|
450
|
+
# Keep track of created directory nodes to avoid duplicates
|
|
451
|
+
directory_nodes = {"": tree.root} # Empty string maps to root node
|
|
452
|
+
|
|
453
|
+
# Add all files and directories
|
|
454
|
+
for file_path, file_type, git_status in file_tree:
|
|
455
|
+
parts = file_path.split('/')
|
|
456
|
+
|
|
457
|
+
for i in range(len(parts)):
|
|
458
|
+
# For directories, we need to process all parts
|
|
459
|
+
# For files, we need to process all parts except the last one (handled separately)
|
|
460
|
+
if file_type == "directory" or i < len(parts) - 1:
|
|
461
|
+
parent_path = "/".join(parts[:i])
|
|
462
|
+
current_path = "/".join(parts[:i+1])
|
|
463
|
+
|
|
464
|
+
# Create node if it doesn't exist
|
|
465
|
+
if current_path not in directory_nodes:
|
|
466
|
+
parent_node = directory_nodes[parent_path]
|
|
467
|
+
new_node = parent_node.add(parts[i], expand=True)
|
|
468
|
+
new_node.label.stylize("bold #bb9af7") # Color directories with accent color
|
|
469
|
+
directory_nodes[current_path] = new_node
|
|
470
|
+
|
|
471
|
+
# For files, add as leaf node under the appropriate directory
|
|
472
|
+
if file_type == "file":
|
|
473
|
+
# Get the parent directory node
|
|
474
|
+
parent_dir_path = "/".join(parts[:-1])
|
|
475
|
+
parent_node = directory_nodes[parent_dir_path] if parent_dir_path else tree.root
|
|
476
|
+
|
|
477
|
+
leaf_node = parent_node.add_leaf(parts[-1], data={"path": file_path, "status": git_status})
|
|
478
|
+
# Apply specific text colors based on git status
|
|
479
|
+
if git_status == "staged":
|
|
480
|
+
leaf_node.label.stylize("bold #9ece6a")
|
|
481
|
+
elif git_status == "modified":
|
|
482
|
+
leaf_node.label.stylize("bold #a9a1e1")
|
|
483
|
+
elif git_status == "untracked":
|
|
484
|
+
leaf_node.label.stylize("bold purple")
|
|
485
|
+
else: # unchanged
|
|
486
|
+
leaf_node.label.stylize("default")
|
|
487
|
+
|
|
488
|
+
except Exception as e:
|
|
489
|
+
# Show error in diff panel
|
|
490
|
+
try:
|
|
491
|
+
diff_content = self.query_one("#diff-content", VerticalScroll)
|
|
492
|
+
diff_content.remove_children()
|
|
493
|
+
diff_content.mount(Static(f"Error populating file tree: {e}", classes="error"))
|
|
494
|
+
except Exception:
|
|
495
|
+
# If we can't even show the error, that's okay - just continue without it
|
|
496
|
+
pass
|
|
497
|
+
|
|
428
498
|
def action_show_branch_switcher(self) -> None:
|
|
429
499
|
"""Show the branch switcher modal."""
|
|
430
500
|
modal = BranchSwitchModal(self.git_sidebar)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: octotui
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.2
|
|
4
4
|
Summary: A blazing-fast TUI replacement for GitKraken - manage your Git repos with style!
|
|
5
5
|
Project-URL: Repository, https://github.com/never-use-gui/octotui
|
|
6
6
|
Project-URL: Homepage, https://github.com/never-use-gui/octotui
|
|
@@ -5,14 +5,14 @@ octotui/diff_markdown.py,sha256=uJ-AEmnFC62042nnn7gWQNuD4wIOaCLa1VGAtADJSlY,6424
|
|
|
5
5
|
octotui/gac_config_modal.py,sha256=ylufuKOUrXxKzRiqjlbkaNwwlupv_uGMdxSJ03msxRU,13929
|
|
6
6
|
octotui/gac_integration.py,sha256=h5Lbc6SgUD9fnXLQ1ry5jRT_BI0zOURqtlEN8z2RF9M,6792
|
|
7
7
|
octotui/gac_provider_registry.py,sha256=-RQ5vY_f4C9BHjIXs-0DLFVVOAzbaGxdEXZlbuz2NvQ,6183
|
|
8
|
-
octotui/git_diff_viewer.py,sha256=
|
|
8
|
+
octotui/git_diff_viewer.py,sha256=w9M0cXny7gqDSg7CvqN-w9iYvaD1gTci-Ax8B16ZAZg,57406
|
|
9
9
|
octotui/git_status_sidebar.py,sha256=7Eoui9PXM4SIMzfUeSRgzdN6oQRSMh9K0WbHdsb9wek,34441
|
|
10
10
|
octotui/main.py,sha256=W8dPSdr1ulDXbn_Wk0bmkFVcM38A2L32kWnF6TM2yl0,310
|
|
11
11
|
octotui/octotui_logo.py,sha256=mSEbO51vsPt9LG14z8HNTjBZknPP8XC04l8qLtsn9e4,1430
|
|
12
12
|
octotui/style.tcss,sha256=Nuu4jx8Tac4Z2G78x99UUZRhGcNxB6TXFp1Jq2fJKwM,6453
|
|
13
13
|
octotui/syntax_utils.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
14
|
-
octotui-0.1.
|
|
15
|
-
octotui-0.1.
|
|
16
|
-
octotui-0.1.
|
|
17
|
-
octotui-0.1.
|
|
18
|
-
octotui-0.1.
|
|
14
|
+
octotui-0.1.2.data/data/octotui/style.tcss,sha256=Nuu4jx8Tac4Z2G78x99UUZRhGcNxB6TXFp1Jq2fJKwM,6453
|
|
15
|
+
octotui-0.1.2.dist-info/METADATA,sha256=gms_tPiG4mNm_eS8Zp_UhNvpO2qmZCLuYTfvwUXGAbg,6010
|
|
16
|
+
octotui-0.1.2.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
17
|
+
octotui-0.1.2.dist-info/entry_points.txt,sha256=MCqXQjBbXVLDjyBrhzWNvbFEU1vQ1hfSogoage2Uhh0,46
|
|
18
|
+
octotui-0.1.2.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|