mirror of
https://github.com/naruxde/revpipycontrol.git
synced 2025-11-08 23:53:52 +01:00
Compare commits
6 Commits
0.7.1
...
procimgser
| Author | SHA1 | Date | |
|---|---|---|---|
| 472605bb38 | |||
| 79ea020903 | |||
| 7b61dee1c6 | |||
| f1163f2e3f | |||
| 5812dba69d | |||
| 7e9afd0944 |
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,5 @@ include stdeb.cfg
|
||||
recursive-include data *
|
||||
recursive-include revpipycontrol *
|
||||
global-exclude *.pyc
|
||||
include LICENSE.txt
|
||||
|
||||
|
||||
@@ -87,6 +87,9 @@ Methods</h3>
|
||||
<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.minint">minint</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>
|
||||
@@ -244,13 +247,29 @@ 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>)
|
||||
<b>maxint</b>(<i>io</i>)
|
||||
<p>
|
||||
Errechnet maximalen int() Wert für Bytes max 22.
|
||||
</p><dl>
|
||||
<dt><i>bytelen</i></dt>
|
||||
<dt><i>io</i></dt>
|
||||
<dd>
|
||||
Anzahl Bytes
|
||||
IO-Liste, deren Wert berechnet werden soll
|
||||
</dd>
|
||||
</dl><dl>
|
||||
<dt>Returns:</dt>
|
||||
<dd>
|
||||
int() max oder 0 bei Überschreitung
|
||||
</dd>
|
||||
</dl><a NAME="RevPiCheckClient.minint" ID="RevPiCheckClient.minint"></a>
|
||||
<h3 style="background-color:#FFFFFF;color:#FF0000">
|
||||
RevPiCheckClient.minint</h3>
|
||||
<b>minint</b>(<i>io</i>)
|
||||
<p>
|
||||
Errechnet maximalen int() Wert für Bytes max 22.
|
||||
</p><dl>
|
||||
<dt><i>io</i></dt>
|
||||
<dd>
|
||||
IO-Liste, deren Wert berechnet werden soll
|
||||
</dd>
|
||||
</dl><dl>
|
||||
<dt>Returns:</dt>
|
||||
|
||||
@@ -53,7 +53,8 @@ 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.maxint?4(io)
|
||||
revpicheckclient.RevPiCheckClient.minint?4(io)
|
||||
revpicheckclient.RevPiCheckClient.readvalues?4()
|
||||
revpicheckclient.RevPiCheckClient.refreshvalues?4()
|
||||
revpicheckclient.RevPiCheckClient.tmr_workvalues?4()
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE Project SYSTEM "Project-5.1.dtd">
|
||||
<!-- eric project file for project revpipycontrol -->
|
||||
<!-- Saved: 2018-10-07, 12:09:56 -->
|
||||
<!-- Copyright (C) 2018 Sven Sager, akira@narux.de -->
|
||||
<!-- Saved: 2019-09-15, 22:15:53 -->
|
||||
<!-- Copyright (C) 2019 Sven Sager, akira@narux.de -->
|
||||
<Project version="5.1">
|
||||
<Language>en_US</Language>
|
||||
<Hash>66103e2eaf8a762f14d1fd51d8b1c9dcaf35a275</Hash>
|
||||
<ProgLanguage mixed="0">Python3</ProgLanguage>
|
||||
<ProjectType>Console</ProjectType>
|
||||
<Version>0.7.1</Version>
|
||||
<Version>0.8.0</Version>
|
||||
<Author>Sven Sager</Author>
|
||||
<Email>akira@narux.de</Email>
|
||||
<Eol index="1"/>
|
||||
|
||||
@@ -14,6 +14,7 @@ from os.path import join as pathjoin
|
||||
from sys import platform
|
||||
|
||||
# Systemwerte und SaveFiles
|
||||
# TODO: Mac einbauen
|
||||
if platform == "linux":
|
||||
homedir = environ["HOME"]
|
||||
else:
|
||||
|
||||
@@ -101,7 +101,7 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
try:
|
||||
newvalue = io[5].get()
|
||||
# Wertebereich prüfen
|
||||
if newvalue < 0 or newvalue > self.maxint(io[1]):
|
||||
if not self.minint(io) <= newvalue <= self.maxint(io):
|
||||
raise ValueError("too big")
|
||||
|
||||
self.__chval(device, io)
|
||||
@@ -168,7 +168,7 @@ 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=1, row=rowcount, sticky="w"
|
||||
@@ -185,7 +185,11 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
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)
|
||||
@@ -198,13 +202,13 @@ 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"
|
||||
self.maxint(io) == 0 else "normal"
|
||||
txt["width"] = 5
|
||||
txt["textvariable"] = var
|
||||
txt.grid(column=0, row=rowcount)
|
||||
|
||||
# Steuerelementvariable in IO übernehmen (mutabel)
|
||||
io.append(var)
|
||||
io.insert(5, var)
|
||||
|
||||
rowcount += 1
|
||||
|
||||
@@ -345,7 +349,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:
|
||||
@@ -358,7 +362,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
|
||||
@@ -384,11 +390,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."""
|
||||
|
||||
@@ -219,10 +219,10 @@ class RevPiOption(tkinter.Frame):
|
||||
# Row 3
|
||||
lst = self.xmlcli.get_filelist()
|
||||
lst.sort()
|
||||
if len(lst) == 0:
|
||||
lst.append("none")
|
||||
if ".placeholder" in lst:
|
||||
lst.remove(".placeholder")
|
||||
if len(lst) == 0:
|
||||
lst.append("none")
|
||||
opt_startpy = tkinter.OptionMenu(
|
||||
prog, self.var_startpy, *lst
|
||||
)
|
||||
|
||||
@@ -5,7 +5,7 @@ u"""RevPiPyControl main program."""
|
||||
__author__ = "Sven Sager"
|
||||
__copyright__ = "Copyright (C) 2018 Sven Sager"
|
||||
__license__ = "GPLv3"
|
||||
__version__ = "0.7.1"
|
||||
__version__ = "0.8.0"
|
||||
|
||||
import revpicheckclient
|
||||
import revpidevelop
|
||||
|
||||
3
setup.py
3
setup.py
@@ -23,7 +23,7 @@ globsetup = {
|
||||
"author_email": "akira@narux.de",
|
||||
"url": "https://revpimodio.org/revpipyplc/",
|
||||
"license": "LGPLv3",
|
||||
"version": "0.7.1",
|
||||
"version": "0.8.0",
|
||||
|
||||
"name": "revpipycontrol",
|
||||
|
||||
@@ -37,6 +37,7 @@ globsetup = {
|
||||
"zur Laufzeit überwacht werden.",
|
||||
}
|
||||
|
||||
# TODO: Mac einbauen
|
||||
if platform == "linux":
|
||||
from setuptools import setup
|
||||
setup(
|
||||
|
||||
Reference in New Issue
Block a user