@@ -518,7 +518,8 @@ def update(self):
518518 ###################
519519 # helper functions
520520 ###################
521-
521+ # return a found string or else None by default, anything else by option
522+ # since this is used in this file there are some workarounds for plasma machines
522523 def get_error_safe_setting (self , heading , detail , default = None ):
523524 result = self .INI .find (heading , detail )
524525 if result :
@@ -531,6 +532,22 @@ def get_error_safe_setting(self, heading, detail, default=None):
531532 log .warning ('INI Parsing Error, No {} Entry in {}, Using: {}' .format (detail , heading , default ))
532533 return default
533534
535+ # return a found float or else None by default, anything else by option
536+ def get_safe_float (self , heading , detail , default = None ):
537+ try :
538+ result = float (self .INI .find (heading , detail ))
539+ return result
540+ except :
541+ return default
542+
543+ # return a found integer or else None by default, anything else by option
544+ def get_safe_int (self , heading , detail , default = None ):
545+ try :
546+ result = int (self .INI .find (heading , detail ))
547+ return result
548+ except :
549+ return default
550+
534551 def convert_machine_to_metric (self , data ):
535552 if self .MACHINE_IS_METRIC :
536553 return data
0 commit comments