From 845e1388e20ea04e58860e6d13b81cb4ab471621 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Lukas=20M=C3=BCller?= <l.muller@student.tudelft.nl>
Date: Wed, 24 May 2017 02:04:27 +0200
Subject: [PATCH] Added option to interface

Former-commit-id: a51a53ba0f29eeb6b4c96bc449924913563c46a2
---
 kadmos/interface/interface.log                | 176 ------------------
 kadmos/interface/interface.py                 |  15 +-
 .../interface/static/bootstrap-toggle.min.css |  28 +++
 .../interface/static/bootstrap-toggle.min.js  |   9 +
 kadmos/interface/templates/view.html          |  71 ++++---
 5 files changed, 87 insertions(+), 212 deletions(-)
 delete mode 100644 kadmos/interface/interface.log
 create mode 100644 kadmos/interface/static/bootstrap-toggle.min.css
 create mode 100644 kadmos/interface/static/bootstrap-toggle.min.js

diff --git a/kadmos/interface/interface.log b/kadmos/interface/interface.log
deleted file mode 100644
index a59511921..000000000
--- a/kadmos/interface/interface.log
+++ /dev/null
@@ -1,176 +0,0 @@
-INFO: 2017-05-23 23:36:27,665  * Restarting with stat
-WARNING: 2017-05-23 23:36:28,638  * Debugger is active!
-INFO: 2017-05-23 23:36:28,638  * Debugger pin code: 161-058-028
-INFO: 2017-05-23 23:36:28,645  * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)
-INFO: 2017-05-23 23:36:53,210 127.0.0.1 - - [23/May/2017 23:36:53] "GET / HTTP/1.1" 200 -
-INFO: 2017-05-23 23:36:55,244 Loading the CMDOWS file c:\users\lukas\appdata\local\temp\tmp65ojgs\input.xml...
-INFO: 2017-05-23 23:36:57,230 Checking FundamentalProblemGraph...
-INFO: 2017-05-23 23:36:57,230 Logging general checking info...
-INFO: 2017-05-23 23:36:57,232 Name: None
-INFO: 2017-05-23 23:36:57,232 Number of nodes: 16
-INFO: 2017-05-23 23:36:57,232 Number of functions: 6
-INFO: 2017-05-23 23:36:57,232 Number of variables: 10
-INFO: 2017-05-23 23:36:57,232 Number of edges: 22
-INFO: 2017-05-23 23:36:57,232 Successfully logged general checking info.
-INFO: 2017-05-23 23:36:57,232 Performing category A checks...
-INFO: 2017-05-23 23:36:57,233 Successfully performed 5 category A checks.
-INFO: 2017-05-23 23:36:57,233 Performing category B checks...
-INFO: 2017-05-23 23:36:57,234 Successfully performed 9 category B checks.
-INFO: 2017-05-23 23:36:57,234 Performing category C checks...
-INFO: 2017-05-23 23:36:57,236 Successfully performed 12 category C checks.
-INFO: 2017-05-23 23:36:57,236 Successfully checked FundamentalProblemGraph.
-INFO: 2017-05-23 23:36:57,236 The graph generated from the loaded file is a valid KADMOS graph.
-INFO: 2017-05-23 23:36:57,236 Successfully loaded the CMDOWS file c:\users\lukas\appdata\local\temp\tmp65ojgs\input.xml.
-INFO: 2017-05-23 23:36:57,236 Checking FundamentalProblemGraph...
-INFO: 2017-05-23 23:36:57,237 Logging general checking info...
-INFO: 2017-05-23 23:36:57,237 Name: None
-INFO: 2017-05-23 23:36:57,237 Number of nodes: 16
-INFO: 2017-05-23 23:36:57,237 Number of functions: 6
-INFO: 2017-05-23 23:36:57,237 Number of variables: 10
-INFO: 2017-05-23 23:36:57,237 Number of edges: 22
-INFO: 2017-05-23 23:36:57,237 Successfully logged general checking info.
-INFO: 2017-05-23 23:36:57,237 Performing category A checks...
-INFO: 2017-05-23 23:36:57,240 Successfully performed 5 category A checks.
-INFO: 2017-05-23 23:36:57,240 Performing category B checks...
-INFO: 2017-05-23 23:36:57,240 Successfully performed 9 category B checks.
-INFO: 2017-05-23 23:36:57,240 Performing category C checks...
-INFO: 2017-05-23 23:36:57,243 Successfully performed 12 category C checks.
-INFO: 2017-05-23 23:36:57,243 Successfully checked FundamentalProblemGraph.
-INFO: 2017-05-23 23:36:57,243 The graph to be saved is a valid KADMOS graph.
-INFO: 2017-05-23 23:36:57,243 Saving the KDMS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.kdms...
-INFO: 2017-05-23 23:36:57,243 Successfully saved the KDMS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.kdms.
-INFO: 2017-05-23 23:36:57,246 127.0.0.1 - - [23/May/2017 23:36:57] "GET /examples/sellar_problem/CMDOWS/FPG_MDF-J.xml HTTP/1.1" 302 -
-INFO: 2017-05-23 23:36:57,269 Loading the KDMS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.kdms...
-INFO: 2017-05-23 23:36:57,269 Checking FundamentalProblemGraph...
-INFO: 2017-05-23 23:36:57,272 Logging general checking info...
-INFO: 2017-05-23 23:36:57,272 Name: None
-INFO: 2017-05-23 23:36:57,273 Number of nodes: 16
-INFO: 2017-05-23 23:36:57,273 Number of functions: 6
-INFO: 2017-05-23 23:36:57,273 Number of variables: 10
-INFO: 2017-05-23 23:36:57,273 Number of edges: 22
-INFO: 2017-05-23 23:36:57,273 Successfully logged general checking info.
-INFO: 2017-05-23 23:36:57,273 Performing category A checks...
-INFO: 2017-05-23 23:36:57,276 Successfully performed 5 category A checks.
-INFO: 2017-05-23 23:36:57,276 Performing category B checks...
-INFO: 2017-05-23 23:36:57,278 Successfully performed 9 category B checks.
-INFO: 2017-05-23 23:36:57,278 Performing category C checks...
-INFO: 2017-05-23 23:36:57,279 Successfully performed 12 category C checks.
-INFO: 2017-05-23 23:36:57,279 Successfully checked FundamentalProblemGraph.
-INFO: 2017-05-23 23:36:57,279 The graph generated from the loaded file is a valid KADMOS graph.
-INFO: 2017-05-23 23:36:57,279 Successfully loaded the KDMS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.kdms.
-INFO: 2017-05-23 23:36:57,296 127.0.0.1 - - [23/May/2017 23:36:57] "GET /tmp65ojgs?message=Here+we+go%21+You+just+uploaded+a+KADMOS+graph+file.+The+graph+was+imported+successfully. HTTP/1.1" 200 -
-INFO: 2017-05-23 23:36:59,207 Loading the KDMS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.kdms...
-INFO: 2017-05-23 23:36:59,211 Loading the KDMS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.kdms...
-INFO: 2017-05-23 23:36:59,214 Checking FundamentalProblemGraph...
-INFO: 2017-05-23 23:36:59,220 Logging general checking info...
-INFO: 2017-05-23 23:36:59,220 Name: None
-INFO: 2017-05-23 23:36:59,220 Number of nodes: 16
-INFO: 2017-05-23 23:36:59,220 Number of functions: 6
-INFO: 2017-05-23 23:36:59,220 Number of variables: 10
-INFO: 2017-05-23 23:36:59,220 Number of edges: 22
-INFO: 2017-05-23 23:36:59,220 Successfully logged general checking info.
-INFO: 2017-05-23 23:36:59,221 Performing category A checks...
-INFO: 2017-05-23 23:36:59,230 Successfully performed 5 category A checks.
-INFO: 2017-05-23 23:36:59,230 Performing category B checks...
-INFO: 2017-05-23 23:36:59,234 Successfully performed 9 category B checks.
-INFO: 2017-05-23 23:36:59,234 Performing category C checks...
-INFO: 2017-05-23 23:36:59,243 Successfully performed 12 category C checks.
-INFO: 2017-05-23 23:36:59,243 Successfully checked FundamentalProblemGraph.
-INFO: 2017-05-23 23:36:59,243 The graph generated from the loaded file is a valid KADMOS graph.
-INFO: 2017-05-23 23:36:59,243 Successfully loaded the KDMS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.kdms.
-INFO: 2017-05-23 23:36:59,243 Checking FundamentalProblemGraph...
-INFO: 2017-05-23 23:36:59,246 Logging general checking info...
-INFO: 2017-05-23 23:36:59,246 Name: None
-INFO: 2017-05-23 23:36:59,246 Number of nodes: 16
-INFO: 2017-05-23 23:36:59,246 Number of functions: 6
-INFO: 2017-05-23 23:36:59,246 Number of variables: 10
-INFO: 2017-05-23 23:36:59,246 Number of edges: 22
-INFO: 2017-05-23 23:36:59,246 Successfully logged general checking info.
-INFO: 2017-05-23 23:36:59,246 Performing category A checks...
-INFO: 2017-05-23 23:36:59,250 Successfully performed 5 category A checks.
-INFO: 2017-05-23 23:36:59,250 Performing category B checks...
-INFO: 2017-05-23 23:36:59,250 Successfully performed 9 category B checks.
-INFO: 2017-05-23 23:36:59,250 Performing category C checks...
-INFO: 2017-05-23 23:36:59,253 Successfully performed 12 category C checks.
-INFO: 2017-05-23 23:36:59,253 Successfully checked FundamentalProblemGraph.
-INFO: 2017-05-23 23:36:59,253 The graph generated from the loaded file is a valid KADMOS graph.
-INFO: 2017-05-23 23:36:59,253 Successfully loaded the KDMS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.kdms.
-INFO: 2017-05-23 23:36:59,865 127.0.0.1 - - [23/May/2017 23:36:59] "GET /tmp65ojgs/vispack HTTP/1.1" 200 -
-INFO: 2017-05-23 23:37:00,244 127.0.0.1 - - [23/May/2017 23:37:00] "GET /tmp65ojgs/vispackstatus HTTP/1.1" 200 -
-INFO: 2017-05-23 23:37:01,128 Loading the KDMS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.kdms...
-INFO: 2017-05-23 23:37:01,128 Checking FundamentalProblemGraph...
-INFO: 2017-05-23 23:37:01,130 Logging general checking info...
-INFO: 2017-05-23 23:37:01,130 Name: None
-INFO: 2017-05-23 23:37:01,130 Number of nodes: 16
-INFO: 2017-05-23 23:37:01,130 Number of functions: 6
-INFO: 2017-05-23 23:37:01,130 Number of variables: 10
-INFO: 2017-05-23 23:37:01,130 Number of edges: 22
-INFO: 2017-05-23 23:37:01,130 Successfully logged general checking info.
-INFO: 2017-05-23 23:37:01,130 Performing category A checks...
-INFO: 2017-05-23 23:37:01,131 Successfully performed 5 category A checks.
-INFO: 2017-05-23 23:37:01,132 Performing category B checks...
-INFO: 2017-05-23 23:37:01,132 Successfully performed 9 category B checks.
-INFO: 2017-05-23 23:37:01,132 Performing category C checks...
-INFO: 2017-05-23 23:37:01,134 Successfully performed 12 category C checks.
-INFO: 2017-05-23 23:37:01,135 Successfully checked FundamentalProblemGraph.
-INFO: 2017-05-23 23:37:01,135 The graph generated from the loaded file is a valid KADMOS graph.
-INFO: 2017-05-23 23:37:01,135 Successfully loaded the KDMS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.kdms.
-INFO: 2017-05-23 23:37:01,135 Creating the (X)DSM file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.pdf...
-INFO: 2017-05-23 23:37:05,253 Loading the KDMS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.kdms...
-INFO: 2017-05-23 23:37:05,255 Checking FundamentalProblemGraph...
-INFO: 2017-05-23 23:37:05,256 Logging general checking info...
-INFO: 2017-05-23 23:37:05,256 Name: None
-INFO: 2017-05-23 23:37:05,256 Number of nodes: 16
-INFO: 2017-05-23 23:37:05,256 Number of functions: 6
-INFO: 2017-05-23 23:37:05,256 Number of variables: 10
-INFO: 2017-05-23 23:37:05,256 Number of edges: 22
-INFO: 2017-05-23 23:37:05,256 Successfully logged general checking info.
-INFO: 2017-05-23 23:37:05,256 Performing category A checks...
-INFO: 2017-05-23 23:37:05,259 Successfully performed 5 category A checks.
-INFO: 2017-05-23 23:37:05,259 Performing category B checks...
-INFO: 2017-05-23 23:37:05,260 Successfully performed 9 category B checks.
-INFO: 2017-05-23 23:37:05,260 Performing category C checks...
-INFO: 2017-05-23 23:37:05,263 Successfully performed 12 category C checks.
-INFO: 2017-05-23 23:37:05,263 Successfully checked FundamentalProblemGraph.
-INFO: 2017-05-23 23:37:05,263 The graph generated from the loaded file is a valid KADMOS graph.
-INFO: 2017-05-23 23:37:05,263 Successfully loaded the KDMS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.kdms.
-INFO: 2017-05-23 23:37:06,265 127.0.0.1 - - [23/May/2017 23:37:06] "GET /tmp65ojgs/vispackstatus HTTP/1.1" 200 -
-INFO: 2017-05-23 23:37:07,088 Successfully created the (X)DSM file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.pdf.
-INFO: 2017-05-23 23:37:07,094 127.0.0.1 - - [23/May/2017 23:37:07] "GET /tmp65ojgs/pdf HTTP/1.1" 200 -
-INFO: 2017-05-23 23:37:12,391 Loading the KDMS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.kdms...
-INFO: 2017-05-23 23:37:12,391 Checking FundamentalProblemGraph...
-INFO: 2017-05-23 23:37:12,391 Logging general checking info...
-INFO: 2017-05-23 23:37:12,391 Name: None
-INFO: 2017-05-23 23:37:12,391 Number of nodes: 16
-INFO: 2017-05-23 23:37:12,391 Number of functions: 6
-INFO: 2017-05-23 23:37:12,391 Number of variables: 10
-INFO: 2017-05-23 23:37:12,391 Number of edges: 22
-INFO: 2017-05-23 23:37:12,392 Successfully logged general checking info.
-INFO: 2017-05-23 23:37:12,392 Performing category A checks...
-INFO: 2017-05-23 23:37:12,394 Successfully performed 5 category A checks.
-INFO: 2017-05-23 23:37:12,394 Performing category B checks...
-INFO: 2017-05-23 23:37:12,394 Successfully performed 9 category B checks.
-INFO: 2017-05-23 23:37:12,394 Performing category C checks...
-INFO: 2017-05-23 23:37:12,397 Successfully performed 12 category C checks.
-INFO: 2017-05-23 23:37:12,397 Successfully checked FundamentalProblemGraph.
-INFO: 2017-05-23 23:37:12,397 The graph generated from the loaded file is a valid KADMOS graph.
-INFO: 2017-05-23 23:37:12,397 Successfully loaded the KDMS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.kdms.
-INFO: 2017-05-23 23:37:12,397 Checking FundamentalProblemGraph...
-INFO: 2017-05-23 23:37:12,398 Logging general checking info...
-INFO: 2017-05-23 23:37:12,398 Name: None
-INFO: 2017-05-23 23:37:12,398 Number of nodes: 16
-INFO: 2017-05-23 23:37:12,400 Number of functions: 6
-INFO: 2017-05-23 23:37:12,400 Number of variables: 10
-INFO: 2017-05-23 23:37:12,400 Number of edges: 22
-INFO: 2017-05-23 23:37:12,400 Successfully logged general checking info.
-INFO: 2017-05-23 23:37:12,400 Performing category A checks...
-INFO: 2017-05-23 23:37:12,403 Successfully performed 5 category A checks.
-INFO: 2017-05-23 23:37:12,403 Performing category B checks...
-INFO: 2017-05-23 23:37:12,403 Successfully performed 9 category B checks.
-INFO: 2017-05-23 23:37:12,403 Performing category C checks...
-INFO: 2017-05-23 23:37:12,404 Successfully performed 12 category C checks.
-INFO: 2017-05-23 23:37:12,404 Successfully checked FundamentalProblemGraph.
-INFO: 2017-05-23 23:37:12,404 The graph to be saved is a valid KADMOS graph.
-INFO: 2017-05-23 23:37:12,404 Saving the CMDOWS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.xml...
-INFO: 2017-05-23 23:37:12,496 Successfully saved the CMDOWS file c:\users\lukas\appdata\local\temp\tmp65ojgs\graph.xml.
-INFO: 2017-05-23 23:37:12,500 127.0.0.1 - - [23/May/2017 23:37:12] "GET /tmp65ojgs/cmdows HTTP/1.1" 200 -
diff --git a/kadmos/interface/interface.py b/kadmos/interface/interface.py
index a5b562dc7..bb91a4bd2 100644
--- a/kadmos/interface/interface.py
+++ b/kadmos/interface/interface.py
@@ -9,13 +9,10 @@ from flask import Flask, request, redirect, url_for, send_file, render_template,
 from kadmos.graph import *
 
 
