Skip to content

Commit 4b57926

Browse files
committed
qtvcp -add optional quiet INI error safe inquery.
calculator does a safe error INI inquery, but it set a warning if data was missing. In some cases warning is a bit much. Should the log level be settable?
1 parent 25f523b commit 4b57926

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

lib/python/qtvcp/qt_istat.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -659,15 +659,15 @@ def update(self):
659659
###################
660660
# return a found string or else None by default, anything else by option
661661
# since this is used in this file there are some workarounds for plasma machines
662-
def get_error_safe_setting(self, heading, detail, default=None):
662+
def get_error_safe_setting(self, heading, detail, default=None, warning = True):
663663
result = self.INI.find(heading, detail)
664664
if result:
665665
return result
666666
else:
667667
if ('SPINDLE' in detail and self.MACHINE_IS_QTPLASMAC) or \
668668
('ANGULAR' in detail and not self.HAS_ANGULAR_JOINT):
669669
return default
670-
else:
670+
elif warning:
671671
log.warning('INI Parsing Error, No {} Entry in {}, Using: {}'.format(detail, heading, default))
672672
return default
673673

lib/python/qtvcp/widgets/calculator.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ def __init__(self, parent=None):
110110
mainLayout.addWidget(self.tpi_btn, 6, 2)
111111

112112
self.constButtons = []
113-
constValues = INFO.get_error_safe_setting('DISPLAY', 'CALCULATOR_CONST_VALUES', None)
113+
constValues = INFO.get_error_safe_setting('DISPLAY', 'CALCULATOR_CONST_VALUES', None, warning=False)
114114
if constValues is not None:
115115
constValues = ''.join(constValues.split())
116116
for value in constValues.split(',')[:6]:
@@ -157,7 +157,7 @@ def __init__(self, parent=None):
157157
STATUS.connect('all-homed', lambda w: self.axisButton.setEnabled(True))
158158
STATUS.connect('not-all-homed', lambda w, data: self.axisButton.setEnabled(False))
159159

160-
self.behaviorOnShow = INFO.get_error_safe_setting('DISPLAY', 'CALCULATOR_ON_SHOW', None)
160+
self.behaviorOnShow = INFO.get_error_safe_setting('DISPLAY', 'CALCULATOR_ON_SHOW', None, warning=None)
161161

162162
def showEvent(self, event):
163163
if self.behaviorOnShow is not None:

0 commit comments

Comments
 (0)