mirror of
https://github.com/naruxde/revpipycontrol.git
synced 2025-11-08 15:43:52 +01:00
Maximale Bytel?nge f?r int() berechnung festgelegt 32Bit Systeme
This commit is contained in:
@@ -82,6 +82,9 @@ Methods</h3>
|
||||
<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>
|
||||
@@ -236,7 +239,23 @@ RevPiCheckClient.hideallwindows</h3>
|
||||
<b>hideallwindows</b>(<i></i>)
|
||||
<p>
|
||||
Versteckt alle Fenster.
|
||||
</p><a NAME="RevPiCheckClient.readvalues" ID="RevPiCheckClient.readvalues"></a>
|
||||
</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>)
|
||||
|
||||
@@ -11,6 +11,7 @@ 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()
|
||||
|
||||
@@ -96,7 +96,7 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
try:
|
||||
newvalue = io[5].get()
|
||||
# Wertebereich prüfen
|
||||
if newvalue < 0 or newvalue > 256 ** io[1] - 1:
|
||||
if newvalue < 0 or newvalue > self.maxint(io[1]):
|
||||
raise ValueError("too big")
|
||||
|
||||
self.__chval(device, io)
|
||||
@@ -177,7 +177,7 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
check.grid(column=1, row=rowcount)
|
||||
else:
|
||||
var = tkinter.IntVar()
|
||||
txt = tkinter.Spinbox(s_frame, to=256 ** io[1] - 1)
|
||||
txt = tkinter.Spinbox(s_frame, to=self.maxint(io[1]))
|
||||
txt.bind(
|
||||
"<Key>",
|
||||
lambda event, tkvar=var: self.__saveoldvalue(event, tkvar)
|
||||
@@ -189,7 +189,8 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
)
|
||||
txt["command"] = \
|
||||
lambda device=device, io=io: self.__chval(device, io)
|
||||
txt["state"] = "disabled" if iotype == "inp" else "normal"
|
||||
txt["state"] = "disabled" if iotype == "inp" or \
|
||||
self.maxint(io[1]) == 0 else "normal"
|
||||
txt["width"] = 5
|
||||
txt["textvariable"] = var
|
||||
txt.grid(column=1, row=rowcount)
|
||||
@@ -363,6 +364,12 @@ class RevPiCheckClient(tkinter.Frame):
|
||||
for win in self.dict_wins:
|
||||
self.dict_wins[win].withdraw()
|
||||
|
||||
def maxint(self, bytelen):
|
||||
u"""Errechnet maximalen int() Wert für Bytes max 22.
|
||||
@param bytelen Anzahl Bytes
|
||||
@return int() max oder 0 bei Überschreitung"""
|
||||
return 0 if bytelen > 22 else 256 ** bytelen - 1
|
||||
|
||||
def readvalues(self):
|
||||
u"""Ruft nur Input Werte von RevPi ab und aktualisiert Fenster."""
|
||||
if not self.autorw.get():
|
||||
|
||||
Reference in New Issue
Block a user