-# TODO add pretty print option
-
-
 # Initial settings
 logger = logging.getLogger(__name__)
 app = Flask(__name__)
-app.debug = True
+# app.debug = True
 
 
 # Initial variables
@@ -118,13 +115,16 @@ def view(temp_id=None, action=None, error=None, message=None):
                              mpg=mpg)
         return send_file(os.path.join(temp_dir, 'graph.pdf'))
     if action == 'cmdows':
-        if not os.path.exists(os.path.join(temp_dir, 'graph.xml')):
+        pretty_print = bool(request.args.get('pretty_print', False))
+        reset = bool(request.args.get('reset', False))
+        if not os.path.exists(os.path.join(temp_dir, 'graph.xml')) or reset:
             graph.save('graph',
                        file_type='cmdows',
                        destination_folder=temp_dir,
                        description='CMDOWS file created with the KADMOS interface',
                        creator='KADMOS interface',
                        version='1.0',
+                       pretty_print=pretty_print,
                        mpg=mpg)
         return send_file(os.path.join(temp_dir, 'graph.xml'), as_attachment=True)
     if action == 'vispack':
@@ -150,7 +150,10 @@ def view(temp_id=None, action=None, error=None, message=None):
                 yield "data:" + str(status) + "\n\n"
         return Response(get_status(), mimetype='text/event-stream')
     if action == 'delete':
