Skip to content

TheGitCraft/tfUtils

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

56 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

TF Utils

A user-friendly tool that helps TFBern students manage their projects more efficiently. Perfect for both beginners and advanced users!

๐ŸŽฏ What is TF Utils?

TF Utils is an unofficial student-created tool that makes working with TFBern projects easier. It automates common tasks and helps you follow best practices, saving you time and reducing errors.

๐ŸŽ“ Made by Students, for Students: While this isn't an official TFBern tool, it's designed specifically to help fellow students with their project workflow.

๐Ÿ“ฆ Installation Guide

For Everyone (Quick Install)

  1. Download the installer

    • Go to our releases page
    • Click on tfutils_setup_vX.X.X.exe (latest version)
    • Save it to your computer
  2. Install the program

    • Double-click the downloaded installer
    • Click "Next" to begin installation
    • When asked, check "Add to PATH" โœ…
    • Click "Install"
    • Click "Finish"
  3. Start using TF Utils

    • Restart any open command prompts or terminals
    • That's it! You're ready to go! ๐ŸŽ‰

๐Ÿš€ How to Use TF Utils

Basic Usage (For Everyone)

  1. Start TF Utils

    • Open your project folder in File Explorer
    • Click in the address bar at the top
    • Type tfutils and press Enter
  2. Navigate the Menu

    • Use โ†‘ and โ†“ arrow keys to move
    • Press Enter to select an option
    • Or just press the number shown next to your choice

Example Menu

โ•ญโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€ Choose an Action: โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฎ
โ”‚ Use arrow keys to navigate, Enter to select, or press the number key โ”‚
โ”‚                                                                      โ”‚
โ”‚    1. Altium Project                                                 โ”‚
โ”‚    2. Obsidian Notes                                                 โ”‚
โ”‚    3. Office Documents                                               โ”‚
โ”‚    4. New Project                                                    โ”‚
โ”‚ -> 5. ยตVision Project                                                โ”‚
โ•ฐโ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ”€โ•ฏ

Features

  • Project Templates: Quickly create new projects with the correct structure
  • File Management: Automatically organize your project files
  • Tool Integration: Easy setup for Altium, Obsidian, Office, and ยตVision projects
  • Smart Prompts: Clear instructions guide you through each step

๐Ÿ”’ Security & Trust

We take security seriously:

  • โœ… No admin rights needed
  • โœ… Open source - you can see all the code
  • โœ… Clear build process
  • โœ… SHA256 checksums provided
  • โœ… Built by students like you

๐Ÿ› ๏ธ Developer Documentation

This section explains how to set up the development environment and contribute to TF Utils.

Prerequisites

Before you start, make sure you have these installed:

  • Python 3.10 - 3.12
  • Git
  • Inno Setup (only needed if you want to build installers)

