Skip to content

Commit

Permalink
StatusMessage improved
Browse files Browse the repository at this point in the history
  • Loading branch information
pi committed May 16, 2022
1 parent 7c8bf0c commit a8170a1
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions Sail_Instrument/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def __init__(self,api):
self.oldtime=0
self.polare={}
if not self.Polare('polare.xml'):
raise Exception("polare.xml Error")
raise Exception("polare.xml not found Error")
return
self.saveAllConfig()
self.startSequence = 0
Expand Down Expand Up @@ -172,7 +172,7 @@ def run(self):
if calc_Laylines(self,gpsdata):
self.api.setStatus('NMEA', 'computing Laylines/TSS/VPOL')
else:
self.api.setStatus('ERROR', 'Missing Input (windAngle or windSpeed), cannot compute Laylines')
self.api.setStatus('INACTIVE', 'Missing Input of windAngle and/or windSpeed, cannot compute Laylines')



Expand All @@ -188,11 +188,16 @@ def Polare(self, f_name):
try:
tree = ET.parse(polare_filename)
except:
source=os.path.join(os.path.dirname(__file__), f_name)
dest=os.path.join(self.api.getDataDir(),'user','viewer','polare.xml')
with open(source, 'rb') as src, open(dest, 'wb') as dst: dst.write(src.read())
tree = ET.parse(polare_filename)
try:
source=os.path.join(os.path.dirname(__file__), f_name)
dest=os.path.join(self.api.getDataDir(),'user','viewer','polare.xml')
with open(source, 'rb') as src, open(dest, 'wb') as dst: dst.write(src.read())
tree = ET.parse(polare_filename)
except:
return False
finally:
if not 'tree' in locals():
return False
root = tree.getroot()
x=ET.tostring(root, encoding='utf8').decode('utf8')
e_str='windspeedvector'
Expand Down

0 comments on commit a8170a1

Please sign in to comment.