-        shutil.rmtree(temp_dir)
+        try:
+            shutil.rmtree(temp_dir)
+        except OSError:
+            pass
         return redirect(url_for('index', message='All files were deleted.'))
     return render_template('view.html', temp_id=temp_id, graph=graph, error=error, message=message)
 
diff --git a/kadmos/interface/static/bootstrap-toggle.min.css b/kadmos/interface/static/bootstrap-toggle.min.css
new file mode 100644
index 000000000..abd1c8ce5
--- /dev/null
+++ b/kadmos/interface/static/bootstrap-toggle.min.css
@@ -0,0 +1,28 @@
+/*! ========================================================================
+ * Bootstrap Toggle: bootstrap-toggle.css v2.0.0
+ * http://www.bootstraptoggle.com
+ * ========================================================================
+ * Copyright 2014 Min Hur, The New York Times Company
+ * Licensed under MIT
+ * ======================================================================== */
+.checkbox label .toggle,.checkbox-inline .toggle{margin-left:-20px;margin-right:5px}
+.toggle{position:relative;overflow:hidden}
+.toggle input[type=checkbox]{display:none}
+.toggle-group{position:absolute;width:200%;top:0;bottom:0;left:0;transition:left .35s;-webkit-transition:left .35s;-moz-user-select:none;-webkit-user-select:none}
+.toggle.off .toggle-group{left:-100%}
+.toggle-on{position:absolute;top:0;bottom:0;left:0;right:50%;margin:0;border:0;border-radius:0}
+.toggle-off{position:absolute;top:0;bottom:0;left:50%;right:0;margin:0;border:0;border-radius:0}
+.toggle-handle{position:relative;margin:0 auto;padding-top:0;padding-bottom:0;height:100%;width:0;border-width:0 1px}
+.toggle.btn{min-width:59px;min-height:34px}
+.toggle-on.btn{padding-right:24px}
+.toggle-off.btn{padding-left:24px}
+.toggle.btn-lg{min-width:79px;min-height:45px}
+.toggle-on.btn-lg{padding-right:31px}
+.toggle-off.btn-lg{padding-left:31px}
+.toggle-handle.btn-lg{width:40px}
+.toggle.btn-sm{min-width:50px;min-height:30px}
+.toggle-on.btn-sm{padding-right:20px}
+.toggle-off.btn-sm{padding-left:20px}
+.toggle.btn-xs{min-width:35px;min-height:22px}
+.toggle-on.btn-xs{padding-right:12px}
+.toggle-off.btn-xs{padding-left:12px}
\ No newline at end of file
diff --git a/kadmos/interface/static/bootstrap-toggle.min.js b/kadmos/interface/static/bootstrap-toggle.min.js
new file mode 100644
index 000000000..d05310d94
--- /dev/null
+++ b/kadmos/interface/static/bootstrap-toggle.min.js
@@ -0,0 +1,9 @@
+/*! ========================================================================
+ * Bootstrap Toggle: bootstrap-toggle.js v2.0.0
+ * http://www.bootstraptoggle.com
+ * ========================================================================
+ * Copyright 2014 Min Hur, The New York Times Company
+ * Licensed under MIT
+ * ======================================================================== */
++function(a){"use strict";function b(b){return this.each(function(){var d=a(this),e=d.data("bs.toggle"),f="object"==typeof b&&b;e||d.data("bs.toggle",e=new c(this,f)),"string"==typeof b&&e[b]&&e[b]()})}var c=function(b,c){this.$element=a(b),this.options=a.extend({},this.defaults(),c),this.render()};c.VERSION="3.0.0",c.DEFAULTS={on:"On",off:"Off",onstyle:"primary",offstyle:"default",size:"normal",style:""},c.prototype.defaults=function(){return{on:this.$element.attr("data-on")||c.DEFAULTS.on,off:this.$element.attr("data-off")||c.DEFAULTS.off,onstyle:this.$element.attr("data-onstyle")||c.DEFAULTS.onstyle,offstyle:this.$element.attr("data-offstyle")||c.DEFAULTS.offstyle,size:this.$element.attr("data-size")||c.DEFAULTS.size,style:this.$element.attr("data-style")||c.DEFAULTS.style}},c.prototype.render=function(){this._onstyle="btn-"+this.options.onstyle,this._offstyle="btn-"+this.options.offstyle;var b="large"===this.options.size?"btn-lg":"small"===this.options.size?"btn-sm":"mini"===this.options.size?"btn-xs":"",c=a('<label class="btn">').html(this.options.on).addClass(this._onstyle+" "+b),d=a('<label class="btn">').html(this.options.off).addClass(this._offstyle+" "+b+" active"),e=a('<span class="toggle-handle btn btn-default">').addClass(b),f=a('<div class="toggle-group">').append(c,d,e),g=a('<div class="toggle btn" data-toggle="toggle">').addClass(this.$element.prop("checked")?this._onstyle:this._offstyle+" off").addClass(b).addClass(this.options.style);this.$element.wrap(g),a.extend(this,{$toggle:this.$element.parent(),$toggleOn:c,$toggleOff:d,$toggleGroup:f}),this.$toggle.append(f);var h=Math.max(c.outerWidth(),d.outerWidth())+e.outerWidth()/2,i=Math.max(c.outerHeight(),d.outerHeight());c.addClass("toggle-on"),d.addClass("toggle-off"),this.$toggle.css({width:h,height:i}),this.update(),this.trigger(!0)},c.prototype.toggle=function(){this.$element.prop("checked")?this.off():this.on()},c.prototype.on=function(){return this.$element.prop("disabled")?!1:(this.$toggle.removeClass(this._offstyle+" off").addClass(this._onstyle),this.$element.prop("checked",!0),void this.trigger())},c.prototype.off=function(){return this.$element.prop("disabled")?!1:(this.$toggle.removeClass(this._onstyle).addClass(this._offstyle+" off"),this.$element.prop("checked",!1),void this.trigger())},c.prototype.enable=function(){this.$toggle.removeAttr("disabled"),this.$element.prop("disabled",!1)},c.prototype.disable=function(){this.$toggle.attr("disabled","disabled"),this.$element.prop("disabled",!0)},c.prototype.update=function(){this.$element.prop("disabled")?this.disable():this.enable(),this.$element.prop("checked")?this.on():this.off()},c.prototype.trigger=function(b){this.$element.off("change.bs.toggle"),b||this.$element.change(),this.$element.on("change.bs.toggle",a.proxy(function(){this.update()},this))},c.prototype.destroy=function(){this.$element.off("change.bs.toggle"),this.$toggleGroup.remove(),this.$element.removeData("bs.toggle"),this.$element.unwrap()};var d=a.fn.bootstrapToggle;a.fn.bootstrapToggle=b,a.fn.bootstrapToggle.Constructor=c,a.fn.toggle.noConflict=function(){return a.fn.bootstrapToggle=d,this},a(function(){a("input[type=checkbox][data-toggle^=toggle]").bootstrapToggle()}),a(document).on("click.bs.toggle","div[data-toggle^=toggle]",function(b){var c=a(this).find("input[type=checkbox]");c.bootstrapToggle("toggle"),b.preventDefault()})}(jQuery);
+//# sourceMappingURL=bootstrap-toggle.min.js.map
\ No newline at end of file
diff --git a/kadmos/interface/templates/view.html b/kadmos/interface/templates/view.html
index 5cf5cc5b4..49ccce56c 100644
--- a/kadmos/interface/templates/view.html
+++ b/kadmos/interface/templates/view.html
@@ -1,6 +1,7 @@
 {% extends "base.html" %}
 {% block head %}
 <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.css">
