-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcontroller.py
More file actions
82 lines (71 loc) · 2.82 KB
/
controller.py
File metadata and controls
82 lines (71 loc) · 2.82 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
import dash
##
# Function to connect the variable 'app' to the Dash framework.
# this variable is used for annotating the call-back functions in other part of the application, \n
# !! this file must exist on the toplevel.
# !! otherwise content in the assets folder cannot be served with default flask settings
# DISABLE the next line when creating Sphinx documentation
app = dash.Dash(__name__,)
# ENABLE this following code section when creating Sphinx documentation
# inspired by https://github.com/plotly/dash/issues/696
# class app:
# def callback(*argument):
# def decorator(function):
# def wrapper(*args, **kwargs):
# result = function(*args, **kwargs)
# return result
# return wrapper
# return decorator
##
# Function to add the following extra layouts for the network graph.
# cose-bilkent, cola, euler, spread, dagre, klay:
# these layouts are very computation intensive.
# Use only when needed and only with small graphs
def loadextralayouts():
import dash_cytoscape as cyto
cyto.load_extra_layouts() # Load extra layouts
##
# Function to prepare and launch the dash application server.
# the port option creates a new instance to listen on the specified port.
# parallel instance are possible.
def launch(port):
"""
Takes care of Cleanup of previous interrupted runs
Prepare the Web-page layout,
Increase the loglevel of the Server to Error.
Load extra layouts
Register the callbacks
Finally the server is started
"""
import utils.filehandling
import settings.usersettings as settings
from layouts.layout import mainlayout
import settings.applicationsettings as glob
import logging
utils.filehandling.clearassetsfolder()
log = logging.getLogger('werkzeug')
log.setLevel(logging.ERROR)
app.layout = mainlayout
app.config['suppress_callback_exceptions'] = True
loadextralayouts()
# !!!!callbacks are connected to layout: Keep/Remain the following entries despite python 'unuse' warnings !!!
# these imports need to be placed -AFTER- the 'app.layout' definition
# noinspection PyUnresolvedReferences
import utils.serverlargeupload
# noinspection PyUnresolvedReferences
import utils.servershutdown
# noinspection PyUnresolvedReferences
import callbacks.call_LoadGraph
# noinspection PyUnresolvedReferences
import callbacks.call_VisualTuning
# noinspection PyUnresolvedReferences
import callbacks.call_Oracles
# noinspection PyUnresolvedReferences
import callbacks.call_Cyto
# noinspection PyUnresolvedReferences
import callbacks.call_Cytolegenda
# noinspection PyUnresolvedReferences
import callbacks.call_SelectedData
# end of dash dependent imports
app.title = glob.title
app.run_server(port=port, debug=settings.debug)