Skip to main content

A tool that will GUI-ify your functions

Project description

GUIfy


Simplest form of GUI for automation scripts.

Made with eel as python backend and react used as frontend.

How to use

pip install guify
# main.py
import GUIfy from guify

# Instantiate the app, variables are optional.
app = GUIfy(app_name='GUIfy', port=8080) # default app_name is 'GUIfy'

# Register the function "test_1"
# All variables are optional
# name - the name of the "test" in the gui
# priority - Sets the order of the tests, priority 0 will run before priority 1
# description - the small text description under the test's name in the gui.
@app.register(name='Test 1', priority=0, description='This is a test')
# Define the test, each argument that "test_1" requires will be automatically prompted for in the gui.
# if same arg name (example_arg) apperas on 2 different tests, it will be requested only once in the gui.
def test_1(example_arg):
    # app.monitor object represents the textarea on the right-hand side of the gui
    # app.monitor.clear_text() - sets the text to empty string
    app.monitor.clear_text()

    # app.monitor.set_text(text) - sets the text to whatever is passed to it
    app.monitor.set_text('This is a test\n')

    # app.monitor.append_text(text) - appends whatever passed to it to the textarea
    app.monitor.append_text('This is a test2\n')

    # app.prompt_user(prompt) - pops up a modal in the gui and asks user to click OK or cancel.
    # app.prompt_user will return True if user clicked OK and False if user clicked cancel
    result = app.prompt_user('This is a prompt') # True if user clicked OK, False if user clicked Cancel

    # app.config get something from config tab, acts similar to configparser
    # config stored in config.ini in the current working directory.
    foo = app.config.get('example','foo') # == bar

    # Specify the return type, this is used for report generation
    # if function returns True then test considered as Passed
    # if function returns False then test considered as Failed
    return True


# this test will be registered after test_1, because its priority arg is higher.
@app.register(name='Test 2', priority=1, description='This is the second test.')
def test_2(example_arg, second_arg):
    app.monitor.clear_text()




app.run()

Monitor object

app.monitor is the monitor object representing the preview window on right hand side of the GUI,

  • set_text(text: str) -> None // will set the text in the monitor to whatever passed in "text" argument
  • append_text(text: str) -> None // will append the next to the monitor
  • clear_text(text: str) -> None // will clear all text in the monitor

Config tab

"app.config" is an object representing the config tab. All configurations are stored in config.ini.

app.config methods:

  • save() // Save config to config.ini
  • load() // Load config from config.ini
  • get_section() // load() and return an entire section as a dictionary
  • get(section, attribute) // load() and get value of attribute in section
  • set(section, attribute, value) // load() and set value of attribute in section and then save().

Assuming this is the config file:

[example]
foo = bar

This will be the correct usage of app.config object

app.config.get_section('example') -> {'foo': 'bar'}
app.config.get('example', 'foo') -> 'bar'

Settings

in settings.ini you can change the following settings:

  • reports_dir - Optional defualt is "reports/" the directory where the reports will be saved
  • report_name_prefix - Optional: Can be one of the variables passed to registered functions, uses this variable name as identification for reports

Building

Theoretically its possible to build an executable with eel using the following:

py -m eel index.py build --onefile --noconsole --name <whatever_u_want> --icon=public/favicon.ico

Please not that this hasn't been tested yet.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

guify-0.2.6.tar.gz (379.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

guify-0.2.6-py3-none-any.whl (382.0 kB view details)

Uploaded Python 3

File details

Details for the file guify-0.2.6.tar.gz.

File metadata

  • Download URL: guify-0.2.6.tar.gz
  • Upload date:
  • Size: 379.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for guify-0.2.6.tar.gz
Algorithm Hash digest
SHA256 a2afc7be6176ba0ef5ad4474ede71dac585e738fbf28cf8fd7a8f7b7cbc44452
MD5 59bd2c0b021253d9c0eb1f73401bedd3
BLAKE2b-256 36767c04e8f6cd55f01f4492d3c7e9722356740b5fd93fb58a63f97afeb28fe1

See more details on using hashes here.

File details

Details for the file guify-0.2.6-py3-none-any.whl.

File metadata

  • Download URL: guify-0.2.6-py3-none-any.whl
  • Upload date:
  • Size: 382.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.11.3

File hashes

Hashes for guify-0.2.6-py3-none-any.whl
Algorithm Hash digest
SHA256 774c7be171e9432c75d394f5f2ccf101e334e22a37d3de048ce61125a26f7b4a
MD5 fdd360096d12db9686bc6186fd479216
BLAKE2b-256 c216b379104fb49a61f3010e042218cc45880e2dac9ffe430f7b7e9ad0125e3b

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page