+<link rel="stylesheet" href="{{url_for('static', filename='bootstrap-toggle.min.css')}}">
 {% endblock %}
 {% block content %}
 <div class="container">
@@ -36,7 +37,7 @@
                     </div>
                 </div>
                 <a onclick="pdf()" id="pdf">
-                    <div class="panel-footer">
+                    <div class="panel-body">
                         <span class="pull-left">Create</span>
                         <span class="pull-right"><span class="glyphicon glyphicon-arrow-right" aria-hidden="true"></span></span>
                         <div class="clearfix"></div>
@@ -56,10 +57,10 @@
                     </div>
                 </div>
                 <a onclick="vispack()" id="vispack">
-                    <div class="panel-footer">
+                    <div class="panel-body">
                         <div class="pull-left">Create</div>
                         <div class="pull-left progress progress-vispack">
-                            <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0%;"></div>
+                            <div class="progress-bar" role="progressbar" aria-valuenow="0" aria-valuemin="0" aria-valuemax="100" style="width: 0;"></div>
                         </div>
                         <span class="pull-right">
                             <span class="glyphicon glyphicon-arrow-right" aria-hidden="true"></span></span>
@@ -79,50 +80,35 @@
                         </div>
                     </div>
                 </div>
-                    <div class="panel-footer blue">
-                        <span class="pull-left">Settings</span>
-                        <div class="clear-inline">
-                            <span>Settings here</span>
-                        </div>
-                        <div class="clearfix"></div>
-                    </div>
                 <a onclick="cmdows()" id="cmdows">
