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.5a0.tar.gz (12.1 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.5a0-py3-none-any.whl (11.9 kB view details)

Uploaded Python 3

File details

Details for the file guify-0.2.5a0.tar.gz.

File metadata

  • Download URL: guify-0.2.5a0.tar.gz
  • Upload date:
  • Size: 12.1 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.5a0.tar.gz
Algorithm Hash digest
SHA256 a8d1a47492d0dff4b83c9bea9d27653a5ff288c67aba0e2b488ce04ea45680bc
MD5 54d118b12fe995f9140bd24a15b7ad4e
BLAKE2b-256 1c7535718a2c05d82e34ef7751209242ec34410a4a004aea882e30069cde7a93

See more details on using hashes here.

File details

Details for the file guify-0.2.5a0-py3-none-any.whl.

File metadata

  • Download URL: guify-0.2.5a0-py3-none-any.whl
  • Upload date:
  • Size: 11.9 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.5a0-py3-none-any.whl
Algorithm Hash digest
SHA256 d91d8c8bd62a02dffaed8667faf9bb97f25af792ee8f5d1f34959e041ac82985
MD5 55a767a483badb99eeb1c052177b3e8e
BLAKE2b-256 a4559893b2bad2ceb2df7db2b60d367e2b8b515119dac6963e00f53b2edf3982

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