#!/usr/bin/env python




##################################################
## DEPENDENCIES
import sys
import os
import os.path
try:
    import builtins as builtin
except ImportError:
    import __builtin__ as builtin
from os.path import getmtime, exists
import time
import types
from Cheetah.Version import MinCompatibleVersion as RequiredCheetahVersion
from Cheetah.Version import MinCompatibleVersionTuple as RequiredCheetahVersionTuple
from Cheetah.Template import Template
from Cheetah.DummyTransaction import *
from Cheetah.NameMapper import NotFound, valueForName, valueFromSearchList, valueFromFrameOrSearchList
from Cheetah.CacheRegion import CacheRegion
import Cheetah.Filters as Filters
import Cheetah.ErrorCatchers as ErrorCatchers
from Plugins.Extensions.OpenWebif.controllers.i18n import tstrings
from Plugins.Extensions.OpenWebif.controllers.models.info import getInfo, getPipStatus

##################################################
## MODULE CONSTANTS
VFFSL=valueFromFrameOrSearchList
VFSL=valueFromSearchList
VFN=valueForName
currentTime=time.time
__CHEETAH_version__ = '2.4.4'
__CHEETAH_versionTuple__ = (2, 4, 4, 'development', 0)
__CHEETAH_genTime__ = 1644596121.036502
__CHEETAH_genTimestamp__ = 'Fri Feb 11 16:15:21 2022'
__CHEETAH_src__ = '/home/nonsolosat/openpli-dreambox-oe-core/build/tmp/work/dm520-oe-linux/enigma2-plugin-extensions-openwebif/gitAUTOINC+81b15e17ab-r0/git/plugin/controllers/views/ajax/screenshot.tmpl'
__CHEETAH_srcLastModified__ = 'Fri Feb 11 15:59:45 2022'
__CHEETAH_docstring__ = 'Autogenerated by Cheetah: The Python-Powered Template Engine'

if __CHEETAH_versionTuple__ < RequiredCheetahVersionTuple:
    raise AssertionError(
      'This template was compiled with Cheetah version'
      ' %s. Templates compiled before version %s must be recompiled.'%(
         __CHEETAH_version__, RequiredCheetahVersion))

##################################################
## CLASSES