-                    <div class="panel-footer">
+                    <div class="panel-body">
                         <span class="pull-left">Create</span>
                         <span class="pull-right"><span class="glyphicon glyphicon-arrow-right" aria-hidden="true"></span></span>
                         <div class="clearfix"></div>
                     </div>
                 </a>
             </div>
-            <!--
+        </div>
+    </div>
+    <div class="row">
+        <div class="col-lg-7">
             <div class="panel panel-default">
                 <div class="panel-heading">
-                    <div class="row">
-                        <div class="col-xs-3">
-                            <span class="glyphicon glyphicon-align-left huge" aria-hidden="true"></span>
-                        </div>
-                        <div class="col-xs-9 text-right">
-                            <div class="huge">XML</div>
-                            <div>RCE worklow file</div>
-                        </div>
-                    </div>
+                    <h3 class="panel-title"><span class="glyphicon glyphicon-cog" aria-hidden="true"></span> Settings</h3>
+                </div>
+                <div class="panel-body blue">
+                    Save XML files in a pretty style <input id="pretty_print" class="off" type="checkbox" data-toggle="toggle">
                 </div>
-                <a href="#">
-                    <div class="panel-footer">
-                        <span class="pull-left">Create</span>
-                        <span class="pull-right"><span class="glyphicon glyphicon-circle-arrow-right spin" aria-hidden="true"></span></span>
-                        <div class="clearfix"></div>
-                    </div>
-                </a>
             </div>
