01.01. Basic Usage

This guide will walk you through the process of setting up and customizing the INI Configurator to create your own configuration editor application. The configurator allows you to design a custom graphical interface for managing .ini files by modifying fields and constants.

Step 1: Fork the Repository

  1. Navigate to the GitHub repository LaswitchTech/ini-configurator.
  2. Click the Fork button in the top-right corner to create your own copy of the repository under your GitHub account.

Step 2: Set Up a Development Branch

  1. Go to your forked repository.
  2. Create a new branch named dev:
    • In GitHub, go to the Code tab.
    • Click the branch dropdown, type dev, and select Create branch: dev.
  3. This branch will be used to compile your .exe file and manage development.

Step 3: Clone the Repository Locally

  1. Clone your forked repository using Git:
    git clone -b dev https://github.com/<your-username>/ini-configurator.git
    cd ini-configurator
  2. Verify that you are on the dev branch:
    git branch

Step 4: Customize the Application

Modify the fields.json File

The src/lib/fields.json file defines the sections and fields displayed in the configurator. Update this file to specify the .ini configuration options you want to manage.

Example: Here’s an example of a fields.json entry:

fields.json
{
    "General": {
        "appName": {
            "label": "Application Name",
            "tooltip": "The name of your application",
            "type": "text",
            "default": "MyApp",
            "required": true
        },
        "debugMode": {
            "label": "Enable Debugging",
            "tooltip": "Enable or disable debug mode",
            "type": "checkbox",
            "default": "false",
            "required": false
        }
    }
}

Update Constants in configurator.py

At the start of the src/configurator.py script, modify the constants to set your application name, .ini file name, and debugging preferences:

# Declare Constants
APP_NAME = "INI Configurator"
INI_FILE = "conf.ini"
LOG_FILE = "log.log"
ENCODING = "mbcs" if sys.platform == "win32" else "utf-8"
DEBUG = False
  • APP_NAME: Name of your application.
  • INI_FILE: Name of the .ini file that will be managed.
  • LOG_FILE: Name of the log file.
  • ENCODING: This constant sets the default encoding method for the .ini file.
  • DEBUG: Set to True for debugging during development.

Step 5: Use Utility Scripts

iconset.sh

This script converts your src/icons/icon.png file into icon formats suitable for Windows and macOS.

Usage:

  1. Place your custom icon in src/icons/icon.png.
  2. Run the script:
    ./iconset.sh
  3. The script generates the required icon files for your application.

build.sh

This script compiles the configurator for macOS. Usage: Run the script:

./build.sh

The compiled macOS .app file will be created in the dist/macos directory.

Step 6: Compile for Windows

To compile the .exe file for Windows:

  1. Push your changes to the dev branch:
    git add .
    git commit -m "Customize fields.json and constants"
    git push origin dev
  2. GitHub Actions will automatically build the .exe file. It uses the build.yml workflow in the .github/workflows/ directory.

Step 7: Test and Refine

  1. Run the application locally or test the .exe or .app files to ensure everything works as expected.
  2. Refine the fields, constants, or icons as needed.
  3. Repeat the build process after each update.

Optional: Enable Debugging

If you encounter issues during development, set DEBUG = True in src/configurator.py. This enables logging of additional details to help troubleshoot problems.

Notes

  • File Paths: Ensure all resource paths in your code (e.g., icons, stylesheets) work for both development and compiled environments. Use the self.resource_directory constant in src/configurator.py to access files dynamically.
  • Branch Management: Keep the main branch clean for releases. Use dev for development and testing.

Conclusion

By following this guide, you can easily set up, customize, and build your own version of the INI Configurator. Enjoy creating your custom configuration editor!