added classes
This commit is contained in:
parent
c9e8ab3334
commit
64a5ca985c
|
|
@ -0,0 +1,100 @@
|
|||
# Byte-compiled / optimized / DLL files
|
||||
__pycache__/
|
||||
*.py[cod]
|
||||
*$py.class
|
||||
|
||||
# C extensions
|
||||
*.so
|
||||
|
||||
# Distribution / packaging
|
||||
.Python
|
||||
build/
|
||||
develop-eggs/
|
||||
dist/
|
||||
downloads/
|
||||
eggs/
|
||||
.eggs/
|
||||
lib/
|
||||
lib64/
|
||||
parts/
|
||||
sdist/
|
||||
var/
|
||||
wheels/
|
||||
*.egg-info/
|
||||
.installed.cfg
|
||||
*.egg
|
||||
|
||||
# PyInstaller
|
||||
# Usually these files are written by a python script from a template
|
||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||
*.manifest
|
||||
*.spec
|
||||
|
||||
# Installer logs
|
||||
pip-log.txt
|
||||
pip-delete-this-directory.txt
|
||||
|
||||
# Unit test / coverage reports
|
||||
htmlcov/
|
||||
.tox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
config.txt
|
||||
46
gui.py
46
gui.py
|
|
@ -1,39 +1,65 @@
|
|||
try:
|
||||
from tkinter import *
|
||||
from tkinter import ttk
|
||||
except:
|
||||
from Tkinter import *
|
||||
import ttk
|
||||
|
||||
import request
|
||||
|
||||
def shon(event):
|
||||
request.openURL(request.shutter_on)
|
||||
Pana.shutterOn()
|
||||
setstat()
|
||||
|
||||
def shoff(event):
|
||||
request.openURL(request.shutter_off)
|
||||
Pana.shutterOff()
|
||||
setstat()
|
||||
|
||||
def stat():
|
||||
lbstat.text='Shutter: {} / OSD: {} / INPUT: {}'.format(*request.openSTATUS(request.status))
|
||||
Pana.getStatus()
|
||||
setstat()
|
||||
|
||||
def setstat():
|
||||
if Pana.st_shutter=='Off':
|
||||
btno.config(relief=SUNKEN)
|
||||
btnf.config(relief=RAISED)
|
||||
else:
|
||||
btnf.config(relief=SUNKEN)
|
||||
btno.config(relief=RAISED)
|
||||
strstatus.set(Pana.strStatus())
|
||||
|
||||
Pana=request.VP('192.168.0.8')
|
||||
|
||||
window = Tk()
|
||||
|
||||
window.title("Panasonic Remote GUI")
|
||||
window.geometry('350x200')
|
||||
|
||||
lbsh = Label(window, text="SHUTTER")
|
||||
lbst = Label(window, text="STATUS")
|
||||
lbstat=Label(window, text="")
|
||||
tabctrl=ttk.Notebook(window)
|
||||
tab1=ttk.Frame(tabctrl)
|
||||
tabctrl.add(tab1,text=Pana.ip)
|
||||
tabctrl.pack(expand=1,fill='both')
|
||||
|
||||
lbsh = Label(tab1, text="SHUTTER")
|
||||
lbst = Label(tab1, text="STATUS")
|
||||
strstatus=StringVar()
|
||||
lbstat=Label(tab1, textvariable=strstatus,anchor=W)
|
||||
|
||||
btno = Button(tab1, text="OFF",command=lambda: shoff(None))
|
||||
btnf = Button(tab1, text="ON",command=lambda: shon(None))
|
||||
btstat=Button(tab1, text="Refresh",command=stat)
|
||||
|
||||
btno = Button(window, text="OFF",command=lambda: shoff(None))
|
||||
btnf = Button(window, text="ON",command=lambda: shon(None))
|
||||
btstat=Button(window, text="Refresh",command=stat)
|
||||
|
||||
btno.grid(column=2, row=0)
|
||||
btnf.grid(column=1, row=0)
|
||||
btstat.grid(column=1,row=1)
|
||||
lbsh.grid(column=0, row=0)
|
||||
lbst.grid(column=0,row=1)
|
||||
lbstat.grid(column=0,row=2)
|
||||
|
||||
lbstat.grid(column=3,columnspan=3,pady=80,sticky=E)
|
||||
|
||||
window.bind("a", shon)
|
||||
window.bind("z", shoff)
|
||||
|
||||
setstat()
|
||||
window.mainloop()
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,25 +0,0 @@
|
|||
/*function uniKeyCode(event) {
|
||||
var key = event.keyCode;
|
||||
document.getElementById("demo2").innerHTML = "Unicode KEY code: " + key;
|
||||
}*/
|
||||
$(document).ready(function() {
|
||||
$("#shutter").html("SHUTTER : ?");
|
||||
document.addEventListener('keydown', (event) => {
|
||||
const keyName = event.key;
|
||||
if (keyName=="a"){
|
||||
alert('keydown event\n\n' + 'key: ' + keyName);
|
||||
$.ajax({
|
||||
type: "GET",
|
||||
url: "http://192.168.0.8/cgi-bin/proj_ctl.cgi?key=shutter_on&lang=e&osd=on",
|
||||
dataType: 'json',
|
||||
async: false,
|
||||
headers: {
|
||||
"Authorization": "Basic " + btoa("admin1 : panasonic")
|
||||
},
|
||||
data: '',
|
||||
success: function (){
|
||||
alert('keydown event\n\n' + 'key: ' + keyName);
|
||||
}});
|
||||
};
|
||||
});
|
||||
});
|
||||
18
remote.html
18
remote.html
|
|
@ -1,18 +0,0 @@
|
|||
<!doctype html>
|
||||
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
|
||||
<title>Remote</title>
|
||||
<meta name="description" content="Panasonic Remote">
|
||||
<meta name="author" content="Maximilien Rigaut">
|
||||
Access-Control-Allow-Origin: *
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<script src="js/jquery.js"></script>
|
||||
<script src="js/scripts.js"></script>
|
||||
<div id="shutter">SHUTTER : ON</div>
|
||||
</body>
|
||||
</html>
|
||||
31
request.py
31
request.py
|
|
@ -54,6 +54,37 @@ shutter_on=makeURL(ip,"shutter_on")
|
|||
shutter_off=makeURL(ip,"shutter_off")
|
||||
status=makeSTATUS(ip)
|
||||
|
||||
class VP(object):
|
||||
"""Class to acess a VP."""
|
||||
def __init__(self, ip):
|
||||
super(VP, self).__init__()
|
||||
self.ip = ip
|
||||
self.st_shutter=None
|
||||
self.st_osd=None
|
||||
self.st_input=None
|
||||
self.shutter_on=makeURL(ip,"shutter_on")
|
||||
self.shutter_off=makeURL(ip,"shutter_off")
|
||||
self.status=makeSTATUS(ip)
|
||||
self.getStatus()
|
||||
|
||||
def shutterOn(self):
|
||||
openURL(self.shutter_on)
|
||||
self.st_shutter='On'
|
||||
|
||||
def shutterOff(self):
|
||||
openURL(self.shutter_off)
|
||||
self.st_shutter='Off'
|
||||
|
||||
def getStatus(self):
|
||||
self.st_shutter,self.st_osd,self.st_input=openSTATUS(self.status)
|
||||
return self
|
||||
|
||||
def __str__(self):
|
||||
return self.ip
|
||||
|
||||
def strStatus(self):
|
||||
return 'OSD: {} - INPUT: {}'.format(self.st_osd,self.st_input)
|
||||
|
||||
if __name__ == '__main__':
|
||||
try:
|
||||
cmd=sys.argv[1]
|
||||
|
|
|
|||
Reference in New Issue