mirror of
https://github.com/naruxde/revpipycontrol.git
synced 2025-11-08 23:53:52 +01:00
Compare commits
45 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7939f193da | |||
| d7d1aa2194 | |||
| 5dde6e2705 | |||
| 8a6d1ebca8 | |||
| e828c1f55a | |||
| 84f52cb17a | |||
| 93e02df73e | |||
| 63f60f9e36 | |||
| 34f133ea6e | |||
| 472605bb38 | |||
| 79ea020903 | |||
| 7b61dee1c6 | |||
| f1163f2e3f | |||
| 5812dba69d | |||
| 7e9afd0944 | |||
| 79c737ea2f | |||
| 55c1349edf | |||
| df308600c2 | |||
| fb88271364 | |||
| fa8fc6a7ce | |||
| df4c82579d | |||
| 220de03774 | |||
| f2dd6416ea | |||
| 7d3957a9d1 | |||
| ef912fa907 | |||
| 0fc9af633c | |||
| 1d9c28d48b | |||
| 554f19d090 | |||
| e42cc1a6d2 | |||
| 6c2578f84c | |||
| 37e6dd6a75 | |||
| 348ef65716 | |||
| 6ac9466850 | |||
| 56cf5a7b09 | |||
| 3c05f9f024 | |||
| 2751a2bd35 | |||
| e32383048f | |||
| 7fefb1aece | |||
| a60d029f39 | |||
| e322b1d43b | |||
| a8442b5969 | |||
| c7d5e4432a | |||
| adc1158f5c | |||
| 364e6a169c | |||
| f761bca89d |
118
.gitignore
vendored
Normal file
118
.gitignore
vendored
Normal file
@@ -0,0 +1,118 @@
|
||||
# ---> Python
|
||||
# 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
|
||||
MANIFEST
|
||||
|
||||
# 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/
|
||||
.nox/
|
||||
.coverage
|
||||
.coverage.*
|
||||
.cache
|
||||
nosetests.xml
|
||||
coverage.xml
|
||||
*.cover
|
||||
.hypothesis/
|
||||
.pytest_cache/
|
||||
|
||||
# Translations
|
||||
*.mo
|
||||
*.pot
|
||||
|
||||
# Django stuff:
|
||||
*.log
|
||||
local_settings.py
|
||||
db.sqlite3
|
||||
|
||||
# Flask stuff:
|
||||
instance/
|
||||
.webassets-cache
|
||||
|
||||
# Scrapy stuff:
|
||||
.scrapy
|
||||
|
||||
# Sphinx documentation
|
||||
docs/_build/
|
||||
|
||||
# PyBuilder
|
||||
target/
|
||||
|
||||
# Jupyter Notebook
|
||||
.ipynb_checkpoints
|
||||
|
||||
# IPython
|
||||
profile_default/
|
||||
ipython_config.py
|
||||
|
||||
# pyenv
|
||||
.python-version
|
||||
|
||||
# celery beat schedule file
|
||||
celerybeat-schedule
|
||||
|
||||
# SageMath parsed files
|
||||
*.sage.py
|
||||
|
||||
# Environments
|
||||
.env
|
||||
.venv
|
||||
env/
|
||||
venv/
|
||||
ENV/
|
||||
env.bak/
|
||||
venv.bak/
|
||||
|
||||
# Spyder project settings
|
||||
.spyderproject
|
||||
.spyproject
|
||||
|
||||
# Rope project settings
|
||||
.ropeproject
|
||||
|
||||
# mkdocs documentation
|
||||
/site
|
||||
|
||||
# mypy
|
||||
.mypy_cache/
|
||||
.dmypy.json
|
||||
dmypy.json
|
||||
|
||||
# Pyre type checker
|
||||
.pyre/
|
||||
|
||||
/test/
|
||||
/make.conf
|
||||
@@ -1,9 +0,0 @@
|
||||
syntax: glob
|
||||
*.pyc
|
||||
deb_dist/*
|
||||
dist/*
|
||||
revpipycontrol.egg-info/*
|
||||
deb/*
|
||||
.eric6project/*
|
||||
*.directory
|
||||
*.mo
|
||||
17
.idea/$CACHE_FILE$
generated
Normal file
17
.idea/$CACHE_FILE$
generated
Normal file
@@ -0,0 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectInspectionProfilesVisibleTreeState">
|
||||
<entry key="Project Default">
|
||||
<profile-state>
|
||||
<expanded-state>
|
||||
<State />
|
||||
</expanded-state>
|
||||
<selected-state>
|
||||
<State>
|
||||
<id>Angular</id>
|
||||
</State>
|
||||
</selected-state>
|
||||
</profile-state>
|
||||
</entry>
|
||||
</component>
|
||||
</project>
|
||||
2
.idea/.gitignore
generated
vendored
Normal file
2
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
# Default ignored files
|
||||
/workspace.xml
|
||||
7
.idea/dictionaries/akira.xml
generated
Normal file
7
.idea/dictionaries/akira.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<component name="ProjectDictionaryState">
|
||||
<dictionary name="akira">
|
||||
<words>
|
||||
<w>revpipycontrol</w>
|
||||
</words>
|
||||
</dictionary>
|
||||
</component>
|
||||
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
7
.idea/misc.xml
generated
Normal file
7
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="JavaScriptSettings">
|
||||
<option name="languageLevel" value="ES6" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" project-jdk-name="Python 3.6" project-jdk-type="Python SDK" />
|
||||
</project>
|
||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/revpipycontrol.iml" filepath="$PROJECT_DIR$/.idea/revpipycontrol.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
12
.idea/revpipycontrol.iml
generated
Normal file
12
.idea/revpipycontrol.iml
generated
Normal file
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/revpipycontrol" isTestSource="false" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/dist" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/downloads" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="Python 3.6" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
6
.idea/vcs.xml
generated
Normal file
6
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
165
LICENSE.txt
Normal file
165
LICENSE.txt
Normal file
@@ -0,0 +1,165 @@
|
||||
GNU LESSER GENERAL PUBLIC LICENSE
|
||||
Version 3, 29 June 2007
|
||||
|
||||
Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
|
||||
Everyone is permitted to copy and distribute verbatim copies
|
||||
of this license document, but changing it is not allowed.
|
||||
|
||||
|
||||
This version of the GNU Lesser General Public License incorporates
|
||||
the terms and conditions of version 3 of the GNU General Public
|
||||
License, supplemented by the additional permissions listed below.
|
||||
|
||||
0. Additional Definitions.
|
||||
|
||||
As used herein, "this License" refers to version 3 of the GNU Lesser
|
||||
General Public License, and the "GNU GPL" refers to version 3 of the GNU
|
||||
General Public License.
|
||||
|
||||
"The Library" refers to a covered work governed by this License,
|
||||
other than an Application or a Combined Work as defined below.
|
||||
|
||||
An "Application" is any work that makes use of an interface provided
|
||||
by the Library, but which is not otherwise based on the Library.
|
||||
Defining a subclass of a class defined by the Library is deemed a mode
|
||||
of using an interface provided by the Library.
|
||||
|
||||
A "Combined Work" is a work produced by combining or linking an
|
||||
Application with the Library. The particular version of the Library
|
||||
with which the Combined Work was made is also called the "Linked
|
||||
Version".
|
||||
|
||||
The "Minimal Corresponding Source" for a Combined Work means the
|
||||
Corresponding Source for the Combined Work, excluding any source code
|
||||
for portions of the Combined Work that, considered in isolation, are
|
||||
based on the Application, and not on the Linked Version.
|
||||
|
||||
The "Corresponding Application Code" for a Combined Work means the
|
||||
object code and/or source code for the Application, including any data
|
||||
and utility programs needed for reproducing the Combined Work from the
|
||||
Application, but excluding the System Libraries of the Combined Work.
|
||||
|
||||
1. Exception to Section 3 of the GNU GPL.
|
||||
|
||||
You may convey a covered work under sections 3 and 4 of this License
|
||||
without being bound by section 3 of the GNU GPL.
|
||||
|
||||
2. Conveying Modified Versions.
|
||||
|
||||
If you modify a copy of the Library, and, in your modifications, a
|
||||
facility refers to a function or data to be supplied by an Application
|
||||
that uses the facility (other than as an argument passed when the
|
||||
facility is invoked), then you may convey a copy of the modified
|
||||
version:
|
||||
|
||||
a) under this License, provided that you make a good faith effort to
|
||||
ensure that, in the event an Application does not supply the
|
||||
function or data, the facility still operates, and performs
|
||||
whatever part of its purpose remains meaningful, or
|
||||
|
||||
b) under the GNU GPL, with none of the additional permissions of
|
||||
this License applicable to that copy.
|
||||
|
||||
3. Object Code Incorporating Material from Library Header Files.
|
||||
|
||||
The object code form of an Application may incorporate material from
|
||||
a header file that is part of the Library. You may convey such object
|
||||
code under terms of your choice, provided that, if the incorporated
|
||||
material is not limited to numerical parameters, data structure
|
||||
layouts and accessors, or small macros, inline functions and templates
|
||||
(ten or fewer lines in length), you do both of the following:
|
||||
|
||||
a) Give prominent notice with each copy of the object code that the
|
||||
Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the object code with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
4. Combined Works.
|
||||
|
||||
You may convey a Combined Work under terms of your choice that,
|
||||
taken together, effectively do not restrict modification of the
|
||||
portions of the Library contained in the Combined Work and reverse
|
||||
engineering for debugging such modifications, if you also do each of
|
||||
the following:
|
||||
|
||||
a) Give prominent notice with each copy of the Combined Work that
|
||||
the Library is used in it and that the Library and its use are
|
||||
covered by this License.
|
||||
|
||||
b) Accompany the Combined Work with a copy of the GNU GPL and this license
|
||||
document.
|
||||
|
||||
c) For a Combined Work that displays copyright notices during
|
||||
execution, include the copyright notice for the Library among
|
||||
these notices, as well as a reference directing the user to the
|
||||
copies of the GNU GPL and this license document.
|
||||
|
||||
d) Do one of the following:
|
||||
|
||||
0) Convey the Minimal Corresponding Source under the terms of this
|
||||
License, and the Corresponding Application Code in a form
|
||||
suitable for, and under terms that permit, the user to
|
||||
recombine or relink the Application with a modified version of
|
||||
the Linked Version to produce a modified Combined Work, in the
|
||||
manner specified by section 6 of the GNU GPL for conveying
|
||||
Corresponding Source.
|
||||
|
||||
1) Use a suitable shared library mechanism for linking with the
|
||||
Library. A suitable mechanism is one that (a) uses at run time
|
||||
a copy of the Library already present on the user's computer
|
||||
system, and (b) will operate properly with a modified version
|
||||
of the Library that is interface-compatible with the Linked
|
||||
Version.
|
||||
|
||||
e) Provide Installation Information, but only if you would otherwise
|
||||
be required to provide such information under section 6 of the
|
||||
GNU GPL, and only to the extent that such information is
|
||||
necessary to install and execute a modified version of the
|
||||
Combined Work produced by recombining or relinking the
|
||||
Application with a modified version of the Linked Version. (If
|
||||
you use option 4d0, the Installation Information must accompany
|
||||
the Minimal Corresponding Source and Corresponding Application
|
||||
Code. If you use option 4d1, you must provide the Installation
|
||||
Information in the manner specified by section 6 of the GNU GPL
|
||||
for conveying Corresponding Source.)
|
||||
|
||||
5. Combined Libraries.
|
||||
|
||||
You may place library facilities that are a work based on the
|
||||
Library side by side in a single library together with other library
|
||||
facilities that are not Applications and are not covered by this
|
||||
License, and convey such a combined library under terms of your
|
||||
choice, if you do both of the following:
|
||||
|
||||
a) Accompany the combined library with a copy of the same work based
|
||||
on the Library, uncombined with any other library facilities,
|
||||
conveyed under the terms of this License.
|
||||
|
||||
b) Give prominent notice with the combined library that part of it
|
||||
is a work based on the Library, and explaining where to find the
|
||||
accompanying uncombined form of the same work.
|
||||
|
||||
6. Revised Versions of the GNU Lesser General Public License.
|
||||
|
||||
The Free Software Foundation may publish revised and/or new versions
|
||||
of the GNU Lesser General Public License from time to time. Such new
|
||||
versions will be similar in spirit to the present version, but may
|
||||
differ in detail to address new problems or concerns.
|
||||
|
||||
Each version is given a distinguishing version number. If the
|
||||
Library as you received it specifies that a certain numbered version
|
||||
of the GNU Lesser General Public License "or any later version"
|
||||
applies to it, you have the option of following the terms and
|
||||
conditions either of that published version or of any later version
|
||||
published by the Free Software Foundation. If the Library as you
|
||||
received it does not specify a version number of the GNU Lesser
|
||||
General Public License, you may choose any version of the GNU Lesser
|
||||
General Public License ever published by the Free Software Foundation.
|
||||
|
||||
If the Library as you received it specifies that a proxy can decide
|
||||
whether future versions of the GNU Lesser General Public License shall
|
||||
apply, that proxy's public statement of acceptance of any version is
|
||||
permanent authorization for you to choose that version for the
|
||||
Library.
|
||||
@@ -3,3 +3,4 @@ include stdeb.cfg
|
||||
recursive-include data *
|
||||
recursive-include revpipycontrol *
|
||||
global-exclude *.pyc
|
||||
include LICENSE.txt
|
||||
|
||||
@@ -1,41 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<title>Table of contents</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body style="background-color:#FFFFFF;color:#000000">
|
||||
<h1 style="background-color:#FFFFFF;color:#0000FF">
|
||||
Table of contents</h1>
|
||||
|
||||
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Modules</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="mytools.html">mytools</a></td>
|
||||
<td></td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="revpicheckclient.html">revpicheckclient</a></td>
|
||||
<td></td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="revpiinfo.html">revpiinfo</a></td>
|
||||
<td></td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="revpilogfile.html">revpilogfile</a></td>
|
||||
<td></td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="revpioption.html">revpioption</a></td>
|
||||
<td></td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="revpiplclist.html">revpiplclist</a></td>
|
||||
<td></td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="revpiprogram.html">revpiprogram</a></td>
|
||||
<td></td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="revpipycontrol.html">revpipycontrol</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
</body></html>
|
||||
@@ -1,59 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<title>mytools</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
|
||||
<h1 style="background-color:#FFFFFF;color:#0000FF">
|
||||
mytools</h1>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Global Attributes</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Classes</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Functions</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#addroot">addroot</a></td>
|
||||
<td>Hängt root-dir der Anwendung vor Dateinamen.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#gettrans">gettrans</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr /><hr />
|
||||
<a NAME="addroot" ID="addroot"></a>
|
||||
<h2 style="background-color:#FFFFFF;color:#0000FF">addroot</h2>
|
||||
<b>addroot</b>(<i>filename</i>)
|
||||
<p>
|
||||
Hängt root-dir der Anwendung vor Dateinamen.
|
||||
</p><p>
|
||||
Je nach Ausführungsart der Anwendung muss das root-dir über
|
||||
andere Arten abgerufen werden.
|
||||
</p><dl>
|
||||
<dt><i>filename</i></dt>
|
||||
<dd>
|
||||
Datei oder Ordnername
|
||||
</dd>
|
||||
</dl><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
root dir
|
||||
</dd>
|
||||
</dl>
|
||||
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||
<hr /><hr />
|
||||
<a NAME="gettrans" ID="gettrans"></a>
|
||||
<h2 style="background-color:#FFFFFF;color:#0000FF">gettrans</h2>
|
||||
<b>gettrans</b>(<i>proglang=None</i>)
|
||||
|
||||
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||
<hr />
|
||||
</body></html>
|
||||
@@ -1,313 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<title>revpicheckclient</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
|
||||
<h1 style="background-color:#FFFFFF;color:#0000FF">
|
||||
revpicheckclient</h1>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Global Attributes</h3>
|
||||
<table>
|
||||
<tr><td>_</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Classes</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient">RevPiCheckClient</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Functions</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<hr /><hr />
|
||||
<a NAME="RevPiCheckClient" ID="RevPiCheckClient"></a>
|
||||
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiCheckClient</h2>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Derived from</h3>
|
||||
tkinter.Frame
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Class Attributes</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Class Methods</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Methods</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.__init__">RevPiCheckClient</a></td>
|
||||
<td>Instantiiert MyApp-Klasse.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.__chval">__chval</a></td>
|
||||
<td>Schreibt neuen Output Wert auf den RevPi.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.__hidewin">__hidewin</a></td>
|
||||
<td>Verbergt übergebenes Fenster.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.__saveoldvalue">__saveoldvalue</a></td>
|
||||
<td>Speichert bei Keypress aktuellen Wert für wiederherstellung.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.__showwin">__showwin</a></td>
|
||||
<td>Zeigt oder verbergt übergebenes Fenster.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.__spinboxkey">__spinboxkey</a></td>
|
||||
<td>Prüft die Eingabe auf plausibilität.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient._createiogroup">_createiogroup</a></td>
|
||||
<td>Erstellt IO-Gruppen.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient._createwidgets">_createwidgets</a></td>
|
||||
<td>Erstellt den Fensterinhalt.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient._onfrmconf">_onfrmconf</a></td>
|
||||
<td>Erstellt Fenster in einem Canvas.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient._warnwrite">_warnwrite</a></td>
|
||||
<td>Warnung für Benutzer über Schreibfunktion einmal fragen.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient._workvalues">_workvalues</a></td>
|
||||
<td>Alle Werte der Inputs und Outputs abrufen.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.hideallwindows">hideallwindows</a></td>
|
||||
<td>Versteckt alle Fenster.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.maxint">maxint</a></td>
|
||||
<td>Errechnet maximalen int() Wert für Bytes max 22.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.readvalues">readvalues</a></td>
|
||||
<td>Ruft nur Input Werte von RevPi ab und aktualisiert Fenster.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.refreshvalues">refreshvalues</a></td>
|
||||
<td>Ruft alle IO Werte von RevPi ab und aktualisiert Fenster.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.tmr_workvalues">tmr_workvalues</a></td>
|
||||
<td>Timer für zyklische Abfrage.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.toggleauto">toggleauto</a></td>
|
||||
<td>Schaltet zwischen Autorefresh um und aktualisiert Widgets.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.togglewrite">togglewrite</a></td>
|
||||
<td>Schaltet zwischen DoWrite um und aktiviert Schreibfunktion.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.validatereturn">validatereturn</a></td>
|
||||
<td>Überprüft die Rückgaben der setvalue Funktion.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiCheckClient.writevalues">writevalues</a></td>
|
||||
<td>Schreibt geänderte Outputs auf den RevPi.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Static Methods</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<a NAME="RevPiCheckClient.__init__" ID="RevPiCheckClient.__init__"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient (Constructor)</h3>
|
||||
<b>RevPiCheckClient</b>(<i>master, xmlcli, xmlmode=0</i>)
|
||||
<p>
|
||||
Instantiiert MyApp-Klasse.
|
||||
</p><a NAME="RevPiCheckClient.__chval" ID="RevPiCheckClient.__chval"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.__chval</h3>
|
||||
<b>__chval</b>(<i>device, io, event=None</i>)
|
||||
<p>
|
||||
Schreibt neuen Output Wert auf den RevPi.
|
||||
</p><a NAME="RevPiCheckClient.__hidewin" ID="RevPiCheckClient.__hidewin"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.__hidewin</h3>
|
||||
<b>__hidewin</b>(<i>win, event=None</i>)
|
||||
<p>
|
||||
Verbergt übergebenes Fenster.
|
||||
</p><dl>
|
||||
<dt><i>win</i></dt>
|
||||
<dd>
|
||||
Fenster zum verbergen
|
||||
</dd><dt><i>event</i></dt>
|
||||
<dd>
|
||||
Tkinter Event
|
||||
</dd>
|
||||
</dl><a NAME="RevPiCheckClient.__saveoldvalue" ID="RevPiCheckClient.__saveoldvalue"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.__saveoldvalue</h3>
|
||||
<b>__saveoldvalue</b>(<i>event, tkvar</i>)
|
||||
<p>
|
||||
Speichert bei Keypress aktuellen Wert für wiederherstellung.
|
||||
</p><a NAME="RevPiCheckClient.__showwin" ID="RevPiCheckClient.__showwin"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.__showwin</h3>
|
||||
<b>__showwin</b>(<i>win</i>)
|
||||
<p>
|
||||
Zeigt oder verbergt übergebenes Fenster.
|
||||
</p><dl>
|
||||
<dt><i>win</i></dt>
|
||||
<dd>
|
||||
Fenster zum anzeigen/verbergen
|
||||
</dd>
|
||||
</dl><a NAME="RevPiCheckClient.__spinboxkey" ID="RevPiCheckClient.__spinboxkey"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.__spinboxkey</h3>
|
||||
<b>__spinboxkey</b>(<i>device, io, event=None</i>)
|
||||
<p>
|
||||
Prüft die Eingabe auf plausibilität.
|
||||
</p><dl>
|
||||
<dt><i>event</i></dt>
|
||||
<dd>
|
||||
tkinter Event
|
||||
</dd><dt><i>io</i></dt>
|
||||
<dd>
|
||||
IO Liste mit tkinter Variable
|
||||
</dd>
|
||||
</dl><a NAME="RevPiCheckClient._createiogroup" ID="RevPiCheckClient._createiogroup"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient._createiogroup</h3>
|
||||
<b>_createiogroup</b>(<i>device, frame, iotype</i>)
|
||||
<p>
|
||||
Erstellt IO-Gruppen.
|
||||
</p><dl>
|
||||
<dt><i>device</i></dt>
|
||||
<dd>
|
||||
Deviceposition
|
||||
</dd><dt><i>frame</i></dt>
|
||||
<dd>
|
||||
tkinter Frame
|
||||
</dd><dt><i>iotype</i></dt>
|
||||
<dd>
|
||||
'inp' oder 'out' als str()
|
||||
</dd>
|
||||
</dl><a NAME="RevPiCheckClient._createwidgets" ID="RevPiCheckClient._createwidgets"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient._createwidgets</h3>
|
||||
<b>_createwidgets</b>(<i></i>)
|
||||
<p>
|
||||
Erstellt den Fensterinhalt.
|
||||
</p><a NAME="RevPiCheckClient._onfrmconf" ID="RevPiCheckClient._onfrmconf"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient._onfrmconf</h3>
|
||||
<b>_onfrmconf</b>(<i>canvas</i>)
|
||||
<p>
|
||||
Erstellt Fenster in einem Canvas.
|
||||
</p><dl>
|
||||
<dt><i>canvas</i></dt>
|
||||
<dd>
|
||||
Canvas in dem Objekte erstellt werden sollen
|
||||
</dd>
|
||||
</dl><a NAME="RevPiCheckClient._warnwrite" ID="RevPiCheckClient._warnwrite"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient._warnwrite</h3>
|
||||
<b>_warnwrite</b>(<i></i>)
|
||||
<p>
|
||||
Warnung für Benutzer über Schreibfunktion einmal fragen.
|
||||
</p><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
True, wenn Warnung einmal mit OK bestätigt wurde
|
||||
</dd>
|
||||
</dl><a NAME="RevPiCheckClient._workvalues" ID="RevPiCheckClient._workvalues"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient._workvalues</h3>
|
||||
<b>_workvalues</b>(<i>io_dicts=None, writeout=False</i>)
|
||||
<p>
|
||||
Alle Werte der Inputs und Outputs abrufen.
|
||||
</p><dl>
|
||||
<dt><i>io_dicts</i></dt>
|
||||
<dd>
|
||||
Arbeit nur für dieses Dict()
|
||||
</dd><dt><i>writeout</i></dt>
|
||||
<dd>
|
||||
Änderungen auf RevPi schreiben
|
||||
</dd>
|
||||
</dl><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
None
|
||||
</dd>
|
||||
</dl><a NAME="RevPiCheckClient.hideallwindows" ID="RevPiCheckClient.hideallwindows"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.hideallwindows</h3>
|
||||
<b>hideallwindows</b>(<i></i>)
|
||||
<p>
|
||||
Versteckt alle Fenster.
|
||||
</p><a NAME="RevPiCheckClient.maxint" ID="RevPiCheckClient.maxint"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.maxint</h3>
|
||||
<b>maxint</b>(<i>bytelen</i>)
|
||||
<p>
|
||||
Errechnet maximalen int() Wert für Bytes max 22.
|
||||
</p><dl>
|
||||
<dt><i>bytelen</i></dt>
|
||||
<dd>
|
||||
Anzahl Bytes
|
||||
</dd>
|
||||
</dl><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
int() max oder 0 bei Überschreitung
|
||||
</dd>
|
||||
</dl><a NAME="RevPiCheckClient.readvalues" ID="RevPiCheckClient.readvalues"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.readvalues</h3>
|
||||
<b>readvalues</b>(<i></i>)
|
||||
<p>
|
||||
Ruft nur Input Werte von RevPi ab und aktualisiert Fenster.
|
||||
</p><a NAME="RevPiCheckClient.refreshvalues" ID="RevPiCheckClient.refreshvalues"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.refreshvalues</h3>
|
||||
<b>refreshvalues</b>(<i></i>)
|
||||
<p>
|
||||
Ruft alle IO Werte von RevPi ab und aktualisiert Fenster.
|
||||
</p><a NAME="RevPiCheckClient.tmr_workvalues" ID="RevPiCheckClient.tmr_workvalues"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.tmr_workvalues</h3>
|
||||
<b>tmr_workvalues</b>(<i></i>)
|
||||
<p>
|
||||
Timer für zyklische Abfrage.
|
||||
</p><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
None
|
||||
</dd>
|
||||
</dl><a NAME="RevPiCheckClient.toggleauto" ID="RevPiCheckClient.toggleauto"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.toggleauto</h3>
|
||||
<b>toggleauto</b>(<i></i>)
|
||||
<p>
|
||||
Schaltet zwischen Autorefresh um und aktualisiert Widgets.
|
||||
</p><a NAME="RevPiCheckClient.togglewrite" ID="RevPiCheckClient.togglewrite"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.togglewrite</h3>
|
||||
<b>togglewrite</b>(<i></i>)
|
||||
<p>
|
||||
Schaltet zwischen DoWrite um und aktiviert Schreibfunktion.
|
||||
</p><a NAME="RevPiCheckClient.validatereturn" ID="RevPiCheckClient.validatereturn"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.validatereturn</h3>
|
||||
<b>validatereturn</b>(<i>returnlist</i>)
|
||||
<p>
|
||||
Überprüft die Rückgaben der setvalue Funktion.
|
||||
</p><dl>
|
||||
<dt><i>returnlist</i></dt>
|
||||
<dd>
|
||||
list() der xml Rückgabe
|
||||
</dd>
|
||||
</dl><a NAME="RevPiCheckClient.writevalues" ID="RevPiCheckClient.writevalues"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.writevalues</h3>
|
||||
<b>writevalues</b>(<i></i>)
|
||||
<p>
|
||||
Schreibt geänderte Outputs auf den RevPi.
|
||||
</p>
|
||||
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||
<hr />
|
||||
</body></html>
|
||||
@@ -1,99 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<title>revpiinfo</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
|
||||
<h1 style="background-color:#FFFFFF;color:#0000FF">
|
||||
revpiinfo</h1>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Global Attributes</h3>
|
||||
<table>
|
||||
<tr><td>_</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Classes</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiInfo">RevPiInfo</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Functions</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<hr /><hr />
|
||||
<a NAME="RevPiInfo" ID="RevPiInfo"></a>
|
||||
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiInfo</h2>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Derived from</h3>
|
||||
tkinter.Frame
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Class Attributes</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Class Methods</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Methods</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiInfo.__init__">RevPiInfo</a></td>
|
||||
<td>Init RevPiLogfile-Class.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiInfo._checkclose">_checkclose</a></td>
|
||||
<td>Prüft ob Fenster beendet werden soll.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiInfo._createwidgets">_createwidgets</a></td>
|
||||
<td>Erstellt alle Widgets.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiInfo.visitwebsite">visitwebsite</a></td>
|
||||
<td>Öffnet auf dem System einen Webbrowser zur Projektseite.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Static Methods</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<a NAME="RevPiInfo.__init__" ID="RevPiInfo.__init__"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiInfo (Constructor)</h3>
|
||||
<b>RevPiInfo</b>(<i>master, xmlcli, version</i>)
|
||||
<p>
|
||||
Init RevPiLogfile-Class.
|
||||
</p><a NAME="RevPiInfo._checkclose" ID="RevPiInfo._checkclose"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiInfo._checkclose</h3>
|
||||
<b>_checkclose</b>(<i>event=None</i>)
|
||||
<p>
|
||||
Prüft ob Fenster beendet werden soll.
|
||||
</p><dl>
|
||||
<dt><i>event</i></dt>
|
||||
<dd>
|
||||
tkinter-Event
|
||||
</dd>
|
||||
</dl><a NAME="RevPiInfo._createwidgets" ID="RevPiInfo._createwidgets"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiInfo._createwidgets</h3>
|
||||
<b>_createwidgets</b>(<i>extended=False</i>)
|
||||
<p>
|
||||
Erstellt alle Widgets.
|
||||
</p><a NAME="RevPiInfo.visitwebsite" ID="RevPiInfo.visitwebsite"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiInfo.visitwebsite</h3>
|
||||
<b>visitwebsite</b>(<i>event=None</i>)
|
||||
<p>
|
||||
Öffnet auf dem System einen Webbrowser zur Projektseite.
|
||||
</p>
|
||||
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||
<hr />
|
||||
</body></html>
|
||||
@@ -1,164 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<title>revpilogfile</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
|
||||
<h1 style="background-color:#FFFFFF;color:#0000FF">
|
||||
revpilogfile</h1>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Global Attributes</h3>
|
||||
<table>
|
||||
<tr><td>_</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Classes</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiLogfile">RevPiLogfile</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Functions</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<hr /><hr />
|
||||
<a NAME="RevPiLogfile" ID="RevPiLogfile"></a>
|
||||
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiLogfile</h2>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Derived from</h3>
|
||||
tkinter.Frame
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Class Attributes</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Class Methods</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Methods</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiLogfile.__init__">RevPiLogfile</a></td>
|
||||
<td>Init RevPiLogfile-Class.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiLogfile._checkclose">_checkclose</a></td>
|
||||
<td>Prüft ob Fenster beendet werden soll.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiLogfile._createwidgets">_createwidgets</a></td>
|
||||
<td>Erstellt alle Widgets.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiLogfile._load_log">_load_log</a></td>
|
||||
<td>Läd die angegebenen Logfiles herunter.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiLogfile.btn_clearapp">btn_clearapp</a></td>
|
||||
<td>Leert die Logliste der App.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiLogfile.btn_clearplc">btn_clearplc</a></td>
|
||||
<td>Leert die Logliste des PLC.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiLogfile.get_applog">get_applog</a></td>
|
||||
<td>Ruft App Logbuch ab.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiLogfile.get_plclog">get_plclog</a></td>
|
||||
<td>Ruft PLC Logbuch ab.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Static Methods</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<a NAME="RevPiLogfile.__init__" ID="RevPiLogfile.__init__"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiLogfile (Constructor)</h3>
|
||||
<b>RevPiLogfile</b>(<i>master, xmlcli</i>)
|
||||
<p>
|
||||
Init RevPiLogfile-Class.
|
||||
</p><a NAME="RevPiLogfile._checkclose" ID="RevPiLogfile._checkclose"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiLogfile._checkclose</h3>
|
||||
<b>_checkclose</b>(<i>event=None</i>)
|
||||
<p>
|
||||
Prüft ob Fenster beendet werden soll.
|
||||
</p><dl>
|
||||
<dt><i>event</i></dt>
|
||||
<dd>
|
||||
tkinter-Event
|
||||
</dd>
|
||||
</dl><a NAME="RevPiLogfile._createwidgets" ID="RevPiLogfile._createwidgets"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiLogfile._createwidgets</h3>
|
||||
<b>_createwidgets</b>(<i></i>)
|
||||
<p>
|
||||
Erstellt alle Widgets.
|
||||
</p><a NAME="RevPiLogfile._load_log" ID="RevPiLogfile._load_log"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiLogfile._load_log</h3>
|
||||
<b>_load_log</b>(<i>textwidget, xmlcall, startposition, full</i>)
|
||||
<p>
|
||||
Läd die angegebenen Logfiles herunter.
|
||||
</p><dl>
|
||||
<dt><i>textwidget</i></dt>
|
||||
<dd>
|
||||
Widget in das Logs eingefügt werden sollen
|
||||
</dd><dt><i>xmlcall</i></dt>
|
||||
<dd>
|
||||
xmlrpc Funktion zum Abrufen der Logdaten
|
||||
</dd><dt><i>startposition</i></dt>
|
||||
<dd>
|
||||
Startposition ab der Logdaten kommen sollen
|
||||
</dd><dt><i>full</i></dt>
|
||||
<dd>
|
||||
Komplettes Logbuch laden
|
||||
</dd>
|
||||
</dl><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
Ende der Datei (neue Startposition)
|
||||
</dd>
|
||||
</dl><a NAME="RevPiLogfile.btn_clearapp" ID="RevPiLogfile.btn_clearapp"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiLogfile.btn_clearapp</h3>
|
||||
<b>btn_clearapp</b>(<i></i>)
|
||||
<p>
|
||||
Leert die Logliste der App.
|
||||
</p><a NAME="RevPiLogfile.btn_clearplc" ID="RevPiLogfile.btn_clearplc"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiLogfile.btn_clearplc</h3>
|
||||
<b>btn_clearplc</b>(<i></i>)
|
||||
<p>
|
||||
Leert die Logliste des PLC.
|
||||
</p><a NAME="RevPiLogfile.get_applog" ID="RevPiLogfile.get_applog"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiLogfile.get_applog</h3>
|
||||
<b>get_applog</b>(<i>full=False</i>)
|
||||
<p>
|
||||
Ruft App Logbuch ab.
|
||||
</p><dl>
|
||||
<dt><i>full</i></dt>
|
||||
<dd>
|
||||
Ganzes Logbuch laden
|
||||
</dd>
|
||||
</dl><a NAME="RevPiLogfile.get_plclog" ID="RevPiLogfile.get_plclog"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiLogfile.get_plclog</h3>
|
||||
<b>get_plclog</b>(<i>full=False</i>)
|
||||
<p>
|
||||
Ruft PLC Logbuch ab.
|
||||
</p><dl>
|
||||
<dt><i>full</i></dt>
|
||||
<dd>
|
||||
Ganzes Logbuch laden
|
||||
</dd>
|
||||
</dl>
|
||||
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||
<hr />
|
||||
</body></html>
|
||||
@@ -1,164 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<title>revpioption</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
|
||||
<h1 style="background-color:#FFFFFF;color:#0000FF">
|
||||
revpioption</h1>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Global Attributes</h3>
|
||||
<table>
|
||||
<tr><td>_</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Classes</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiOption">RevPiOption</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Functions</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<hr /><hr />
|
||||
<a NAME="RevPiOption" ID="RevPiOption"></a>
|
||||
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiOption</h2>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Derived from</h3>
|
||||
tkinter.Frame
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Class Attributes</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Class Methods</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Methods</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiOption.__init__">RevPiOption</a></td>
|
||||
<td>Init RevPiOption-Class.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiOption._changesdone">_changesdone</a></td>
|
||||
<td>Prüft ob sich die Einstellungen geändert haben.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiOption._checkclose">_checkclose</a></td>
|
||||
<td>Prüft ob Fenster beendet werden soll.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiOption._createwidgets">_createwidgets</a></td>
|
||||
<td>Erstellt Widgets.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiOption._loadappdata">_loadappdata</a></td>
|
||||
<td>Läd aktuelle Einstellungen vom RevPi.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiOption._setappdata">_setappdata</a></td>
|
||||
<td>Speichert geänderte Einstellungen auf RevPi.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiOption.askxmlon">askxmlon</a></td>
|
||||
<td>Fragt Nuter, ob wirklicht abgeschaltet werden soll.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiOption.xmlmod2_tail">xmlmod2_tail</a></td>
|
||||
<td>Passt XML-Optionszugriff an.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiOption.xmlmod_tail">xmlmod_tail</a></td>
|
||||
<td>Passt XML-Optionszugriff an.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Static Methods</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<a NAME="RevPiOption.__init__" ID="RevPiOption.__init__"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiOption (Constructor)</h3>
|
||||
<b>RevPiOption</b>(<i>master, xmlcli</i>)
|
||||
<p>
|
||||
Init RevPiOption-Class.
|
||||
</p><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
None
|
||||
</dd>
|
||||
</dl><a NAME="RevPiOption._changesdone" ID="RevPiOption._changesdone"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiOption._changesdone</h3>
|
||||
<b>_changesdone</b>(<i></i>)
|
||||
<p>
|
||||
Prüft ob sich die Einstellungen geändert haben.
|
||||
</p><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
True, wenn min. eine Einstellung geändert wurde
|
||||
</dd>
|
||||
</dl><a NAME="RevPiOption._checkclose" ID="RevPiOption._checkclose"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiOption._checkclose</h3>
|
||||
<b>_checkclose</b>(<i>event=None</i>)
|
||||
<p>
|
||||
Prüft ob Fenster beendet werden soll.
|
||||
</p><dl>
|
||||
<dt><i>event</i></dt>
|
||||
<dd>
|
||||
tkinter-Event
|
||||
</dd>
|
||||
</dl><a NAME="RevPiOption._createwidgets" ID="RevPiOption._createwidgets"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiOption._createwidgets</h3>
|
||||
<b>_createwidgets</b>(<i></i>)
|
||||
<p>
|
||||
Erstellt Widgets.
|
||||
</p><a NAME="RevPiOption._loadappdata" ID="RevPiOption._loadappdata"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiOption._loadappdata</h3>
|
||||
<b>_loadappdata</b>(<i>refresh=False</i>)
|
||||
<p>
|
||||
Läd aktuelle Einstellungen vom RevPi.
|
||||
</p><dl>
|
||||
<dt><i>refresh</i></dt>
|
||||
<dd>
|
||||
Wenn True, werden Einstellungen heruntergeladen.
|
||||
</dd>
|
||||
</dl><a NAME="RevPiOption._setappdata" ID="RevPiOption._setappdata"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiOption._setappdata</h3>
|
||||
<b>_setappdata</b>(<i></i>)
|
||||
<p>
|
||||
Speichert geänderte Einstellungen auf RevPi.
|
||||
</p><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
None
|
||||
</dd>
|
||||
</dl><a NAME="RevPiOption.askxmlon" ID="RevPiOption.askxmlon"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiOption.askxmlon</h3>
|
||||
<b>askxmlon</b>(<i></i>)
|
||||
<p>
|
||||
Fragt Nuter, ob wirklicht abgeschaltet werden soll.
|
||||
</p><a NAME="RevPiOption.xmlmod2_tail" ID="RevPiOption.xmlmod2_tail"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiOption.xmlmod2_tail</h3>
|
||||
<b>xmlmod2_tail</b>(<i></i>)
|
||||
<p>
|
||||
Passt XML-Optionszugriff an.
|
||||
</p><a NAME="RevPiOption.xmlmod_tail" ID="RevPiOption.xmlmod_tail"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiOption.xmlmod_tail</h3>
|
||||
<b>xmlmod_tail</b>(<i></i>)
|
||||
<p>
|
||||
Passt XML-Optionszugriff an.
|
||||
</p>
|
||||
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||
<hr />
|
||||
</body></html>
|
||||
@@ -1,188 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<title>revpiplclist</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
|
||||
<h1 style="background-color:#FFFFFF;color:#0000FF">
|
||||
revpiplclist</h1>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Global Attributes</h3>
|
||||
<table>
|
||||
<tr><td>_</td></tr><tr><td>savefile</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Classes</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPlcList">RevPiPlcList</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Functions</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#get_connections">get_connections</a></td>
|
||||
<td>Verbindungen aus Datei laden.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<hr /><hr />
|
||||
<a NAME="RevPiPlcList" ID="RevPiPlcList"></a>
|
||||
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiPlcList</h2>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Derived from</h3>
|
||||
tkinter.Frame
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Class Attributes</h3>
|
||||
<table>
|
||||
<tr><td>myapp</td></tr><tr><td>root</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Class Methods</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Methods</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPlcList.__init__">RevPiPlcList</a></td>
|
||||
<td>Init RevPiPlcList-class.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPlcList._checkclose">_checkclose</a></td>
|
||||
<td>Prüft ob Fenster beendet werden soll.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPlcList._createwidgets">_createwidgets</a></td>
|
||||
<td>Erstellt alle Widgets.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPlcList._saveappdata">_saveappdata</a></td>
|
||||
<td>Speichert Verbindungen im home Dir.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPlcList.build_listconn">build_listconn</a></td>
|
||||
<td>Füllt Verbindungsliste.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPlcList.evt_btnadd">evt_btnadd</a></td>
|
||||
<td>Verbindungseinstellungen übernehmen.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPlcList.evt_btnnew">evt_btnnew</a></td>
|
||||
<td>Neue Verbindung erstellen.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPlcList.evt_btnremove">evt_btnremove</a></td>
|
||||
<td>Verbindung löschen.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPlcList.evt_btnsave">evt_btnsave</a></td>
|
||||
<td>Alle Verbindungen speichern.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPlcList.evt_keypress">evt_keypress</a></td>
|
||||
<td>Passt bei Tastendruck den Status der Buttons an.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPlcList.evt_listconn">evt_listconn</a></td>
|
||||
<td>Übernimmt Einstellungen in Eingabefelder.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Static Methods</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<a NAME="RevPiPlcList.__init__" ID="RevPiPlcList.__init__"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPlcList (Constructor)</h3>
|
||||
<b>RevPiPlcList</b>(<i>master</i>)
|
||||
<p>
|
||||
Init RevPiPlcList-class.
|
||||
</p><dl>
|
||||
<dt><i>master</i></dt>
|
||||
<dd>
|
||||
tkinter master
|
||||
</dd>
|
||||
</dl><a NAME="RevPiPlcList._checkclose" ID="RevPiPlcList._checkclose"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPlcList._checkclose</h3>
|
||||
<b>_checkclose</b>(<i>event=None</i>)
|
||||
<p>
|
||||
Prüft ob Fenster beendet werden soll.
|
||||
</p><dl>
|
||||
<dt><i>event</i></dt>
|
||||
<dd>
|
||||
tkinter-Event
|
||||
</dd>
|
||||
</dl><a NAME="RevPiPlcList._createwidgets" ID="RevPiPlcList._createwidgets"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPlcList._createwidgets</h3>
|
||||
<b>_createwidgets</b>(<i></i>)
|
||||
<p>
|
||||
Erstellt alle Widgets.
|
||||
</p><a NAME="RevPiPlcList._saveappdata" ID="RevPiPlcList._saveappdata"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPlcList._saveappdata</h3>
|
||||
<b>_saveappdata</b>(<i></i>)
|
||||
<p>
|
||||
Speichert Verbindungen im home Dir.
|
||||
</p><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
True, bei erfolgreicher Verarbeitung
|
||||
</dd>
|
||||
</dl><a NAME="RevPiPlcList.build_listconn" ID="RevPiPlcList.build_listconn"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPlcList.build_listconn</h3>
|
||||
<b>build_listconn</b>(<i></i>)
|
||||
<p>
|
||||
Füllt Verbindungsliste.
|
||||
</p><a NAME="RevPiPlcList.evt_btnadd" ID="RevPiPlcList.evt_btnadd"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPlcList.evt_btnadd</h3>
|
||||
<b>evt_btnadd</b>(<i></i>)
|
||||
<p>
|
||||
Verbindungseinstellungen übernehmen.
|
||||
</p><a NAME="RevPiPlcList.evt_btnnew" ID="RevPiPlcList.evt_btnnew"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPlcList.evt_btnnew</h3>
|
||||
<b>evt_btnnew</b>(<i></i>)
|
||||
<p>
|
||||
Neue Verbindung erstellen.
|
||||
</p><a NAME="RevPiPlcList.evt_btnremove" ID="RevPiPlcList.evt_btnremove"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPlcList.evt_btnremove</h3>
|
||||
<b>evt_btnremove</b>(<i></i>)
|
||||
<p>
|
||||
Verbindung löschen.
|
||||
</p><a NAME="RevPiPlcList.evt_btnsave" ID="RevPiPlcList.evt_btnsave"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPlcList.evt_btnsave</h3>
|
||||
<b>evt_btnsave</b>(<i></i>)
|
||||
<p>
|
||||
Alle Verbindungen speichern.
|
||||
</p><a NAME="RevPiPlcList.evt_keypress" ID="RevPiPlcList.evt_keypress"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPlcList.evt_keypress</h3>
|
||||
<b>evt_keypress</b>(<i>evt=None</i>)
|
||||
<p>
|
||||
Passt bei Tastendruck den Status der Buttons an.
|
||||
</p><a NAME="RevPiPlcList.evt_listconn" ID="RevPiPlcList.evt_listconn"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPlcList.evt_listconn</h3>
|
||||
<b>evt_listconn</b>(<i>evt=None</i>)
|
||||
<p>
|
||||
Übernimmt Einstellungen in Eingabefelder.
|
||||
</p>
|
||||
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||
<hr /><hr />
|
||||
<a NAME="get_connections" ID="get_connections"></a>
|
||||
<h2 style="background-color:#FFFFFF;color:#0000FF">get_connections</h2>
|
||||
<b>get_connections</b>(<i></i>)
|
||||
<p>
|
||||
Verbindungen aus Datei laden.
|
||||
</p><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
dict() mit Verbindungen
|
||||
</dd>
|
||||
</dl>
|
||||
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||
<hr />
|
||||
</body></html>
|
||||
@@ -1,246 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<title>revpiprogram</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
|
||||
<h1 style="background-color:#FFFFFF;color:#0000FF">
|
||||
revpiprogram</h1>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Global Attributes</h3>
|
||||
<table>
|
||||
<tr><td>_</td></tr><tr><td>savefile</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Classes</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram">RevPiProgram</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Functions</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<hr /><hr />
|
||||
<a NAME="RevPiProgram" ID="RevPiProgram"></a>
|
||||
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiProgram</h2>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Derived from</h3>
|
||||
tkinter.Frame
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Class Attributes</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Class Methods</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Methods</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram.__init__">RevPiProgram</a></td>
|
||||
<td>Init RevPiProgram-Class.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram._checkclose">_checkclose</a></td>
|
||||
<td>Prüft ob Fenster beendet werden soll.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram._createwidgets">_createwidgets</a></td>
|
||||
<td>Erstellt alle Widgets.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram._evt_optdown">_evt_optdown</a></td>
|
||||
<td>Passt je nach gewählter Option den Status der Widgets an.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram._evt_optup">_evt_optup</a></td>
|
||||
<td>Passt je nach gewählter Option den Status der Widgets an.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram._loaddefault">_loaddefault</a></td>
|
||||
<td>Übernimmt für den Pi die letzen Pfade.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram._savedefaults">_savedefaults</a></td>
|
||||
<td>Schreibt fuer den Pi die letzen Pfade.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram.check_replacedir">check_replacedir</a></td>
|
||||
<td>Gibt das rootdir von einem entpackten Verzeichnis zurueck.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram.create_filelist">create_filelist</a></td>
|
||||
<td>Erstellt eine Dateiliste von einem Verzeichnis.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram.getpictoryrsc">getpictoryrsc</a></td>
|
||||
<td>Läd die piCtory Konfiguration herunter.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram.getprocimg">getprocimg</a></td>
|
||||
<td>Läd das aktuelle Prozessabbild herunter.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram.picontrolreset">picontrolreset</a></td>
|
||||
<td>Fürt ein Reset der piBridge durch.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram.plcdownload">plcdownload</a></td>
|
||||
<td>Läd das aktuelle Projekt herunter.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram.plcupload">plcupload</a></td>
|
||||
<td>Lädt das angegebene Projekt auf den RevPi.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiProgram.setpictoryrsc">setpictoryrsc</a></td>
|
||||
<td>Überträgt die angegebene piCtory-Konfiguration.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Static Methods</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<a NAME="RevPiProgram.__init__" ID="RevPiProgram.__init__"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram (Constructor)</h3>
|
||||
<b>RevPiProgram</b>(<i>master, xmlcli, xmlmode, revpi</i>)
|
||||
<p>
|
||||
Init RevPiProgram-Class.
|
||||
</p><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
None
|
||||
</dd>
|
||||
</dl><a NAME="RevPiProgram._checkclose" ID="RevPiProgram._checkclose"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram._checkclose</h3>
|
||||
<b>_checkclose</b>(<i>event=None</i>)
|
||||
<p>
|
||||
Prüft ob Fenster beendet werden soll.
|
||||
</p><dl>
|
||||
<dt><i>event</i></dt>
|
||||
<dd>
|
||||
tkinter-Event
|
||||
</dd>
|
||||
</dl><a NAME="RevPiProgram._createwidgets" ID="RevPiProgram._createwidgets"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram._createwidgets</h3>
|
||||
<b>_createwidgets</b>(<i></i>)
|
||||
<p>
|
||||
Erstellt alle Widgets.
|
||||
</p><a NAME="RevPiProgram._evt_optdown" ID="RevPiProgram._evt_optdown"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram._evt_optdown</h3>
|
||||
<b>_evt_optdown</b>(<i>text=""</i>)
|
||||
<p>
|
||||
Passt je nach gewählter Option den Status der Widgets an.
|
||||
</p><a NAME="RevPiProgram._evt_optup" ID="RevPiProgram._evt_optup"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram._evt_optup</h3>
|
||||
<b>_evt_optup</b>(<i>text=""</i>)
|
||||
<p>
|
||||
Passt je nach gewählter Option den Status der Widgets an.
|
||||
</p><a NAME="RevPiProgram._loaddefault" ID="RevPiProgram._loaddefault"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram._loaddefault</h3>
|
||||
<b>_loaddefault</b>(<i>full=False</i>)
|
||||
<p>
|
||||
Übernimmt für den Pi die letzen Pfade.
|
||||
</p><dl>
|
||||
<dt><i>full</i></dt>
|
||||
<dd>
|
||||
Einstellungen für alle Verbindungen laden
|
||||
</dd>
|
||||
</dl><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
dict() mit Einstellungen
|
||||
</dd>
|
||||
</dl><a NAME="RevPiProgram._savedefaults" ID="RevPiProgram._savedefaults"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram._savedefaults</h3>
|
||||
<b>_savedefaults</b>(<i></i>)
|
||||
<p>
|
||||
Schreibt fuer den Pi die letzen Pfade.
|
||||
</p><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
True, bei erfolgreicher Verarbeitung
|
||||
</dd>
|
||||
</dl><a NAME="RevPiProgram.check_replacedir" ID="RevPiProgram.check_replacedir"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram.check_replacedir</h3>
|
||||
<b>check_replacedir</b>(<i>rootdir</i>)
|
||||
<p>
|
||||
Gibt das rootdir von einem entpackten Verzeichnis zurueck.
|
||||
</p><p>
|
||||
Dabei wird geprueft, ob es sich um einen einzelnen Ordner handelt
|
||||
und ob es eine piCtory Konfiguration im rootdir gibt.
|
||||
</p><dl>
|
||||
<dt><i>rootdir</i></dt>
|
||||
<dd>
|
||||
Verzeichnis fuer Pruefung
|
||||
</dd>
|
||||
</dl><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
Abgeaendertes rootdir
|
||||
</dd>
|
||||
</dl><a NAME="RevPiProgram.create_filelist" ID="RevPiProgram.create_filelist"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram.create_filelist</h3>
|
||||
<b>create_filelist</b>(<i>rootdir</i>)
|
||||
<p>
|
||||
Erstellt eine Dateiliste von einem Verzeichnis.
|
||||
</p><dl>
|
||||
<dt><i>rootdir</i></dt>
|
||||
<dd>
|
||||
Verzeichnis fuer das eine Liste erstellt werden soll
|
||||
</dd>
|
||||
</dl><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
Dateiliste
|
||||
</dd>
|
||||
</dl><a NAME="RevPiProgram.getpictoryrsc" ID="RevPiProgram.getpictoryrsc"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram.getpictoryrsc</h3>
|
||||
<b>getpictoryrsc</b>(<i></i>)
|
||||
<p>
|
||||
Läd die piCtory Konfiguration herunter.
|
||||
</p><a NAME="RevPiProgram.getprocimg" ID="RevPiProgram.getprocimg"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram.getprocimg</h3>
|
||||
<b>getprocimg</b>(<i></i>)
|
||||
<p>
|
||||
Läd das aktuelle Prozessabbild herunter.
|
||||
</p><a NAME="RevPiProgram.picontrolreset" ID="RevPiProgram.picontrolreset"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram.picontrolreset</h3>
|
||||
<b>picontrolreset</b>(<i></i>)
|
||||
<p>
|
||||
Fürt ein Reset der piBridge durch.
|
||||
</p><a NAME="RevPiProgram.plcdownload" ID="RevPiProgram.plcdownload"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram.plcdownload</h3>
|
||||
<b>plcdownload</b>(<i></i>)
|
||||
<p>
|
||||
Läd das aktuelle Projekt herunter.
|
||||
</p><a NAME="RevPiProgram.plcupload" ID="RevPiProgram.plcupload"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram.plcupload</h3>
|
||||
<b>plcupload</b>(<i></i>)
|
||||
<p>
|
||||
Lädt das angegebene Projekt auf den RevPi.
|
||||
</p><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
True, bei erfolgreicher Verarbeitung
|
||||
</dd>
|
||||
</dl><a NAME="RevPiProgram.setpictoryrsc" ID="RevPiProgram.setpictoryrsc"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiProgram.setpictoryrsc</h3>
|
||||
<b>setpictoryrsc</b>(<i>filename=None</i>)
|
||||
<p>
|
||||
Überträgt die angegebene piCtory-Konfiguration.
|
||||
</p>
|
||||
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||
<hr />
|
||||
</body></html>
|
||||
@@ -1,270 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html><head>
|
||||
<title>revpipycontrol</title>
|
||||
<meta charset="UTF-8">
|
||||
</head>
|
||||
<body style="background-color:#FFFFFF;color:#000000"><a NAME="top" ID="top"></a>
|
||||
<h1 style="background-color:#FFFFFF;color:#0000FF">
|
||||
revpipycontrol</h1>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Global Attributes</h3>
|
||||
<table>
|
||||
<tr><td>_</td></tr><tr><td>pycontrolversion</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Classes</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl">RevPiPyControl</a></td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Functions</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<hr /><hr />
|
||||
<a NAME="RevPiPyControl" ID="RevPiPyControl"></a>
|
||||
<h2 style="background-color:#FFFFFF;color:#0000FF">RevPiPyControl</h2>
|
||||
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Derived from</h3>
|
||||
tkinter.Frame
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Class Attributes</h3>
|
||||
<table>
|
||||
<tr><td>myapp</td></tr><tr><td>root</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Class Methods</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Methods</h3>
|
||||
<table>
|
||||
<tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl.__init__">RevPiPyControl</a></td>
|
||||
<td>Init RevPiPyControl-Class.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl._btnstate">_btnstate</a></td>
|
||||
<td>Setzt den state der Buttons.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl._closeall">_closeall</a></td>
|
||||
<td>Schließt alle Fenster.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl._closeapp">_closeapp</a></td>
|
||||
<td>Räumt auf und beendet Programm.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl._createwidgets">_createwidgets</a></td>
|
||||
<td>Erstellt den Fensterinhalt.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl._fillconnbar">_fillconnbar</a></td>
|
||||
<td>Generiert Menüeinträge für Verbindungen.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl._fillmbar">_fillmbar</a></td>
|
||||
<td>Generiert Menüeinträge.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl._opt_conn">_opt_conn</a></td>
|
||||
<td>Stellt eine neue Verbindung zu RevPiPyLoad her.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl.infowindow">infowindow</a></td>
|
||||
<td>Öffnet das Fenster für die Info.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl.plcdebug">plcdebug</a></td>
|
||||
<td>Baut den Debugframe und packt ihn.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl.plclist">plclist</a></td>
|
||||
<td>Öffnet das Fenster für die Verbindungen.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl.plclogs">plclogs</a></td>
|
||||
<td>Öffnet das Fenster für Logdateien.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl.plcoptions">plcoptions</a></td>
|
||||
<td>Startet das Optionsfenster.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl.plcprogram">plcprogram</a></td>
|
||||
<td>Startet das Programmfenster.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl.plcrestart">plcrestart</a></td>
|
||||
<td>Startet das PLC Programm neu.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl.plcstart">plcstart</a></td>
|
||||
<td>Startet das PLC Programm.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl.plcstop">plcstop</a></td>
|
||||
<td>Beendet das PLC Programm.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl.serverdisconnect">serverdisconnect</a></td>
|
||||
<td>Trennt eine bestehende Verbindung.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl.servererror">servererror</a></td>
|
||||
<td>Setzt alles zurück für neue Verbindungen.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl.tmr_plcrunning">tmr_plcrunning</a></td>
|
||||
<td>Timer der den Status des PLC Programms prüft.</td>
|
||||
</tr><tr>
|
||||
<td><a style="color:#0000FF" href="#RevPiPyControl.visitwebsite">visitwebsite</a></td>
|
||||
<td>Öffnet auf dem System einen Webbrowser zur Projektseite.</td>
|
||||
</tr>
|
||||
</table>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
Static Methods</h3>
|
||||
<table>
|
||||
<tr><td>None</td></tr>
|
||||
</table>
|
||||
<a NAME="RevPiPyControl.__init__" ID="RevPiPyControl.__init__"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl (Constructor)</h3>
|
||||
<b>RevPiPyControl</b>(<i>master=None</i>)
|
||||
<p>
|
||||
Init RevPiPyControl-Class.
|
||||
</p><dl>
|
||||
<dt><i>master</i></dt>
|
||||
<dd>
|
||||
tkinter master
|
||||
</dd>
|
||||
</dl><a NAME="RevPiPyControl._btnstate" ID="RevPiPyControl._btnstate"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl._btnstate</h3>
|
||||
<b>_btnstate</b>(<i></i>)
|
||||
<p>
|
||||
Setzt den state der Buttons.
|
||||
</p><a NAME="RevPiPyControl._closeall" ID="RevPiPyControl._closeall"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl._closeall</h3>
|
||||
<b>_closeall</b>(<i></i>)
|
||||
<p>
|
||||
Schließt alle Fenster.
|
||||
</p><a NAME="RevPiPyControl._closeapp" ID="RevPiPyControl._closeapp"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl._closeapp</h3>
|
||||
<b>_closeapp</b>(<i>event=None</i>)
|
||||
<p>
|
||||
Räumt auf und beendet Programm.
|
||||
</p><dl>
|
||||
<dt><i>event</i></dt>
|
||||
<dd>
|
||||
tkinter Event
|
||||
</dd>
|
||||
</dl><a NAME="RevPiPyControl._createwidgets" ID="RevPiPyControl._createwidgets"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl._createwidgets</h3>
|
||||
<b>_createwidgets</b>(<i></i>)
|
||||
<p>
|
||||
Erstellt den Fensterinhalt.
|
||||
</p><a NAME="RevPiPyControl._fillconnbar" ID="RevPiPyControl._fillconnbar"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl._fillconnbar</h3>
|
||||
<b>_fillconnbar</b>(<i></i>)
|
||||
<p>
|
||||
Generiert Menüeinträge für Verbindungen.
|
||||
</p><a NAME="RevPiPyControl._fillmbar" ID="RevPiPyControl._fillmbar"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl._fillmbar</h3>
|
||||
<b>_fillmbar</b>(<i></i>)
|
||||
<p>
|
||||
Generiert Menüeinträge.
|
||||
</p><a NAME="RevPiPyControl._opt_conn" ID="RevPiPyControl._opt_conn"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl._opt_conn</h3>
|
||||
<b>_opt_conn</b>(<i>text, reconnect=False</i>)
|
||||
<p>
|
||||
Stellt eine neue Verbindung zu RevPiPyLoad her.
|
||||
</p><dl>
|
||||
<dt><i>text</i></dt>
|
||||
<dd>
|
||||
Verbindungsname
|
||||
</dd><dt><i>reconnect</i></dt>
|
||||
<dd>
|
||||
Socket Timeout nicht heruntersetzen
|
||||
</dd>
|
||||
</dl><a NAME="RevPiPyControl.infowindow" ID="RevPiPyControl.infowindow"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl.infowindow</h3>
|
||||
<b>infowindow</b>(<i></i>)
|
||||
<p>
|
||||
Öffnet das Fenster für die Info.
|
||||
</p><a NAME="RevPiPyControl.plcdebug" ID="RevPiPyControl.plcdebug"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl.plcdebug</h3>
|
||||
<b>plcdebug</b>(<i></i>)
|
||||
<p>
|
||||
Baut den Debugframe und packt ihn.
|
||||
</p><a NAME="RevPiPyControl.plclist" ID="RevPiPyControl.plclist"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl.plclist</h3>
|
||||
<b>plclist</b>(<i></i>)
|
||||
<p>
|
||||
Öffnet das Fenster für die Verbindungen.
|
||||
</p><a NAME="RevPiPyControl.plclogs" ID="RevPiPyControl.plclogs"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl.plclogs</h3>
|
||||
<b>plclogs</b>(<i></i>)
|
||||
<p>
|
||||
Öffnet das Fenster für Logdateien.
|
||||
</p><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
None
|
||||
</dd>
|
||||
</dl><a NAME="RevPiPyControl.plcoptions" ID="RevPiPyControl.plcoptions"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl.plcoptions</h3>
|
||||
<b>plcoptions</b>(<i></i>)
|
||||
<p>
|
||||
Startet das Optionsfenster.
|
||||
</p><a NAME="RevPiPyControl.plcprogram" ID="RevPiPyControl.plcprogram"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl.plcprogram</h3>
|
||||
<b>plcprogram</b>(<i></i>)
|
||||
<p>
|
||||
Startet das Programmfenster.
|
||||
</p><a NAME="RevPiPyControl.plcrestart" ID="RevPiPyControl.plcrestart"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl.plcrestart</h3>
|
||||
<b>plcrestart</b>(<i></i>)
|
||||
<p>
|
||||
Startet das PLC Programm neu.
|
||||
</p><a NAME="RevPiPyControl.plcstart" ID="RevPiPyControl.plcstart"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl.plcstart</h3>
|
||||
<b>plcstart</b>(<i></i>)
|
||||
<p>
|
||||
Startet das PLC Programm.
|
||||
</p><a NAME="RevPiPyControl.plcstop" ID="RevPiPyControl.plcstop"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl.plcstop</h3>
|
||||
<b>plcstop</b>(<i></i>)
|
||||
<p>
|
||||
Beendet das PLC Programm.
|
||||
</p><a NAME="RevPiPyControl.serverdisconnect" ID="RevPiPyControl.serverdisconnect"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl.serverdisconnect</h3>
|
||||
<b>serverdisconnect</b>(<i></i>)
|
||||
<p>
|
||||
Trennt eine bestehende Verbindung.
|
||||
</p><a NAME="RevPiPyControl.servererror" ID="RevPiPyControl.servererror"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl.servererror</h3>
|
||||
<b>servererror</b>(<i></i>)
|
||||
<p>
|
||||
Setzt alles zurück für neue Verbindungen.
|
||||
</p><a NAME="RevPiPyControl.tmr_plcrunning" ID="RevPiPyControl.tmr_plcrunning"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl.tmr_plcrunning</h3>
|
||||
<b>tmr_plcrunning</b>(<i></i>)
|
||||
<p>
|
||||
Timer der den Status des PLC Programms prüft.
|
||||
</p><a NAME="RevPiPyControl.visitwebsite" ID="RevPiPyControl.visitwebsite"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiPyControl.visitwebsite</h3>
|
||||
<b>visitwebsite</b>(<i></i>)
|
||||
<p>
|
||||
Öffnet auf dem System einen Webbrowser zur Projektseite.
|
||||
</p>
|
||||
<div align="right"><a style="color:#0000FF" href="#top">Up</a></div>
|
||||
<hr />
|
||||
</body></html>
|
||||
20
docs/Makefile
Normal file
20
docs/Makefile
Normal file
@@ -0,0 +1,20 @@
|
||||
# Minimal makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
SPHINXPROJ = RevPiPyControl
|
||||
SOURCEDIR = .
|
||||
BUILDDIR = _build
|
||||
|
||||
# Put it first so that "make" without argument is like "make help".
|
||||
help:
|
||||
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
|
||||
.PHONY: help Makefile
|
||||
|
||||
# Catch-all target: route all unknown targets to Sphinx using the new
|
||||
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
|
||||
%: Makefile
|
||||
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
|
||||
7
docs/aclmanager.rst
Normal file
7
docs/aclmanager.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
aclmanager module
|
||||
=================
|
||||
|
||||
.. automodule:: aclmanager
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
171
docs/conf.py
Normal file
171
docs/conf.py
Normal file
@@ -0,0 +1,171 @@
|
||||
#!/usr/bin/env python3
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# RevPiPyControl documentation build configuration file, created by
|
||||
# sphinx-quickstart on Sun Oct 20 17:05:21 2019.
|
||||
#
|
||||
# This file is execfile()d with the current directory set to its
|
||||
# containing dir.
|
||||
#
|
||||
# Note that not all possible configuration values are present in this
|
||||
# autogenerated file.
|
||||
#
|
||||
# All configuration values have a default; values that are commented out
|
||||
# serve to show the default.
|
||||
|
||||
# If extensions (or modules to document with autodoc) are in another directory,
|
||||
# add these directories to sys.path here. If the directory is relative to the
|
||||
# documentation root, use os.path.abspath to make it absolute, like shown here.
|
||||
#
|
||||
import os
|
||||
import sys
|
||||
sys.path.insert(0, os.path.abspath('../revpipycontrol'))
|
||||
|
||||
|
||||
# -- General configuration ------------------------------------------------
|
||||
|
||||
# If your documentation needs a minimal Sphinx version, state it here.
|
||||
#
|
||||
# needs_sphinx = '1.0'
|
||||
|
||||
# Add any Sphinx extension module names here, as strings. They can be
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = ['sphinx.ext.autodoc',
|
||||
'sphinx.ext.todo',
|
||||
'sphinx.ext.viewcode']
|
||||
|
||||
# Add any paths that contain templates here, relative to this directory.
|
||||
templates_path = ['_templates']
|
||||
|
||||
# The suffix(es) of source filenames.
|
||||
# You can specify multiple suffix as a list of string:
|
||||
#
|
||||
# source_suffix = ['.rst', '.md']
|
||||
source_suffix = '.rst'
|
||||
|
||||
# The master toctree document.
|
||||
master_doc = 'index'
|
||||
|
||||
# General information about the project.
|
||||
project = 'RevPiPyControl'
|
||||
copyright = '2019, Sven Sager (NaruX)'
|
||||
author = 'Sven Sager (NaruX)'
|
||||
|
||||
# The version info for the project you're documenting, acts as replacement for
|
||||
# |version| and |release|, also used in various other places throughout the
|
||||
# built documents.
|
||||
#
|
||||
# The short X.Y version.
|
||||
version = ''
|
||||
# The full version, including alpha/beta/rc tags.
|
||||
release = ''
|
||||
|
||||
# The language for content autogenerated by Sphinx. Refer to documentation
|
||||
# for a list of supported languages.
|
||||
#
|
||||
# This is also used if you do content translation via gettext catalogs.
|
||||
# Usually you set "language" from the command line for these cases.
|
||||
language = None
|
||||
|
||||
# List of patterns, relative to source directory, that match files and
|
||||
# directories to ignore when looking for source files.
|
||||
# This patterns also effect to html_static_path and html_extra_path
|
||||
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
|
||||
|
||||
# The name of the Pygments (syntax highlighting) style to use.
|
||||
pygments_style = 'sphinx'
|
||||
|
||||
# If true, `todo` and `todoList` produce output, else they produce nothing.
|
||||
todo_include_todos = True
|
||||
|
||||
|
||||
# -- Options for HTML output ----------------------------------------------
|
||||
|
||||
# The theme to use for HTML and HTML Help pages. See the documentation for
|
||||
# a list of builtin themes.
|
||||
#
|
||||
html_theme = 'alabaster'
|
||||
|
||||
# Theme options are theme-specific and customize the look and feel of a theme
|
||||
# further. For a list of options available for each theme, see the
|
||||
# documentation.
|
||||
#
|
||||
# html_theme_options = {}
|
||||
|
||||
# Add any paths that contain custom static files (such as style sheets) here,
|
||||
# relative to this directory. They are copied after the builtin static files,
|
||||
# so a file named "default.css" will overwrite the builtin "default.css".
|
||||
html_static_path = ['_static']
|
||||
|
||||
# Custom sidebar templates, must be a dictionary that maps document names
|
||||
# to template names.
|
||||
#
|
||||
# This is required for the alabaster theme
|
||||
# refs: http://alabaster.readthedocs.io/en/latest/installation.html#sidebars
|
||||
html_sidebars = {
|
||||
'**': [
|
||||
'relations.html', # needs 'show_related': True theme option to display
|
||||
'searchbox.html',
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
# -- Options for HTMLHelp output ------------------------------------------
|
||||
|
||||
# Output file base name for HTML help builder.
|
||||
htmlhelp_basename = 'RevPiPyControldoc'
|
||||
|
||||
|
||||
# -- Options for LaTeX output ---------------------------------------------
|
||||
|
||||
latex_elements = {
|
||||
# The paper size ('letterpaper' or 'a4paper').
|
||||
#
|
||||
# 'papersize': 'letterpaper',
|
||||
|
||||
# The font size ('10pt', '11pt' or '12pt').
|
||||
#
|
||||
# 'pointsize': '10pt',
|
||||
|
||||
# Additional stuff for the LaTeX preamble.
|
||||
#
|
||||
# 'preamble': '',
|
||||
|
||||
# Latex figure (float) alignment
|
||||
#
|
||||
# 'figure_align': 'htbp',
|
||||
}
|
||||
|
||||
# Grouping the document tree into LaTeX files. List of tuples
|
||||
# (source start file, target name, title,
|
||||
# author, documentclass [howto, manual, or own class]).
|
||||
latex_documents = [
|
||||
(master_doc, 'RevPiPyControl.tex', 'RevPiPyControl Documentation',
|
||||
'Sven Sager (NaruX)', 'manual'),
|
||||
]
|
||||
|
||||
|
||||
# -- Options for manual page output ---------------------------------------
|
||||
|
||||
# One entry per manual page. List of tuples
|
||||
# (source start file, name, description, authors, manual section).
|
||||
man_pages = [
|
||||
(master_doc, 'revpipycontrol', 'RevPiPyControl Documentation',
|
||||
[author], 1)
|
||||
]
|
||||
|
||||
|
||||
# -- Options for Texinfo output -------------------------------------------
|
||||
|
||||
# Grouping the document tree into Texinfo files. List of tuples
|
||||
# (source start file, target name, title, author,
|
||||
# dir menu entry, description, category)
|
||||
texinfo_documents = [
|
||||
(master_doc, 'RevPiPyControl', 'RevPiPyControl Documentation',
|
||||
author, 'RevPiPyControl', 'One line description of project.',
|
||||
'Miscellaneous'),
|
||||
]
|
||||
|
||||
|
||||
|
||||
20
docs/index.rst
Normal file
20
docs/index.rst
Normal file
@@ -0,0 +1,20 @@
|
||||
.. RevPiPyControl documentation master file, created by
|
||||
sphinx-quickstart on Sun Oct 20 17:05:21 2019.
|
||||
You can adapt this file completely to your liking, but it should at least
|
||||
contain the root `toctree` directive.
|
||||
|
||||
Welcome to RevPiPyControl's documentation!
|
||||
==========================================
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 2
|
||||
:caption: Contents:
|
||||
|
||||
|
||||
|
||||
Indices and tables
|
||||
==================
|
||||
|
||||
* :ref:`genindex`
|
||||
* :ref:`modindex`
|
||||
* :ref:`search`
|
||||
19
docs/modules.rst
Normal file
19
docs/modules.rst
Normal file
@@ -0,0 +1,19 @@
|
||||
revpipycontrol
|
||||
==============
|
||||
|
||||
.. toctree::
|
||||
:maxdepth: 4
|
||||
|
||||
aclmanager
|
||||
mqttmanager
|
||||
mytools
|
||||
revpicheckclient
|
||||
revpidevelop
|
||||
revpiinfo
|
||||
revpilegacy
|
||||
revpilogfile
|
||||
revpioption
|
||||
revpiplclist
|
||||
revpiprogram
|
||||
revpipycontrol
|
||||
shared
|
||||
7
docs/mqttmanager.rst
Normal file
7
docs/mqttmanager.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
mqttmanager module
|
||||
==================
|
||||
|
||||
.. automodule:: mqttmanager
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
7
docs/mytools.rst
Normal file
7
docs/mytools.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
mytools module
|
||||
==============
|
||||
|
||||
.. automodule:: mytools
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
7
docs/revpicheckclient.rst
Normal file
7
docs/revpicheckclient.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
revpicheckclient module
|
||||
=======================
|
||||
|
||||
.. automodule:: revpicheckclient
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
7
docs/revpidevelop.rst
Normal file
7
docs/revpidevelop.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
revpidevelop module
|
||||
===================
|
||||
|
||||
.. automodule:: revpidevelop
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
7
docs/revpiinfo.rst
Normal file
7
docs/revpiinfo.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
revpiinfo module
|
||||
================
|
||||
|
||||
.. automodule:: revpiinfo
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
7
docs/revpilegacy.rst
Normal file
7
docs/revpilegacy.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
revpilegacy module
|
||||
==================
|
||||
|
||||
.. automodule:: revpilegacy
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
7
docs/revpilogfile.rst
Normal file
7
docs/revpilogfile.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
revpilogfile module
|
||||
===================
|
||||
|
||||
.. automodule:: revpilogfile
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
7
docs/revpioption.rst
Normal file
7
docs/revpioption.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
revpioption module
|
||||
==================
|
||||
|
||||
.. automodule:: revpioption
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
7
docs/revpiplclist.rst
Normal file
7
docs/revpiplclist.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
revpiplclist module
|
||||
===================
|
||||
|
||||
.. automodule:: revpiplclist
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
7
docs/revpiprogram.rst
Normal file
7
docs/revpiprogram.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
revpiprogram module
|
||||
===================
|
||||
|
||||
.. automodule:: revpiprogram
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
7
docs/revpipycontrol.rst
Normal file
7
docs/revpipycontrol.rst
Normal file
@@ -0,0 +1,7 @@
|
||||
revpipycontrol module
|
||||
=====================
|
||||
|
||||
.. automodule:: revpipycontrol
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
22
docs/shared.rst
Normal file
22
docs/shared.rst
Normal file
@@ -0,0 +1,22 @@
|
||||
shared package
|
||||
==============
|
||||
|
||||
Submodules
|
||||
----------
|
||||
|
||||
shared\.ipaclmanager module
|
||||
---------------------------
|
||||
|
||||
.. automodule:: shared.ipaclmanager
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
|
||||
|
||||
Module contents
|
||||
---------------
|
||||
|
||||
.. automodule:: shared
|
||||
:members:
|
||||
:undoc-members:
|
||||
:show-inheritance:
|
||||
5
make.bat
Normal file
5
make.bat
Normal file
@@ -0,0 +1,5 @@
|
||||
@echo off
|
||||
pyinstaller --clean -D --windowed ^
|
||||
--add-data="data\revpipycontrol.ico;." ^
|
||||
--icon=data\\revpipycontrol.ico ^
|
||||
revpipycontrol\revpipycontrol.py
|
||||
@@ -1,105 +0,0 @@
|
||||
mytools.addroot?4(filename)
|
||||
mytools.gettrans?4(proglang=None)
|
||||
revpicheckclient.RevPiCheckClient.__chval?6(device, io, event=None)
|
||||
revpicheckclient.RevPiCheckClient.__hidewin?6(win, event=None)
|
||||
revpicheckclient.RevPiCheckClient.__saveoldvalue?6(event, tkvar)
|
||||
revpicheckclient.RevPiCheckClient.__showwin?6(win)
|
||||
revpicheckclient.RevPiCheckClient.__spinboxkey?6(device, io, event=None)
|
||||
revpicheckclient.RevPiCheckClient._createiogroup?5(device, frame, iotype)
|
||||
revpicheckclient.RevPiCheckClient._createwidgets?5()
|
||||
revpicheckclient.RevPiCheckClient._onfrmconf?5(canvas)
|
||||
revpicheckclient.RevPiCheckClient._warnwrite?5()
|
||||
revpicheckclient.RevPiCheckClient._workvalues?5(io_dicts=None, writeout=False)
|
||||
revpicheckclient.RevPiCheckClient.hideallwindows?4()
|
||||
revpicheckclient.RevPiCheckClient.maxint?4(bytelen)
|
||||
revpicheckclient.RevPiCheckClient.readvalues?4()
|
||||
revpicheckclient.RevPiCheckClient.refreshvalues?4()
|
||||
revpicheckclient.RevPiCheckClient.tmr_workvalues?4()
|
||||
revpicheckclient.RevPiCheckClient.toggleauto?4()
|
||||
revpicheckclient.RevPiCheckClient.togglewrite?4()
|
||||
revpicheckclient.RevPiCheckClient.validatereturn?4(returnlist)
|
||||
revpicheckclient.RevPiCheckClient.writevalues?4()
|
||||
revpicheckclient.RevPiCheckClient?1(master, xmlcli, xmlmode=0)
|
||||
revpicheckclient._?8
|
||||
revpiinfo.RevPiInfo._checkclose?5(event=None)
|
||||
revpiinfo.RevPiInfo._createwidgets?5(extended=False)
|
||||
revpiinfo.RevPiInfo.visitwebsite?4(event=None)
|
||||
revpiinfo.RevPiInfo?1(master, xmlcli, version)
|
||||
revpiinfo._?8
|
||||
revpilogfile.RevPiLogfile._checkclose?5(event=None)
|
||||
revpilogfile.RevPiLogfile._createwidgets?5()
|
||||
revpilogfile.RevPiLogfile._load_log?5(textwidget, xmlcall, startposition, full)
|
||||
revpilogfile.RevPiLogfile.btn_clearapp?4()
|
||||
revpilogfile.RevPiLogfile.btn_clearplc?4()
|
||||
revpilogfile.RevPiLogfile.get_applog?4(full=False)
|
||||
revpilogfile.RevPiLogfile.get_plclog?4(full=False)
|
||||
revpilogfile.RevPiLogfile?1(master, xmlcli)
|
||||
revpilogfile._?8
|
||||
revpioption.RevPiOption._changesdone?5()
|
||||
revpioption.RevPiOption._checkclose?5(event=None)
|
||||
revpioption.RevPiOption._createwidgets?5()
|
||||
revpioption.RevPiOption._loadappdata?5(refresh=False)
|
||||
revpioption.RevPiOption._setappdata?5()
|
||||
revpioption.RevPiOption.askxmlon?4()
|
||||
revpioption.RevPiOption.xmlmod2_tail?4()
|
||||
revpioption.RevPiOption.xmlmod_tail?4()
|
||||
revpioption.RevPiOption?1(master, xmlcli)
|
||||
revpioption._?8
|
||||
revpiplclist.RevPiPlcList._checkclose?5(event=None)
|
||||
revpiplclist.RevPiPlcList._createwidgets?5()
|
||||
revpiplclist.RevPiPlcList._saveappdata?5()
|
||||
revpiplclist.RevPiPlcList.build_listconn?4()
|
||||
revpiplclist.RevPiPlcList.evt_btnadd?4()
|
||||
revpiplclist.RevPiPlcList.evt_btnnew?4()
|
||||
revpiplclist.RevPiPlcList.evt_btnremove?4()
|
||||
revpiplclist.RevPiPlcList.evt_btnsave?4()
|
||||
revpiplclist.RevPiPlcList.evt_keypress?4(evt=None)
|
||||
revpiplclist.RevPiPlcList.evt_listconn?4(evt=None)
|
||||
revpiplclist.RevPiPlcList.myapp?7
|
||||
revpiplclist.RevPiPlcList.root?7
|
||||
revpiplclist.RevPiPlcList?1(master)
|
||||
revpiplclist._?8
|
||||
revpiplclist.get_connections?4()
|
||||
revpiplclist.savefile?7
|
||||
revpiprogram.RevPiProgram._checkclose?5(event=None)
|
||||
revpiprogram.RevPiProgram._createwidgets?5()
|
||||
revpiprogram.RevPiProgram._evt_optdown?5(text="")
|
||||
revpiprogram.RevPiProgram._evt_optup?5(text="")
|
||||
revpiprogram.RevPiProgram._loaddefault?5(full=False)
|
||||
revpiprogram.RevPiProgram._savedefaults?5()
|
||||
revpiprogram.RevPiProgram.check_replacedir?4(rootdir)
|
||||
revpiprogram.RevPiProgram.create_filelist?4(rootdir)
|
||||
revpiprogram.RevPiProgram.getpictoryrsc?4()
|
||||
revpiprogram.RevPiProgram.getprocimg?4()
|
||||
revpiprogram.RevPiProgram.picontrolreset?4()
|
||||
revpiprogram.RevPiProgram.plcdownload?4()
|
||||
revpiprogram.RevPiProgram.plcupload?4()
|
||||
revpiprogram.RevPiProgram.setpictoryrsc?4(filename=None)
|
||||
revpiprogram.RevPiProgram?1(master, xmlcli, xmlmode, revpi)
|
||||
revpiprogram._?8
|
||||
revpiprogram.savefile?7
|
||||
revpipycontrol.RevPiPyControl._btnstate?5()
|
||||
revpipycontrol.RevPiPyControl._closeall?5()
|
||||
revpipycontrol.RevPiPyControl._closeapp?5(event=None)
|
||||
revpipycontrol.RevPiPyControl._createwidgets?5()
|
||||
revpipycontrol.RevPiPyControl._fillconnbar?5()
|
||||
revpipycontrol.RevPiPyControl._fillmbar?5()
|
||||
revpipycontrol.RevPiPyControl._opt_conn?5(text, reconnect=False)
|
||||
revpipycontrol.RevPiPyControl.infowindow?4()
|
||||
revpipycontrol.RevPiPyControl.myapp?7
|
||||
revpipycontrol.RevPiPyControl.plcdebug?4()
|
||||
revpipycontrol.RevPiPyControl.plclist?4()
|
||||
revpipycontrol.RevPiPyControl.plclogs?4()
|
||||
revpipycontrol.RevPiPyControl.plcoptions?4()
|
||||
revpipycontrol.RevPiPyControl.plcprogram?4()
|
||||
revpipycontrol.RevPiPyControl.plcrestart?4()
|
||||
revpipycontrol.RevPiPyControl.plcstart?4()
|
||||
revpipycontrol.RevPiPyControl.plcstop?4()
|
||||
revpipycontrol.RevPiPyControl.root?7
|
||||
revpipycontrol.RevPiPyControl.serverdisconnect?4()
|
||||
revpipycontrol.RevPiPyControl.servererror?4()
|
||||
revpipycontrol.RevPiPyControl.tmr_plcrunning?4()
|
||||
revpipycontrol.RevPiPyControl.visitwebsite?4()
|
||||
revpipycontrol.RevPiPyControl?1(master=None)
|
||||
revpipycontrol._?8
|
||||
revpipycontrol.pycontrolversion?7
|
||||
@@ -1,7 +0,0 @@
|
||||
RevPiCheckClient tkinter.Frame
|
||||
RevPiInfo tkinter.Frame
|
||||
RevPiLogfile tkinter.Frame
|
||||
RevPiOption tkinter.Frame
|
||||
RevPiPlcList tkinter.Frame
|
||||
RevPiProgram tkinter.Frame
|
||||
RevPiPyControl tkinter.Frame
|
||||
@@ -1,340 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE Project SYSTEM "Project-5.1.dtd">
|
||||
<!-- eric project file for project revpipycontrol -->
|
||||
<!-- Saved: 2017-07-02, 11:35:49 -->
|
||||
<!-- Copyright (C) 2017 Sven Sager, akira@narux.de -->
|
||||
<Project version="5.1">
|
||||
<Language>en_US</Language>
|
||||
<Hash>66103e2eaf8a762f14d1fd51d8b1c9dcaf35a275</Hash>
|
||||
<ProgLanguage mixed="0">Python3</ProgLanguage>
|
||||
<ProjectType>Console</ProjectType>
|
||||
<Description></Description>
|
||||
<Version>0.4.1</Version>
|
||||
<Author>Sven Sager</Author>
|
||||
<Email>akira@narux.de</Email>
|
||||
<Eol index="-1"/>
|
||||
<Sources>
|
||||
<Source>revpipycontrol/revpipycontrol.py</Source>
|
||||
<Source>revpipycontrol/revpicheckclient.py</Source>
|
||||
<Source>setup.py</Source>
|
||||
<Source>revpipycontrol/revpiplclist.py</Source>
|
||||
<Source>revpipycontrol/revpilogfile.py</Source>
|
||||
<Source>revpipycontrol/revpioption.py</Source>
|
||||
<Source>revpipycontrol/revpiprogram.py</Source>
|
||||
<Source>revpipycontrol/mytools.py</Source>
|
||||
<Source>revpipycontrol/revpiinfo.py</Source>
|
||||
</Sources>
|
||||
<Forms/>
|
||||
<Translations/>
|
||||
<Resources/>
|
||||
<Interfaces/>
|
||||
<Others>
|
||||
<Other>data</Other>
|
||||
<Other>doc</Other>
|
||||
<Other>revpipycontrol.api</Other>
|
||||
<Other>stdeb.cfg</Other>
|
||||
</Others>
|
||||
<MainScript>revpipycontrol/revpipycontrol.py</MainScript>
|
||||
<Vcs>
|
||||
<VcsType>Mercurial</VcsType>
|
||||
<VcsOptions>
|
||||
<dict>
|
||||
<key>
|
||||
<string>add</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string></string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>checkout</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string></string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>commit</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string></string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>diff</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string></string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>export</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string></string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>global</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string></string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>history</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string></string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>log</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string></string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>remove</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string></string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>status</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string></string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>tag</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string></string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>update</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string></string>
|
||||
</list>
|
||||
</value>
|
||||
</dict>
|
||||
</VcsOptions>
|
||||
<VcsOtherData>
|
||||
<dict/>
|
||||
</VcsOtherData>
|
||||
</Vcs>
|
||||
<FiletypeAssociations>
|
||||
<FiletypeAssociation pattern="*.idl" type="INTERFACES"/>
|
||||
<FiletypeAssociation pattern="*.py" type="SOURCES"/>
|
||||
<FiletypeAssociation pattern="*.py3" type="SOURCES"/>
|
||||
<FiletypeAssociation pattern="*.pyw" type="SOURCES"/>
|
||||
<FiletypeAssociation pattern="*.pyw3" type="SOURCES"/>
|
||||
</FiletypeAssociations>
|
||||
<Documentation>
|
||||
<DocumentationParams>
|
||||
<dict>
|
||||
<key>
|
||||
<string>ERIC4API</string>
|
||||
</key>
|
||||
<value>
|
||||
<dict>
|
||||
<key>
|
||||
<string>ignoreDirectories</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string>data</string>
|
||||
<string>deb</string>
|
||||
<string>dist</string>
|
||||
<string>doc</string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>ignoreFilePatterns</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string>setup.py</string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>includePrivate</string>
|
||||
</key>
|
||||
<value>
|
||||
<bool>True</bool>
|
||||
</value>
|
||||
<key>
|
||||
<string>languages</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string>Python3</string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>outputFile</string>
|
||||
</key>
|
||||
<value>
|
||||
<string>revpipycontrol.api</string>
|
||||
</value>
|
||||
<key>
|
||||
<string>useRecursion</string>
|
||||
</key>
|
||||
<value>
|
||||
<bool>True</bool>
|
||||
</value>
|
||||
</dict>
|
||||
</value>
|
||||
<key>
|
||||
<string>ERIC4DOC</string>
|
||||
</key>
|
||||
<value>
|
||||
<dict>
|
||||
<key>
|
||||
<string>ignoreDirectories</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string>data</string>
|
||||
<string>deb</string>
|
||||
<string>dist</string>
|
||||
<string>doc</string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>ignoreFilePatterns</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string>setup.py</string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>outputDirectory</string>
|
||||
</key>
|
||||
<value>
|
||||
<string>doc</string>
|
||||
</value>
|
||||
<key>
|
||||
<string>qtHelpEnabled</string>
|
||||
</key>
|
||||
<value>
|
||||
<bool>False</bool>
|
||||
</value>
|
||||
<key>
|
||||
<string>sourceExtensions</string>
|
||||
</key>
|
||||
<value>
|
||||
<list>
|
||||
<string></string>
|
||||
</list>
|
||||
</value>
|
||||
<key>
|
||||
<string>useRecursion</string>
|
||||
</key>
|
||||
<value>
|
||||
<bool>True</bool>
|
||||
</value>
|
||||
</dict>
|
||||
</value>
|
||||
</dict>
|
||||
</DocumentationParams>
|
||||
</Documentation>
|
||||
<Checkers>
|
||||
<CheckersParams>
|
||||
<dict>
|
||||
<key>
|
||||
<string>Pep8Checker</string>
|
||||
</key>
|
||||
<value>
|
||||
<dict>
|
||||
<key>
|
||||
<string>DocstringType</string>
|
||||
</key>
|
||||
<value>
|
||||
<string>pep257</string>
|
||||
</value>
|
||||
<key>
|
||||
<string>ExcludeFiles</string>
|
||||
</key>
|
||||
<value>
|
||||
<string></string>
|
||||
</value>
|
||||
<key>
|
||||
<string>ExcludeMessages</string>
|
||||
</key>
|
||||
<value>
|
||||
<string>E123,E226,E24</string>
|
||||
</value>
|
||||
<key>
|
||||
<string>FixCodes</string>
|
||||
</key>
|
||||
<value>
|
||||
<string></string>
|
||||
</value>
|
||||
<key>
|
||||
<string>FixIssues</string>
|
||||
</key>
|
||||
<value>
|
||||
<bool>False</bool>
|
||||
</value>
|
||||
<key>
|
||||
<string>HangClosing</string>
|
||||
</key>
|
||||
<value>
|
||||
<bool>False</bool>
|
||||
</value>
|
||||
<key>
|
||||
<string>IncludeMessages</string>
|
||||
</key>
|
||||
<value>
|
||||
<string></string>
|
||||
</value>
|
||||
<key>
|
||||
<string>MaxLineLength</string>
|
||||
</key>
|
||||
<value>
|
||||
<int>79</int>
|
||||
</value>
|
||||
<key>
|
||||
<string>NoFixCodes</string>
|
||||
</key>
|
||||
<value>
|
||||
<string>E501</string>
|
||||
</value>
|
||||
<key>
|
||||
<string>RepeatMessages</string>
|
||||
</key>
|
||||
<value>
|
||||
<bool>True</bool>
|
||||
</value>
|
||||
<key>
|
||||
<string>ShowIgnored</string>
|
||||
</key>
|
||||
<value>
|
||||
<bool>False</bool>
|
||||
</value>
|
||||
</dict>
|
||||
</value>
|
||||
</dict>
|
||||
</CheckersParams>
|
||||
</Checkers>
|
||||
</Project>
|
||||
392
revpipycontrol/aclmanager.py
Normal file
392
revpipycontrol/aclmanager.py
Normal file
@@ -0,0 +1,392 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
u"""Manager für ACL Einträge."""
|
||||
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
import tkinter
|
||||
import tkinter.messagebox as tkmsg
|
||||
from mytools import gettrans
|
||||
from shared.ipaclmanager import IpAclManager
|
||||
from tkinter import ttk
|
||||
|
||||
# Übersetzung laden
|
||||
_ = gettrans()
|
||||
|
||||
|
||||
class AclManager(ttk.Frame):
|
||||
|
||||
u"""Hauptfenster des ACL-Managers."""
|
||||
|
||||
def __init__(self, master, minlevel, maxlevel, acl_str="", readonly=False):
|
||||
u"""Init AclManger-Class.
|
||||
@return None"""
|
||||
super().__init__(master)
|
||||
self.master.bind("<KeyPress-Escape>", self._checkclose)
|
||||
self.master.protocol("WM_DELETE_WINDOW", self._checkclose)
|
||||
self.pack(expand=True, fill="both")
|
||||
|
||||
# Daten laden
|
||||
self.__acl = IpAclManager(minlevel, maxlevel, acl_str)
|
||||
self.__dict_acltext = {}
|
||||
self.__oldacl = self.__acl.acl
|
||||
self.__ro = "disabled" if readonly else "normal"
|
||||
self.maxlevel = maxlevel
|
||||
self.minlevel = minlevel
|
||||
|
||||
# Fenster bauen
|
||||
self._createwidgets()
|
||||
|
||||
def __get_acltext(self):
|
||||
"""Getter fuer Leveltexte.
|
||||
@return Leveltexte als <class 'dict'>"""
|
||||
return self.__dict_acltext.copy()
|
||||
|
||||
def __set_acltext(self, value):
|
||||
"""Setter fuer Leveltexte.
|
||||
@param value Leveltexte als <class 'dict'>"""
|
||||
if type(value) != dict:
|
||||
raise ValueError("value must be <class 'dict'>")
|
||||
self.__dict_acltext = value.copy()
|
||||
|
||||
# Infotexte aufbauen
|
||||
self.aclinfo.destroy()
|
||||
self.aclinfo = ttk.Frame(self)
|
||||
for acltext in self.__dict_acltext:
|
||||
lbl = ttk.Label(self.aclinfo)
|
||||
lbl["text"] = _("Level") + " {id}: {text}".format(
|
||||
id=acltext, text=self.__dict_acltext[acltext]
|
||||
)
|
||||
lbl.pack(anchor="w")
|
||||
|
||||
self.aclinfo.pack(anchor="w", padx=4, pady=4)
|
||||
|
||||
def _changesdone(self):
|
||||
u"""Prüft ob sich die Einstellungen geändert haben.
|
||||
@return True, wenn min. eine Einstellung geändert wurde"""
|
||||
return not self.__acl.acl == self.__oldacl
|
||||
|
||||
def _checkclose(self, event=None):
|
||||
u"""Prüft ob Fenster beendet werden soll.
|
||||
@param event tkinter-Event"""
|
||||
ask = True
|
||||
if self._changesdone():
|
||||
ask = tkmsg.askyesno(
|
||||
_("Question"),
|
||||
_("Do you really want to quit? \nUnsaved changes will "
|
||||
"be lost"),
|
||||
parent=self.master, default="no"
|
||||
)
|
||||
|
||||
if ask:
|
||||
self.master.destroy()
|
||||
|
||||
def _createwidgets(self):
|
||||
u"""Erstellt Widgets."""
|
||||
self.master.wm_title(_("IP access control list"))
|
||||
self.master.wm_resizable(width=False, height=False)
|
||||
|
||||
cpadw = {"padx": 4, "pady": 2, "sticky": "w"}
|
||||
|
||||
# Gruppe Bestehende ACL ######################################
|
||||
gb_acl = ttk.LabelFrame(self)
|
||||
gb_acl["text"] = _("Existing ACLs")
|
||||
gb_acl.columnconfigure(0, weight=1)
|
||||
gb_acl.columnconfigure(1, weight=1)
|
||||
gb_acl.pack(expand=True, fill="both", padx=4, pady=4)
|
||||
|
||||
row = 0
|
||||
frame = ttk.Frame(gb_acl)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
|
||||
scb_acl = ttk.Scrollbar(frame)
|
||||
|
||||
self.trv_acl = ttk.Treeview(frame)
|
||||
self.trv_acl["columns"] = ("level")
|
||||
self.trv_acl["yscrollcommand"] = scb_acl.set
|
||||
self.trv_acl.heading("level", text=_("Access level"))
|
||||
self.trv_acl.column("level", width=100)
|
||||
self.trv_acl.bind("<<TreeviewSelect>>", self._status_editremove)
|
||||
self._refreshacls()
|
||||
self.trv_acl.grid(row=0, column=0, sticky="we")
|
||||
|
||||
scb_acl["command"] = self.trv_acl.yview
|
||||
scb_acl.grid(row=0, column=1, sticky="ns")
|
||||
|
||||
frame.grid(row=row, columnspan=2, sticky="we")
|
||||
|
||||
row = 1
|
||||
|
||||
# Edit / Remove button
|
||||
self.btn_edit = ttk.Button(gb_acl)
|
||||
self.btn_edit["command"] = self._loadfields
|
||||
self.btn_edit["text"] = _("load entry")
|
||||
self.btn_edit["state"] = "disabled"
|
||||
self.btn_edit.grid(row=row, column=0, pady=4)
|
||||
|
||||
self.btn_remove = ttk.Button(gb_acl)
|
||||
self.btn_remove["command"] = self._ask_delete
|
||||
self.btn_remove["text"] = _("remove entry")
|
||||
self.btn_remove["state"] = "disabled"
|
||||
self.btn_remove.grid(row=row, column=1, pady=4)
|
||||
|
||||
# ############################################################
|
||||
|
||||
# Gruppe Bearbeiten ##########################################
|
||||
gb_edit = ttk.LabelFrame(self)
|
||||
gb_edit["text"] = _("Edit acess control list")
|
||||
gb_edit.pack(expand=True, fill="both", padx=4, pady=4)
|
||||
|
||||
frame = ttk.Frame(gb_edit)
|
||||
frame.grid()
|
||||
|
||||
row = 0
|
||||
lbl = ttk.Label(frame)
|
||||
lbl["text"] = _("IP address") + ": "
|
||||
lbl.grid(row=row, column=0, **cpadw)
|
||||
|
||||
# Variablen IP / Level
|
||||
self.var_ip1 = tkinter.StringVar(frame)
|
||||
self.var_ip2 = tkinter.StringVar(frame)
|
||||
self.var_ip3 = tkinter.StringVar(frame)
|
||||
self.var_ip4 = tkinter.StringVar(frame)
|
||||
self.var_acl = tkinter.StringVar(frame, self.minlevel)
|
||||
|
||||
ip_block1 = ttk.Entry(frame, width=4)
|
||||
ip_block2 = ttk.Entry(frame, width=4)
|
||||
ip_block3 = ttk.Entry(frame, width=4)
|
||||
ip_block4 = ttk.Entry(frame, width=4)
|
||||
|
||||
ip_block1.bind(
|
||||
"<KeyRelease>",
|
||||
lambda event, tkvar=self.var_ip1: self._checkdot(
|
||||
event, tkvar, ip_block2
|
||||
)
|
||||
)
|
||||
ip_block1["state"] = self.__ro
|
||||
ip_block1["textvariable"] = self.var_ip1
|
||||
ip_block1.grid(row=row, column=1)
|
||||
|
||||
ip_block2.bind(
|
||||
"<KeyRelease>",
|
||||
lambda event, tkvar=self.var_ip2: self._checkdot(
|
||||
event, tkvar, ip_block3
|
||||
)
|
||||
)
|
||||
ip_block2.bind(
|
||||
"<Key>",
|
||||
lambda event, tkvar=self.var_ip2: self._checkback(
|
||||
event, tkvar, ip_block1
|
||||
)
|
||||
)
|
||||
ip_block2["state"] = self.__ro
|
||||
ip_block2["textvariable"] = self.var_ip2
|
||||
ip_block2.grid(row=row, column=3)
|
||||
|
||||
ip_block3.bind(
|
||||
"<KeyRelease>",
|
||||
lambda event, tkvar=self.var_ip3: self._checkdot(
|
||||
event, tkvar, ip_block4
|
||||
)
|
||||
)
|
||||
ip_block3.bind(
|
||||
"<Key>",
|
||||
lambda event, tkvar=self.var_ip3: self._checkback(
|
||||
event, tkvar, ip_block2
|
||||
)
|
||||
)
|
||||
ip_block3["state"] = self.__ro
|
||||
ip_block3["textvariable"] = self.var_ip3
|
||||
ip_block3.grid(row=row, column=5)
|
||||
|
||||
ip_block4.bind(
|
||||
"<KeyRelease>",
|
||||
lambda event, tkvar=self.var_ip4: self._checkdot(
|
||||
event, tkvar, None
|
||||
)
|
||||
)
|
||||
ip_block4.bind(
|
||||
"<Key>",
|
||||
lambda event, tkvar=self.var_ip4: self._checkback(
|
||||
event, tkvar, ip_block3
|
||||
)
|
||||
)
|
||||
ip_block4["state"] = self.__ro
|
||||
ip_block4["textvariable"] = self.var_ip4
|
||||
ip_block4.grid(row=row, column=7)
|
||||
|
||||
# Punkte zwischen IP-Feldern
|
||||
for i in range(2, 7, 2):
|
||||
lbl = ttk.Label(frame, text=".")
|
||||
lbl.grid(row=row, column=i)
|
||||
|
||||
row = 1
|
||||
lbl = ttk.Label(frame)
|
||||
lbl["text"] = _("Access level") + ": "
|
||||
lbl.grid(row=row, column=0, **cpadw)
|
||||
|
||||
self.sb_level = tkinter.Spinbox(frame, width=4)
|
||||
self.sb_level["from_"] = self.minlevel
|
||||
self.sb_level["to"] = self.maxlevel
|
||||
self.sb_level["state"] = self.__ro
|
||||
self.sb_level["textvariable"] = self.var_acl
|
||||
self.sb_level.grid(row=row, column=1, columnspan=8, sticky="w")
|
||||
|
||||
# Buttons neben IP-Eintrag
|
||||
self.btn_add = ttk.Button(gb_edit)
|
||||
self.btn_add["command"] = self._savefields
|
||||
self.btn_add["state"] = self.__ro
|
||||
self.btn_add["text"] = _("add to list")
|
||||
self.btn_add.grid(column=0, row=1, sticky="e", padx=4, pady=4)
|
||||
self.btn_clear = ttk.Button(gb_edit)
|
||||
self.btn_clear["command"] = self._clearfields
|
||||
self.btn_clear["state"] = self.__ro
|
||||
self.btn_clear["text"] = _("clear")
|
||||
self.btn_clear.grid(column=1, row=1, padx=4, pady=4)
|
||||
|
||||
# ############################################################
|
||||
|
||||
frame = ttk.Frame(self)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.pack(expand=True, fill="both", pady=4)
|
||||
|
||||
# Buttons
|
||||
btn_save = ttk.Button(frame)
|
||||
btn_save["command"] = self._save
|
||||
btn_save["state"] = self.__ro
|
||||
btn_save["text"] = _("Save")
|
||||
btn_save.grid(column=0, row=0)
|
||||
|
||||
btn_close = ttk.Button(frame)
|
||||
btn_close["command"] = self._checkclose
|
||||
btn_close["text"] = _("Close")
|
||||
btn_close.grid(column=1, row=0)
|
||||
|
||||
# Infotexte vorbereiten
|
||||
self.aclinfo = ttk.Frame(self)
|
||||
|
||||
def _ask_delete(self):
|
||||
u"""Löscht ein Eintrag der Liste."""
|
||||
str_acl = self.trv_acl.focus()
|
||||
if str_acl != "":
|
||||
lst_ipacl = str_acl.split()
|
||||
ask = tkmsg.askyesno(
|
||||
_("Question"),
|
||||
_("Do you really want to delete the following item? \n"
|
||||
"\nIP: {0} / Level: {1}").format(*lst_ipacl),
|
||||
parent=self.master, default="no"
|
||||
)
|
||||
if ask:
|
||||
new_acl = self.__acl.acl.replace(
|
||||
"{0},{1}".format(*lst_ipacl), ""
|
||||
).replace(" ", " ")
|
||||
|
||||
if self.__acl.loadacl(new_acl.strip()):
|
||||
# Liste neu aufbauen
|
||||
self._refreshacls()
|
||||
else:
|
||||
tkmsg.showerror(
|
||||
_("Error"),
|
||||
_("Can not delete ACL! Check format."),
|
||||
parent=self.master
|
||||
)
|
||||
|
||||
def _checkback(self, event, tkvar, pretxt):
|
||||
u"""Springt bei Backspace in vorheriges Feld.
|
||||
|
||||
@param event TK Event
|
||||
@param tkvar TK Variable zum prüfen
|
||||
@param nexttxt Vorheriges IP Feld für Fokus
|
||||
|
||||
"""
|
||||
if pretxt is not None and event.keycode == 22 and tkvar.get() == "":
|
||||
pretxt.focus_set()
|
||||
|
||||
def _checkdot(self, event, tkvar, nexttxt):
|
||||
u"""Prüft auf . und geht weiter.
|
||||
|
||||
@param event TK Event
|
||||
@param tkvar TK Variable zum prüfen
|
||||
@param nexttxt Nächstes IP Feld für Fokus
|
||||
|
||||
"""
|
||||
val = tkvar.get()
|
||||
if val.find(".") >= 0:
|
||||
tkvar.set(val[:-1])
|
||||
if nexttxt is not None:
|
||||
nexttxt.focus_set()
|
||||
|
||||
def _clearfields(self):
|
||||
u"""Leert die Eingabefelder."""
|
||||
self.var_ip1.set("")
|
||||
self.var_ip2.set("")
|
||||
self.var_ip3.set("")
|
||||
self.var_ip4.set("")
|
||||
self.var_acl.set(self.minlevel)
|
||||
|
||||
def _loadfields(self):
|
||||
u"""Übernimmt Listeneintrag in Editfelder."""
|
||||
str_acl = self.trv_acl.focus()
|
||||
if str_acl != "":
|
||||
lst_ip, acl = str_acl.split()
|
||||
lst_ip = lst_ip.split(".")
|
||||
self.var_ip1.set(lst_ip[0])
|
||||
self.var_ip2.set(lst_ip[1])
|
||||
self.var_ip3.set(lst_ip[2])
|
||||
self.var_ip4.set(lst_ip[3])
|
||||
self.var_acl.set(acl)
|
||||
|
||||
def _refreshacls(self):
|
||||
u"""Leert die ACL Liste und füllt sie neu."""
|
||||
self.trv_acl.delete(*self.trv_acl.get_children())
|
||||
for tup_acl in self.__acl:
|
||||
self.trv_acl.insert(
|
||||
"", "end", tup_acl, text=tup_acl[0], values=tup_acl[1]
|
||||
)
|
||||
|
||||
def _save(self):
|
||||
u"""Übernimt die Änderungen."""
|
||||
self.__oldacl = self.__acl.acl
|
||||
self._checkclose()
|
||||
|
||||
def _savefields(self):
|
||||
u"""Übernimmt neuen ACL Eintrag."""
|
||||
new_acl = "{0}.{1}.{2}.{3},{4}".format(
|
||||
self.var_ip1.get(),
|
||||
self.var_ip2.get(),
|
||||
self.var_ip3.get(),
|
||||
self.var_ip4.get(),
|
||||
self.var_acl.get()
|
||||
)
|
||||
if self.__acl.loadacl((self.__acl.acl + " " + new_acl).strip()):
|
||||
self._refreshacls()
|
||||
else:
|
||||
tkmsg.showerror(
|
||||
_("Error"),
|
||||
_("Can not load new ACL! Check format."),
|
||||
parent=self.master
|
||||
)
|
||||
|
||||
def _status_editremove(self, tkevt):
|
||||
u"""Setzt state der Buttons."""
|
||||
if self.__ro == "normal":
|
||||
status = "disabled" if self.trv_acl.focus() == "" else "normal"
|
||||
self.btn_edit["state"] = status
|
||||
self.btn_remove["state"] = status
|
||||
|
||||
def get_acl(self):
|
||||
u"""Gibt die Konfigurierten ACL zurück.
|
||||
@return ACL als <class 'str'>"""
|
||||
return self.__oldacl
|
||||
|
||||
acl = property(get_acl)
|
||||
acltext = property(__get_acltext, __set_acltext)
|
||||
|
||||
|
||||
# Debugging
|
||||
if __name__ == "__main__":
|
||||
root = AclManager(tkinter.Tk(), 0, 9, " 192.168.50.100,2 127.0.0.*,1")
|
||||
root.acltext = {0: "Keine Rechte", 1: "Hohe Rechte"}
|
||||
root.mainloop()
|
||||
File diff suppressed because it is too large
Load Diff
321
revpipycontrol/mqttmanager.py
Normal file
321
revpipycontrol/mqttmanager.py
Normal file
@@ -0,0 +1,321 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
u"""Optionen für das MQTT System."""
|
||||
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
import tkinter
|
||||
import tkinter.messagebox as tkmsg
|
||||
from mytools import gettrans
|
||||
|
||||
# Übersetzung laden
|
||||
_ = gettrans()
|
||||
|
||||
|
||||
class MqttManager(tkinter.Frame):
|
||||
|
||||
u"""Hauptfenster der MQTT-Einstellungen."""
|
||||
|
||||
def __init__(self, master, settings, readonly=False):
|
||||
u"""Init MqttManager-Class.
|
||||
@return None"""
|
||||
if not isinstance(settings, dict):
|
||||
raise ValueError("parameter settings must be <class 'dict'>")
|
||||
if not isinstance(readonly, bool):
|
||||
raise ValueError("parameter readonly must be <class 'bool'>")
|
||||
|
||||
super().__init__(master)
|
||||
self.master.bind("<KeyPress-Escape>", self._checkclose)
|
||||
self.master.protocol("WM_DELETE_WINDOW", self._checkclose)
|
||||
self.pack(expand=True, fill="both")
|
||||
|
||||
# Daten laden
|
||||
self.__ro = "disabled" if readonly else "normal"
|
||||
self.__settings = settings
|
||||
|
||||
# Fenster bauen
|
||||
self._createwidgets()
|
||||
|
||||
def _changesdone(self):
|
||||
u"""Prüft ob sich die Einstellungen geändert haben.
|
||||
@return True, wenn min. eine Einstellung geändert wurde"""
|
||||
return (
|
||||
self.var_basetopic.get() != self.__settings["mqttbasetopic"] or
|
||||
self.var_send_events.get() !=
|
||||
self.__settings["mqttsend_on_event"] or
|
||||
self.var_client_id.get() != self.__settings["mqttclient_id"] or
|
||||
self.var_password.get() != self.__settings["mqttpassword"] or
|
||||
self.var_port.get() != str(self.__settings["mqttport"]) or
|
||||
self.var_tls_set.get() != self.__settings["mqtttls_set"] or
|
||||
self.var_username.get() != self.__settings["mqttusername"] or
|
||||
self.var_broker_address.get() !=
|
||||
self.__settings["mqttbroker_address"] or
|
||||
self.var_sendinterval.get() !=
|
||||
str(self.__settings["mqttsendinterval"]) or
|
||||
self.var_write_outputs.get() !=
|
||||
self.__settings["mqttwrite_outputs"]
|
||||
)
|
||||
|
||||
def _checkclose(self, event=None):
|
||||
u"""Prüft ob Fenster beendet werden soll.
|
||||
@param event tkinter-Event"""
|
||||
ask = True
|
||||
if self._changesdone():
|
||||
ask = tkmsg.askyesno(
|
||||
_("Question"),
|
||||
_("Do you really want to quit? \nUnsaved changes will "
|
||||
"be lost"),
|
||||
parent=self.master, default="no"
|
||||
)
|
||||
|
||||
if ask:
|
||||
self.master.destroy()
|
||||
|
||||
def _createwidgets(self):
|
||||
u"""Erstellt Widgets."""
|
||||
self.master.wm_title(_("MQTT Settings"))
|
||||
self.master.wm_resizable(width=False, height=False)
|
||||
|
||||
# cpade = {"padx": 4, "pady": 2, "sticky": "e"}
|
||||
cpadw = {"padx": 4, "pady": 2, "sticky": "w"}
|
||||
cpadwe = {"padx": 4, "pady": 2, "sticky": "we"}
|
||||
|
||||
# Gruppe MQTT System ######################################
|
||||
|
||||
# Basetopic
|
||||
gb = tkinter.LabelFrame(self)
|
||||
gb["text"] = _("MQTT base topic")
|
||||
gb.columnconfigure(0, weight=1)
|
||||
gb.pack(expand=True, fill="both", padx=4, pady=4)
|
||||
|
||||
self.var_basetopic = tkinter.StringVar(
|
||||
gb, self.__settings["mqttbasetopic"])
|
||||
|
||||
row = 0
|
||||
lbl = tkinter.Label(gb)
|
||||
lbl["text"] = _("Base topic") + ":"
|
||||
lbl.grid(row=row, column=0, **cpadw)
|
||||
|
||||
txt = tkinter.Entry(gb)
|
||||
txt["state"] = self.__ro
|
||||
txt["textvariable"] = self.var_basetopic
|
||||
txt["width"] = 34
|
||||
txt.grid(row=row, column=1, **cpadwe)
|
||||
|
||||
row += 1
|
||||
lbl = tkinter.Label(gb)
|
||||
lbl["justify"] = "left"
|
||||
lbl["text"] = _(
|
||||
"""The base topic is the first part of any mqtt topic, the
|
||||
Revolution Pi will publish. You can use any character
|
||||
includig '/' to structure the messages on your broker.
|
||||
|
||||
For example: revpi0000/data"""
|
||||
)
|
||||
lbl.grid(row=row, column=0, columnspan=2, **cpadw)
|
||||
|
||||
# Publish settings
|
||||
gb = tkinter.LabelFrame(self)
|
||||
gb["text"] = _("MQTT publish settings")
|
||||
gb.columnconfigure(0, weight=1)
|
||||
gb.pack(expand=True, fill="both", padx=4, pady=4)
|
||||
|
||||
self.var_send_events = tkinter.BooleanVar(
|
||||
gb, self.__settings["mqttsend_on_event"])
|
||||
self.var_sendinterval = tkinter.StringVar(
|
||||
gb, self.__settings["mqttsendinterval"])
|
||||
self.var_write_outputs = tkinter.BooleanVar(
|
||||
gb, self.__settings["mqttwrite_outputs"])
|
||||
|
||||
row = 0
|
||||
lbl = tkinter.Label(gb)
|
||||
lbl["text"] = _("Publish all exported values every n seconds") + ":"
|
||||
lbl.grid(row=row, column=0, **cpadw)
|
||||
sb = tkinter.Spinbox(gb)
|
||||
sb["state"] = self.__ro
|
||||
sb["textvariable"] = self.var_sendinterval
|
||||
sb["width"] = 5
|
||||
sb.grid(row=row, column=1, **cpadw)
|
||||
|
||||
row += 1
|
||||
lbl = tkinter.Label(gb)
|
||||
lbl["justify"] = "left"
|
||||
lbl["text"] = _("Topic: \t[basetopic]/io/[ioname]")
|
||||
lbl.grid(row=row, columnspan=2, **cpadw)
|
||||
|
||||
row += 1
|
||||
cb = tkinter.Checkbutton(gb)
|
||||
cb["state"] = self.__ro
|
||||
cb["text"] = _("Send exported values immediately on value change")
|
||||
cb["variable"] = self.var_send_events
|
||||
cb.grid(row=row, columnspan=2, **cpadw)
|
||||
|
||||
row += 1
|
||||
lbl = tkinter.Label(gb)
|
||||
lbl["justify"] = "left"
|
||||
lbl["text"] = _("Topic: \t[basetopic]/event/[ioname]")
|
||||
lbl.grid(row=row, columnspan=2, **cpadw)
|
||||
|
||||
# Subscribe settings
|
||||
gb = tkinter.LabelFrame(self)
|
||||
gb["text"] = _("MQTT set outputs")
|
||||
gb.columnconfigure(0, weight=1)
|
||||
gb.pack(expand=True, fill="both", padx=4, pady=4)
|
||||
|
||||
row = 0
|
||||
cb = tkinter.Checkbutton(gb)
|
||||
cb["state"] = self.__ro
|
||||
cb["text"] = _("Allow MQTT to to set outputs on Revolution Pi")
|
||||
cb["variable"] = self.var_write_outputs
|
||||
cb.grid(row=row, columnspan=2, **cpadw)
|
||||
|
||||
row += 1
|
||||
lbl = tkinter.Label(gb)
|
||||
lbl["justify"] = "left"
|
||||
lbl["text"] = _(
|
||||
"""The Revolution Pi will subscribe a topic on which your mqtt
|
||||
client can publish messages with the new io value as payload.
|
||||
|
||||
Publish values with topic: \t[basetopic]/set/[outputname]"""
|
||||
)
|
||||
lbl.grid(row=row, columnspan=2, **cpadw)
|
||||
|
||||
# ############################################################
|
||||
|
||||
# Gruppe Broker ##########################################
|
||||
gb = tkinter.LabelFrame(self)
|
||||
gb["text"] = _("MQTT broker settings")
|
||||
gb.pack(expand=True, fill="both", padx=4, pady=4)
|
||||
gb.columnconfigure(2, weight=1)
|
||||
|
||||
# Variablen
|
||||
self.var_client_id = tkinter.StringVar(
|
||||
gb, self.__settings["mqttclient_id"])
|
||||
self.var_broker_address = tkinter.StringVar(
|
||||
gb, self.__settings["mqttbroker_address"])
|
||||
self.var_password = tkinter.StringVar(
|
||||
gb, self.__settings["mqttpassword"])
|
||||
self.var_port = tkinter.StringVar(
|
||||
gb, self.__settings["mqttport"])
|
||||
self.var_tls_set = tkinter.BooleanVar(
|
||||
gb, self.__settings["mqtttls_set"])
|
||||
self.var_username = tkinter.StringVar(
|
||||
gb, self.__settings["mqttusername"])
|
||||
|
||||
row = 0
|
||||
lbl = tkinter.Label(gb)
|
||||
lbl["text"] = _("Broker address") + ":"
|
||||
lbl.grid(row=row, column=0, **cpadw)
|
||||
txt = tkinter.Entry(gb)
|
||||
txt["state"] = self.__ro
|
||||
txt["textvariable"] = self.var_broker_address
|
||||
txt.grid(row=row, column=1, columnspan=2, **cpadw)
|
||||
|
||||
row += 1
|
||||
lbl = tkinter.Label(gb)
|
||||
lbl["text"] = _("Broker port") + ":"
|
||||
lbl.grid(row=row, column=0, **cpadw)
|
||||
sb = tkinter.Spinbox(gb)
|
||||
sb["state"] = self.__ro
|
||||
sb["textvariable"] = self.var_port
|
||||
sb["width"] = 6
|
||||
sb.grid(row=row, column=1, **cpadw)
|
||||
|
||||
ckb = tkinter.Checkbutton(gb)
|
||||
ckb["state"] = self.__ro
|
||||
ckb["text"] = _("Use TLS") + ":"
|
||||
ckb["variable"] = self.var_tls_set
|
||||
ckb.grid(row=row, column=2, **cpadw)
|
||||
|
||||
row += 1
|
||||
lbl = tkinter.Label(gb)
|
||||
lbl["text"] = _("Username") + ":"
|
||||
lbl.grid(row=row, column=0, **cpadw)
|
||||
txt = tkinter.Entry(gb)
|
||||
txt["state"] = self.__ro
|
||||
txt["textvariable"] = self.var_username
|
||||
txt.grid(row=row, column=1, columnspan=2, **cpadw)
|
||||
|
||||
row += 1
|
||||
lbl = tkinter.Label(gb)
|
||||
lbl["text"] = _("Password") + ":"
|
||||
lbl.grid(row=row, column=0, **cpadw)
|
||||
txt = tkinter.Entry(gb)
|
||||
txt["state"] = self.__ro
|
||||
txt["textvariable"] = self.var_password
|
||||
txt.grid(row=row, column=1, columnspan=2, **cpadw)
|
||||
|
||||
row += 1
|
||||
lbl = tkinter.Label(gb)
|
||||
lbl["text"] = _("Client ID") + ":"
|
||||
lbl.grid(row=row, column=0, **cpadw)
|
||||
txt = tkinter.Entry(gb)
|
||||
txt["state"] = self.__ro
|
||||
txt["textvariable"] = self.var_client_id
|
||||
txt["width"] = 30
|
||||
txt.grid(row=row, column=1, columnspan=2, **cpadw)
|
||||
|
||||
# ############################################################
|
||||
|
||||
frame = tkinter.Frame(self)
|
||||
frame.columnconfigure(0, weight=1)
|
||||
frame.columnconfigure(1, weight=1)
|
||||
frame.pack(expand=True, fill="both", pady=4)
|
||||
|
||||
# Buttons
|
||||
btn_save = tkinter.Button(frame)
|
||||
btn_save["command"] = self._save
|
||||
btn_save["state"] = self.__ro
|
||||
btn_save["text"] = _("Save")
|
||||
btn_save.grid(column=0, row=0)
|
||||
|
||||
btn_close = tkinter.Button(frame)
|
||||
btn_close["command"] = self._checkclose
|
||||
btn_close["text"] = _("Close")
|
||||
btn_close.grid(column=1, row=0)
|
||||
|
||||
def _save(self):
|
||||
u"""Übernimt die Änderungen."""
|
||||
|
||||
# TODO: Wertprüfung
|
||||
|
||||
# Wertübernahme
|
||||
self.__settings["mqttbasetopic"] = self.var_basetopic.get()
|
||||
self.__settings["mqttsendinterval"] = int(self.var_sendinterval.get())
|
||||
self.__settings["mqttsend_on_event"] = int(self.var_send_events.get())
|
||||
self.__settings["mqttwrite_outputs"] = \
|
||||
int(self.var_write_outputs.get())
|
||||
self.__settings["mqttbroker_address"] = self.var_broker_address.get()
|
||||
self.__settings["mqtttls_set"] = int(self.var_tls_set.get())
|
||||
self.__settings["mqttport"] = int(self.var_port.get())
|
||||
self.__settings["mqttusername"] = self.var_username.get()
|
||||
self.__settings["mqttpassword"] = self.var_password.get()
|
||||
self.__settings["mqttclient_id"] = self.var_client_id.get()
|
||||
|
||||
self._checkclose()
|
||||
|
||||
def get_settings(self):
|
||||
u"""Gibt die MQTT Konfiguration zurück.
|
||||
@return Settings als <class 'dict'>"""
|
||||
return self.__settings
|
||||
|
||||
settings = property(get_settings)
|
||||
|
||||
|
||||
# Debugging
|
||||
if __name__ == "__main__":
|
||||
dict_mqttsettings = {
|
||||
"mqttbasetopic": "revpi01",
|
||||
"mqttclient_id": "",
|
||||
"mqttbroker_address": "127.0.0.1",
|
||||
"mqttpassword": "",
|
||||
"mqttport": 1883,
|
||||
"mqttsend_on_event": 0,
|
||||
"mqttsendinterval": 30,
|
||||
"mqtttls_set": 0,
|
||||
"mqttusername": "",
|
||||
"mqttwrite_outputs": 0,
|
||||
}
|
||||
root = MqttManager(tkinter.Tk(), dict_mqttsettings)
|
||||
root.mainloop()
|
||||
@@ -1,15 +1,31 @@
|
||||
#
|
||||
# RevPiPyControl
|
||||
#
|
||||
# Webpage: https://revpimodio.org/revpipyplc/
|
||||
# (c) Sven Sager, License: LGPLv3
|
||||
#
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Tools-Sammlung."""
|
||||
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
import gettext
|
||||
import locale
|
||||
import sys
|
||||
from os import environ
|
||||
from os.path import dirname
|
||||
from os.path import join as pathjoin
|
||||
from sys import platform
|
||||
|
||||
# Systemwerte und SaveFiles
|
||||
# TODO: Mac einbauen
|
||||
if platform == "linux":
|
||||
homedir = environ["HOME"]
|
||||
else:
|
||||
homedir = environ["APPDATA"]
|
||||
|
||||
savefile_connections = pathjoin(
|
||||
homedir, ".revpipyplc", "connections.dat")
|
||||
savefile_developer = pathjoin(
|
||||
homedir, ".revpipyplc", "developer.dat")
|
||||
savefile_programpath = pathjoin(
|
||||
homedir, ".revpipyplc", "programpath.dat")
|
||||
|
||||
|
||||
def addroot(filename):
|
||||
@@ -29,7 +45,12 @@ def addroot(filename):
|
||||
|
||||
|
||||
def gettrans(proglang=None):
|
||||
u"""Wertet die Sprache des OS aus und gibt Übersetzung zurück.
|
||||
|
||||
@param proglang Bestimmte Sprache laden
|
||||
@return gettext Übersetzung für Zuweisung an '_'
|
||||
|
||||
"""
|
||||
# Sprache auswählen
|
||||
if proglang is None:
|
||||
# Autodetect Language or switch to static
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
#
|
||||
# RevPiPyControl
|
||||
#
|
||||
# Webpage: https://revpimodio.org/revpipyplc/
|
||||
# (c) Sven Sager, License: LGPLv3
|
||||
#
|
||||
# Thranks to: http://stackoverflow.com/questions/3085696/adding-a-
|
||||
# scrollbar-to-a-group-of-widgets-in-tkinter
|
||||
# -*- coding: utf-8 -*-
|
||||
u"""Fenstererweiterung für den 'watch modus'.
|
||||
|
||||
Thranks to: http://stackoverflow.com/questions/3085696/adding-a-
|
||||
scrollbar-to-a-group-of-widgets-in-tkinter
|
||||
|
||||
"""
|
||||
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
import pickle
|
||||
import tkinter
|
||||
@@ -20,6 +23,8 @@ _ = gettrans()
|
||||
|
||||
class RevPiCheckClient(tkinter.Frame):
|
||||
|
||||
u"""Baut Fenstererweiterung für 'watch modus'."""
|
||||
|
||||
def __init__(self, master, xmlcli, xmlmode=0):
|
||||
"""Instantiiert MyApp-Klasse."""
|
||||
super().__init__(master)
|
||||
@@ -96,8 +101,8 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
try:
|
||||
newvalue = io[5].get()
|
||||
# Wertebereich prüfen
|
||||
if newvalue < 0 or newvalue > self.maxint(io[1]):
|
||||
raise ValueError("too big")
|
||||
if not self.minint(io) <= newvalue <= self.maxint(io):
|
||||
raise ValueError("value not valid")
|
||||
|
||||
self.__chval(device, io)
|
||||
|
||||
@@ -105,8 +110,11 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
io[5].set(self.__oldvalue)
|
||||
tkmsg.showerror(
|
||||
_("Error"),
|
||||
_("Given value for Output '{}' is not valid! \nReset to ""'{}'"
|
||||
"").format(self.dict_devices[device], self.__oldvalue),
|
||||
_("Given value for Output '{0}' is not valid! \n"
|
||||
"Reset to '{1}'").format(
|
||||
self.dict_devices[device],
|
||||
self.__oldvalue
|
||||
),
|
||||
parent=self.dict_wins[device]
|
||||
)
|
||||
|
||||
@@ -132,10 +140,11 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
canvas = tkinter.Canvas(
|
||||
frame,
|
||||
borderwidth=0,
|
||||
width=180,
|
||||
width=190,
|
||||
heigh=calc_heigh if calc_heigh <= 600 else 600
|
||||
)
|
||||
s_frame = tkinter.Frame(canvas)
|
||||
s_frame.columnconfigure(1, weight=1)
|
||||
vsb = tkinter.Scrollbar(frame, orient="vertical", command=canvas.yview)
|
||||
canvas.configure(yscrollcommand=vsb.set)
|
||||
|
||||
@@ -160,10 +169,10 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
# IOs generieren
|
||||
rowcount = 0
|
||||
for io in lst_io:
|
||||
# io = [name,bytelen,byteaddr,bmk,bitaddress,(tkinter_var)]
|
||||
# io = [name,blen,baddr,bmk,bitaddr,(tkinter_var),border,signed]
|
||||
|
||||
tkinter.Label(s_frame, text=io[0]).grid(
|
||||
column=0, row=rowcount, sticky="w"
|
||||
column=1, row=rowcount, sticky="w"
|
||||
)
|
||||
|
||||
if io[4] >= 0:
|
||||
@@ -174,10 +183,14 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
check["state"] = "disabled" if iotype == "inp" else "normal"
|
||||
check["text"] = ""
|
||||
check["variable"] = var
|
||||
check.grid(column=1, row=rowcount)
|
||||
check.grid(column=0, row=rowcount)
|
||||
else:
|
||||
var = tkinter.IntVar()
|
||||
txt = tkinter.Spinbox(s_frame, to=self.maxint(io[1]))
|
||||
txt = tkinter.Spinbox(
|
||||
s_frame,
|
||||
from_=self.minint(io),
|
||||
to=self.maxint(io),
|
||||
)
|
||||
txt.bind(
|
||||
"<Key>",
|
||||
lambda event, tkvar=var: self.__saveoldvalue(event, tkvar)
|
||||
@@ -190,19 +203,21 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
txt["command"] = \
|
||||
lambda device=device, io=io: self.__chval(device, io)
|
||||
txt["state"] = "disabled" if iotype == "inp" or \
|
||||
self.maxint(io[1]) == 0 else "normal"
|
||||
txt["width"] = 5
|
||||
self.maxint(io) == 0 else "normal"
|
||||
width = len(str(self.maxint(io))) + 1
|
||||
txt["width"] = 7 if width > 7 else width
|
||||
txt["textvariable"] = var
|
||||
txt.grid(column=1, row=rowcount)
|
||||
txt.grid(column=0, row=rowcount)
|
||||
|
||||
# Steuerelementvariable in IO übernehmen (mutabel)
|
||||
io.append(var)
|
||||
io.insert(5, var)
|
||||
|
||||
rowcount += 1
|
||||
s_frame.update()
|
||||
|
||||
def _createwidgets(self):
|
||||
"""Erstellt den Fensterinhalt."""
|
||||
cFxPxy53 = {"fill": "x", "padx": 5, "pady": 3}
|
||||
cfxpxy53 = {"fill": "x", "padx": 5, "pady": 3}
|
||||
|
||||
devgrp = tkinter.LabelFrame(self)
|
||||
devgrp["text"] = _("Devices of RevPi")
|
||||
@@ -210,12 +225,11 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
|
||||
for dev in self.lst_devices:
|
||||
win = tkinter.Toplevel(self)
|
||||
win.wm_title("{} | {}".format(dev, self.dict_devices[dev]))
|
||||
win.wm_title("{0} | {1}".format(dev, self.dict_devices[dev]))
|
||||
win.protocol(
|
||||
"WM_DELETE_WINDOW",
|
||||
lambda win=win: self.__hidewin(win)
|
||||
)
|
||||
win.resizable(False, True)
|
||||
win.withdraw()
|
||||
self.dict_wins[dev] = win
|
||||
|
||||
@@ -227,13 +241,14 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
for iotype in ["inp", "out"]:
|
||||
frame = tkinter.Frame(group)
|
||||
frame.pack(side="left", fill="both", expand=True)
|
||||
frame.update()
|
||||
self._createiogroup(dev, frame, iotype)
|
||||
|
||||
# Button erstellen
|
||||
btn = tkinter.Button(devgrp)
|
||||
btn["command"] = lambda win=win: self.__showwin(win)
|
||||
btn["text"] = "{} | {}".format(dev, self.dict_devices[dev])
|
||||
btn.pack(**cFxPxy53)
|
||||
btn["text"] = "{0} | {1}".format(dev, self.dict_devices[dev])
|
||||
btn.pack(**cfxpxy53)
|
||||
|
||||
# Steuerungsfunktionen
|
||||
cntgrp = tkinter.LabelFrame(self)
|
||||
@@ -243,19 +258,19 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
self.btn_refresh = tkinter.Button(cntgrp)
|
||||
self.btn_refresh["text"] = _("Read all IOs")
|
||||
self.btn_refresh["command"] = self.refreshvalues
|
||||
self.btn_refresh.pack(**cFxPxy53)
|
||||
self.btn_refresh.pack(**cfxpxy53)
|
||||
|
||||
self.btn_read = tkinter.Button(cntgrp)
|
||||
self.btn_read["text"] = _("Read just Inputs")
|
||||
self.btn_read["command"] = self.readvalues
|
||||
self.btn_read.pack(**cFxPxy53)
|
||||
self.btn_read.pack(**cfxpxy53)
|
||||
|
||||
self.btn_write = tkinter.Button(cntgrp)
|
||||
self.btn_write["state"] = "normal" if self.xmlmode >= 3 \
|
||||
else "disabled"
|
||||
self.btn_write["text"] = _("Write Outputs")
|
||||
self.btn_write["command"] = self.writevalues
|
||||
self.btn_write.pack(**cFxPxy53)
|
||||
self.btn_write.pack(**cfxpxy53)
|
||||
|
||||
self.chk_auto = tkinter.Checkbutton(cntgrp)
|
||||
self.chk_auto["command"] = self.toggleauto
|
||||
@@ -308,16 +323,28 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
try:
|
||||
ba_values = bytearray(self.cli.ps_values().data)
|
||||
self.err_workvalues = 0
|
||||
except:
|
||||
except Exception:
|
||||
if self.autorw.get():
|
||||
self.err_workvalues += 1
|
||||
else:
|
||||
self.err_workvalues = self.max_errors
|
||||
|
||||
if self.err_workvalues >= self.max_errors:
|
||||
# Fenster zerstören bei zu vielen Fehlern
|
||||
self.hideallwindows()
|
||||
if self.autorw.get():
|
||||
self.autorw.set(False)
|
||||
self.toggleauto()
|
||||
self.dowrite.set(False)
|
||||
self.pack_forget()
|
||||
|
||||
tkmsg.showerror(
|
||||
_("Error"),
|
||||
_("To many errors while reading IO data. "
|
||||
"Can not show the Watch-Mode."),
|
||||
parent=self.master
|
||||
)
|
||||
|
||||
return None
|
||||
|
||||
# Multicall zum Schreiben vorbereiten
|
||||
@@ -325,7 +352,7 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
xmlmc = MultiCall(self.cli)
|
||||
|
||||
for dev in self.dict_devices:
|
||||
# io = [name,bytelen,byteaddr,bmk,bitaddress,(tkinter_var)]
|
||||
# io = [name,blen,baddr,bmk,bitaddr,(tkinter_var),border,signed]
|
||||
|
||||
# IO Typ verarbeiten
|
||||
for iotype in io_dicts:
|
||||
@@ -338,7 +365,9 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
|
||||
# Bytes umwandeln
|
||||
int_byte = int.from_bytes(
|
||||
ba_values[io[2]:io[2] + io[1]], byteorder="little"
|
||||
ba_values[io[2]:io[2] + io[1]],
|
||||
byteorder="little" if len(io) < 7 else io[6],
|
||||
signed=False if len(io) < 8 else io[7],
|
||||
)
|
||||
if io[4] >= 0:
|
||||
# Bit-IO
|
||||
@@ -364,11 +393,35 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
for win in self.dict_wins:
|
||||
self.dict_wins[win].withdraw()
|
||||
|
||||
def maxint(self, bytelen):
|
||||
def maxint(self, io):
|
||||
u"""Errechnet maximalen int() Wert für Bytes max 22.
|
||||
@param bytelen Anzahl Bytes
|
||||
@param io IO-Liste, deren Wert berechnet werden soll
|
||||
@return int() max oder 0 bei Überschreitung"""
|
||||
return 0 if bytelen > 22 else 256 ** bytelen - 1
|
||||
# io = [name,blen,baddr,bmk,bitaddr,(tkinter_var),border,signed]
|
||||
bytelen = io[1]
|
||||
if bytelen == 0:
|
||||
return 0
|
||||
signed = io[-1] if type(io[-1]) == bool else False
|
||||
return 0 if bytelen > 22 else int.from_bytes(
|
||||
(b'\x7f' if signed else b'\xff') + b'\xff' * (bytelen - 1),
|
||||
byteorder="big"
|
||||
)
|
||||
|
||||
def minint(self, io):
|
||||
u"""Errechnet maximalen int() Wert für Bytes max 22.
|
||||
@param io IO-Liste, deren Wert berechnet werden soll
|
||||
@return int() max oder 0 bei Überschreitung"""
|
||||
# io = [name,blen,baddr,bmk,bitaddr,(tkinter_var),border,signed]
|
||||
bytelen = io[1]
|
||||
if bytelen == 0:
|
||||
return 0
|
||||
signed = io[-1] if type(io[-1]) == bool else False
|
||||
rc = 0 if bytelen > 22 or not signed else int.from_bytes(
|
||||
b'\x80' + b'\x00' * (bytelen - 1),
|
||||
byteorder="big",
|
||||
signed=True
|
||||
)
|
||||
return rc
|
||||
|
||||
def readvalues(self):
|
||||
u"""Ruft nur Input Werte von RevPi ab und aktualisiert Fenster."""
|
||||
@@ -387,7 +440,7 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
if not self.autorw.get():
|
||||
try:
|
||||
self.chk_auto["state"] = "normal"
|
||||
except:
|
||||
except Exception:
|
||||
pass
|
||||
return None
|
||||
|
||||
@@ -433,10 +486,11 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
# Fehlermeldungen erstellen
|
||||
devicename = self.dict_devices[lst_result[0]]
|
||||
str_errmsg += _(
|
||||
"Error set value of device '{}' Output '{}': {} \n"
|
||||
"Error set value of device '{0}' Output '{1}': {2} \n"
|
||||
).format(devicename, lst_result[1], lst_result[3])
|
||||
|
||||
if str_errmsg != "":
|
||||
tkmsg.showerror(_("Error"), str_errmsg)
|
||||
tkmsg.showerror(_("Error"), str_errmsg, parent=self.master)
|
||||
|
||||
def writevalues(self):
|
||||
u"""Schreibt geänderte Outputs auf den RevPi."""
|
||||
|
||||
318
revpipycontrol/revpidevelop.py
Normal file
318
revpipycontrol/revpidevelop.py
Normal file
@@ -0,0 +1,318 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
u"""PLC Programm und Konfig hoch und runterladen."""
|
||||
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
import gzip
|
||||
import os
|
||||
import pickle
|
||||
import tkinter
|
||||
import tkinter.filedialog as tkfd
|
||||
import tkinter.messagebox as tkmsg
|
||||
from mytools import homedir
|
||||
from mytools import gettrans
|
||||
from mytools import savefile_developer as savefile
|
||||
from tkinter import ttk
|
||||
from xmlrpc.client import Binary
|
||||
|
||||
# Übersetzung laden
|
||||
_ = gettrans()
|
||||
|
||||
|
||||
def _loaddefaults(revpiname=None):
|
||||
u"""Übernimmt für den Pi die letzen Pfade.
|
||||
@param revpiname Einstellungen nur für RevPi laden
|
||||
@return <class 'dict'> mit Einstellungen"""
|
||||
if os.path.exists(savefile):
|
||||
with open(savefile, "rb") as fh:
|
||||
dict_all = pickle.load(fh)
|
||||
if revpiname is None:
|
||||
return dict_all
|
||||
else:
|
||||
return dict_all.get(revpiname, {})
|
||||
return {}
|
||||
|
||||
|
||||
def _savedefaults(revpiname, settings):
|
||||
u"""Schreibt fuer den Pi die letzen Pfade.
|
||||
|
||||
@param revpiname Einstellungen sind für diesen RevPi
|
||||
@param settings <class 'dict'> mit Einstellungen
|
||||
@return True, bei erfolgreicher Verarbeitung
|
||||
|
||||
"""
|
||||
try:
|
||||
os.makedirs(os.path.dirname(savefile), exist_ok=True)
|
||||
if revpiname is None:
|
||||
dict_all = settings
|
||||
else:
|
||||
dict_all = _loaddefaults()
|
||||
dict_all[revpiname] = settings
|
||||
with open(savefile, "wb") as fh:
|
||||
pickle.dump(dict_all, fh)
|
||||
except Exception:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class RevPiDevelop(ttk.Frame):
|
||||
|
||||
u"""Zeigt Debugfenster an."""
|
||||
|
||||
def __init__(self, master, xmlcli, xmlmode, revpi):
|
||||
u"""Init RevPiDevelop-Class.
|
||||
@return None"""
|
||||
if xmlmode < 3:
|
||||
return None
|
||||
|
||||
super().__init__(master)
|
||||
self.pack(expand=True, fill="both")
|
||||
|
||||
self.revpi = revpi
|
||||
self.xmlcli = xmlcli
|
||||
|
||||
# Letzte Einstellungen übernehmen
|
||||
self.opt = _loaddefaults(revpi)
|
||||
|
||||
# Einstellungen
|
||||
self.pathselected = self.opt.get("pathselected", False)
|
||||
self.watchpath = self.opt.get("watchpath", homedir)
|
||||
self.watchfiles = self.opt.get("watchfiles", [])
|
||||
|
||||
# Fenster bauen
|
||||
self._createwidgets()
|
||||
|
||||
# Alte Einstellungen anwenden
|
||||
if self.pathselected:
|
||||
self.load_pathfiles(silent=True)
|
||||
|
||||
self.refresh_stats()
|
||||
|
||||
def _checkclose(self, event=None):
|
||||
u"""Prüft ob Fenster beendet werden soll.
|
||||
@param event tkinter-Event"""
|
||||
|
||||
# Einstellungen speichern
|
||||
self.opt["pathselected"] = self.pathselected
|
||||
self.opt["watchpath"] = self.watchpath
|
||||
self.opt["watchfiles"] = self.watchfiles
|
||||
_savedefaults(self.revpi, self.opt)
|
||||
|
||||
def _createwidgets(self):
|
||||
u"""Erstellt alle Widgets."""
|
||||
self.rowconfigure(0, weight=1)
|
||||
self.columnconfigure(0, weight=1)
|
||||
|
||||
# cpad = {"padx": 4, "pady": 2}
|
||||
# cpade = {"padx": 4, "pady": 2, "sticky": "e"}
|
||||
cpadw = {"padx": 4, "pady": 2, "sticky": "w"}
|
||||
cpadwe = {"padx": 4, "pady": 2, "sticky": "we"}
|
||||
|
||||
# Gruppe Develop
|
||||
devel = ttk.LabelFrame(self)
|
||||
devel.columnconfigure(0, weight=1)
|
||||
devel["text"] = _("File watcher for PLC development")
|
||||
devel.grid(**cpadwe)
|
||||
|
||||
r = 0
|
||||
lbl = ttk.Label(devel)
|
||||
lbl["text"] = _("Path to list files:")
|
||||
lbl.grid(row=r, **cpadw)
|
||||
|
||||
btn = ttk.Button(devel)
|
||||
btn["command"] = self.btn_selectpath
|
||||
btn["text"] = _("Select path")
|
||||
btn.grid(row=r, column=1, **cpadw)
|
||||
|
||||
r += 1
|
||||
self.lbl_path = ttk.Label(devel)
|
||||
self.lbl_path["width"] = 50
|
||||
self.lbl_path.grid(row=r, column=0, columnspan=2, **cpadw)
|
||||
|
||||
# Listbox
|
||||
r += 1
|
||||
trv = ttk.Frame(devel)
|
||||
trv.columnconfigure(0, weight=1)
|
||||
trv.grid(row=r, columnspan=2, sticky="we")
|
||||
scb_files = ttk.Scrollbar(trv)
|
||||
self.trv_files = ttk.Treeview(trv)
|
||||
self.trv_files.bind("<<TreeviewSelect>>", self.select_pathfiles)
|
||||
self.trv_files["height"] = 15
|
||||
self.trv_files["yscrollcommand"] = scb_files.set
|
||||
self.trv_files.grid(row=0, column=0, sticky="we")
|
||||
scb_files["command"] = self.trv_files.yview
|
||||
scb_files.grid(row=0, column=1, sticky="ns")
|
||||
|
||||
# Uploadbutton
|
||||
r += 1
|
||||
btnlist = ttk.Frame(devel)
|
||||
btnlist.columnconfigure(1, weight=1)
|
||||
btnlist.grid(row=r, columnspan=2, sticky="we")
|
||||
|
||||
self.btn_jobs = ttk.Button(btnlist)
|
||||
self.btn_jobs["command"] = lambda: self.btn_domyjob(stop_restart=True)
|
||||
self.btn_jobs["text"] = _("Stop / Upload / Start")
|
||||
self.btn_jobs.grid(row=0, column=0, **cpadwe)
|
||||
|
||||
self.btn_jobs = ttk.Button(btnlist)
|
||||
self.btn_jobs["command"] = lambda: self.btn_domyjob(stop_restart=False)
|
||||
self.btn_jobs["text"] = _("Just upload")
|
||||
self.btn_jobs.grid(row=0, column=1, **cpadwe)
|
||||
|
||||
def btn_domyjob(self, stop_restart=True):
|
||||
u"""Hochladen und neu starten.
|
||||
@param stop_restart Bestehendes Programm Beenden/Starten"""
|
||||
|
||||
if stop_restart:
|
||||
# PLC Programm anhalten
|
||||
self.xmlcli.plcstop()
|
||||
|
||||
# Aktuell konfiguriertes Programm lesen (für uploaded Flag)
|
||||
opt_program = self.xmlcli.get_config()
|
||||
opt_program = opt_program.get("plcprogram", "none.py")
|
||||
uploaded = True
|
||||
ec = 0
|
||||
|
||||
for fname in self.watchfiles:
|
||||
|
||||
# FIXME: Fehlerabfang bei Dateilesen
|
||||
with open(fname, "rb") as fh:
|
||||
|
||||
# Ordnernamen vom System entfernen
|
||||
sendname = fname.replace(self.watchpath, "")[1:]
|
||||
|
||||
# Prüfen ob Dateiname bereits als Startprogramm angegeben ist
|
||||
if sendname == opt_program:
|
||||
uploaded = False
|
||||
|
||||
# Datei übertragen
|
||||
try:
|
||||
ustatus = self.xmlcli.plcupload(
|
||||
Binary(gzip.compress(fh.read())), sendname
|
||||
)
|
||||
except Exception:
|
||||
ec = -2
|
||||
break
|
||||
|
||||
if not ustatus:
|
||||
ec = -1
|
||||
break
|
||||
|
||||
if ec == 0:
|
||||
# Wenn eines der Dateien nicht das Hauptprogram ist, info
|
||||
if uploaded:
|
||||
tkmsg.showinfo(
|
||||
_("Information"),
|
||||
_("A PLC program has been uploaded. Please check the "
|
||||
"PLC options to see if the correct program is "
|
||||
"specified as the start program."),
|
||||
parent=self.master
|
||||
)
|
||||
|
||||
elif ec == -1:
|
||||
tkmsg.showerror(
|
||||
_("Error"),
|
||||
_("The Revolution Pi could not process some parts of the "
|
||||
"transmission."),
|
||||
parent=self.master
|
||||
)
|
||||
|
||||
elif ec == -2:
|
||||
tkmsg.showerror(
|
||||
_("Error"),
|
||||
_("Errors occurred during transmission"),
|
||||
parent=self.master
|
||||
)
|
||||
|
||||
if stop_restart:
|
||||
# PLC Programm starten
|
||||
self.xmlcli.plcstart()
|
||||
|
||||
def btn_selectpath(self):
|
||||
u"""Lässt dem Benuzter ein Verzeichnis auswählen."""
|
||||
dirselect = tkfd.askdirectory(
|
||||
parent=self.master,
|
||||
title=_("Directory to watch"),
|
||||
mustexist=False,
|
||||
initialdir=self.watchpath
|
||||
)
|
||||
if not dirselect:
|
||||
return
|
||||
|
||||
# Neuen Pfad übernehmen
|
||||
if os.path.exists(dirselect):
|
||||
self.pathselected = True
|
||||
self.watchpath = dirselect
|
||||
self.load_pathfiles()
|
||||
|
||||
else:
|
||||
tkmsg.showerror(
|
||||
_("Error"),
|
||||
_("Can not open the selected folder."),
|
||||
parent=self.master
|
||||
)
|
||||
|
||||
self.refresh_stats()
|
||||
|
||||
def load_pathfiles(self, silent=False):
|
||||
u"""Aktualisiert die Dateiliste.
|
||||
@param silent Keinen Dialog anzeigen"""
|
||||
# Liste leeren
|
||||
self.trv_files.delete(*self.trv_files.get_children())
|
||||
|
||||
# Dateiliste erstellen
|
||||
filecount = 0
|
||||
for tup_walk in os.walk(self.watchpath):
|
||||
for filename in sorted(tup_walk[2]):
|
||||
fullname = os.path.join(tup_walk[0], filename)
|
||||
self.trv_files.insert(
|
||||
"", "end", fullname,
|
||||
text=fullname.replace(self.watchpath, "")[1:],
|
||||
values=fullname
|
||||
)
|
||||
|
||||
# Dateiobergrenze
|
||||
filecount += 1
|
||||
if filecount >= 1000:
|
||||
break
|
||||
|
||||
if filecount >= 1000:
|
||||
if not silent:
|
||||
tkmsg.showwarning(
|
||||
_("Warning"),
|
||||
_("Found more than 1000 files! Only 1000 files can be "
|
||||
"shown in this dialog, all other will be ignored."
|
||||
""),
|
||||
parent=self.master
|
||||
)
|
||||
break
|
||||
|
||||
# Alle Elemente für Selection prüfen und anwenden
|
||||
for watchfile in self.watchfiles.copy():
|
||||
try:
|
||||
self.trv_files.item(watchfile)
|
||||
except Exception:
|
||||
self.watchfiles.remove(watchfile)
|
||||
self.trv_files.selection_set(self.watchfiles)
|
||||
|
||||
def select_pathfiles(self, tkevt):
|
||||
u"""Setzt state der Buttons."""
|
||||
self.watchfiles = list(self.trv_files.selection())
|
||||
self.refresh_stats()
|
||||
|
||||
def refresh_stats(self):
|
||||
u"""Passt die Widgets an."""
|
||||
self.btn_jobs["state"] = "normal" if len(self.watchfiles) > 0 \
|
||||
else "disabled"
|
||||
self.lbl_path["text"] = self.watchpath
|
||||
|
||||
|
||||
# Debugging
|
||||
if __name__ == "__main__":
|
||||
from xmlrpc.client import ServerProxy
|
||||
cli = ServerProxy("http://localhost:55123")
|
||||
root = tkinter.Tk()
|
||||
app = RevPiDevelop(root, cli, 3, "debugging")
|
||||
app.mainloop()
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# RevPiPyControl
|
||||
#
|
||||
# Webpage: https://revpimodio.org/revpipyplc/
|
||||
# (c) Sven Sager, License: LGPLv3
|
||||
#
|
||||
# -*- coding: utf-8 -*-
|
||||
u"""Programminformationen anzeigen."""
|
||||
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
import tkinter
|
||||
import tkinter.font as tkf
|
||||
import webbrowser
|
||||
@@ -16,6 +16,8 @@ _ = gettrans()
|
||||
|
||||
class RevPiInfo(tkinter.Frame):
|
||||
|
||||
u"""Baut Frame für Programminformationen."""
|
||||
|
||||
def __init__(self, master, xmlcli, version):
|
||||
u"""Init RevPiLogfile-Class."""
|
||||
self.master = master
|
||||
@@ -52,7 +54,7 @@ class RevPiInfo(tkinter.Frame):
|
||||
lbl.pack(pady=5)
|
||||
lbl = tkinter.Label(self)
|
||||
lbl["font"] = fntmid
|
||||
lbl["text"] = _("Version: {}").format(self.version)
|
||||
lbl["text"] = _("Version: {0}").format(self.version)
|
||||
lbl.bind(
|
||||
"<ButtonPress-2>",
|
||||
lambda event: self._createwidgets(extended=not extended)
|
||||
|
||||
358
revpipycontrol/revpilegacy.py
Normal file
358
revpipycontrol/revpilegacy.py
Normal file
@@ -0,0 +1,358 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
u"""Alte Klassen laden hier, bevor sie entsorgt werden."""
|
||||
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
import tkinter
|
||||
import tkinter.messagebox as tkmsg
|
||||
from mytools import gettrans
|
||||
|
||||
# Übersetzung laden
|
||||
_ = gettrans()
|
||||
|
||||
|
||||
class RevPiOption(tkinter.Frame):
|
||||
|
||||
u"""Optionen für RevPiPyload vor 0.6.0."""
|
||||
|
||||
def __init__(self, master, xmlcli):
|
||||
u"""Init RevPiOption-Class.
|
||||
@return None"""
|
||||
try:
|
||||
self.dc = xmlcli.get_config()
|
||||
except Exception:
|
||||
self.dc = None
|
||||
return None
|
||||
|
||||
super().__init__(master)
|
||||
self.master.bind("<KeyPress-Escape>", self._checkclose)
|
||||
self.master.protocol("WM_DELETE_WINDOW", self._checkclose)
|
||||
self.pack(expand=True, fill="both")
|
||||
|
||||
self.xmlcli = xmlcli
|
||||
self.mrk_var_xmlmod2 = False
|
||||
self.mrk_var_xmlmod3 = False
|
||||
self.mrk_xmlmodask = False
|
||||
self.dorestart = False
|
||||
|
||||
# Fenster bauen
|
||||
self._createwidgets()
|
||||
self._loadappdata()
|
||||
|
||||
def _changesdone(self):
|
||||
u"""Prüft ob sich die Einstellungen geändert haben.
|
||||
@return True, wenn min. eine Einstellung geändert wurde"""
|
||||
return (
|
||||
self.var_start.get() != self.dc.get("autostart", "1") or
|
||||
self.var_reload.get() != self.dc.get("autoreload", "1") or
|
||||
self.var_zexit.get() != self.dc.get("zeroonexit", "0") or
|
||||
self.var_zerr.get() != self.dc.get("zeroonerror", "0") or
|
||||
self.var_startpy.get() != self.dc.get("plcprogram", "none.py") or
|
||||
self.var_startargs.get() != self.dc.get("plcarguments", "") or
|
||||
self.var_pythonver.get() != self.dc.get("pythonversion", "3") or
|
||||
self.var_slave.get() != self.dc.get("plcslave", "0") or
|
||||
self.var_xmlon.get() != (self.dc.get("xmlrpc", 0) >= 1) or
|
||||
self.var_xmlmod2.get() != (self.dc.get("xmlrpc", 0) >= 2) or
|
||||
self.var_xmlmod3.get() != (self.dc.get("xmlrpc", 0) >= 3)
|
||||
# or self.var_xmlport.get() != self.dc.get("xmlrpcport", "55123")
|
||||
)
|
||||
|
||||
def _checkclose(self, event=None):
|
||||
u"""Prüft ob Fenster beendet werden soll.
|
||||
@param event tkinter-Event"""
|
||||
ask = True
|
||||
if self._changesdone():
|
||||
ask = tkmsg.askyesno(
|
||||
_("Question"),
|
||||
_("Do you really want to quit? \nUnsaved changes will "
|
||||
"be lost"),
|
||||
parent=self.master, default="no"
|
||||
)
|
||||
|
||||
if ask:
|
||||
self.master.destroy()
|
||||
|
||||
def _createwidgets(self):
|
||||
u"""Erstellt Widgets."""
|
||||
self.master.wm_title(_("RevPi Python PLC Options"))
|
||||
self.master.wm_resizable(width=False, height=False)
|
||||
|
||||
xmlstate = "normal" if self.dc["xmlrpc"] >= 3 else "disabled"
|
||||
|
||||
cpadw = {"padx": 4, "pady": 2, "sticky": "w"}
|
||||
cpadwe = {"padx": 4, "pady": 2, "sticky": "we"}
|
||||
|
||||
# Gruppe Start/Stop
|
||||
stst = tkinter.LabelFrame(self)
|
||||
stst["text"] = _("Start / Stop behavior")
|
||||
stst.grid(columnspan=2, pady=2, sticky="we")
|
||||
|
||||
self.var_start = tkinter.BooleanVar(stst)
|
||||
self.var_reload = tkinter.BooleanVar(stst)
|
||||
self.var_zexit = tkinter.BooleanVar(stst)
|
||||
self.var_zerr = tkinter.BooleanVar(stst)
|
||||
|
||||
ckb_start = tkinter.Checkbutton(stst)
|
||||
ckb_start["text"] = _("Start program automatically")
|
||||
ckb_start["state"] = xmlstate
|
||||
ckb_start["variable"] = self.var_start
|
||||
ckb_start.grid(**cpadw)
|
||||
|
||||
ckb_reload = tkinter.Checkbutton(stst)
|
||||
ckb_reload["text"] = _("Restart program after exit")
|
||||
ckb_reload["state"] = xmlstate
|
||||
ckb_reload["variable"] = self.var_reload
|
||||
ckb_reload.grid(**cpadw)
|
||||
|
||||
lbl = tkinter.Label(stst)
|
||||
lbl["text"] = _("Set process image to NULL if program terminates...")
|
||||
lbl.grid(**cpadw)
|
||||
|
||||
ckb_zexit = tkinter.Checkbutton(stst, justify="left")
|
||||
ckb_zexit["state"] = xmlstate
|
||||
ckb_zexit["text"] = _("... successfully")
|
||||
ckb_zexit["variable"] = self.var_zexit
|
||||
ckb_zexit.grid(**cpadw)
|
||||
|
||||
ckb_zerr = tkinter.Checkbutton(stst, justify="left")
|
||||
ckb_zerr["state"] = xmlstate
|
||||
ckb_zerr["text"] = _("... with errors")
|
||||
ckb_zerr["variable"] = self.var_zerr
|
||||
ckb_zerr.grid(**cpadw)
|
||||
|
||||
# Gruppe Programm
|
||||
prog = tkinter.LabelFrame(self)
|
||||
prog["text"] = _("PLC program")
|
||||
prog.grid(columnspan=2, pady=2, sticky="we")
|
||||
|
||||
self.var_pythonver = tkinter.IntVar(prog)
|
||||
self.var_startpy = tkinter.StringVar(prog)
|
||||
self.var_startargs = tkinter.StringVar(prog)
|
||||
self.var_slave = tkinter.BooleanVar(prog)
|
||||
|
||||
self.var_pythonver.set(3)
|
||||
|
||||
lbl = tkinter.Label(prog)
|
||||
lbl["text"] = _("Python version")
|
||||
lbl.grid(columnspan=2, row=0, **cpadw)
|
||||
|
||||
rbn = tkinter.Radiobutton(prog)
|
||||
rbn["state"] = xmlstate
|
||||
rbn["text"] = "Python2"
|
||||
rbn["value"] = 2
|
||||
rbn["variable"] = self.var_pythonver
|
||||
rbn.grid(column=0, row=1, **cpadw)
|
||||
|
||||
rbn = tkinter.Radiobutton(prog)
|
||||
rbn["state"] = xmlstate
|
||||
rbn["text"] = "Python3"
|
||||
rbn["value"] = 3
|
||||
rbn["variable"] = self.var_pythonver
|
||||
rbn.grid(column=1, row=1, **cpadw)
|
||||
|
||||
# Row 2
|
||||
lbl = tkinter.Label(prog)
|
||||
lbl["text"] = _("Python PLC program name")
|
||||
lbl.grid(columnspan=2, **cpadw)
|
||||
|
||||
# Row 3
|
||||
lst = self.xmlcli.get_filelist()
|
||||
if len(lst) == 0:
|
||||
lst.append("none")
|
||||
opt_startpy = tkinter.OptionMenu(
|
||||
prog, self.var_startpy, *lst
|
||||
)
|
||||
opt_startpy["state"] = xmlstate
|
||||
opt_startpy.grid(columnspan=2, **cpadwe)
|
||||
|
||||
# Row 4
|
||||
lbl = tkinter.Label(prog)
|
||||
lbl["text"] = _("Program arguments")
|
||||
lbl.grid(columnspan=2, **cpadw)
|
||||
|
||||
# Row 5
|
||||
txt = tkinter.Entry(prog)
|
||||
txt["textvariable"] = self.var_startargs
|
||||
txt.grid(columnspan=2, **cpadw)
|
||||
|
||||
# Row 6
|
||||
ckb_slave = tkinter.Checkbutton(prog, justify="left")
|
||||
ckb_slave["state"] = xmlstate
|
||||
ckb_slave["text"] = _("Use RevPi as PLC-Slave")
|
||||
ckb_slave["variable"] = self.var_slave
|
||||
ckb_slave.grid(column=0, **cpadw)
|
||||
|
||||
# Gruppe XMLRPC
|
||||
xmlrpc = tkinter.LabelFrame(self)
|
||||
xmlrpc["text"] = _("XML-RPC server")
|
||||
xmlrpc.grid(columnspan=2, pady=2, sticky="we")
|
||||
|
||||
self.var_xmlon = tkinter.BooleanVar(xmlrpc)
|
||||
self.var_xmlmod2 = tkinter.BooleanVar(xmlrpc)
|
||||
self.var_xmlmod3 = tkinter.BooleanVar(xmlrpc)
|
||||
# self.var_xmlport = tkinter.StringVar(xmlrpc)
|
||||
# self.var_xmlport.set("55123")
|
||||
|
||||
ckb_xmlon = tkinter.Checkbutton(xmlrpc)
|
||||
ckb_xmlon["command"] = self.askxmlon
|
||||
ckb_xmlon["state"] = xmlstate
|
||||
ckb_xmlon["text"] = _("Activate XML-RPC server on RevPi")
|
||||
ckb_xmlon["variable"] = self.var_xmlon
|
||||
ckb_xmlon.grid(**cpadw)
|
||||
|
||||
self.ckb_xmlmod2 = tkinter.Checkbutton(xmlrpc, justify="left")
|
||||
self.ckb_xmlmod2["command"] = self.xmlmod2_tail
|
||||
self.ckb_xmlmod2["state"] = xmlstate
|
||||
self.ckb_xmlmod2["text"] = \
|
||||
_("Allow download of piCtory configuration and\nPLC programm")
|
||||
self.ckb_xmlmod2["variable"] = self.var_xmlmod2
|
||||
self.ckb_xmlmod2.grid(**cpadw)
|
||||
|
||||
self.ckb_xmlmod3 = tkinter.Checkbutton(xmlrpc, justify="left")
|
||||
self.ckb_xmlmod3["state"] = xmlstate
|
||||
self.ckb_xmlmod3["text"] = \
|
||||
_("Allow upload of piCtory configuration and\nPLC programm")
|
||||
self.ckb_xmlmod3["variable"] = self.var_xmlmod3
|
||||
self.ckb_xmlmod3.grid(**cpadw)
|
||||
|
||||
lbl = tkinter.Label(xmlrpc)
|
||||
lbl["text"] = _("XML-RPC server port")
|
||||
lbl.grid(**cpadw)
|
||||
|
||||
# spb_xmlport = tkinter.Spinbox(xmlrpc)
|
||||
# spb_xmlport["to"] = 65535
|
||||
# spb_xmlport["from"] = 1024
|
||||
# spb_xmlport["state"] = xmlstate
|
||||
# spb_xmlport["textvariable"] = self.var_xmlport
|
||||
# spb_xmlport.grid(**cpadwe)
|
||||
|
||||
# Buttons
|
||||
btn_save = tkinter.Button(self)
|
||||
btn_save["command"] = self._setappdata
|
||||
btn_save["state"] = xmlstate
|
||||
btn_save["text"] = _("Save")
|
||||
btn_save.grid(column=0, row=3)
|
||||
|
||||
btn_close = tkinter.Button(self)
|
||||
btn_close["command"] = self._checkclose
|
||||
btn_close["text"] = _("Close")
|
||||
btn_close.grid(column=1, row=3)
|
||||
|
||||
def _loadappdata(self, refresh=False):
|
||||
u"""Läd aktuelle Einstellungen vom RevPi.
|
||||
@param refresh Wenn True, werden Einstellungen heruntergeladen."""
|
||||
if refresh:
|
||||
self.dc = self.xmlcli.get_config()
|
||||
|
||||
self.var_start.set(self.dc.get("autostart", "1"))
|
||||
self.var_reload.set(self.dc.get("autoreload", "1"))
|
||||
self.var_zexit.set(self.dc.get("zeroonexit", "0"))
|
||||
self.var_zerr.set(self.dc.get("zeroonerror", "0"))
|
||||
|
||||
self.var_startpy.set(self.dc.get("plcprogram", "none.py"))
|
||||
self.var_startargs.set(self.dc.get("plcarguments", ""))
|
||||
self.var_pythonver.set(self.dc.get("pythonversion", "3"))
|
||||
self.var_slave.set(self.dc.get("plcslave", "0"))
|
||||
|
||||
self.var_xmlon.set(self.dc.get("xmlrpc", 0) >= 1)
|
||||
self.var_xmlmod2.set(self.dc.get("xmlrpc", 0) >= 2)
|
||||
self.mrk_var_xmlmod2 = self.var_xmlmod2.get()
|
||||
self.var_xmlmod3.set(self.dc.get("xmlrpc", 0) >= 3)
|
||||
self.mrk_var_xmlmod3 = self.var_xmlmod3.get()
|
||||
|
||||
# self.var_xmlport.set(self.dc.get("xmlrpcport", "55123"))
|
||||
|
||||
def _setappdata(self):
|
||||
u"""Speichert geänderte Einstellungen auf RevPi.
|
||||
@return None"""
|
||||
|
||||
if not self._changesdone():
|
||||
tkmsg.showinfo(
|
||||
_("Information"),
|
||||
_("You have not made any changes to save."),
|
||||
parent=self.master
|
||||
)
|
||||
self._checkclose()
|
||||
return None
|
||||
|
||||
ask = tkmsg.askyesnocancel(
|
||||
_("Question"),
|
||||
_("The settings are now saved on the Revolution Pi. \n\n"
|
||||
"Should the new settings take effect immediately? \nThis "
|
||||
"means a restart of the service and the PLC program!"),
|
||||
parent=self.master
|
||||
)
|
||||
if ask is not None:
|
||||
self.dc["autostart"] = int(self.var_start.get())
|
||||
self.dc["autoreload"] = int(self.var_reload.get())
|
||||
self.dc["zeroonexit"] = int(self.var_zexit.get())
|
||||
self.dc["zeroonerror"] = int(self.var_zerr.get())
|
||||
|
||||
self.dc["plcprogram"] = self.var_startpy.get()
|
||||
self.dc["plcarguments"] = self.var_startargs.get()
|
||||
self.dc["pythonversion"] = self.var_pythonver.get()
|
||||
self.dc["plcslave"] = int(self.var_slave.get())
|
||||
|
||||
self.dc["xmlrpc"] = 0
|
||||
if self.var_xmlon.get():
|
||||
self.dc["xmlrpc"] += 1
|
||||
if self.var_xmlmod2.get():
|
||||
self.dc["xmlrpc"] += 1
|
||||
if self.var_xmlmod3.get():
|
||||
self.dc["xmlrpc"] += 1
|
||||
|
||||
# self.dc["xmlrpcport"] = self.var_xmlport.get()
|
||||
|
||||
if self.xmlcli.set_config(self.dc, ask):
|
||||
tkmsg.showinfo(
|
||||
_("Information"),
|
||||
_("Settings saved"),
|
||||
parent=self.master
|
||||
)
|
||||
self.dorestart = ask
|
||||
self._checkclose()
|
||||
else:
|
||||
tkmsg.showerror(
|
||||
_("Error"),
|
||||
_("The settings could not be saved. This can happen if "
|
||||
"values are wrong!"),
|
||||
parent=self.master
|
||||
)
|
||||
|
||||
def askxmlon(self):
|
||||
u"""Fragt Nuter, ob wirklicht abgeschaltet werden soll."""
|
||||
if not (self.var_xmlon.get() or self.mrk_xmlmodask):
|
||||
self.mrk_xmlmodask = tkmsg.askyesno(
|
||||
_("Question"),
|
||||
_("Are you sure you want to deactivate the XML-RPC server? "
|
||||
"You will NOT be able to access the Revolution Pi with "
|
||||
"this program."),
|
||||
parent=self.master
|
||||
)
|
||||
if not self.mrk_xmlmodask:
|
||||
self.var_xmlon.set(True)
|
||||
|
||||
self.xmlmod_tail()
|
||||
|
||||
def xmlmod_tail(self):
|
||||
u"""Passt XML-Optionszugriff an."""
|
||||
if self.var_xmlon.get():
|
||||
self.var_xmlmod2.set(self.mrk_var_xmlmod2)
|
||||
self.ckb_xmlmod2["state"] = "normal"
|
||||
else:
|
||||
self.mrk_var_xmlmod2 = self.var_xmlmod2.get()
|
||||
self.var_xmlmod2.set(False)
|
||||
self.ckb_xmlmod2["state"] = "disabled"
|
||||
self.xmlmod2_tail()
|
||||
|
||||
def xmlmod2_tail(self):
|
||||
u"""Passt XML-Optionszugriff an."""
|
||||
if self.var_xmlmod2.get():
|
||||
self.var_xmlmod3.set(self.mrk_var_xmlmod3)
|
||||
self.ckb_xmlmod3["state"] = "normal"
|
||||
else:
|
||||
self.mrk_var_xmlmod3 = self.var_xmlmod3.get()
|
||||
self.var_xmlmod3.set(False)
|
||||
self.ckb_xmlmod3["state"] = "disabled"
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# RevPiPyControl
|
||||
#
|
||||
# Webpage: https://revpimodio.org/revpipyplc/
|
||||
# (c) Sven Sager, License: LGPLv3
|
||||
#
|
||||
# -*- coding: utf-8 -*-
|
||||
u"""Zeigt die Logfiles an."""
|
||||
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
import tkinter
|
||||
from mytools import gettrans
|
||||
|
||||
@@ -14,6 +14,8 @@ _ = gettrans()
|
||||
|
||||
class RevPiLogfile(tkinter.Frame):
|
||||
|
||||
u"""Baut Fenster für Logfiles."""
|
||||
|
||||
def __init__(self, master, xmlcli):
|
||||
u"""Init RevPiLogfile-Class."""
|
||||
super().__init__(master)
|
||||
@@ -57,6 +59,7 @@ class RevPiLogfile(tkinter.Frame):
|
||||
self.btnapplog["command"] = self.btn_clearplc
|
||||
self.btnapplog["text"] = _("Clear screen")
|
||||
self.btnapplog.grid(column=1, row=0, sticky="e")
|
||||
|
||||
self.plclog = tkinter.Text(self)
|
||||
self.plcscr = tkinter.Scrollbar(self)
|
||||
self.plclog.grid(sticky="wnse", columnspan=2, column=0, row=1)
|
||||
@@ -72,6 +75,7 @@ class RevPiLogfile(tkinter.Frame):
|
||||
self.btnapplog["command"] = self.btn_clearapp
|
||||
self.btnapplog["text"] = _("Clear screen")
|
||||
self.btnapplog.grid(column=4, row=0, sticky="e")
|
||||
|
||||
self.applog = tkinter.Text(self)
|
||||
self.appscr = tkinter.Scrollbar(self)
|
||||
self.applog.grid(sticky="nesw", columnspan=2, column=3, row=1)
|
||||
@@ -101,7 +105,7 @@ class RevPiLogfile(tkinter.Frame):
|
||||
self.applog, self.xmlcli.load_applog, self.mrkapp, full
|
||||
)
|
||||
self.errapp = 0
|
||||
except:
|
||||
except Exception:
|
||||
self.errapp += 1
|
||||
|
||||
# Timer neu starten
|
||||
@@ -117,7 +121,7 @@ class RevPiLogfile(tkinter.Frame):
|
||||
self.plclog, self.xmlcli.load_plclog, self.mrkplc, full
|
||||
)
|
||||
self.errplc = 0
|
||||
except:
|
||||
except Exception:
|
||||
self.errplc += 1
|
||||
|
||||
# Timer neu starten
|
||||
@@ -150,13 +154,13 @@ class RevPiLogfile(tkinter.Frame):
|
||||
if full:
|
||||
textwidget.delete(1.0, tkinter.END)
|
||||
|
||||
if bytebuff == b'\x16': #
|
||||
if bytebuff == b'\x16': # 'ESC'
|
||||
# Kein Zugriff auf Logdatei
|
||||
textwidget.delete(1.0, tkinter.END)
|
||||
textwidget.insert(
|
||||
tkinter.END, _("Can not access log file on the RevPi")
|
||||
)
|
||||
elif bytebuff == b'\x19': #
|
||||
elif bytebuff == b'\x19': # 'EndOfMedia'
|
||||
# Logdatei neu begonnen
|
||||
startposition = 0
|
||||
else:
|
||||
|
||||
@@ -1,12 +1,14 @@
|
||||
#
|
||||
# RevPiPyControl
|
||||
#
|
||||
# Webpage: https://revpimodio.org/revpipyplc/
|
||||
# (c) Sven Sager, License: LGPLv3
|
||||
#
|
||||
# -*- coding: utf-8 -*-
|
||||
u"""Optionsfenster."""
|
||||
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
import tkinter
|
||||
import tkinter.messagebox as tkmsg
|
||||
from aclmanager import AclManager
|
||||
from mqttmanager import MqttManager
|
||||
from mytools import gettrans
|
||||
|
||||
# Übersetzung laden
|
||||
@@ -15,12 +17,14 @@ _ = gettrans()
|
||||
|
||||
class RevPiOption(tkinter.Frame):
|
||||
|
||||
u"""Zeigt Optionen von RevPiPyLoad an."""
|
||||
|
||||
def __init__(self, master, xmlcli):
|
||||
u"""Init RevPiOption-Class.
|
||||
@return None"""
|
||||
try:
|
||||
self.dc = xmlcli.get_config()
|
||||
except:
|
||||
except Exception:
|
||||
self.dc = None
|
||||
return None
|
||||
|
||||
@@ -29,9 +33,34 @@ class RevPiOption(tkinter.Frame):
|
||||
self.master.protocol("WM_DELETE_WINDOW", self._checkclose)
|
||||
self.pack(expand=True, fill="both")
|
||||
|
||||
self.frm_mqttmgr = None
|
||||
self.frm_slaveacl = None
|
||||
self.frm_xmlacl = None
|
||||
|
||||
# XML-RPC Server konfigurieren
|
||||
self.xmlcli = xmlcli
|
||||
self.mrk_var_xmlmod2 = False
|
||||
self.mrk_var_xmlmod3 = False
|
||||
self.xmlmodus = self.xmlcli.xmlmodus()
|
||||
|
||||
self._dict_mqttsettings = {
|
||||
"mqttbasetopic": "revpi01",
|
||||
"mqttclient_id": "",
|
||||
"mqttbroker_address": "127.0.0.1",
|
||||
"mqttpassword": "",
|
||||
"mqttport": 1883,
|
||||
"mqttsend_on_event": 0,
|
||||
"mqttsendinterval": 30,
|
||||
"mqtttls_set": 0,
|
||||
"mqttusername": "",
|
||||
"mqttwrite_outputs": 0,
|
||||
}
|
||||
|
||||
self.replace_ios_options = [
|
||||
_("Do not use replace io file"),
|
||||
_("Use static file from RevPiPyLoad"),
|
||||
_("Use dynamic file from work directory"),
|
||||
_("Give own path and filename"),
|
||||
]
|
||||
|
||||
self.mrk_xmlmodask = False
|
||||
self.dorestart = False
|
||||
|
||||
@@ -39,24 +68,59 @@ class RevPiOption(tkinter.Frame):
|
||||
self._createwidgets()
|
||||
self._loadappdata()
|
||||
|
||||
def __state_replace_ios(self, text):
|
||||
u"""Konfiguriert Werte für replace_io.
|
||||
@param text: Ausgewählter Eintrag in Liste"""
|
||||
selected_id = self.replace_ios_options.index(text)
|
||||
|
||||
# Preset value
|
||||
if selected_id == 0:
|
||||
self.var_replace_ios.set("")
|
||||
elif selected_id == 1:
|
||||
self.var_replace_ios.set("/etc/revpipyload/replace_ios.conf")
|
||||
else:
|
||||
self.var_replace_ios.set("replace_ios.conf")
|
||||
|
||||
# Set state of input field
|
||||
self.txt_replace_ios["state"] = "normal" \
|
||||
if self.xmlmodus >= 4 and \
|
||||
selected_id == 3 \
|
||||
else "disabled"
|
||||
|
||||
def _changesdone(self):
|
||||
u"""Prüft ob sich die Einstellungen geändert haben.
|
||||
@return True, wenn min. eine Einstellung geändert wurde"""
|
||||
return (
|
||||
self.var_start.get() != self.dc.get("autostart", "1")
|
||||
or self.var_reload.get() != self.dc.get("autoreload", "1")
|
||||
or self.var_zexit.get() != self.dc.get("zeroonexit", "0")
|
||||
or self.var_zerr.get() != self.dc.get("zeroonerror", "0")
|
||||
or self.var_startpy.get() != self.dc.get("plcprogram", "none.py")
|
||||
or self.var_startargs.get() != self.dc.get("plcarguments", "")
|
||||
or self.var_pythonver.get() != self.dc.get("pythonversion", "3")
|
||||
or self.var_slave.get() != self.dc.get("plcslave", "0")
|
||||
or self.var_xmlon.get() != (self.dc.get("xmlrpc", 0) >= 1)
|
||||
or self.var_xmlmod2.get() != (self.dc.get("xmlrpc", 0) >= 2)
|
||||
or self.var_xmlmod3.get() != (self.dc.get("xmlrpc", 0) >= 3)
|
||||
or self.var_xmlport.get() != self.dc.get("xmlrpcport", "55123")
|
||||
self.var_start.get() != self.dc.get("autostart", 1) or
|
||||
self.var_reload.get() != self.dc.get("autoreload", 1) or
|
||||
self.var_reload_delay.get() !=
|
||||
str(self.dc.get("autoreloaddelay", 5)) or
|
||||
self.var_zexit.get() != self.dc.get("zeroonexit", 0) or
|
||||
self.var_zerr.get() != self.dc.get("zeroonerror", 0) or
|
||||
self.var_replace_ios.get() != self.dc.get("replace_ios", "") or
|
||||
# TODO: rtlevel (0)
|
||||
self.var_startpy.get() != self.dc.get("plcprogram", "none.py") or
|
||||
self.var_startargs.get() != self.dc.get("plcarguments", "") or
|
||||
self.var_pythonver.get() != self.dc.get("pythonversion", 3) or
|
||||
self.var_plcworkdir_set_uid.get() != \
|
||||
self.dc.get("plcworkdir_set_uid") or
|
||||
self.var_slave.get() != self.dc.get("plcslave", 0) or
|
||||
self.var_slaveacl.get() != self.dc.get("plcslaveacl", "") or
|
||||
self.var_mqtton.get() != self.dc.get("mqtt", 0) or
|
||||
self.var_xmlon.get() != self.dc.get("xmlrpc", 0) or
|
||||
self.var_xmlacl.get() != self.dc.get("xmlrpcacl", "") or
|
||||
self._changesdone_mqtt()
|
||||
)
|
||||
|
||||
def _changesdone_mqtt(self):
|
||||
u"""Prüft ob MQTT-Settings geändert wurden.
|
||||
@return True, wenn Änderungen existieren"""
|
||||
for key in self._dict_mqttsettings:
|
||||
if key in self.dc:
|
||||
if self._dict_mqttsettings[key] != self.dc[key]:
|
||||
return True
|
||||
return False
|
||||
|
||||
def _checkclose(self, event=None):
|
||||
u"""Prüft ob Fenster beendet werden soll.
|
||||
@param event tkinter-Event"""
|
||||
@@ -72,155 +136,254 @@ class RevPiOption(tkinter.Frame):
|
||||
if ask:
|
||||
self.master.destroy()
|
||||
|
||||
def _checkvalues(self):
|
||||
u"""Prüft alle Werte auf Gültigkeit.
|
||||
@return True, wenn alle Werte gültig sind"""
|
||||
if not self.var_reload_delay.get().isdigit():
|
||||
tkmsg.showerror(
|
||||
_("Error"),
|
||||
_("The value of 'restart delay' ist not valid."),
|
||||
parent=self.master
|
||||
)
|
||||
return False
|
||||
|
||||
return True
|
||||
|
||||
def _createwidgets(self):
|
||||
u"""Erstellt Widgets."""
|
||||
self.master.wm_title(_("RevPi Python PLC Options"))
|
||||
self.master.wm_resizable(width=False, height=False)
|
||||
|
||||
xmlstate = "normal" if self.dc["xmlrpc"] >= 3 else "disabled"
|
||||
xmlstate = "normal" if self.xmlmodus >= 4 else "disabled"
|
||||
|
||||
cpade = {"padx": 4, "pady": 2, "sticky": "e"}
|
||||
cpadw = {"padx": 4, "pady": 2, "sticky": "w"}
|
||||
cpadwe = {"padx": 4, "pady": 2, "sticky": "we"}
|
||||
|
||||
# Gruppe Start/Stop
|
||||
stst = tkinter.LabelFrame(self)
|
||||
stst.columnconfigure(0, weight=1)
|
||||
stst.columnconfigure(1, weight=1)
|
||||
stst.columnconfigure(2, weight=1)
|
||||
stst["text"] = _("Start / Stop behavior")
|
||||
stst.grid(columnspan=2, pady=2, sticky="we")
|
||||
|
||||
self.var_start = tkinter.BooleanVar(stst)
|
||||
self.var_reload = tkinter.BooleanVar(stst)
|
||||
self.var_reload_delay = tkinter.StringVar(stst)
|
||||
self.var_zexit = tkinter.BooleanVar(stst)
|
||||
self.var_zerr = tkinter.BooleanVar(stst)
|
||||
self.var_replace_ios = tkinter.StringVar(stst)
|
||||
self.var_replace_ios_options = tkinter.StringVar(stst)
|
||||
|
||||
# Row 0
|
||||
ckb_start = tkinter.Checkbutton(stst)
|
||||
ckb_start["text"] = _("Start program automatically")
|
||||
ckb_start["state"] = xmlstate
|
||||
ckb_start["variable"] = self.var_start
|
||||
ckb_start.grid(**cpadw)
|
||||
ckb_start.grid(columnspan=3, **cpadw)
|
||||
|
||||
# Row 1
|
||||
ckb_reload = tkinter.Checkbutton(stst)
|
||||
ckb_reload["text"] = _("Restart program after exit")
|
||||
ckb_reload["state"] = xmlstate
|
||||
ckb_reload["variable"] = self.var_reload
|
||||
ckb_reload.grid(**cpadw)
|
||||
ckb_reload.grid(columnspan=3, **cpadw)
|
||||
|
||||
# Row 2
|
||||
lbl = tkinter.Label(stst)
|
||||
lbl["text"] = _("Restart after n seconds of delay")
|
||||
lbl.grid(columnspan=2, **cpadw)
|
||||
sbx = tkinter.Spinbox(stst)
|
||||
sbx["to"] = 60
|
||||
sbx["from_"] = 5
|
||||
sbx["textvariable"] = self.var_reload_delay
|
||||
sbx["width"] = 4
|
||||
sbx.grid(column=2, row=2, **cpade)
|
||||
|
||||
# Row 3
|
||||
lbl = tkinter.Label(stst)
|
||||
lbl["text"] = _("Set process image to NULL if program terminates...")
|
||||
lbl.grid(columnspan=3, **cpadw)
|
||||
|
||||
# Row 4
|
||||
ckb_zexit = tkinter.Checkbutton(stst, justify="left")
|
||||
ckb_zexit["state"] = xmlstate
|
||||
ckb_zexit["text"] = _(
|
||||
"Set process image to NULL if program\n"
|
||||
"terminates successfully")
|
||||
ckb_zexit["text"] = _("... successfully")
|
||||
ckb_zexit["variable"] = self.var_zexit
|
||||
ckb_zexit.grid(**cpadw)
|
||||
ckb_zexit.grid(column=1, **cpadw)
|
||||
|
||||
# Row 5
|
||||
ckb_zerr = tkinter.Checkbutton(stst, justify="left")
|
||||
ckb_zerr["state"] = xmlstate
|
||||
ckb_zerr["text"] = _(
|
||||
"Set process image to NULL if program\n"
|
||||
"terminates with errors")
|
||||
ckb_zerr["text"] = _("... with errors")
|
||||
ckb_zerr["variable"] = self.var_zerr
|
||||
ckb_zerr.grid(**cpadw)
|
||||
ckb_zerr.grid(column=1, **cpadw)
|
||||
|
||||
# Row 6
|
||||
lbl = tkinter.Label(stst)
|
||||
lbl["text"] = _("Replace IO file:")
|
||||
lbl.grid(row=6, **cpadw)
|
||||
|
||||
opt = tkinter.OptionMenu(
|
||||
stst, self.var_replace_ios_options, *self.replace_ios_options,
|
||||
command=self.__state_replace_ios
|
||||
)
|
||||
opt["state"] = xmlstate
|
||||
opt["width"] = 30
|
||||
opt.grid(row=6, column=1, columnspan=2, **cpadwe)
|
||||
|
||||
# Row 7
|
||||
self.txt_replace_ios = tkinter.Entry(stst)
|
||||
self.txt_replace_ios["state"] = xmlstate
|
||||
self.txt_replace_ios["textvariable"] = self.var_replace_ios
|
||||
self.txt_replace_ios.grid(column=1, columnspan=2, **cpadwe)
|
||||
|
||||
# Gruppe Programm
|
||||
prog = tkinter.LabelFrame(self)
|
||||
prog.columnconfigure(0, weight=1)
|
||||
prog.columnconfigure(1, weight=1)
|
||||
prog.columnconfigure(2, weight=1)
|
||||
prog["text"] = _("PLC program")
|
||||
prog.grid(columnspan=2, pady=2, sticky="we")
|
||||
|
||||
self.var_pythonver = tkinter.IntVar(prog)
|
||||
self.var_startpy = tkinter.StringVar(prog)
|
||||
self.var_startargs = tkinter.StringVar(prog)
|
||||
self.var_slave = tkinter.BooleanVar(prog)
|
||||
self.var_plcworkdir_set_uid = tkinter.BooleanVar(prog)
|
||||
|
||||
self.var_pythonver.set(3)
|
||||
|
||||
# Row 0
|
||||
lbl = tkinter.Label(prog)
|
||||
lbl["text"] = _("Python version")
|
||||
lbl.grid(columnspan=2, row=0, **cpadw)
|
||||
lbl["text"] = _("Python version") + ":"
|
||||
lbl.grid(row=0, **cpadw)
|
||||
|
||||
rbn = tkinter.Radiobutton(prog)
|
||||
rbn["state"] = xmlstate
|
||||
rbn["text"] = "Python2"
|
||||
rbn["value"] = 2
|
||||
rbn["variable"] = self.var_pythonver
|
||||
rbn.grid(column=0, row=1, **cpadw)
|
||||
rbn.grid(row=0, column=1, **cpade)
|
||||
|
||||
rbn = tkinter.Radiobutton(prog)
|
||||
rbn["state"] = xmlstate
|
||||
rbn["text"] = "Python3"
|
||||
rbn["value"] = 3
|
||||
rbn["variable"] = self.var_pythonver
|
||||
rbn.grid(column=1, row=1, **cpadw)
|
||||
rbn.grid(row=0, column=2, **cpadw)
|
||||
|
||||
# Row 1
|
||||
lbl = tkinter.Label(prog)
|
||||
lbl["text"] = _("Python PLC program name")
|
||||
lbl.grid(columnspan=2, **cpadw)
|
||||
lbl.grid(columnspan=3, **cpadw)
|
||||
|
||||
# Row 2
|
||||
lst = self.xmlcli.get_filelist()
|
||||
lst.sort()
|
||||
if ".placeholder" in lst:
|
||||
lst.remove(".placeholder")
|
||||
if len(lst) == 0:
|
||||
lst.append("none")
|
||||
opt_startpy = tkinter.OptionMenu(
|
||||
prog, self.var_startpy, *lst)
|
||||
prog, self.var_startpy, *lst
|
||||
)
|
||||
opt_startpy["state"] = xmlstate
|
||||
opt_startpy.grid(columnspan=2, **cpadwe)
|
||||
opt_startpy.grid(columnspan=3, **cpadwe)
|
||||
|
||||
# Row 3
|
||||
lbl = tkinter.Label(prog)
|
||||
lbl["text"] = _("Program arguments")
|
||||
lbl.grid(columnspan=2, **cpadw)
|
||||
lbl["text"] = _("Program arguments:")
|
||||
lbl.grid(**cpadw)
|
||||
|
||||
txt = tkinter.Entry(prog)
|
||||
txt["textvariable"] = self.var_startargs
|
||||
txt.grid(columnspan=2, **cpadw)
|
||||
txt.grid(row=3, column=1, columnspan=2, **cpadwe)
|
||||
|
||||
ckb_slave = tkinter.Checkbutton(prog, justify="left")
|
||||
# Row 4
|
||||
ckb = tkinter.Checkbutton(prog)
|
||||
ckb["text"] = _("Set write access to workdirectory")
|
||||
ckb["state"] = xmlstate
|
||||
ckb["variable"] = self.var_plcworkdir_set_uid
|
||||
ckb.grid(columnspan=2, **cpadw)
|
||||
|
||||
# Gruppe Services
|
||||
services = tkinter.LabelFrame(self)
|
||||
services["text"] = _("RevPiPyLoad server services")
|
||||
services.grid(columnspan=2, pady=2, sticky="we")
|
||||
|
||||
# RevPiSlave Service
|
||||
self.var_slave = tkinter.BooleanVar(services)
|
||||
self.var_slaveacl = tkinter.StringVar(services)
|
||||
row = 0
|
||||
ckb_slave = tkinter.Checkbutton(services, justify="left")
|
||||
ckb_slave["state"] = xmlstate
|
||||
ckb_slave["text"] = _("Use RevPi as PLC-Slave")
|
||||
ckb_slave["state"] = "disabled"
|
||||
ckb_slave["variable"] = self.var_slave
|
||||
ckb_slave.grid(columnspan=2, **cpadw)
|
||||
ckb_slave.grid(column=0, **cpadw)
|
||||
|
||||
# Gruppe XMLRPC
|
||||
xmlrpc = tkinter.LabelFrame(self)
|
||||
xmlrpc["text"] = _("XML-RPC server")
|
||||
xmlrpc.grid(columnspan=2, pady=2, sticky="we")
|
||||
btn_slaveacl = tkinter.Button(services, justify="center")
|
||||
btn_slaveacl["command"] = self.btn_slaveacl
|
||||
btn_slaveacl["text"] = _("Edit ACL")
|
||||
btn_slaveacl.grid(column=1, row=row, **cpadwe)
|
||||
|
||||
self.var_xmlon = tkinter.BooleanVar(xmlrpc)
|
||||
self.var_xmlmod2 = tkinter.BooleanVar(xmlrpc)
|
||||
self.var_xmlmod3 = tkinter.BooleanVar(xmlrpc)
|
||||
self.var_xmlport = tkinter.StringVar(xmlrpc)
|
||||
self.var_xmlport.set("55123")
|
||||
row = 1
|
||||
lbl = tkinter.Label(services)
|
||||
lbl["text"] = _("RevPi-Slave service is:")
|
||||
lbl.grid(column=0, **cpade)
|
||||
|
||||
ckb_xmlon = tkinter.Checkbutton(xmlrpc)
|
||||
status = self.xmlcli.plcslaverunning()
|
||||
lbl = tkinter.Label(services)
|
||||
lbl["fg"] = "green" if status else "red"
|
||||
lbl["text"] = _("running") if status else _("stopped")
|
||||
lbl.grid(column=1, row=row, **cpadwe)
|
||||
|
||||
# MQTT Service
|
||||
self.var_mqtton = tkinter.BooleanVar(services)
|
||||
try:
|
||||
status = self.xmlcli.mqttrunning()
|
||||
except Exception:
|
||||
pass
|
||||
else:
|
||||
row = 2
|
||||
ckb_slave = tkinter.Checkbutton(services, justify="left")
|
||||
ckb_slave["state"] = xmlstate
|
||||
ckb_slave["text"] = _("MQTT process image publisher")
|
||||
ckb_slave["variable"] = self.var_mqtton
|
||||
ckb_slave.grid(column=0, **cpadw)
|
||||
|
||||
btn_slaveacl = tkinter.Button(services, justify="center")
|
||||
btn_slaveacl["command"] = self.btn_mqttsettings
|
||||
btn_slaveacl["text"] = _("Settings")
|
||||
btn_slaveacl.grid(column=1, row=row, **cpadwe)
|
||||
|
||||
row = 3
|
||||
lbl = tkinter.Label(services)
|
||||
lbl["text"] = _("MQTT publish service is:")
|
||||
lbl.grid(column=0, **cpade)
|
||||
|
||||
lbl = tkinter.Label(services)
|
||||
lbl["fg"] = "green" if status else "red"
|
||||
lbl["text"] = _("running") if status else _("stopped")
|
||||
lbl.grid(column=1, row=row, **cpadwe)
|
||||
|
||||
# XML-RPC Service
|
||||
self.var_xmlon = tkinter.BooleanVar(services)
|
||||
self.var_xmlacl = tkinter.StringVar(services)
|
||||
row = 4
|
||||
ckb_xmlon = tkinter.Checkbutton(services)
|
||||
ckb_xmlon["command"] = self.askxmlon
|
||||
ckb_xmlon["state"] = xmlstate
|
||||
ckb_xmlon["text"] = _("Activate XML-RPC server on RevPi")
|
||||
ckb_xmlon["variable"] = self.var_xmlon
|
||||
ckb_xmlon.grid(**cpadw)
|
||||
|
||||
self.ckb_xmlmod2 = tkinter.Checkbutton(xmlrpc, justify="left")
|
||||
self.ckb_xmlmod2["command"] = self.xmlmod2_tail
|
||||
self.ckb_xmlmod2["state"] = xmlstate
|
||||
self.ckb_xmlmod2["text"] = \
|
||||
_("Allow download of piCtory configuration and\nPLC programm")
|
||||
self.ckb_xmlmod2["variable"] = self.var_xmlmod2
|
||||
self.ckb_xmlmod2.grid(**cpadw)
|
||||
btn_slaveacl = tkinter.Button(services, justify="center")
|
||||
btn_slaveacl["command"] = self.btn_xmlacl
|
||||
btn_slaveacl["text"] = _("Edit ACL")
|
||||
btn_slaveacl.grid(column=1, row=row, **cpadwe)
|
||||
|
||||
self.ckb_xmlmod3 = tkinter.Checkbutton(xmlrpc, justify="left")
|
||||
self.ckb_xmlmod3["state"] = xmlstate
|
||||
self.ckb_xmlmod3["text"] = \
|
||||
_("Allow upload of piCtory configuration and\nPLC programm")
|
||||
self.ckb_xmlmod3["variable"] = self.var_xmlmod3
|
||||
self.ckb_xmlmod3.grid(**cpadw)
|
||||
|
||||
lbl = tkinter.Label(xmlrpc)
|
||||
lbl["text"] = _("XML-RPC server port")
|
||||
lbl.grid(**cpadw)
|
||||
|
||||
spb_xmlport = tkinter.Spinbox(xmlrpc)
|
||||
spb_xmlport["to"] = 65535
|
||||
spb_xmlport["from"] = 1024
|
||||
spb_xmlport["state"] = xmlstate
|
||||
spb_xmlport["textvariable"] = self.var_xmlport
|
||||
spb_xmlport.grid(**cpadwe)
|
||||
|
||||
# Buttons
|
||||
# Buttons am Ende
|
||||
btn_save = tkinter.Button(self)
|
||||
btn_save["command"] = self._setappdata
|
||||
btn_save["state"] = xmlstate
|
||||
@@ -238,23 +401,41 @@ class RevPiOption(tkinter.Frame):
|
||||
if refresh:
|
||||
self.dc = self.xmlcli.get_config()
|
||||
|
||||
self.var_start.set(self.dc.get("autostart", "1"))
|
||||
self.var_reload.set(self.dc.get("autoreload", "1"))
|
||||
self.var_zexit.set(self.dc.get("zeroonexit", "0"))
|
||||
self.var_zerr.set(self.dc.get("zeroonerror", "0"))
|
||||
self.var_start.set(self.dc.get("autostart", 1))
|
||||
self.var_reload.set(self.dc.get("autoreload", 1))
|
||||
self.var_reload_delay.set(self.dc.get("autoreloaddelay", 5))
|
||||
self.var_zexit.set(self.dc.get("zeroonexit", 0))
|
||||
self.var_zerr.set(self.dc.get("zeroonerror", 0))
|
||||
replace_ios = self.dc.get("replace_ios", "")
|
||||
self.var_replace_ios.set(replace_ios)
|
||||
if replace_ios == "":
|
||||
self.var_replace_ios_options.set(self.replace_ios_options[0])
|
||||
elif replace_ios == "/etc/revpipyload/replace_ios.conf":
|
||||
self.var_replace_ios_options.set(self.replace_ios_options[1])
|
||||
elif replace_ios == "replace_ios.conf":
|
||||
self.var_replace_ios_options.set(self.replace_ios_options[2])
|
||||
else:
|
||||
self.var_replace_ios_options.set(self.replace_ios_options[3])
|
||||
self.__state_replace_ios(self.var_replace_ios_options.get())
|
||||
# TODO: rtlevel (0)
|
||||
|
||||
self.var_startpy.set(self.dc.get("plcprogram", "none.py"))
|
||||
self.var_startargs.set(self.dc.get("plcarguments", ""))
|
||||
self.var_pythonver.set(self.dc.get("pythonversion", "3"))
|
||||
self.var_slave.set(self.dc.get("plcslave", "0"))
|
||||
self.var_pythonver.set(self.dc.get("pythonversion", 3))
|
||||
self.var_plcworkdir_set_uid.set(
|
||||
self.dc.get("plcworkdir_set_uid", False))
|
||||
|
||||
self.var_xmlon.set(self.dc.get("xmlrpc", 0) >= 1)
|
||||
self.var_xmlmod2.set(self.dc.get("xmlrpc", 0) >= 2)
|
||||
self.mrk_var_xmlmod2 = self.var_xmlmod2.get()
|
||||
self.var_xmlmod3.set(self.dc.get("xmlrpc", 0) >= 3)
|
||||
self.mrk_var_xmlmod3 = self.var_xmlmod3.get()
|
||||
# MQTT Einstellungen laden
|
||||
self.var_mqtton.set(self.dc.get("mqtt", 0))
|
||||
for key in self._dict_mqttsettings:
|
||||
if key in self.dc:
|
||||
self._dict_mqttsettings[key] = self.dc[key]
|
||||
|
||||
self.var_xmlport.set(self.dc.get("xmlrpcport", "55123"))
|
||||
self.var_slave.set(self.dc.get("plcslave", 0))
|
||||
self.var_slaveacl.set(self.dc.get("plcslaveacl", ""))
|
||||
|
||||
self.var_xmlon.set(self.dc.get("xmlrpc", 0))
|
||||
self.var_xmlacl.set(self.dc.get("xmlrpcacl", ""))
|
||||
|
||||
def _setappdata(self):
|
||||
u"""Speichert geänderte Einstellungen auf RevPi.
|
||||
@@ -264,37 +445,67 @@ class RevPiOption(tkinter.Frame):
|
||||
tkmsg.showinfo(
|
||||
_("Information"),
|
||||
_("You have not made any changes to save."),
|
||||
parent=self.master
|
||||
)
|
||||
self._checkclose()
|
||||
return None
|
||||
|
||||
ask = tkmsg.askyesnocancel(
|
||||
# Gültigkeitsprüfung
|
||||
if not self._checkvalues():
|
||||
return None
|
||||
|
||||
ask = tkmsg.askokcancel(
|
||||
_("Question"),
|
||||
_("The settings are now saved on the Revolution Pi. \n\n"
|
||||
"Should the new settings take effect immediately? \nThis "
|
||||
"means a restart of the service and the PLC program!"),
|
||||
_("The settings will be set on the Revolution Pi now. \n\n"
|
||||
"If you made changes on the 'PCL Program' section, your plc "
|
||||
"program will restart! \n"
|
||||
"ACL changes and service settings are applied immediately."),
|
||||
parent=self.master
|
||||
)
|
||||
if ask is not None:
|
||||
self.dc["autostart"] = int(self.var_start.get())
|
||||
if ask:
|
||||
self.dc["autoreload"] = int(self.var_reload.get())
|
||||
self.dc["zeroonexit"] = int(self.var_zexit.get())
|
||||
self.dc["zeroonerror"] = int(self.var_zerr.get())
|
||||
|
||||
self.dc["autoreloaddelay"] = int(self.var_reload_delay.get())
|
||||
self.dc["autostart"] = int(self.var_start.get())
|
||||
self.dc["plcprogram"] = self.var_startpy.get()
|
||||
self.dc["plcarguments"] = self.var_startargs.get()
|
||||
self.dc["pythonversion"] = self.var_pythonver.get()
|
||||
self.dc["plcworkdir_set_uid"] = \
|
||||
int(self.var_plcworkdir_set_uid.get())
|
||||
# TODO: rtlevel (0)
|
||||
self.dc["zeroonerror"] = int(self.var_zerr.get())
|
||||
self.dc["zeroonexit"] = int(self.var_zexit.get())
|
||||
self.dc["replace_ios"] = self.var_replace_ios.get()
|
||||
|
||||
# MQTT Settings
|
||||
self.dc["mqtt"] = int(self.var_mqtton.get())
|
||||
self.dc["mqttbasetopic"] = \
|
||||
self._dict_mqttsettings["mqttbasetopic"]
|
||||
self.dc["mqttclient_id"] = \
|
||||
self._dict_mqttsettings["mqttclient_id"]
|
||||
self.dc["mqttbroker_address"] = \
|
||||
self._dict_mqttsettings["mqttbroker_address"]
|
||||
self.dc["mqttpassword"] = \
|
||||
self._dict_mqttsettings["mqttpassword"]
|
||||
self.dc["mqttusername"] = \
|
||||
self._dict_mqttsettings["mqttusername"]
|
||||
self.dc["mqttport"] = \
|
||||
int(self._dict_mqttsettings["mqttport"])
|
||||
self.dc["mqttsend_on_event"] = \
|
||||
int(self._dict_mqttsettings["mqttsend_on_event"])
|
||||
self.dc["mqttsendinterval"] = \
|
||||
int(self._dict_mqttsettings["mqttsendinterval"])
|
||||
self.dc["mqtttls_set"] = \
|
||||
int(self._dict_mqttsettings["mqtttls_set"])
|
||||
self.dc["mqttwrite_outputs"] = \
|
||||
int(self._dict_mqttsettings["mqttwrite_outputs"])
|
||||
|
||||
# PLCSlave Settings
|
||||
self.dc["plcslave"] = int(self.var_slave.get())
|
||||
self.dc["plcslaveacl"] = self.var_slaveacl.get()
|
||||
|
||||
self.dc["xmlrpc"] = 0
|
||||
if self.var_xmlon.get():
|
||||
self.dc["xmlrpc"] += 1
|
||||
if self.var_xmlmod2.get():
|
||||
self.dc["xmlrpc"] += 1
|
||||
if self.var_xmlmod3.get():
|
||||
self.dc["xmlrpc"] += 1
|
||||
|
||||
self.dc["xmlrpcport"] = self.var_xmlport.get()
|
||||
# XML Settings
|
||||
self.dc["xmlrpc"] = int(self.var_xmlon.get())
|
||||
self.dc["xmlrpcacl"] = self.var_xmlacl.get()
|
||||
|
||||
if self.xmlcli.set_config(self.dc, ask):
|
||||
tkmsg.showinfo(
|
||||
@@ -325,25 +536,62 @@ class RevPiOption(tkinter.Frame):
|
||||
if not self.mrk_xmlmodask:
|
||||
self.var_xmlon.set(True)
|
||||
|
||||
self.xmlmod_tail()
|
||||
def btn_mqttsettings(self):
|
||||
u"""Öffnet Fenster für MQTT Einstellungen."""
|
||||
win = tkinter.Toplevel(self)
|
||||
win.focus_set()
|
||||
win.grab_set()
|
||||
self.frm_mqttmgr = MqttManager(
|
||||
win, self._dict_mqttsettings,
|
||||
readonly=self.xmlmodus < 4
|
||||
)
|
||||
self.wait_window(win)
|
||||
self._dict_mqttsettings = self.frm_mqttmgr.settings
|
||||
|
||||
def xmlmod_tail(self):
|
||||
u"""Passt XML-Optionszugriff an."""
|
||||
if self.var_xmlon.get():
|
||||
self.var_xmlmod2.set(self.mrk_var_xmlmod2)
|
||||
self.ckb_xmlmod2["state"] = "normal"
|
||||
else:
|
||||
self.mrk_var_xmlmod2 = self.var_xmlmod2.get()
|
||||
self.var_xmlmod2.set(False)
|
||||
self.ckb_xmlmod2["state"] = "disabled"
|
||||
self.xmlmod2_tail()
|
||||
def btn_slaveacl(self):
|
||||
u"""Öffnet Fenster für ACL-Verwaltung."""
|
||||
win = tkinter.Toplevel(self)
|
||||
win.focus_set()
|
||||
win.grab_set()
|
||||
self.frm_slaveacl = AclManager(
|
||||
win, 0, 1,
|
||||
self.var_slaveacl.get(),
|
||||
readonly=self.xmlmodus < 4
|
||||
)
|
||||
self.frm_slaveacl.acltext = {
|
||||
0: _("read only"),
|
||||
1: _("read and write")
|
||||
}
|
||||
self.wait_window(win)
|
||||
self.var_slaveacl.set(self.frm_slaveacl.acl)
|
||||
|
||||
def xmlmod2_tail(self):
|
||||
u"""Passt XML-Optionszugriff an."""
|
||||
if self.var_xmlmod2.get():
|
||||
self.var_xmlmod3.set(self.mrk_var_xmlmod3)
|
||||
self.ckb_xmlmod3["state"] = "normal"
|
||||
else:
|
||||
self.mrk_var_xmlmod3 = self.var_xmlmod3.get()
|
||||
self.var_xmlmod3.set(False)
|
||||
self.ckb_xmlmod3["state"] = "disabled"
|
||||
def btn_xmlacl(self):
|
||||
u"""Öffnet Fenster für ACL-Verwaltung."""
|
||||
win = tkinter.Toplevel(self)
|
||||
win.focus_set()
|
||||
win.grab_set()
|
||||
self.frm_xmlacl = AclManager(
|
||||
win, 0, 4,
|
||||
self.var_xmlacl.get(),
|
||||
readonly=self.xmlmodus < 4
|
||||
)
|
||||
self.frm_xmlacl.acltext = {
|
||||
0: _("Start/Stop PLC program and read logs"),
|
||||
1: _("+ read IOs in watch modus"),
|
||||
2: _("+ read properties and download PLC program"),
|
||||
3: _("+ upload PLC program"),
|
||||
4: _("+ set properties")
|
||||
}
|
||||
self.wait_window(win)
|
||||
self.var_xmlacl.set(self.frm_xmlacl.acl)
|
||||
|
||||
def destroy(self):
|
||||
u"""Beendet alle Unterfenster und sich selbst."""
|
||||
if self.frm_mqttmgr is not None:
|
||||
self.frm_mqttmgr.master.destroy()
|
||||
if self.frm_slaveacl is not None:
|
||||
self.frm_slaveacl.master.destroy()
|
||||
if self.frm_xmlacl is not None:
|
||||
self.frm_xmlacl.master.destroy()
|
||||
|
||||
super().destroy()
|
||||
|
||||
@@ -1,35 +1,32 @@
|
||||
#
|
||||
# RevPiPyControl
|
||||
#
|
||||
# Webpage: https://revpimodio.org/revpipyplc/
|
||||
# (c) Sven Sager, License: LGPLv3
|
||||
#
|
||||
# -*- coding: utf-8 -*-
|
||||
u"""Fenster um RevPi-Verbindungen einzurichten."""
|
||||
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
import os.path
|
||||
import pickle
|
||||
import tkinter
|
||||
import tkinter.messagebox as tkmsg
|
||||
from mytools import gettrans
|
||||
from os import environ
|
||||
from mytools import savefile_connections as savefile
|
||||
from revpidevelop import _loaddefaults as developloaddefaults
|
||||
from revpidevelop import _savedefaults as developsavedefaults
|
||||
from revpiprogram import _loaddefaults as programloaddefaults
|
||||
from revpiprogram import _savedefaults as programsavedefaults
|
||||
from os import makedirs
|
||||
from sys import platform
|
||||
|
||||
|
||||
# Übersetzungen laden
|
||||
_ = gettrans()
|
||||
|
||||
# Systemwerte
|
||||
if platform == "linux":
|
||||
homedir = environ["HOME"]
|
||||
else:
|
||||
homedir = environ["APPDATA"]
|
||||
savefile = os.path.join(homedir, ".revpipyplc", "connections.dat")
|
||||
|
||||
|
||||
def get_connections():
|
||||
u"""Verbindungen aus Datei laden.
|
||||
@return dict() mit Verbindungen"""
|
||||
if os.path.exists(savefile):
|
||||
fh = open(savefile, "rb")
|
||||
with open(savefile, "rb") as fh:
|
||||
connections = pickle.load(fh)
|
||||
return connections
|
||||
else:
|
||||
@@ -38,6 +35,8 @@ def get_connections():
|
||||
|
||||
class RevPiPlcList(tkinter.Frame):
|
||||
|
||||
u"""TK Fenster."""
|
||||
|
||||
def __init__(self, master):
|
||||
u"""Init RevPiPlcList-class.
|
||||
@param master tkinter master"""
|
||||
@@ -92,11 +91,13 @@ class RevPiPlcList(tkinter.Frame):
|
||||
|
||||
# Eingabefelder für Adresse und Namen
|
||||
tkinter.Label(self, text=_("Name")).grid(
|
||||
column=2, row=0, sticky="wn", padx=5, pady=5)
|
||||
column=2, row=0, sticky="wn", padx=5, pady=5
|
||||
)
|
||||
self.txt_name = tkinter.Entry(self, textvariable=self.var_name)
|
||||
self.txt_name.bind("<KeyRelease>", self.evt_keypress)
|
||||
self.txt_name.grid(
|
||||
column=3, row=0, columnspan=3, sticky="n", padx=5, pady=5)
|
||||
column=3, row=0, columnspan=3, sticky="n", padx=5, pady=5
|
||||
)
|
||||
|
||||
tkinter.Label(self, text=_("IP address")).grid(
|
||||
column=2, row=1, sticky="wn", padx=5, pady=5
|
||||
@@ -104,34 +105,42 @@ class RevPiPlcList(tkinter.Frame):
|
||||
self.txt_address = tkinter.Entry(self, textvariable=self.var_address)
|
||||
self.txt_address.bind("<KeyRelease>", self.evt_keypress)
|
||||
self.txt_address.grid(
|
||||
column=3, row=1, columnspan=3, sticky="n", padx=5, pady=5)
|
||||
column=3, row=1, columnspan=3, sticky="n", padx=5, pady=5
|
||||
)
|
||||
|
||||
tkinter.Label(self, text=_("Port")).grid(
|
||||
column=2, row=2, sticky="wn", padx=5, pady=5)
|
||||
column=2, row=2, sticky="wn", padx=5, pady=5
|
||||
)
|
||||
self.txt_port = tkinter.Entry(self, textvariable=self.var_port)
|
||||
self.txt_port.bind("<KeyRelease>", self.evt_keypress)
|
||||
self.txt_port.grid(
|
||||
column=3, row=2, columnspan=3, sticky="n", padx=5, pady=5)
|
||||
column=3, row=2, columnspan=3, sticky="n", padx=5, pady=5
|
||||
)
|
||||
|
||||
# Listenbutton
|
||||
self.btn_new = tkinter.Button(
|
||||
self, text=_("New"), command=self.evt_btnnew)
|
||||
self, text=_("New"), command=self.evt_btnnew
|
||||
)
|
||||
self.btn_new.grid(column=2, row=3, sticky="s")
|
||||
self.btn_add = tkinter.Button(
|
||||
self, text=_("Apply"), command=self.evt_btnadd,
|
||||
state="disabled")
|
||||
self, text=_("Apply"),
|
||||
command=self.evt_btnadd, state="disabled"
|
||||
)
|
||||
self.btn_add.grid(column=3, row=3, sticky="s")
|
||||
self.btn_remove = tkinter.Button(
|
||||
self, text=_("Remove"), command=self.evt_btnremove,
|
||||
state="disabled")
|
||||
self, text=_("Remove"),
|
||||
command=self.evt_btnremove, state="disabled"
|
||||
)
|
||||
self.btn_remove.grid(column=4, row=3, sticky="s")
|
||||
|
||||
# Fensterbuttons
|
||||
self.btn_save = tkinter.Button(
|
||||
self, text=_("Save"), command=self.evt_btnsave)
|
||||
self, text=_("Save"), command=self.evt_btnsave
|
||||
)
|
||||
self.btn_save.grid(column=3, row=9, sticky="se")
|
||||
self.btn_close = tkinter.Button(
|
||||
self, text=_("Close"), command=self._checkclose)
|
||||
self, text=_("Close"), command=self._checkclose
|
||||
)
|
||||
self.btn_close.grid(column=4, row=9, sticky="se")
|
||||
|
||||
def _saveappdata(self):
|
||||
@@ -139,11 +148,24 @@ class RevPiPlcList(tkinter.Frame):
|
||||
@return True, bei erfolgreicher Verarbeitung"""
|
||||
try:
|
||||
makedirs(os.path.dirname(savefile), exist_ok=True)
|
||||
fh = open(savefile, "wb")
|
||||
with open(savefile, "wb") as fh:
|
||||
pickle.dump(self._connections, fh)
|
||||
self.changes = False
|
||||
except:
|
||||
except Exception:
|
||||
return False
|
||||
|
||||
# Andere Einstellungen aufräumen
|
||||
dict_o = developloaddefaults()
|
||||
for revpi in tuple(dict_o.keys()):
|
||||
if revpi not in self._connections:
|
||||
del dict_o[revpi]
|
||||
developsavedefaults(None, dict_o)
|
||||
dict_o = programloaddefaults()
|
||||
for revpi in tuple(dict_o.keys()):
|
||||
if revpi not in self._connections:
|
||||
del dict_o[revpi]
|
||||
programsavedefaults(None, dict_o)
|
||||
|
||||
return True
|
||||
|
||||
def build_listconn(self):
|
||||
@@ -179,7 +201,7 @@ class RevPiPlcList(tkinter.Frame):
|
||||
item = self.list_conn.get(item_index[0])
|
||||
ask = tkmsg.askyesno(
|
||||
_("Question"),
|
||||
_("Do you really want to delete the selected connection '{}'?"
|
||||
_("Do you really want to delete the selected connection '{0}'?"
|
||||
"").format(item),
|
||||
parent=self.master
|
||||
)
|
||||
@@ -220,7 +242,6 @@ class RevPiPlcList(tkinter.Frame):
|
||||
self.var_port.set(self._connections[item][1])
|
||||
|
||||
self.btn_add["state"] == "normal"
|
||||
|
||||
self.btn_remove["state"] = "normal"
|
||||
else:
|
||||
self.btn_remove["state"] = "disabled"
|
||||
@@ -228,9 +249,9 @@ class RevPiPlcList(tkinter.Frame):
|
||||
def evt_keypress(self, evt=None):
|
||||
u"""Passt bei Tastendruck den Status der Buttons an."""
|
||||
okvalue = "normal" if (
|
||||
self.var_address.get() != ""
|
||||
and self.var_name.get() != ""
|
||||
and self.var_port.get() != ""
|
||||
self.var_address.get() != "" and
|
||||
self.var_name.get() != "" and
|
||||
self.var_port.get() != ""
|
||||
) else "disabled"
|
||||
self.btn_add["state"] = okvalue
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#
|
||||
# RevPiPyControl
|
||||
#
|
||||
# Webpage: https://revpimodio.org/revpipyplc/
|
||||
# (c) Sven Sager, License: LGPLv3
|
||||
#
|
||||
# -*- coding: utf-8 -*-
|
||||
u"""PLC Programm und Konfig hoch und runterladen."""
|
||||
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
import gzip
|
||||
import os
|
||||
import pickle
|
||||
@@ -14,26 +14,56 @@ import tkinter.filedialog as tkfd
|
||||
import tkinter.messagebox as tkmsg
|
||||
import zipfile
|
||||
from mytools import gettrans
|
||||
from os import environ
|
||||
from os import makedirs
|
||||
from mytools import homedir
|
||||
from mytools import savefile_programpath as savefile
|
||||
from shutil import rmtree
|
||||
from sys import platform
|
||||
from tempfile import mkstemp, mkdtemp
|
||||
from xmlrpc.client import Binary
|
||||
|
||||
# Übersetzung laden
|
||||
_ = gettrans()
|
||||
|
||||
# Systemwerte
|
||||
if platform == "linux":
|
||||
homedir = environ["HOME"]
|
||||
else:
|
||||
homedir = environ["APPDATA"]
|
||||
savefile = os.path.join(homedir, ".revpipyplc", "programpath.dat")
|
||||
|
||||
def _loaddefaults(revpiname=None):
|
||||
u"""Übernimmt für den Pi die letzen Pfade.
|
||||
@param revpiname Einstellungen nur für RevPi laden
|
||||
@return <class 'dict'> mit Einstellungen"""
|
||||
if os.path.exists(savefile):
|
||||
with open(savefile, "rb") as fh:
|
||||
dict_all = pickle.load(fh)
|
||||
if revpiname is None:
|
||||
return dict_all
|
||||
else:
|
||||
return dict_all.get(revpiname, {})
|
||||
return {}
|
||||
|
||||
|
||||
def _savedefaults(revpiname, settings):
|
||||
u"""Schreibt fuer den Pi die letzen Pfade.
|
||||
|
||||
@param revpiname Einstellungen sind für diesen RevPi
|
||||
@param settings <class 'dict'> mit Einstellungen
|
||||
@return True, bei erfolgreicher Verarbeitung
|
||||
|
||||
"""
|
||||
try:
|
||||
os.makedirs(os.path.dirname(savefile), exist_ok=True)
|
||||
if revpiname is None:
|
||||
dict_all = settings
|
||||
else:
|
||||
dict_all = _loaddefaults()
|
||||
dict_all[revpiname] = settings
|
||||
with open(savefile, "wb") as fh:
|
||||
pickle.dump(dict_all, fh)
|
||||
except Exception:
|
||||
return False
|
||||
return True
|
||||
|
||||
|
||||
class RevPiProgram(tkinter.Frame):
|
||||
|
||||
u"""Zeigt Programmfenster an."""
|
||||
|
||||
def __init__(self, master, xmlcli, xmlmode, revpi):
|
||||
u"""Init RevPiProgram-Class.
|
||||
@return None"""
|
||||
@@ -48,11 +78,10 @@ class RevPiProgram(tkinter.Frame):
|
||||
self.uploaded = False
|
||||
self.revpi = revpi
|
||||
self.xmlcli = xmlcli
|
||||
self.xmlmode = xmlmode
|
||||
self.xmlstate = "normal" if xmlmode == 3 else "disabled"
|
||||
self.xmlstate = "normal" if xmlmode >= 3 else "disabled"
|
||||
|
||||
# Letzte Einstellungen übernehmen
|
||||
self.opt = self._loaddefault()
|
||||
self.opt = _loaddefaults(revpi)
|
||||
|
||||
# Fenster bauen
|
||||
self._createwidgets()
|
||||
@@ -121,8 +150,9 @@ class RevPiProgram(tkinter.Frame):
|
||||
lbl["text"] = _("Download PLC program as:")
|
||||
lbl.grid(column=0, row=r, **cpadw)
|
||||
opt = tkinter.OptionMenu(
|
||||
prog, self.var_typedown, *self.lst_typedown,
|
||||
command=self._evt_optdown)
|
||||
prog, self.var_typedown, command=self._evt_optdown,
|
||||
*self.lst_typedown
|
||||
)
|
||||
opt["width"] = 10
|
||||
opt.grid(column=1, row=r, **cpad)
|
||||
|
||||
@@ -131,6 +161,7 @@ class RevPiProgram(tkinter.Frame):
|
||||
self.ckb_picdown["text"] = _("include piCtory configuration")
|
||||
self.ckb_picdown["variable"] = self.var_picdown
|
||||
self.ckb_picdown.grid(column=0, row=r, **cpadw)
|
||||
|
||||
btn = tkinter.Button(prog)
|
||||
btn["command"] = self.plcdownload
|
||||
btn["text"] = _("Download")
|
||||
@@ -140,9 +171,11 @@ class RevPiProgram(tkinter.Frame):
|
||||
lbl = tkinter.Label(prog)
|
||||
lbl["text"] = _("Upload PLC program as:")
|
||||
lbl.grid(column=0, row=r, **cpadw)
|
||||
|
||||
opt = tkinter.OptionMenu(
|
||||
prog, self.var_typeup, *self.lst_typeup,
|
||||
command=self._evt_optup)
|
||||
prog, self.var_typeup, command=self._evt_optup,
|
||||
*self.lst_typeup
|
||||
)
|
||||
opt["state"] = self.xmlstate
|
||||
opt["width"] = 10
|
||||
opt.grid(column=1, row=r, **cpad)
|
||||
@@ -160,6 +193,7 @@ class RevPiProgram(tkinter.Frame):
|
||||
self.ckb_picup["text"] = _("includes piCtory configuration")
|
||||
self.ckb_picup["variable"] = self.var_picup
|
||||
self.ckb_picup.grid(column=0, row=r, **cpadw)
|
||||
|
||||
btn = tkinter.Button(prog)
|
||||
btn["command"] = self.plcupload
|
||||
btn["state"] = self.xmlstate
|
||||
@@ -175,13 +209,16 @@ class RevPiProgram(tkinter.Frame):
|
||||
lbl = tkinter.Label(picto)
|
||||
lbl["text"] = _("Download piCtory configuration")
|
||||
lbl.grid(column=0, row=0, **cpadw)
|
||||
|
||||
btn = tkinter.Button(picto)
|
||||
btn["command"] = self.getpictoryrsc
|
||||
btn["text"] = _("Download")
|
||||
btn.grid(column=1, row=0, **cpad)
|
||||
|
||||
lbl = tkinter.Label(picto)
|
||||
lbl["text"] = _("Upload piCtory configuration")
|
||||
lbl.grid(column=0, row=1, **cpadw)
|
||||
|
||||
btn = tkinter.Button(picto)
|
||||
btn["command"] = self.setpictoryrsc
|
||||
btn["state"] = self.xmlstate
|
||||
@@ -193,9 +230,11 @@ class RevPiProgram(tkinter.Frame):
|
||||
proc.columnconfigure(0, weight=1)
|
||||
proc["text"] = _("piControl0 process image")
|
||||
proc.grid(columnspan=2, pady=2, sticky="we")
|
||||
|
||||
lbl = tkinter.Label(proc)
|
||||
lbl["text"] = _("Download process image dump")
|
||||
lbl.grid(column=0, row=0, **cpadw)
|
||||
|
||||
btn = tkinter.Button(proc)
|
||||
btn["command"] = self.getprocimg
|
||||
btn["text"] = _("Download")
|
||||
@@ -206,9 +245,11 @@ class RevPiProgram(tkinter.Frame):
|
||||
picon.columnconfigure(0, weight=1)
|
||||
picon["text"] = _("Reset piControl")
|
||||
picon.grid(columnspan=2, pady=2, sticky="we")
|
||||
|
||||
lbl = tkinter.Label(picon)
|
||||
lbl["text"] = _("Execute piControlReset")
|
||||
lbl.grid(column=0, row=0, **cpadw)
|
||||
|
||||
btn = tkinter.Button(picon)
|
||||
btn["command"] = self.picontrolreset
|
||||
btn["text"] = _("execute")
|
||||
@@ -236,33 +277,6 @@ class RevPiProgram(tkinter.Frame):
|
||||
else:
|
||||
self.ckb_picup["state"] = "normal"
|
||||
|
||||
def _loaddefault(self, full=False):
|
||||
u"""Übernimmt für den Pi die letzen Pfade.
|
||||
@param full Einstellungen für alle Verbindungen laden
|
||||
@return dict() mit Einstellungen"""
|
||||
if os.path.exists(savefile):
|
||||
fh = open(savefile, "rb")
|
||||
dict_all = pickle.load(fh)
|
||||
if full:
|
||||
return dict_all
|
||||
else:
|
||||
return dict_all.get(self.revpi, {})
|
||||
return {}
|
||||
|
||||
def _savedefaults(self):
|
||||
u"""Schreibt fuer den Pi die letzen Pfade.
|
||||
@return True, bei erfolgreicher Verarbeitung"""
|
||||
try:
|
||||
makedirs(os.path.dirname(savefile), exist_ok=True)
|
||||
dict_all = self._loaddefault(full=True)
|
||||
dict_all[self.revpi] = self.opt
|
||||
fh = open(savefile, "wb")
|
||||
pickle.dump(dict_all, fh)
|
||||
self.changes = False
|
||||
except:
|
||||
return False
|
||||
return True
|
||||
|
||||
def create_filelist(self, rootdir):
|
||||
u"""Erstellt eine Dateiliste von einem Verzeichnis.
|
||||
@param rootdir Verzeichnis fuer das eine Liste erstellt werden soll
|
||||
@@ -310,7 +324,7 @@ class RevPiProgram(tkinter.Frame):
|
||||
if fh is not None:
|
||||
try:
|
||||
fh.write(self.xmlcli.get_pictoryrsc().data)
|
||||
except:
|
||||
except Exception:
|
||||
tkmsg.showerror(
|
||||
_("Error"),
|
||||
_("Could not load and save file!"),
|
||||
@@ -324,7 +338,7 @@ class RevPiProgram(tkinter.Frame):
|
||||
)
|
||||
# Einstellungen speichern
|
||||
self.opt["getpictoryrsc_dir"] = os.path.dirname(fh.name)
|
||||
self._savedefaults()
|
||||
_savedefaults(self.revpi, self.opt)
|
||||
finally:
|
||||
fh.close()
|
||||
|
||||
@@ -341,7 +355,7 @@ class RevPiProgram(tkinter.Frame):
|
||||
if fh is not None:
|
||||
try:
|
||||
fh.write(self.xmlcli.get_procimg().data)
|
||||
except:
|
||||
except Exception:
|
||||
tkmsg.showerror(
|
||||
_("Error"),
|
||||
_("Could not load and save file!"),
|
||||
@@ -355,7 +369,7 @@ class RevPiProgram(tkinter.Frame):
|
||||
)
|
||||
# Einstellungen speichern
|
||||
self.opt["getprocimg_dir"] = os.path.dirname(fh.name)
|
||||
self._savedefaults()
|
||||
_savedefaults(self.revpi, self.opt)
|
||||
finally:
|
||||
fh.close()
|
||||
|
||||
@@ -403,7 +417,7 @@ class RevPiProgram(tkinter.Frame):
|
||||
|
||||
# Einstellungen speichern
|
||||
self.opt["setpictoryrsc_dir"] = os.path.dirname(fh.name)
|
||||
self._savedefaults()
|
||||
_savedefaults(self.revpi, self.opt)
|
||||
elif ec == -1:
|
||||
tkmsg.showerror(
|
||||
_("Error"),
|
||||
@@ -546,7 +560,7 @@ class RevPiProgram(tkinter.Frame):
|
||||
self.opt["typedown"] = self.var_typedown.get()
|
||||
self.opt["picdown"] = self.var_picdown.get()
|
||||
|
||||
except:
|
||||
except Exception:
|
||||
raise
|
||||
tkmsg.showerror(
|
||||
_("Error"),
|
||||
@@ -561,7 +575,7 @@ class RevPiProgram(tkinter.Frame):
|
||||
)
|
||||
|
||||
# Einstellungen speichern
|
||||
self._savedefaults()
|
||||
_savedefaults(self.revpi, self.opt)
|
||||
finally:
|
||||
fh.close()
|
||||
|
||||
@@ -573,6 +587,7 @@ class RevPiProgram(tkinter.Frame):
|
||||
dirtmp = None
|
||||
filelist = []
|
||||
fileselect = None
|
||||
foldername = ""
|
||||
rscfile = None
|
||||
|
||||
if tup == 0:
|
||||
@@ -580,7 +595,7 @@ class RevPiProgram(tkinter.Frame):
|
||||
fileselect = tkfd.askopenfilenames(
|
||||
parent=self.master,
|
||||
title="Upload Python program...",
|
||||
initialdir=self.opt.get("plcupload_dir", ""),
|
||||
initialdir=self.opt.get("plcupload_dir", homedir),
|
||||
filetypes=(("Python", "*.py"), (_("All files"), "*.*"))
|
||||
)
|
||||
if type(fileselect) == tuple and len(fileselect) > 0:
|
||||
@@ -593,8 +608,12 @@ class RevPiProgram(tkinter.Frame):
|
||||
parent=self.master,
|
||||
title=_("Folder to upload"),
|
||||
mustexist=True,
|
||||
initialdir=self.opt.get("plcupload_dir", self.revpi)
|
||||
initialdir=self.opt.get("plcupload_dir", homedir)
|
||||
)
|
||||
|
||||
# Ordnernamen merken um diesen auf RevPi anzulegen
|
||||
foldername = os.path.basename(dirselect)
|
||||
|
||||
if type(dirselect) == str and dirselect != "":
|
||||
filelist = self.create_filelist(dirselect)
|
||||
|
||||
@@ -691,7 +710,11 @@ class RevPiProgram(tkinter.Frame):
|
||||
if dirselect == "":
|
||||
sendname = os.path.basename(fname)
|
||||
else:
|
||||
sendname = fname.replace(dirselect, "")[1:]
|
||||
# Ordnernamen in Dateipfad für RevPi übernehmen
|
||||
sendname = os.path.join(
|
||||
foldername,
|
||||
fname.replace(dirselect, "")[1:]
|
||||
)
|
||||
|
||||
# Prüfen ob Dateiname bereits als Startprogramm angegeben ist
|
||||
if sendname == opt_program:
|
||||
@@ -701,7 +724,7 @@ class RevPiProgram(tkinter.Frame):
|
||||
try:
|
||||
ustatus = self.xmlcli.plcupload(
|
||||
Binary(gzip.compress(fh.read())), sendname)
|
||||
except:
|
||||
except Exception:
|
||||
ec = -2
|
||||
break
|
||||
|
||||
@@ -737,7 +760,7 @@ class RevPiProgram(tkinter.Frame):
|
||||
|
||||
self.opt["typeup"] = self.var_typeup.get()
|
||||
self.opt["picup"] = self.var_picup.get()
|
||||
self._savedefaults()
|
||||
_savedefaults(self.revpi, self.opt)
|
||||
|
||||
elif ec == -1:
|
||||
tkmsg.showerror(
|
||||
|
||||
@@ -1,16 +1,18 @@
|
||||
#!/usr/bin/python3
|
||||
#
|
||||
# RevPiPyControl
|
||||
# Version: see global var pycontrolverion
|
||||
#
|
||||
# Webpage: https://revpimodio.org/revpipyplc/
|
||||
# (c) Sven Sager, License: LGPLv3
|
||||
#
|
||||
# -*- coding: utf-8 -*-
|
||||
u"""RevPiPyControl main program."""
|
||||
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
__version__ = "0.8.1"
|
||||
|
||||
import revpicheckclient
|
||||
import revpidevelop
|
||||
import revpiinfo
|
||||
import revpilogfile
|
||||
import revpioption
|
||||
import revpilegacy
|
||||
import revpiplclist
|
||||
import revpiprogram
|
||||
import socket
|
||||
@@ -23,11 +25,11 @@ from xmlrpc.client import ServerProxy
|
||||
# Übersetzung laden
|
||||
_ = gettrans()
|
||||
|
||||
pycontrolversion = "0.4.1"
|
||||
|
||||
|
||||
class RevPiPyControl(tkinter.Frame):
|
||||
|
||||
u"""Baut Hauptprogramm auf."""
|
||||
|
||||
def __init__(self, master=None):
|
||||
u"""Init RevPiPyControl-Class.
|
||||
@param master tkinter master"""
|
||||
@@ -38,12 +40,15 @@ class RevPiPyControl(tkinter.Frame):
|
||||
self.cli = None
|
||||
self.dict_conn = revpiplclist.get_connections()
|
||||
self.errcount = 0
|
||||
self.revpiaddress = None
|
||||
self.revpiname = None
|
||||
self.revpipyversion = [0, 0, 0]
|
||||
self.xmlfuncs = []
|
||||
self.xmlmode = 0
|
||||
|
||||
# Debugger vorbereiten
|
||||
# Frames vorbereiten
|
||||
self.debugframe = None
|
||||
self.developframe = None
|
||||
|
||||
# Globale Fenster
|
||||
self.tkcheckclient = None
|
||||
@@ -70,17 +75,24 @@ class RevPiPyControl(tkinter.Frame):
|
||||
u"""Schließt alle Fenster."""
|
||||
if self.tkcheckclient is not None:
|
||||
self.tkcheckclient.destroy()
|
||||
if self.developframe is not None:
|
||||
self.developframe._checkclose()
|
||||
self.developframe.destroy()
|
||||
self.developframe = None
|
||||
if self.tklogs is not None:
|
||||
self.tklogs.master.destroy()
|
||||
if self.tkoptions is not None:
|
||||
self.tkoptions.destroy()
|
||||
self.tkoptions.master.destroy()
|
||||
if self.tkprogram is not None:
|
||||
self.tkprogram.destroy()
|
||||
if self.debugframe is not None:
|
||||
self.plcdebug()
|
||||
self.debugframe.destroy()
|
||||
self.cli.psstop()
|
||||
self.debugframe = None
|
||||
try:
|
||||
self.cli.psstop()
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
def _closeapp(self, event=None):
|
||||
u"""Räumt auf und beendet Programm.
|
||||
@@ -118,38 +130,43 @@ class RevPiPyControl(tkinter.Frame):
|
||||
menu1.add_command(label=_("Info..."), command=self.infowindow)
|
||||
self.mbar.add_cascade(label=_("Help"), menu=menu1)
|
||||
|
||||
self.var_conn = tkinter.StringVar(self)
|
||||
self.txt_connect = tkinter.Entry(self, state="readonly", width=40)
|
||||
self.main_frame = tkinter.Frame(self)
|
||||
self.main_frame.pack(side="left", fill="y")
|
||||
|
||||
self.var_conn = tkinter.StringVar(self.main_frame)
|
||||
self.txt_connect = tkinter.Entry(
|
||||
self.main_frame, state="readonly", width=40
|
||||
)
|
||||
self.txt_connect["textvariable"] = self.var_conn
|
||||
self.txt_connect.pack(fill="x")
|
||||
|
||||
self.btn_plcstart = tkinter.Button(self)
|
||||
self.btn_plcstart = tkinter.Button(self.main_frame)
|
||||
self.btn_plcstart["text"] = _("PLC start")
|
||||
self.btn_plcstart["command"] = self.plcstart
|
||||
self.btn_plcstart.pack(fill="x")
|
||||
|
||||
self.btn_plcstop = tkinter.Button(self)
|
||||
self.btn_plcstop = tkinter.Button(self.main_frame)
|
||||
self.btn_plcstop["text"] = _("PLC stop")
|
||||
self.btn_plcstop["command"] = self.plcstop
|
||||
self.btn_plcstop.pack(fill="x")
|
||||
|
||||
self.btn_plcrestart = tkinter.Button(self)
|
||||
self.btn_plcrestart = tkinter.Button(self.main_frame)
|
||||
self.btn_plcrestart["text"] = _("PLC restart")
|
||||
self.btn_plcrestart["command"] = self.plcrestart
|
||||
self.btn_plcrestart.pack(fill="x")
|
||||
|
||||
self.btn_plclogs = tkinter.Button(self)
|
||||
self.btn_plclogs = tkinter.Button(self.main_frame)
|
||||
self.btn_plclogs["text"] = _("PLC logs")
|
||||
self.btn_plclogs["command"] = self.plclogs
|
||||
self.btn_plclogs.pack(fill="x")
|
||||
|
||||
self.var_status = tkinter.StringVar(self)
|
||||
self.txt_status = tkinter.Entry(self)
|
||||
self.var_status = tkinter.StringVar(self.main_frame)
|
||||
self.txt_status = tkinter.Entry(self.main_frame)
|
||||
self.txt_status["state"] = "readonly"
|
||||
self.txt_status["textvariable"] = self.var_status
|
||||
self.txt_status.pack(fill="x")
|
||||
|
||||
self.btn_debug = tkinter.Button(self)
|
||||
self.btn_debug = tkinter.Button(self.main_frame)
|
||||
self.btn_debug["text"] = _("PLC watch mode")
|
||||
self.btn_debug["command"] = self.plcdebug
|
||||
self.btn_debug.pack(fill="x")
|
||||
@@ -172,6 +189,12 @@ class RevPiPyControl(tkinter.Frame):
|
||||
label=_("PLC options..."), command=self.plcoptions)
|
||||
self.mplc.add_command(
|
||||
label=_("PLC program..."), command=self.plcprogram)
|
||||
self.mplc.add_command(
|
||||
label=_("PLC developer..."), command=self.plcdevelop)
|
||||
self.mplc.add_separator()
|
||||
|
||||
self.mplc.add_command(
|
||||
label=_("piCtory configuration"), command=self.plcpictory)
|
||||
self.mplc.add_separator()
|
||||
|
||||
self.mplc.add_command(
|
||||
@@ -187,12 +210,12 @@ class RevPiPyControl(tkinter.Frame):
|
||||
@param text Verbindungsname
|
||||
@param reconnect Socket Timeout nicht heruntersetzen"""
|
||||
if reconnect:
|
||||
socket.setdefaulttimeout(15)
|
||||
socket.setdefaulttimeout(6)
|
||||
else:
|
||||
socket.setdefaulttimeout(2)
|
||||
|
||||
sp = ServerProxy(
|
||||
"http://{}:{}".format(
|
||||
"http://{0}:{1}".format(
|
||||
self.dict_conn[text][0], int(self.dict_conn[text][1])
|
||||
)
|
||||
)
|
||||
@@ -200,18 +223,20 @@ class RevPiPyControl(tkinter.Frame):
|
||||
try:
|
||||
self.xmlfuncs = sp.system.listMethods()
|
||||
self.xmlmode = sp.xmlmodus()
|
||||
except:
|
||||
self.revpipyversion = list(map(int, sp.version().split(".")))
|
||||
except Exception as e:
|
||||
self.servererror()
|
||||
else:
|
||||
self._closeall()
|
||||
socket.setdefaulttimeout(15)
|
||||
socket.setdefaulttimeout(6)
|
||||
self.cli = ServerProxy(
|
||||
"http://{}:{}".format(
|
||||
"http://{0}:{1}".format(
|
||||
self.dict_conn[text][0], int(self.dict_conn[text][1])
|
||||
)
|
||||
)
|
||||
self.revpiaddress = self.dict_conn[text][0]
|
||||
self.revpiname = text
|
||||
self.var_conn.set("{} - {}:{}".format(
|
||||
self.var_conn.set("{0} - {1}:{2}".format(
|
||||
text, self.dict_conn[text][0], int(self.dict_conn[text][1])
|
||||
))
|
||||
self.mbar.entryconfig("PLC", state="normal")
|
||||
@@ -221,33 +246,48 @@ class RevPiPyControl(tkinter.Frame):
|
||||
win = tkinter.Toplevel(self)
|
||||
win.focus_set()
|
||||
win.grab_set()
|
||||
revpiinfo.RevPiInfo(win, self.cli, pycontrolversion)
|
||||
revpiinfo.RevPiInfo(win, self.cli, __version__)
|
||||
self.wait_window(win)
|
||||
self.dict_conn = revpiplclist.get_connections()
|
||||
self._fillconnbar()
|
||||
|
||||
|
||||
def plcdebug(self):
|
||||
u"""Baut den Debugframe und packt ihn."""
|
||||
u"""Baut den Debugframe und packt ihn.
|
||||
@return None"""
|
||||
self.btn_debug["state"] = "disabled"
|
||||
|
||||
if "psstart" not in self.xmlfuncs:
|
||||
tkmsg.showwarning(
|
||||
_("Warning"),
|
||||
_("The watch mode ist not supported in version {} "
|
||||
_("The watch mode ist not supported in version {0} "
|
||||
"of RevPiPyLoad on your RevPi! You need at least version "
|
||||
"0.4.0. Or the python3-revpimodio module is not installt"
|
||||
"on your RevPi at least version 0.15.0."
|
||||
"0.5.3! Maybe the python3-revpimodio2 module is not "
|
||||
"installed on your RevPi at least version 2.0.0."
|
||||
"").format(self.cli.version()),
|
||||
parent=self.master
|
||||
)
|
||||
else:
|
||||
# Debugfenster laden
|
||||
if self.debugframe is None \
|
||||
or self.debugframe.err_workvalues >= \
|
||||
self.debugframe.max_errors:
|
||||
return
|
||||
|
||||
# FIXME: Bei neuer piCtory Konfig schneller vernichten
|
||||
if self.debugframe is None:
|
||||
try:
|
||||
self.debugframe = revpicheckclient.RevPiCheckClient(
|
||||
self, self.cli, self.xmlmode
|
||||
self.main_frame, self.cli, self.xmlmode
|
||||
)
|
||||
except Exception:
|
||||
tkmsg.showwarning(
|
||||
_("Error"),
|
||||
_("Can not load piCtory configuration. \n"
|
||||
"Did you create a hardware configuration? "
|
||||
"Please check this in piCtory!"),
|
||||
parent=self.master
|
||||
)
|
||||
self.btn_debug["state"] = "normal"
|
||||
return None
|
||||
|
||||
# Fehler prüfen
|
||||
if self.debugframe.err_workvalues >= self.debugframe.max_errors:
|
||||
self.debugframe = None
|
||||
return None
|
||||
|
||||
# Show/Hide wechseln
|
||||
if self.debugframe.winfo_viewable():
|
||||
@@ -262,6 +302,29 @@ class RevPiPyControl(tkinter.Frame):
|
||||
|
||||
self.btn_debug["state"] = "normal"
|
||||
|
||||
def plcdevelop(self):
|
||||
u"""Startet das Developfenster."""
|
||||
if self.xmlmode < 3:
|
||||
tkmsg.showwarning(
|
||||
_("Warning"),
|
||||
_("XML-RPC access mode in the RevPiPyLoad "
|
||||
"configuration is too small to access this dialog!"),
|
||||
parent=self.master
|
||||
)
|
||||
return
|
||||
|
||||
# Developframe laden
|
||||
if self.developframe is None:
|
||||
self.developframe = revpidevelop.RevPiDevelop(
|
||||
self, self.cli, self.xmlmode, self.revpiname
|
||||
)
|
||||
|
||||
if self.developframe.winfo_viewable():
|
||||
self.developframe._checkclose()
|
||||
self.developframe.pack_forget()
|
||||
else:
|
||||
self.developframe.pack(side="right") # fill="x")
|
||||
|
||||
def plclist(self):
|
||||
u"""Öffnet das Fenster für die Verbindungen."""
|
||||
win = tkinter.Toplevel(self)
|
||||
@@ -278,7 +341,7 @@ class RevPiPyControl(tkinter.Frame):
|
||||
if "load_plclog" not in self.xmlfuncs:
|
||||
tkmsg.showwarning(
|
||||
_("Warning"),
|
||||
_("This version of Logviewer ist not supported in version {} "
|
||||
_("This version of Logviewer ist not supported in version {0} "
|
||||
"of RevPiPyLoad on your RevPi! You need at least version "
|
||||
"0.4.1.").format(self.cli.version()),
|
||||
parent=self.master
|
||||
@@ -304,19 +367,30 @@ class RevPiPyControl(tkinter.Frame):
|
||||
win = tkinter.Toplevel(self)
|
||||
win.focus_set()
|
||||
win.grab_set()
|
||||
|
||||
# Gegenstelle prüfen und passende Optionen laden
|
||||
if self.revpipyversion[0] == 0 and self.revpipyversion[1] < 6:
|
||||
self.tkoptions = \
|
||||
revpilegacy.RevPiOption(win, self.cli)
|
||||
else:
|
||||
self.tkoptions = \
|
||||
revpioption.RevPiOption(win, self.cli)
|
||||
|
||||
self.wait_window(win)
|
||||
if self.tkoptions.dc is not None and self.tkoptions.dorestart:
|
||||
|
||||
# Wenn XML-Modus anders und Dienstneustart
|
||||
if self.xmlmode != self.tkoptions.dc["xmlrpc"]:
|
||||
if self.xmlmode != self.cli.xmlmodus():
|
||||
self.serverdisconnect()
|
||||
self._opt_conn(self.revpiname, True)
|
||||
|
||||
if self.debugframe is not None:
|
||||
self.cli.psstart()
|
||||
|
||||
def plcpictory(self):
|
||||
u"""Öffnet piCtory Konfiguraiton."""
|
||||
webbrowser.open("http://{0}/".format(self.revpiaddress))
|
||||
|
||||
def plcprogram(self):
|
||||
u"""Startet das Programmfenster."""
|
||||
if self.xmlmode < 2:
|
||||
@@ -361,7 +435,10 @@ class RevPiPyControl(tkinter.Frame):
|
||||
self.serverdisconnect()
|
||||
tkmsg.showerror(
|
||||
_("Error"),
|
||||
_("Can not reach server!"),
|
||||
_("Can not connect to RevPi XML-RPC Service! \n\n"
|
||||
"This could have the following reasons: The RevPi is not "
|
||||
"online, the XML-RPC service is not running or the ACL "
|
||||
"permission is not set for your IP!!!"),
|
||||
parent=self.master
|
||||
)
|
||||
|
||||
@@ -374,7 +451,7 @@ class RevPiPyControl(tkinter.Frame):
|
||||
else:
|
||||
try:
|
||||
plcec = self.cli.plcexitcode()
|
||||
except:
|
||||
except Exception:
|
||||
self.errcount += 1
|
||||
if self.errcount >= 5:
|
||||
self.var_status.set("SERVER ERROR")
|
||||
|
||||
6
revpipycontrol/shared/__init__.py
Normal file
6
revpipycontrol/shared/__init__.py
Normal file
@@ -0,0 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Shared modules."""
|
||||
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
188
revpipycontrol/shared/ipaclmanager.py
Normal file
188
revpipycontrol/shared/ipaclmanager.py
Normal file
@@ -0,0 +1,188 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Verwaltet IP Adressen und deren ACLs."""
|
||||
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
|
||||
from os import access, R_OK, W_OK
|
||||
from re import match as rematch
|
||||
|
||||
|
||||
def refullmatch(regex, string):
|
||||
"""re.fullmatch wegen alter python version aus wheezy nachgebaut.
|
||||
|
||||
@param regex RegEx Statement
|
||||
@param string Zeichenfolge gegen die getestet wird
|
||||
@return True, wenn komplett passt sonst False
|
||||
|
||||
"""
|
||||
m = rematch(regex, string)
|
||||
return m is not None and m.end() == len(string)
|
||||
|
||||
|
||||
class IpAclManager():
|
||||
|
||||
"""Verwaltung fuer IP Adressen und deren ACL Level."""
|
||||
|
||||
def __init__(self, minlevel, maxlevel, acl=None):
|
||||
"""Init IpAclManager class.
|
||||
|
||||
@param minlevel Smallest access level (min. 0)
|
||||
@param maxlevel Biggest access level (max. 9)
|
||||
@param acl ACL Liste fuer Berechtigungen als <class 'str'>
|
||||
|
||||
"""
|
||||
if type(minlevel) != int:
|
||||
raise ValueError("parameter minlevel must be <class 'int'>")
|
||||
if type(maxlevel) != int:
|
||||
raise ValueError("parameter maxlevel must be <class 'int'>")
|
||||
if minlevel < 0:
|
||||
raise ValueError("minlevel must be 0 or more")
|
||||
if maxlevel > 9:
|
||||
raise ValueError("maxlevel maximum is 9")
|
||||
if minlevel > maxlevel:
|
||||
raise ValueError("minlevel is smaller than maxlevel")
|
||||
|
||||
self.__dict_acl = {}
|
||||
self.__dict_regex = {}
|
||||
self.__dict_knownips = {}
|
||||
self.__filename = None
|
||||
self.__re_ipacl = "(([\\d\\*]{1,3}\\.){3}[\\d\\*]{1,3},[" \
|
||||
+ str(minlevel) + "-" + str(maxlevel) + "] ?)*"
|
||||
|
||||
# Liste erstellen, wenn übergeben
|
||||
if acl is not None:
|
||||
self.__set_acl(acl)
|
||||
|
||||
def __iter__(self):
|
||||
"""Gibt einzelne ACLs als <class 'tuple'> aus."""
|
||||
for aclip in sorted(self.__dict_acl):
|
||||
yield (aclip, self.__dict_acl[aclip])
|
||||
|
||||
def __get_acl(self):
|
||||
"""Getter fuer den rohen ACL-String.
|
||||
return ACLs als <class 'str'>"""
|
||||
str_acl = ""
|
||||
for aclip in sorted(self.__dict_acl):
|
||||
str_acl += "{0},{1} ".format(aclip, self.__dict_acl[aclip])
|
||||
return str_acl.strip()
|
||||
|
||||
def __get_filename(self):
|
||||
"""Getter fuer Dateinamen.
|
||||
@return Filename der ACL <class 'str'>"""
|
||||
return "" if self.__filename is None else self.__filename
|
||||
|
||||
def __get_regex_acl(self):
|
||||
"""Gibt formatierten RegEx-String zurueck.
|
||||
return RegEx Code als <class 'str'>"""
|
||||
return self.__re_ipacl
|
||||
|
||||
def __set_acl(self, value):
|
||||
"""Uebernimmt neue ACL-Liste fuer die Ausertung der Level.
|
||||
@param value Neue ACL-Liste als <class 'str'>"""
|
||||
if type(value) != str:
|
||||
raise ValueError("parameter acl must be <class 'str'>")
|
||||
|
||||
value = value.strip()
|
||||
if not refullmatch(self.__re_ipacl, value):
|
||||
raise ValueError("acl format ist not okay - 1.2.3.4,0 5.6.7.8,1")
|
||||
|
||||
# Klassenwerte übernehmen
|
||||
self.__dict_acl = {}
|
||||
self.__dict_regex = {}
|
||||
self.__dict_knownips = {}
|
||||
|
||||
# Liste neu füllen mit regex Strings
|
||||
for ip_level in value.split():
|
||||
ip, level = ip_level.split(",", 1)
|
||||
self.__dict_acl[ip] = int(level)
|
||||
self.__dict_regex[ip] = \
|
||||
ip.replace(".", "\\.").replace("*", "\\d{1,3}")
|
||||
|
||||
def get_acllevel(self, ipaddress):
|
||||
"""Prueft IP gegen ACL List und gibt ACL-Wert aus.
|
||||
@param ipaddress zum pruefen
|
||||
@return <class 'int'> ACL Wert oder -1 wenn nicht gefunden"""
|
||||
# Bei bereits aufgelösten IPs direkt ACL auswerten
|
||||
if ipaddress in self.__dict_knownips:
|
||||
return self.__dict_knownips[ipaddress]
|
||||
|
||||
for aclip in sorted(self.__dict_acl, reverse=True):
|
||||
if refullmatch(self.__dict_regex[aclip], ipaddress):
|
||||
# IP und Level merken
|
||||
self.__dict_knownips[ipaddress] = self.__dict_acl[aclip]
|
||||
|
||||
# Level zurückgeben
|
||||
return self.__dict_acl[aclip]
|
||||
|
||||
return -1
|
||||
|
||||
def loadacl(self, str_acl):
|
||||
"""Laed ACL String und gibt erfolg zurueck.
|
||||
@param str_acl ACL als <class 'str'>
|
||||
@return True, wenn erfolgreich uebernommen"""
|
||||
if not refullmatch(self.__re_ipacl, str_acl):
|
||||
return False
|
||||
self.__set_acl(str_acl)
|
||||
return True
|
||||
|
||||
def loadaclfile(self, filename):
|
||||
"""Laed ACL Definitionen aus Datei.
|
||||
@param filename Dateiname fuer Definitionen
|
||||
@return True, wenn Laden erfolgreich war"""
|
||||
if type(filename) != str:
|
||||
raise ValueError("parameter filename must be <class 'str'>")
|
||||
|
||||
# Zugriffsrecht prüfen
|
||||
if not access(filename, R_OK):
|
||||
return False
|
||||
|
||||
str_acl = ""
|
||||
with open(filename, "r") as fh:
|
||||
while True:
|
||||
buff = fh.readline()
|
||||
if buff == "":
|
||||
break
|
||||
buff = buff.split("#")[0].strip()
|
||||
if len(buff) > 0:
|
||||
str_acl += buff + " "
|
||||
|
||||
acl_okay = self.loadacl(str_acl.strip())
|
||||
if acl_okay:
|
||||
# Dateinamen für Schreiben übernehmen
|
||||
self.__filename = filename
|
||||
|
||||
return acl_okay
|
||||
|
||||
def writeaclfile(self, filename=None, aclname=None):
|
||||
"""Schreibt ACL Definitionen in Datei.
|
||||
@param filename Dateiname fuer Definitionen
|
||||
@return True, wenn Schreiben erfolgreich war"""
|
||||
if filename is not None and type(filename) != str:
|
||||
raise ValueError("parameter filename must be <class 'str'>")
|
||||
if aclname is not None and type(aclname) != str:
|
||||
raise ValueError("parameter aclname must be <class 'str'>")
|
||||
|
||||
# Dateinamen prüfen
|
||||
if filename is None and self.__filename is not None:
|
||||
filename = self.__filename
|
||||
|
||||
# Zugriffsrecht prüfen
|
||||
if not access(filename, W_OK):
|
||||
return False
|
||||
|
||||
header = "# {0}Access Control List (acl)\n" \
|
||||
"# One entry per Line IPADRESS,LEVEL\n" \
|
||||
"#\n".format("" if aclname is None else aclname + " ")
|
||||
|
||||
with open(filename, "w") as fh:
|
||||
fh.write(header)
|
||||
for aclip in sorted(self.__dict_acl):
|
||||
fh.write("{0},{1}\n".format(aclip, self.__dict_acl[aclip]))
|
||||
|
||||
return True
|
||||
|
||||
acl = property(__get_acl, __set_acl)
|
||||
filename = property(__get_filename)
|
||||
regex_acl = property(__get_regex_acl)
|
||||
91
setup.py
91
setup.py
@@ -1,11 +1,11 @@
|
||||
#! /usr/bin/env python3
|
||||
#
|
||||
# (c) Sven Sager, License: LGPLv3
|
||||
#
|
||||
# -*- coding: utf-8 -*-
|
||||
"""Setupscript fuer RevPiPyLoad."""
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "LGPLv3"
|
||||
|
||||
import distutils.command.install_egg_info
|
||||
from sys import platform
|
||||
from distutils.core import setup
|
||||
from glob import glob
|
||||
|
||||
|
||||
@@ -18,77 +18,42 @@ class MyEggInfo(distutils.command.install_egg_info.install_egg_info):
|
||||
pass
|
||||
|
||||
|
||||
globsetup = {
|
||||
"author": "Sven Sager",
|
||||
"author_email": "akira@narux.de",
|
||||
"url": "https://revpimodio.org/revpipyplc/",
|
||||
"license": "LGPLv3",
|
||||
"version": "0.4.1",
|
||||
|
||||
"name": "revpipycontrol",
|
||||
|
||||
"description": "PLC Loader für Python-Projekte auf den RevolutionPi",
|
||||
"long_description": ""
|
||||
"Dieses Programm startet beim Systemstart ein angegebenes Python PLC\n"
|
||||
"Programm. Es überwacht das Programm und startet es im Fehlerfall neu.\n"
|
||||
"Bei Abstruz kann das gesamte /dev/piControl0 auf 0x00 gesettz werden.\n"
|
||||
"Außerdem stellt es einen XML-RPC Server bereit, über den die Software\n"
|
||||
"auf den RevPi geladen werden kann. Das Prozessabbild kann über ein Tool\n"
|
||||
"zur Laufzeit überwacht werden.",
|
||||
}
|
||||
|
||||
if platform == "linux":
|
||||
from setuptools import setup
|
||||
setup(
|
||||
maintainer="Sven Sager",
|
||||
maintainer_email="akira@revpimodio.org",
|
||||
setup(
|
||||
version="0.8.1",
|
||||
python_requires="~=3.4",
|
||||
requires=["tkinter", "zeroconf"],
|
||||
|
||||
scripts=["data/revpipycontrol"],
|
||||
|
||||
data_files=[
|
||||
("share/applications", ["data/revpipycontrol.desktop"]),
|
||||
("share/icons/hicolor/32x32/apps", ["data/revpipycontrol.png"]),
|
||||
("share/revpipycontrol", glob("revpipycontrol/*.*")),
|
||||
("share/revpipycontrol/shared", glob("revpipycontrol/shared/*.*")),
|
||||
(
|
||||
"share/revpipycontrol/locale/de/LC_MESSAGES",
|
||||
glob("revpipycontrol/locale/de/LC_MESSAGES/*.mo")
|
||||
),
|
||||
],
|
||||
|
||||
install_requires=["tkinter"],
|
||||
|
||||
# Additional meta-data
|
||||
name="revpipycontrol",
|
||||
author="Sven Sager",
|
||||
author_email="akira@narux.de",
|
||||
maintainer="Sven Sager",
|
||||
maintainer_email="akira@revpimodio.org",
|
||||
url="https://revpimodio.org/revpipyplc/",
|
||||
description="GUI for Revolution Pi to upload programs and do IO-Checks",
|
||||
long_description=""
|
||||
"Dieses Programm startet beim Systemstart ein angegebenes Python PLC\n"
|
||||
"Programm. Es überwacht das Programm und startet es im Fehlerfall neu.\n"
|
||||
"Bei Abstruz kann das gesamte /dev/piControl0 auf 0x00 gesettz werden.\n"
|
||||
"Außerdem stellt es einen XML-RPC Server bereit, über den die Software\n"
|
||||
"auf den RevPi geladen werden kann. Das Prozessabbild kann über ein Tool\n"
|
||||
"zur Laufzeit überwacht werden.",
|
||||
classifiers=[
|
||||
"License :: OSI Approved :: "
|
||||
"GNU Lesser General Public License v3 (LGPLv3)",
|
||||
"License :: OSI Approved :: GNU Lesser General Public License v3 (GPLv3)",
|
||||
"Operating System :: POSIX :: Linux",
|
||||
],
|
||||
license="LGPLv3",
|
||||
cmdclass={"install_egg_info": MyEggInfo},
|
||||
**globsetup
|
||||
)
|
||||
|
||||
elif platform == "win32":
|
||||
import sys
|
||||
from cx_Freeze import setup, Executable
|
||||
|
||||
sys.path.append("revpipycontrol")
|
||||
|
||||
exe = Executable(
|
||||
script="revpipycontrol/revpipycontrol.py",
|
||||
base="Win32GUI",
|
||||
compress=False,
|
||||
copyDependentFiles=True,
|
||||
appendScriptToExe=True,
|
||||
appendScriptToLibrary=False,
|
||||
icon="data/revpipycontrol.ico"
|
||||
)
|
||||
|
||||
setup(
|
||||
options={"build_exe": {
|
||||
"include_files": [
|
||||
"revpipycontrol/revpipycontrol.png",
|
||||
"revpipycontrol/locale"
|
||||
]
|
||||
}},
|
||||
executables=[exe],
|
||||
**globsetup
|
||||
)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user