Getting Started

  1. Fork the Repository

    • Go to TF Utils Repository
    • Click the "Fork" button in the top-right corner
    • This creates your own copy of the repository
  2. Clone Your Fork

    git clone https://github.com/[your-username]/tfUtils.git
    cd tfUtils
  3. Install Poetry (Package Manager)

    # Windows (PowerShell)
    (Invoke-WebRequest -Uri https://install.python-poetry.org -UseBasicParsing).Content | py -
    
    # Linux/MacOS/WSL
    curl -sSL https://install.python-poetry.org | python3 -
  4. Set Up Development Environment

    # Install project dependencies
    poetry install
    
    # Install pre-commit hooks
    poetry run pre-commit install

Development Workflow

  1. Create a Feature Branch

    # Create and switch to a new branch
    git checkout -b feature/my-new-feature
  2. Make Your Changes

    • Write your code
    • Add new tests if needed
    • Update documentation if needed
  3. Test Your Changes

    # Run the program locally
    poetry run python main.py
    
    # Run pre-commit checks (REQUIRED)
    poetry run pre-commit run --all-files
  4. Commit and Push

    # Add your changes
    git add .
    
    # Commit with a descriptive message
    git commit -m "feat: add my new feature"
    
    # Push to your fork
    git push origin feature/my-new-feature
  5. Create a Pull Request

    • Go to the original TF Utils Repository
    • Click "Pull requests"
    • Click "New Pull Request"
    • Choose your feature branch
    • Fill in the description of your changes
    • Submit the pull request
  6. Review Process

    • Wait for code review
    • Make any requested changes
    • Push new commits to your feature branch if needed
    • Once approved, your changes will be merged!

Project Structure

tfUtils/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ interfaces/    # Command implementations
โ”‚   โ”‚   โ””โ”€โ”€ ...
โ”‚   โ””โ”€โ”€ lib/           # Core utilities
โ”‚       โ”œโ”€โ”€ console.py  # User interaction
โ”‚       โ”œโ”€โ”€ utils.py    # File operations
โ”‚       โ””โ”€โ”€ paths.py    # Path handling
โ”œโ”€โ”€ build.py          # Build script
โ”œโ”€โ”€ main.py           # Entry point
โ””โ”€โ”€ pyproject.toml    # Project config

Creating New Features

TF Utils uses a simple plugin system based on Python decorators. Any function with the @interface decorator in the interfaces/ directory becomes available in the menu automatically!

Examples

  1. Simple Command
# interfaces/hello_world.py
from src.lib.console import ask_input
from src.interfaces import interface


@interface(name="Say Hello")
def say_hello():
    """A simple greeting command."""
    name = ask_input("What's your name?", "Enter your name to get a greeting")
    print(f"Hello {name}!")
  1. Subcategory Command
# interfaces/Office/create_document.py
from src.lib.console import ask_select, ask_input
from src.lib.utils import safe_copy_file
from src.interfaces import interface


@interface(name="Create Document")
def create_doc():
    """Create a new Office document from template."""
    # Show template selection
    templates = ["Letter", "Report", "Presentation"]
    choice = ask_select("Choose template:", templates)

    # Get document name
    doc_name = ask_input(
        "Document name:",
        "Enter name for your new document",
        placeholder="My Document"
    )

    # Copy template
    template_path = f"templates/office/{templates[choice].lower()}.docx"
    safe_copy_file(template_path, f"{doc_name}.docx")

The file structure determines the menu structure:

interfaces/
โ”œโ”€โ”€ hello_world.py          โ†’ Main menu: "Say Hello"
โ””โ”€โ”€ Office/                 โ†’ Creates "Office" submenu
    โ””โ”€โ”€ create_document.py  โ†’ Submenu item: "Create Document"

Key Components

Console Utilities (console.py)

def ask_select(prompt: str, choices: list[str], default: int = 0) -> int:
    """Display an interactive selection menu."""


def ask_input(question: str, description: str, placeholder: str = "",
              regex: str = None, error_message: str = None) -> str:
    """Display an interactive text input prompt with validation."""


def ask_yes_no(question: str, description: str = "") -> bool:
    """Display an interactive Yes/No selection menu."""

File Operations (utils.py)

def safe_copy_file(source: PathLike, destination: PathLike) -> None:
    """Safely copy a file with error handling."""


def safe_copy_directory(source: PathLike, destination: PathLike) -> None:
    """Safely copy a directory with error handling."""


def get_copied_files(directory: PathLike) -> List[Path]:
    """Get list of files in a directory."""


def safe_download(url: str, destination: PathLike) -> Tuple[Optional[Path], Optional[str]]:
    """Safely download a file with error handling."""

Path Handling (paths.py)

class NetworkPath:
    """Handle Windows network paths with validation."""

Interface Decorator

@interface(name

: str, activate: bool = True)
"""Mark and name interface functions for the menu system."""

Code Quality

We use these tools to maintain code quality:

  • black for formatting
  • isort for import sorting
  • ruff for linting
  • pre-commit for git hooks

Building from Source

poetry run python build.py
# Creates installer in dist/tfutils_setup_v[version].exe

๐Ÿ’ฌ Support & Community

Need help? We're here:

๐Ÿ“„ License

TF Utils is licensed under the GNU GPL v3.0. This means you can:

  • โœ… Use the software for any purpose
  • โœ… Study how it works and modify it
  • โœ… Share the software with others
  • โœ… Share your modifications

Full License Text

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 98.2%
  • Batchfile 1.3%
  • CMake 0.5%