mirror of
https://github.com/openplotter/openplotter-maiana.git
synced 2025-05-29 05:20:13 -07:00
new SK connections management
This commit is contained in:
parent
43bba0a5aa
commit
45d95a0a1b
2
debian/control
vendored
2
debian/control
vendored
@ -10,6 +10,6 @@ X-Python3-Version: >= 3.2
|
||||
Package: openplotter-maiana
|
||||
Architecture: all
|
||||
Multi-Arch: foreign
|
||||
Depends: ${misc:Depends}, ${python3:Depends}, openplotter-settings, openplotter-signalk-installer, python3-serial, python3-websocket
|
||||
Depends: ${misc:Depends}, ${python3:Depends}, openplotter-settings, openplotter-signalk-installer, python3-serial
|
||||
Description: OpenPlotter integration of the MAIANA open source AIS transponder
|
||||
OpenPlotter integration of the MAIANA open source AIS transponder
|
||||
|
@ -56,15 +56,6 @@ def main():
|
||||
print(_('DONE'))
|
||||
except Exception as e: print(_('FAILED: ')+str(e))
|
||||
|
||||
print(_('Checking access to Signal K server...'))
|
||||
try:
|
||||
from openplotterSignalkInstaller import connections
|
||||
skConnections = connections.Connections('MAIANA')
|
||||
result = skConnections.checkConnection()
|
||||
if result[1]: print(result[1])
|
||||
else: print(_('DONE'))
|
||||
except Exception as e: print(_('FAILED: ')+str(e))
|
||||
|
||||
print(_('Setting version...'))
|
||||
try:
|
||||
conf2.set('APPS', 'maiana', version)
|
||||
|
@ -20,7 +20,6 @@ import wx.richtext as rt
|
||||
from openplotterSettings import conf
|
||||
from openplotterSettings import language
|
||||
from openplotterSettings import platform
|
||||
from openplotterSignalkInstaller import connections
|
||||
from .version import version
|
||||
|
||||
class MyFrame(wx.Frame):
|
||||
@ -53,11 +52,6 @@ class MyFrame(wx.Frame):
|
||||
toolSettings = self.toolbar1.AddTool(102, _('Settings'), wx.Bitmap(self.currentdir+"/data/settings.png"))
|
||||
self.Bind(wx.EVT_TOOL, self.OnToolSettings, toolSettings)
|
||||
self.toolbar1.AddSeparator()
|
||||
aproveSK = self.toolbar1.AddTool(105, _('Approve'), wx.Bitmap(self.currentdir+"/data/sk.png"))
|
||||
self.Bind(wx.EVT_TOOL, self.onAproveSK, aproveSK)
|
||||
connectionSK = self.toolbar1.AddTool(106, _('Reconnect'), wx.Bitmap(self.currentdir+"/data/sk.png"))
|
||||
self.Bind(wx.EVT_TOOL, self.onConnectionSK, connectionSK)
|
||||
self.toolbar1.AddSeparator()
|
||||
self.connInit = _('MAIANA Signal K connection')
|
||||
self.SKconn = wx.ComboBox(self.toolbar1, 103, self.connInit, choices=[], size=(250,-1), style=wx.CB_DROPDOWN)
|
||||
toolSKconn = self.toolbar1.AddControl(self.SKconn)
|
||||
@ -122,16 +116,6 @@ class MyFrame(wx.Frame):
|
||||
subprocess.call(['pkill', '-f', 'openplotter-settings'])
|
||||
subprocess.Popen('openplotter-settings')
|
||||
|
||||
def onAproveSK(self,e):
|
||||
if self.platform.skPort:
|
||||
url = self.platform.http+'localhost:'+self.platform.skPort+'/admin/#/security/access/requests'
|
||||
webbrowser.open(url, new=2)
|
||||
|
||||
def onConnectionSK(self,e):
|
||||
self.conf.set('MAIANA', 'href', '')
|
||||
self.conf.set('MAIANA', 'token', '')
|
||||
self.onRead()
|
||||
|
||||
def onShowSK(self, event):
|
||||
if self.platform.skPort:
|
||||
url = self.platform.http+'localhost:'+self.platform.skPort+'/admin/#/serverConfiguration/connections/-'
|
||||
@ -155,7 +139,6 @@ class MyFrame(wx.Frame):
|
||||
self.logger.Clear()
|
||||
self.logger2.Clear()
|
||||
self.device = self.conf.get('MAIANA', 'device')
|
||||
self.toolbar1.EnableTool(105,False)
|
||||
self.toolbar2.EnableTool(202,False)
|
||||
self.toolbar3.EnableTool(302,False)
|
||||
self.toolbar3.EnableTool(303,False)
|
||||
@ -166,24 +149,6 @@ class MyFrame(wx.Frame):
|
||||
selected = ''
|
||||
self.tx = False
|
||||
|
||||
skConnections = connections.Connections('MAIANA')
|
||||
result = skConnections.checkConnection()
|
||||
if result[0] == 'pending':
|
||||
self.toolbar1.EnableTool(105,True)
|
||||
self.ShowStatusBarYELLOW(result[1]+_(' Press "Approve" and then "Refresh".'))
|
||||
return
|
||||
elif result[0] == 'error':
|
||||
self.ShowStatusBarRED(result[1]+_(' Try "Reconnect".'))
|
||||
return
|
||||
elif result[0] == 'repeat':
|
||||
self.ShowStatusBarYELLOW(result[1]+_(' Press "Refresh".'))
|
||||
return
|
||||
elif result[0] == 'permissions':
|
||||
self.ShowStatusBarYELLOW(result[1])
|
||||
return
|
||||
elif result[0] == 'approved':
|
||||
self.ShowStatusBarGREEN(result[1])
|
||||
|
||||
try:
|
||||
setting_file = self.platform.skDir+'/settings.json'
|
||||
with open(setting_file) as data_file:
|
||||
|
@ -20,6 +20,7 @@ from openplotterSettings import conf
|
||||
from openplotterSettings import platform
|
||||
from openplotterSettings import language
|
||||
from websocket import create_connection
|
||||
from openplotterSignalkInstaller import connections
|
||||
|
||||
def main():
|
||||
platform2 = platform.Platform()
|
||||
@ -28,7 +29,8 @@ def main():
|
||||
currentLanguage = conf2.get('GENERAL', 'lang')
|
||||
package = 'openplotter-maiana'
|
||||
language.Language(currentdir, package, currentLanguage)
|
||||
token = conf2.get('MAIANA', 'token')
|
||||
skConnections = connections.Connections('MAIANA')
|
||||
token = skConnections.token
|
||||
device = conf2.get('MAIANA', 'device')
|
||||
if conf2.get('GENERAL', 'debug') == 'yes': debug = True
|
||||
else: debug = False
|
||||
|
@ -149,10 +149,10 @@ class Check():
|
||||
#access
|
||||
skConnections = connections.Connections('MAIANA')
|
||||
result = skConnections.checkConnection()
|
||||
if result[0] == 'pending' or result[0] == 'error' or result[0] == 'repeat' or result[0] == 'permissions':
|
||||
if result[0] =='error':
|
||||
if not red: red = result[1]
|
||||
else: red+= '\n '+result[1]
|
||||
if result[0] == 'approved' or result[0] == 'validated':
|
||||
if result[0] =='validated':
|
||||
msg = _('Access to Signal K server validated')
|
||||
if not black: black = msg
|
||||
else: black+= ' | '+msg
|
||||
|
Loading…
x
Reference in New Issue
Block a user