~azzar1/unity/add-show-desktop-key

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
from ivle.webapp.base.plugins import ViewPlugin, OverlayPlugin, MediaPlugin
from ivle.webapp.console.service import ConsoleServiceRESTView
from ivle.webapp.console.overlay import ConsoleOverlay
from ivle.webapp.base.xhtml import XHTMLView


class ConsoleView(XHTMLView):
    tab = 'console'
    help = 'Console'

    plugin_scripts = {'ivle.webapp.console': ['console.js']}
    plugin_styles  = {'ivle.webapp.console': ['console.css']}
    plugin_scripts_init = ['console_init']

    # Don't load the console overlay when we already have a console.
    overlay_blacklist = [ConsoleOverlay]

    def authorize(self, req):
        return req.user is not None

    def populate(self, req, ctx):
        ctx['windowpane'] = False
        ctx['start_body_attrs'] = {}

class Plugin(ViewPlugin, OverlayPlugin, MediaPlugin):
    urls = [
        ('console/service', ConsoleServiceRESTView),
        ('console', ConsoleView),
    ]
    tabs = [
        ('console', 'Console', 'Try out your code in a Python console',
         'console.png', 'console', 3)
    ]
    overlays = [
        ConsoleOverlay,
    ]
    media = 'media'
    help = {'Console': 'help.html'}