-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update to accommodate changes in 1.7.6 firmware
- Loading branch information
1 parent
98d74df
commit a785599
Showing
7 changed files
with
80 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
from PyQt5.QtWidgets import QDoubleSpinBox | ||
|
||
|
||
class NumberSpinBox(QDoubleSpinBox): | ||
def __init__(self, *args): | ||
QDoubleSpinBox.__init__(self, *args) | ||
self.float_min = None | ||
self.float_max = None | ||
|
||
def setFloatRange(self, fmin, fmax): | ||
self.setFloatMin(fmin) | ||
self.setFloatMax(fmax) | ||
|
||
def setFloatMin(self, fmin): | ||
self.float_min = fmin | ||
|
||
def setFloatMax(self, fmax): | ||
self.float_max = fmax | ||
|
||
def validate(self, value, pos): | ||
r = super().validate(value, pos) | ||
v = r[1] | ||
try: | ||
v = float(v) | ||
if v > self.maximum(): | ||
self.setValue(self.maximum()) | ||
if v < self.minimum(): | ||
self.setValue(self.minimum()) | ||
if self.float_max and v > self.float_max: | ||
v = int(v) | ||
elif self.float_min and v < self.float_min: | ||
v = int(v) | ||
v = f"{v}" | ||
except: | ||
pass | ||
return (r[0], v, r[2]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters