Skip to content
This repository was archived by the owner on Jul 3, 2025. It is now read-only.

Commit 71d3e14

Browse files
Merge pull request #12 from gitxtui/feat/init-gitx-app
feat+doc: init base app, change doc site styling
2 parents 35d7366 + 6b16004 commit 71d3e14

10 files changed

Lines changed: 196 additions & 15 deletions

File tree

docs/installation.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,24 @@ Installation Guide for gitx
6565
> [!NOTE]
6666
> For further information about poetry and managing environments refer to the [poetry docs](https://python-poetry.org/docs/managing-environments/).
6767

68+
5. To install and run the `gitx` package, run the following commands:
69+
70+
```sh
71+
# Install the package in development mode
72+
poetry install
73+
74+
# Run the app using the entry point
75+
poetry run gitxtui # or simply `gitxtui` if already in poetry environment
76+
```
77+
78+
6. To build the package, run:
79+
80+
```sh
81+
poetry build
82+
83+
# This will create dist/gitxtui-<version>.tar.gz and dist/gitxtui-<version>-none-any.whl
84+
```
85+
6886
## Running Tests
6987
7088
Run the test suite using pytest:

mkdocs.yml

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ theme:
1818
# Dark mode
1919
- media: "(prefers-color-scheme: dark)"
2020
scheme: slate
21-
primary: indigo
22-
accent: indigo
21+
primary: black
22+
accent: black
2323
toggle:
24-
icon: material/brightness-4
24+
icon: material/brightness-5
2525
name: Switch to light mode
2626
features:
2727
- navigation.instant
@@ -32,10 +32,19 @@ theme:
3232
- navigation.footer
3333
- content.code.copy
3434
- toc.follow
35+
- navigation.tabs
36+
# - navigation.tabs.sticky
37+
- navigation.sections
38+
- navigation.path
39+
- toc.integrate
40+
# - navigation.expand
3541

3642
extra_css:
3743
- stylesheets/extra.css
3844

45+
extra_javascript:
46+
- javascripts/textual-theme.js
47+
3948
markdown_extensions:
4049
- pymdownx.highlight:
4150
anchor_linenums: true

poetry.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 44 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,51 @@ authors = [
1111
license = { text = "LICENSE" }
1212
readme = "README.md"
1313
requires-python = ">=3.9, <4.0"
14-
dependencies = ["textual (>=2.1.2,<3.0.0)"]
14+
dependencies = ["textual>=2.1.2,<3.0.0"]
15+
classifiers = [
16+
"Development Status :: 3 - Alpha",
17+
"Environment :: Console",
18+
"Intended Audience :: Developers",
19+
"License :: OSI Approved :: MIT License",
20+
"Programming Language :: Python :: 3",
21+
"Programming Language :: Python :: 3.9",
22+
"Programming Language :: Python :: 3.10",
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
25+
"Topic :: Software Development :: Version Control :: Git",
26+
]
27+
28+
[project.scripts]
29+
gitxtui = "gitx.main:main"
30+
31+
[project.urls]
32+
Homepage = "https://github.com/gitxtui/gitx"
33+
Documentation = "https://gitxtui.github.io/gitx/"
34+
Issues = "https://github.com/gitxtui/gitx/issues"
35+
36+
[build-system]
37+
requires = ["poetry-core>=2.0.0,<3.0.0"]
38+
build-backend = "poetry.core.masonry.api"
39+
40+
[tool.poetry]
41+
name = "gitxtui"
42+
version = "0.1.0-a1"
43+
description = "TUI based git helper"
44+
authors = [
45+
"Ayush <mail@ayuch.dev>",
46+
"Ashmit Singh <ashmit9955@gmail.com>",
47+
"Anmol Puri <anmolpuri954@gmail.com>",
48+
"Anmol Kakkar <anmolarora0014@gmail.com>",
49+
]
50+
readme = "README.md"
51+
packages = [{ include = "gitx", from = "src" }]
52+
53+
[tool.poetry.scripts]
54+
gitxtui = "gitx.main:main"
1555

16-
# [tool.poetry]
17-
# package-mode = false
56+
[tool.poetry.dependencies]
57+
python = ">=3.9,<4.0"
58+
textual = ">=2.1.2,<3.0.0"
1859

1960
[tool.poetry.group.dev.dependencies]
2061
pytest = "^8.3.5"
@@ -27,7 +68,3 @@ mkdocs-material = "^9.6.9"
2768
materialx = "^1.39.3"
2869
pymdown-extensions = "^10.14.3"
2970
material = "^0.1"
30-
31-
[build-system]
32-
requires = ["poetry-core>=2.0.0,<3.0.0"]
33-
build-backend = "poetry.core.masonry.api"

src/gitx/__init__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
"""
2+
gitx - A TUI Git helper built with Textual
3+
"""
4+
5+
__version__ = "0.1.0-a1"

src/gitx/app.py

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
from textual.app import App, ComposeResult
2+
from textual.binding import Binding
3+
from textual.containers import Container
4+
from textual.widgets import Header, Footer, Static
5+
6+
7+
class GitxApp(App):
8+
"""A TUI Git client built with Textual."""
9+
10+
CSS_PATH = "css/app.tcss"
11+
12+
BINDINGS = [
13+
Binding(key="q", action="quit", description="Quit"),
14+
Binding(key="t", action="toggle_dark", description="Toggle dark mode"),
15+
]
16+
17+
def compose(self) -> ComposeResult:
18+
"""Compose the app layout using the welcome screen."""
19+
self.theme = "flexoki" # Default theme
20+
yield Header(show_clock=True)
21+
yield Container(
22+
Static("Welcome to gitx!", classes="welcome-title"),
23+
Static("A Terminal User Interface for Git", classes="welcome-text"),
24+
Static("Press 't' to toggle theme or 'q' to quit", classes="welcome-text"),
25+
classes="welcome"
26+
)
27+
yield Footer()
28+
29+
def action_toggle_dark(self) -> None:
30+
"""Toggle between light and dark theme."""
31+
self.theme = (
32+
"flexoki" if self.theme == "catppuccin-latte" else "catppuccin-latte"
33+
)
34+
35+
def main() -> None:
36+
"""Run the app."""
37+
app = GitxApp()
38+
app.run()
39+
40+
41+
if __name__ == "__main__":
42+
main()

src/gitx/css/app.tcss

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/* Base application styles */
2+
Screen {
3+
background: $surface;
4+
color: $text;
5+
layout: vertical;
6+
}
7+
8+
Header {
9+
dock: top;
10+
height: 1;
11+
}
12+
13+
Footer {
14+
dock: bottom;
15+
height: 1;
16+
}
17+
18+
/* Common styles that apply to the whole app */
19+
.welcome {
20+
width: 100%;
21+
height: 100%;
22+
align: center middle;
23+
background: $surface;
24+
}
25+
26+
.welcome-title {
27+
text-style: bold;
28+
text-align: center;
29+
margin-bottom: 1;
30+
color: $accent;
31+
width: 100%;
32+
height: 1;
33+
}
34+
35+
.welcome-text {
36+
text-align: center;
37+
margin-bottom: 1;
38+
width: 100%;
39+
}

src/gitx/css/welcome.tcss

Whitespace-only changes.

src/gitx/main.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env python3
2+
3+
from gitx.app import main
4+
5+
if __name__ == "__main__":
6+
main()

src/gitx/screens/welcome.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""Welcome screen for gitx."""
2+
3+
from textual.app import ComposeResult
4+
from textual.containers import Container
5+
from textual.screen import Screen
6+
from textual.widgets import Header, Footer, Static
7+
8+
9+
class WelcomeScreen(Screen):
10+
"""Welcome screen displayed when the application starts."""
11+
12+
def compose(self) -> ComposeResult:
13+
"""Compose the welcome screen layout."""
14+
yield Header(show_clock=True)
15+
yield Container(classes="welcome")
16+
yield Footer()
17+
18+
def on_mount(self) -> None:
19+
"""Called when the screen is mounted."""
20+
welcome_container = self.query_one(".welcome", Container)
21+
welcome_container.mount(
22+
Static("gitx", classes="welcome-title"),
23+
Static("A Terminal User Interface for Git", classes="welcome-text"),
24+
Static("Press 't' to toggle theme or 'q' to quit", classes="welcome-text"),
25+
)

0 commit comments

Comments
 (0)