class screenshot(Template):

    ##################################################
    ## CHEETAH GENERATED METHODS


    def __init__(self, *args, **KWs):

        super(screenshot, self).__init__(*args, **KWs)
        if not self._CHEETAH__instanceInitialized:
            cheetahKWArgs = {}
            allowedKWs = 'searchList namespaces filter filtersLib errorCatcher'.split()
            for k,v in KWs.items():
                if k in allowedKWs: cheetahKWArgs[k] = v
            self._initCheetahInstance(**cheetahKWArgs)
        

    def respond(self, trans=None):



        ## CHEETAH: main method generated for this template
        if (not trans and not self._CHEETAH__isBuffering and not callable(self.transaction)):
            trans = self.transaction # is None unless self.awake() was called
        if not trans:
            trans = DummyTransaction()
            _dummyTrans = True
        else: _dummyTrans = False
        write = trans.response().write
        SL = self._CHEETAH__searchList
        _filter = self._CHEETAH__currentFilter
        
        ########################################
        ## START - generated method body
        
        write(u'''<div id="content_main" style="min-height: 533px;">
\t<div id="info">
\t\t<h3 class="ui-widget-header">''')
        _v = VFFSL(SL,"tstrings",True)['screenshot'] # u"$tstrings['screenshot']" on line 5, col 32
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['screenshot']")) # from line 5, col 32.
        write(u'''</h3>
\t\t<div id="toolbar-header" class="ui-widget-header">
\t\t\t<span id="toolbar">
\t\t\t\t<span id="screenshotbutton">
\t\t\t\t\t<input type="radio" id="screenshotbutton0" name="screenshotbutton" checked="checked" /><label for="screenshotbutton0">''')
        _v = VFFSL(SL,"tstrings",True)['screenshot'] # u"$tstrings['screenshot']" on line 9, col 124
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['screenshot']")) # from line 9, col 124.
        write(u''' (''')
        _v = VFFSL(SL,"tstrings",True)['all'] # u"$tstrings['all']" on line 9, col 149
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['all']")) # from line 9, col 149.
        write(u''')</label>
\t\t\t\t\t<input type="radio" id="screenshotbutton1" name="screenshotbutton" /><label for="screenshotbutton1">''')
        _v = VFFSL(SL,"tstrings",True)['screenshot'] # u"$tstrings['screenshot']" on line 10, col 106
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['screenshot']")) # from line 10, col 106.
        write(u''' (''')
        _v = VFFSL(SL,"tstrings",True)['video'] # u"$tstrings['video']" on line 10, col 131
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['video']")) # from line 10, col 131.
        write(u''')</label>
\t\t\t\t\t<input type="radio" id="screenshotbutton2" name="screenshotbutton" /><label for="screenshotbutton2">''')
        _v = VFFSL(SL,"tstrings",True)['screenshot'] # u"$tstrings['screenshot']" on line 11, col 106
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['screenshot']")) # from line 11, col 106.
        write(u''' (''')
        _v = VFFSL(SL,"tstrings",True)['osd'] # u"$tstrings['osd']" on line 11, col 131
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['osd']")) # from line 11, col 131.
        write(u''')</label>
\t\t\t\t\t<input type="radio" id="screenshotbutton3" name="screenshotbutton" style="display: none;"/><label for="screenshotbutton3" style="display: none;">''')
        _v = VFFSL(SL,"tstrings",True)['pip'] # u"$tstrings['pip']" on line 12, col 151
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['pip']")) # from line 12, col 151.
        write(u'''</label>
\t\t\t\t\t<input type="radio" id="screenshotbutton4" name="screenshotbutton" style="display: none;"/><label for="screenshotbutton4" style="display: none;">''')
        _v = VFFSL(SL,"tstrings",True)['lcd'] # u"$tstrings['lcd']" on line 13, col 151
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['lcd']")) # from line 13, col 151.
        write(u'''</label>
\t\t\t\t</span>
\t\t\t</span>
\t\t</div>
\t\t<div class="screenshotContainer">
\t\t\t<div id="screenshotImageContainer" style="resize: both;overflow: auto;min-height:480px;min-width:720px">
\t\t\t\t<img id="screenshotimage" src="" alt="''')
        _v = VFFSL(SL,"tstrings",True)['loading'] # u"$tstrings['loading']" on line 19, col 43
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['loading']")) # from line 19, col 43.
        write(u''' ..." width="100%">
\t\t\t\t<div id="screenshotspinnerl" style="top: 50%;left: 50%;margin-left: 50px;margin-top: 50px;;position:absolute;font-size:50px">
\t\t\t\t\t<div id="screenshotspinner" class=\'fa fa-spin\' style="display: none;"></div>
\t\t\t\t</div>
\t\t\t</div>
\t\t</div>
\t\t<div id="screenShotRefresh" style="margin-top: 15px; margin-left: auto; margin-right: auto; width: 720px; text-align: center;">
\t\t\t<input type="checkbox" id="ssr_hd" value="0">''')
        _v = VFFSL(SL,"tstrings",True)['high_resolution'] # u"$tstrings['high_resolution']" on line 26, col 49
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['high_resolution']")) # from line 26, col 49.
        write(u'''
\t\t\t<input type="checkbox" id="ssr_s" value="0">''')
        _v = VFFSL(SL,"tstrings",True)['refresh_auto'] # u"$tstrings['refresh_auto']" on line 27, col 48
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['refresh_auto']")) # from line 27, col 48.
        write(u'''
\t\t\t<input type="text" size="2" id="ssr_i" value="30">''')
        _v = VFFSL(SL,"tstrings",True)['seconds'] # u"$tstrings['seconds']" on line 28, col 54
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['seconds']")) # from line 28, col 54.
        write(u'''
\t\t\t<br>
\t\t\t<span id="screenshotrefreshbutton">
\t\t\t\t<button onclick="grabScreenshot(\'auto\'); return false">''')
        _v = VFFSL(SL,"tstrings",True)['refresh'] # u"$tstrings['refresh']" on line 31, col 60
        if _v is not None: write(_filter(_v, rawExpr=u"$tstrings['refresh']")) # from line 31, col 60.
        write(u'''</button>
\t\t\t</span>
\t\t</div>
\t</div>
</div>

<script type="text/javascript">
var lcd = "''')
        _v = VFFSL(SL,"getInfo",True)['lcd'] # u"$getInfo['lcd']" on line 38, col 12
        if _v is not None: write(_filter(_v, rawExpr=u"$getInfo['lcd']")) # from line 38, col 12.
        write(u'''";
var pip = "''')
        _v = VFFSL(SL,"getPipStatus",False)() # u'$getPipStatus()' on line 39, col 12
        if _v is not None: write(_filter(_v, rawExpr=u'$getPipStatus()')) # from line 39, col 12.
        write(u'''";
$(function() {SSHelper.setup()});

function buttonsSwitcher(pipval){
\tif(parseInt(pipval)){
\t\tif(parseInt(lcd)){
\t\t\t$("label[for=screenshotbutton2]").css("border-radius", "0 0 0 0");
\t\t\t$("label[for=screenshotbutton3]").css("border-radius", "0 0 0 0");
\t\t\t$("label[for=screenshotbutton4]").css("border-radius", "0 5px 5px 0");
\t\t\t$("#screenshotbutton4, label[for=screenshotbutton4]").show();
\t\t}
\t\telse{
\t\t\t$("label[for=screenshotbutton2]").css("border-radius", "0 0 0 0");
\t\t\t$("label[for=screenshotbutton3]").css("border-radius", "0 5px 5px 0");
\t\t\t$("#screenshotbutton4, label[for=screenshotbutton4]").hide();
\t\t}
\t\t$("#screenshotbutton3, label[for=screenshotbutton3]").show(250);
\t}else{
\t\tif(parseInt(lcd)){
\t\t\t$("label[for=screenshotbutton2]").css("border-radius", "0 0 0 0");
\t\t\t$("label[for=screenshotbutton4]").css("border-radius", "0 5px 5px 0");
\t\t\t$("#screenshotbutton4, label[for=screenshotbutton4]").show();
\t\t}else{
\t\t\t$("label[for=screenshotbutton2]").css("border-radius", "0 5px 5px 0");
\t\t\t$("#screenshotbutton4, label[for=screenshotbutton4]").hide();
\t\t}
\t\t$("#screenshotbutton3, label[for=screenshotbutton3]").hide(250);
\t}
}

var start = true;

$(document).ready(function(){
\tbuttonsSwitcher(pip);
\tif(start)
\t{
\t\tstart=false;
\t\tvar w = $(".screenshotContainer").width();
\t\tif(w>1940) {
\t\t\tw = 1920;
\t\t}
\t\tif(w>1044) {
\t\t\tw = 1024;
\t\t}
\t\telse {
\t\t\tw = 720;
\t\t}
\t\t$(\'#screenshotImageContainer\').css(\'width\', w);
\t}
});

</script>
''')
        
        ########################################
        ## END - generated method body
        
        return _dummyTrans and trans.response().getvalue() or ""
        
    ##################################################
    ## CHEETAH GENERATED ATTRIBUTES


    _CHEETAH__instanceInitialized = False

    _CHEETAH_version = __CHEETAH_version__

    _CHEETAH_versionTuple = __CHEETAH_versionTuple__

    _CHEETAH_genTime = __CHEETAH_genTime__

    _CHEETAH_genTimestamp = __CHEETAH_genTimestamp__

    _CHEETAH_src = __CHEETAH_src__

    _CHEETAH_srcLastModified = __CHEETAH_srcLastModified__

    _mainCheetahMethod_for_screenshot= 'respond'

## END CLASS DEFINITION

if not hasattr(screenshot, '_initCheetahAttributes'):
    templateAPIClass = getattr(screenshot, '_CHEETAH_templateClass', Template)
    templateAPIClass._addCheetahPlumbingCodeToClass(screenshot)


# CHEETAH was developed by Tavis Rudd and Mike Orr
# with code, advice and input from many other volunteers.
# For more information visit http://www.CheetahTemplate.org/

##################################################
## if run from command line:
if __name__ == '__main__':
    from Cheetah.TemplateCmdLineIface import CmdLineIface
    CmdLineIface(templateObj=screenshot()).run()