-            -->
         </div>
     </div>
 </div>
 <script src="//code.jquery.com/jquery-3.2.1.min.js"></script>
 <script src="//cdnjs.cloudflare.com/ajax/libs/raphael/2.1.0/raphael-min.js"></script>
 <script src="//cdnjs.cloudflare.com/ajax/libs/morris.js/0.5.1/morris.min.js"></script>
+<script src="{{url_for('static', filename='bootstrap-toggle.min.js')}}"></script>
 <script>
+// Bar chart logic
 Morris.Bar({
     element: 'morris-bar-chart',
     data: [{
@@ -148,6 +134,7 @@ Morris.Bar({
 });
 </script>
 <script>
+// AJAX logic
 function pdf() {
     $.ajax({
         type: 'GET',
@@ -201,9 +188,15 @@ function vispack() {
 }
 
 function cmdows() {
+    var url = '{{ temp_id }}/cmdows?reset=True';
+    if (document.getElementById('pretty_print').checked) {
+        url += '&pretty_print=True';
+    }
+    // Timestamp needs to be added to prevent caching
+    url += '&timestamp='+new Date().getTime();
     $.ajax({
         type: 'GET',
-        url: '{{ temp_id }}/cmdows',
+        url: url,
         beforeSend:function(){
             $("#cmdows").find('.pull-left').html('A CMDOWS XML file is currently being created...');
             $("#cmdows").find('.pull-right').html('<span class="glyphicon glyphicon-refresh spin" aria-hidden="true"></span>');
@@ -225,6 +218,7 @@ function cmdows() {
 }
 </script>
 <script>
+// Streaming logic
 function vispackstatus() {
     var source = new EventSource("{{ temp_id }}/vispackstatus");
     source.onmessage = function(event) {
@@ -233,4 +227,21 @@ function vispackstatus() {
     return;
 }
 </script>
+<script>
+// Settings logic
+jQuery(document).ready(function($) {
+    // Clone relevant divs
+    var cmdows_clone = $("#cmdows").html();
+
+    // Activate toggle switch
+    $('input[type="checkbox"]').bootstrapToggle();
+
+    // Recognize toggle switch change
+    $('#pretty_print').change(function () {
+        $("#cmdows").empty().html(cmdows_clone);
+        $("#cmdows").attr('onclick', 'cmdows()');
+        $("#cmdows").removeAttr('href');
+    });
+});
+</script>
 {% endblock %}
\ No newline at end of file
-- 
GitLab