summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJules Laplace <julescarbon@gmail.com>2020-07-10 21:29:14 +0200
committerJules Laplace <julescarbon@gmail.com>2020-07-10 21:29:14 +0200
commitcc465329a2261b7db11c12665cab62affb266592 (patch)
treeb97dc7bd7f8e51755268ab04a0d2ef23e584ebe2
parent0a341a1f6e1d805143dc13e56bc67394840118b4 (diff)
start with the mouseenter, and the export ;)
-rw-r--r--cli/app/settings/app_cfg.py1
-rw-r--r--cli/commands/site/export.py38
-rw-r--r--frontend/views/graph/components/graph.editor.js9
-rw-r--r--frontend/views/graph/components/page.handle.js4
4 files changed, 51 insertions, 1 deletions
diff --git a/cli/app/settings/app_cfg.py b/cli/app/settings/app_cfg.py
index 14f2efc..0d724c7 100644
--- a/cli/app/settings/app_cfg.py
+++ b/cli/app/settings/app_cfg.py
@@ -32,6 +32,7 @@ load_dotenv(dotenv_path=fp_env)
CLICK_GROUPS = {
# 'process': 'commands/process',
+ 'site': 'commands/site',
'db': '',
'flask': '',
}
diff --git a/cli/commands/site/export.py b/cli/commands/site/export.py
new file mode 100644
index 0000000..8212f55
--- /dev/null
+++ b/cli/commands/site/export.py
@@ -0,0 +1,38 @@
+import click
+
+from app.settings import app_cfg
+
+@click.command('info')
+@click.option('-g', '--graph', 'opt_graph_path', required=True,
+ help='Graph name')
+@click.option('-o', '--output', 'opt_output_dir', required=True, default=app_cfg.DIR_EXPORTS,
+ help='Output dir')
+@click.pass_context
+def cli(ctx, opt_graph_path, opt_output_dir):
+ """Export a graph"""
+
+ # ------------------------------------------------
+ # imports
+
+ from os.path import join
+
+ from app.sql.common import db, Session, Graph, Page, Tile
+
+ # ------------------------------------------------
+ # generate HTML for all pages
+
+ session = Session()
+ graph = session.query(Graph).filter(Graph.path == opt_graph_path).first()
+ if graph is None:
+ print(f"Not a graph: {opt_graph_path}")
+ return
+
+ for page in graph.pages:
+ page_path = f'{graph.path}/{page.path}'
+ if page.id == graph.home_page_id:
+ print(f'/{page_path} [index]')
+ else:
+ print(f'/{page_path}')
+ #
+ # ------------------------------------------------
+ # cat all the relevant CSS from the main site
diff --git a/frontend/views/graph/components/graph.editor.js b/frontend/views/graph/components/graph.editor.js
index 99c5665..a5c7c45 100644
--- a/frontend/views/graph/components/graph.editor.js
+++ b/frontend/views/graph/components/graph.editor.js
@@ -38,6 +38,8 @@ class GraphEditor extends Component {
this.handleMouseMove = this.handleMouseMove.bind(this)
this.handleMouseUp = this.handleMouseUp.bind(this)
this.handleWindowResize = this.handleWindowResize.bind(this)
+ this.handleMouseEnter = this.handleMouseEnter.bind(this)
+ this.handleMouseLeave = this.handleMouseLeave.bind(this)
this.graphRef = React.createRef()
this.measurements = {}
}
@@ -158,6 +160,11 @@ class GraphEditor extends Component {
actions.page.update(updatedPage)
}
+ handleMouseEnter(e, page) {
+ }
+ handleMouseLeave(e, page) {
+ }
+
render(){
// console.log(this.props.graph.show.res)
const { page: currentPage, box, measurements } = this.state
@@ -180,6 +187,8 @@ class GraphEditor extends Component {
bounds={this.state.bounds}
box={currentPage && page.id === currentPage.id && box}
onMouseDown={e => this.handleMouseDown(e, page)}
+ onMouseEnter={e => this.handleMouseEnter(e, page)}
+ onMouseLeave={e => this.handleMouseLeave(e, page)}
onMeasure={measurement => this.addMeasurement(measurement)}
/>
))}
diff --git a/frontend/views/graph/components/page.handle.js b/frontend/views/graph/components/page.handle.js
index be05a1a..7093399 100644
--- a/frontend/views/graph/components/page.handle.js
+++ b/frontend/views/graph/components/page.handle.js
@@ -23,7 +23,7 @@ export default class PageHandle extends Component {
this.props.onMeasure({ id, width, height })
}
render() {
- const { graph, page, bounds, box, onMouseDown } = this.props
+ const { graph, page, bounds, box, onMouseDown, onMouseEnter, onMouseLeave } = this.props
let style;
if (box) {
style = {
@@ -46,6 +46,8 @@ export default class PageHandle extends Component {
className={className}
ref={this.ref}
onMouseDown={onMouseDown}
+ onMouseEnter={onMouseEnter}
+ onMouseLeave={onMouseLeave}
onDoubleClick={() => history.push(url)}
style={style}
>