31
31
from ivle import util
35
import genshi.template
33
37
def insert_scripts_styles(scripts, styles, scripts_init):
34
38
"""Given 2 lists of strings: scripts and styles. These lists are lists of
35
39
pathnames, as expected on the "scripts" and "styles" attributes of a
53
57
windowpane: If True, starts the console in "window pane" mode, where it
54
58
will float over the page and have a "minimize" button.
56
req.write("""<div id="console_body">
57
<div id="console_heading">Python Console
60
req.write("""<span class="console_button minimize">
61
<a onclick="console_minimize()"
62
title="Minimize the Python console">
65
""" % cgi.escape(util.make_path("media/images/interface/minimize.png")))
67
<div id="console_body2">
68
<pre id="console_output" class='outputMsg'></pre>
69
<div id="console_input">
70
<div id="console_inputArea">
72
<label id="console_prompt">>>> </label>
73
<input id="console_inputText"
74
type="text" size="80" onkeypress="return catch_input(event.keyCode)" />
75
<input type='button' value='Interrupt' onclick='set_interrupt();'/>
76
<input type='button' value='Clear Output' onclick='return clear_output();'/>
77
<input type='button' value='Reset' onclick='console_reset();'/>
80
req.write("""<span class="console_button maximize">
81
<a onclick="console_maximize()"
82
title="Open up the Python console">
85
""" % cgi.escape(util.make_path("media/images/interface/maximize.png")))
91
<!-- Console filler, provides extra vertical space to stop the console
92
covering over the bottom content -->
93
<div id="console_filler"></div>
60
ctx = genshi.template.Context()
61
ctx['windowpane'] = windowpane
62
ctx['minimize_path'] = util.make_path("media/images/interface/minimize.png")
63
ctx['maximize_path'] = util.make_path("media/images/interface/maximize.png")
64
loader = genshi.template.TemplateLoader(".", auto_reload=True)
65
tmpl = loader.load(util.make_local_path("plugins/console/template.html"))
66
#TODO: Make the dispatch render this
67
req.write(tmpl.generate(ctx).render('html'))
96
69
def _append_if_absent(list, *values):
97
70
"""Appends an arbitray number of values to a list, but omits values that