summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjaseg <git@jaseg.de>2024-07-07 22:48:19 +0200
committerjaseg <git@jaseg.de>2024-07-07 22:48:19 +0200
commit93fd764482835879f2b64b7f94a6e64815c051a1 (patch)
treef473dec981432c034913cef4a14eed9f2a0b40bf
parent26e85279dc4fa41583f1ebffe7610c097ebe136d (diff)
downloadgerbonara-93fd764482835879f2b64b7f94a6e64815c051a1.tar.gz
gerbonara-93fd764482835879f2b64b7f94a6e64815c051a1.tar.bz2
gerbonara-93fd764482835879f2b64b7f94a6e64815c051a1.zip
protoboard: Add CLI
-rw-r--r--gerbonara/cli.py19
-rw-r--r--setup.py2
2 files changed, 20 insertions, 1 deletions
diff --git a/gerbonara/cli.py b/gerbonara/cli.py
index d6b93f2..93b989e 100644
--- a/gerbonara/cli.py
+++ b/gerbonara/cli.py
@@ -24,6 +24,7 @@ import re
import warnings
import json
import itertools
+import webbrowser
from pathlib import Path
from .utils import MM, Inch
@@ -33,6 +34,7 @@ from . import layers as lyr
from . import __version__
from .cad.kicad import schematic as kc_schematic
from .cad.kicad import tmtheme
+from .cad import protoserve
def _print_version(ctx, param, value):
@@ -130,6 +132,23 @@ def cli():
well as sets of those files """
pass
+@cli.group('protoboard')
+def protoboard_group():
+ pass
+
+
+@protoboard_group.command()
+@click.option('-h', '--host', default=None, help='Hostname to listen on. Defaults to localhost.')
+@click.option('-p', '--port', type=int, default=1337, help='Port to listen on. Defaults to 1337')
+def interactive(host, port):
+ ''' Launch gerbonar's interactive protoboard designer in your browser '''
+
+ if host is None:
+ @protoserve.app.before_serving
+ async def open_browser():
+ webbrowser.open_new(f'http://localhost:{port}/')
+ protoserve.app.run(host=host, port=port, use_reloader=False, debug=False)
+
@cli.group('kicad')
def kicad_group():
diff --git a/setup.py b/setup.py
index a45535c..bc82647 100644
--- a/setup.py
+++ b/setup.py
@@ -30,7 +30,7 @@ setup(
'Tracker': 'https://gitlab.com/gerbolyze/gerbonara/issues',
},
packages=find_packages(exclude=['tests']),
- install_requires=['click', 'rtree'],
+ install_requires=['click', 'rtree', 'quart'],
entry_points={
'console_scripts': [
'gerbonara = gerbonara.cli:cli',