Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a web interface for configuration & other features #123

Open
txoof opened this issue Aug 20, 2023 · 13 comments
Open

Create a web interface for configuration & other features #123

txoof opened this issue Aug 20, 2023 · 13 comments
Labels
enhancement New feature or request

Comments

@txoof
Copy link
Owner

txoof commented Aug 20, 2023

see below

@txoof txoof added the enhancement New feature or request label Aug 20, 2023
@9and3r
Copy link

9and3r commented Sep 3, 2023

  • Decide Icon for the web (Favicon at least) and main colors (used on buttons)
  • Decide if web source should be on main repo
  • Look at the timeout for plugins (It breaks the preview on web. Thread related)
  • Extract build_plugins_list function to use it only on one of the plugins
  • @9and3r (if a plugin has configurable: false should not appear on the config
  • Document allowed types in plugin config: "string", "bool", "float", "int" ("choose" property)

@txoof txoof added this to the Web Configurator milestone Sep 3, 2023
@9and3r
Copy link

9and3r commented Sep 10, 2023

  • Decide Icon for the web (Favicon at least) and main colors (used on buttons)
  • Decide if web source should be on main repo
  • Look at the timeout for plugins (It breaks the preview on web. Thread related) @txoof
  • Extract build_plugins_list function to use it only on one of the plugins @ txoof
  • @9and3r (if a plugin has configurable: false should not appear on the config
    Document allowed types in plugin config: "string", "bool", "float", "int" ("choose" property)

Branch: https://github.com/9and3r/PaperPi/tree/web_configuration

@txoof
Copy link
Owner Author

txoof commented Sep 13, 2023

@9and3r Can you give me some more examples of how the plugin_timeout breaks when you're configuring a plugin through the web interface?

I can't think of a reason it would die due to the timeout.

@9and3r
Copy link

9and3r commented Sep 13, 2023

It is not getting to the timeout. The problem is the signal library being called from another thread.

The server is running on another thread, so it calls the update function from outside the main thread.
The signal cannot be set outside of main thread according to the doc.

https://docs.python.org/3/library/signal.html
Besides, only the main thread of the main interpreter is allowed to set a new signal handler.

@9and3r
Copy link

9and3r commented Sep 13, 2023

Example python file to test this. The first runSignal will work. The second part will fail because it runs in a new thread

import signal
import time
from threading import Thread

def _alarm_handler(signum, frame):
    print("Alarm called")

def runSignal():
    signal.signal(signal.SIGALRM, _alarm_handler)
    signal.alarm(1)
    time.sleep(3)


# This will work
runSignal()

# This will fail
t = Thread(target=runSignal)
t.start()

time.sleep(3)

@txoof
Copy link
Owner Author

txoof commented Sep 17, 2023

  • add option disable signal to Plugin() class
  • refactor the configuration functions into new library

@txoof
Copy link
Owner Author

txoof commented Sep 17, 2023

  • update installer to install web_static
  • script to build web_static from source

@txoof
Copy link
Owner Author

txoof commented Sep 17, 2023

PR #136 resolves add option disable signal

@txoof
Copy link
Owner Author

txoof commented Sep 17, 2023

  • plugin class needs to push changes to resolution to the underlying layout object

@txoof
Copy link
Owner Author

txoof commented Sep 17, 2023

EpdLib still needs to be forced to recalculate all the layout dimensions. There's still an underlying bug in the Plugin() class; updating the resolution of the plugin also needs to update the resolution of the layout object attached to the plugin.

This was referenced Sep 17, 2023
@txoof
Copy link
Owner Author

txoof commented Sep 17, 2023

refactor config functions into new module in PR #138

@txoof
Copy link
Owner Author

txoof commented Sep 17, 2023

Recipe for testing out the new configuration bits

# get the command line arguments 
cla = get_cmd_line_args()

# get the configuration files - this includes a list of the config files that were ingested
cfg = get_config_files(cla)

# parse the config files 
pcfg = parse_config(cfg)

# create a plugin using the main config and a single plugin from the list of configured plugins
mp = configure_plugin(main_cfg=pcfg['main'], config=pcfg['plugins'][0], resolution=(800,600), cache=CacheFiles())

@txoof
Copy link
Owner Author

txoof commented Sep 23, 2023

  • Add functions to display user-facing functions for a plugin
  • Add function for calling user-facing functions and returning a string
    @9and3r -- anything else?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Development

No branches or pull requests

2 participants