-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#271 moved web-based GUI infrastructure to soma-base
- Loading branch information
Showing
7 changed files
with
37 additions
and
586 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,39 @@ | ||
# -*- coding: utf-8 -*- | ||
import sys | ||
from soma.qt_gui.qt_backend import Qt | ||
|
||
from capsul.web import CapsulBrowserWindow | ||
from ..api import Capsul | ||
from . import CapsulRoutes, CapsulBackend | ||
|
||
# Parameters common to Qt and Web server handlers | ||
handler_kwargs = dict( | ||
routes=CapsulRoutes(), | ||
backend=CapsulBackend(), | ||
static='capsul.ui', | ||
templates='capsul.ui', | ||
capsul=Capsul(), | ||
title='Capsul' | ||
) | ||
|
||
# import http, http.server | ||
# from capsul.web import CapsulHTTPHandler | ||
def web_server_gui(): | ||
import http, http.server | ||
from soma.web import SomaHTTPHandler | ||
|
||
# class Handler(CapsulHTTPHandler, base_url='http://localhost:8080'): | ||
# pass | ||
# httpd = http.server.HTTPServer(('', 8080), Handler) | ||
# httpd.serve_forever() | ||
class Handler(SomaHTTPHandler, base_url='http://localhost:8080', **handler_kwargs): | ||
pass | ||
httpd = http.server.HTTPServer(('', 8080), Handler) | ||
httpd.serve_forever() | ||
|
||
def qt_web_gui(): | ||
import sys | ||
from soma.qt_gui.qt_backend import Qt | ||
from soma.web import SomaBrowserWindow | ||
|
||
app = Qt.QApplication(sys.argv) | ||
w = SomaBrowserWindow( | ||
starting_url='soma://dashboard', | ||
window_title='Capsul dashboard', | ||
**handler_kwargs | ||
) | ||
w.showMaximized() | ||
app.exec_() | ||
|
||
app = Qt.QApplication(sys.argv) | ||
w = CapsulBrowserWindow() | ||
w.show() | ||
app.exec_() | ||
qt_web_gui() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
{% extends 'layout.html' %} | ||
{%block body %} | ||
{% block body %} | ||
<h1>Capsul engines</h1> | ||
|
||
<table> | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,6 @@ | ||
<!doctype html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1"> | ||
<title>{{title or 'Capsul'}}</title> | ||
{% extends 'soma_layout.html' %} | ||
{%- block head%} | ||
<link rel="icon" href="{{base_url}}/static/favicon.svg" type="image/svg+xml"> | ||
<link rel="stylesheet" href="{{base_url}}/static/capsul.css"> | ||
<script>const backend_ready = new CustomEvent('backend_ready');</script> | ||
{%- if server_type=='qt' %} | ||
<script type="text/javascript" src="qrc:///qtwebchannel/qwebchannel.js"></script> | ||
<script type="text/javascript" src="{{base_url}}/qt_backend.js"></script> | ||
{%- else %} | ||
<script type="text/javascript" src="{{base_url}}/html_backend.js"></script> | ||
{%- endif %} | ||
{% block head -%} | ||
{%- endblock %} | ||
</head> | ||
|
||
<body> | ||
{% block body -%} | ||
{%- endblock %} | ||
{% block script -%} | ||
{%- endblock %} | ||
</body> | ||
</html> | ||
|
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.