Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def __init__(self):
Quelle='127.0.0.1' # Adresse des eigenen Rechners
Port=55560
self.e_udp_sock = socket.socket( socket.AF_INET, socket.SOCK_DGRAM ) #s.o.
self.e_udp_sock.bind( (Quelle,Port) )
self.e_udp_sock.settimeout(1)
self.ttimer=20
self.conf = Conf()
self.home = self.conf.home
self.currentpath = self.home+self.conf.get('GENERAL', 'op_folder')+'/openplotter'
Language(self.conf)
print self.conf.get('GENERAL','lang')
list_N2K_txt=[]
self.list_N2K=[]
with open(self.currentpath+'/classes/N2K_PGN.csv') as f:
list_N2K_txt = [x.strip('\n\r').split(',') for x in f.readlines()]
for ii in list_N2K_txt:
pgn=int(ii[0])
self.list_N2K.append([pgn,ii[1]])
self.Buffer = [0] * 500
# any later version.
# Openplotter is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Openplotter. If not, see .
import serial
import socket
import sys
from classes.conf import Conf
from classes.SK_settings import SK_settings
conf = Conf()
activ = False
activ = conf.get('N2K', 'output') == '1'
if not activ: sys.exit(0)
SK_settings = SK_settings(conf)
baudrate = SK_settings.ngt1_baudrate
can_device = SK_settings.ngt1_device
if baudrate and can_device:
try:
ser = serial.Serial(can_device, baudrate, timeout=0.5)
except:
print('failed to start N2K output server on '+can_device)
sys.exit(0)
else: sys.exit(0)
# the Free Software Foundation, either version 2 of the License, or
# any later version.
# Openplotter is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Openplotter. If not, see .
import time, socket, threading, datetime, geomag, pynmea2, math
from classes.datastream import DataStream
from classes.conf import Conf
from classes.language import Language
conf=Conf()
Language(conf.get('GENERAL','lang'))
global sock_in
global error
sock_in=''
error=0
a=DataStream(conf)
last_heading=''
heading_time=''
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
accuracy=float(conf.get('CALCULATE', 'cal_accuracy'))
rate=float(conf.get('CALCULATE', 'nmea_rate_cal'))
def onCheckConfB(self,e=0):
self.conf = Conf()
self.SK_settings = SK_settings(self.conf)
self.opencpnSettings = opencpnSettings()
self.logger4.Clear()
serialInst = self.conf.get('UDEV', 'Serialinst')
try: serialInst = eval(serialInst)
except: serialInst = {}
serialalias = ''
assignment = ''
device = ''
for alias in serialInst:
if serialInst[alias]['device'] == '/dev/moitessier.tty' and serialInst[alias]['data'] == 'NMEA 0183':
serialalias = alias
assignment = serialInst[alias]['assignment']
device = self.SK_settings.check_device(alias)
def __init__(self):
self.conf = Conf()
self.home = self.conf.home
self.op_folder = self.conf.op_folder
Language(self.conf)
title = _('Moitessier HAT Setup')
wx.Frame.__init__(self, None, title=title, size=(710,460))
self.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.icon = wx.Icon(op_folder+'/static/icons/moitessier_hat.ico', wx.BITMAP_TYPE_ICO)
self.SetIcon(self.icon)
self.help_bmp = wx.Bitmap(self.op_folder + "/static/icons/help-browser.png", wx.BITMAP_TYPE_ANY)
self.p = wx.lib.scrolledpanel.ScrolledPanel(self, -1, style=wx.TAB_TRAVERSAL | wx.SUNKEN_BORDER)
# any later version.
# Openplotter is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Openplotter. If not, see .
import matplotlib.pyplot as plt
import sys
from classes.conf import Conf
from classes.language import Language
edit = sys.argv[1]
conf = Conf()
Language(conf)
data = conf.get('SPI', 'value_' + str(edit))
listsave = []
try:
temp_list = eval(data)
except:
temp_list = []
for ii in temp_list:
listsave.append(ii)
plt.plot(*zip(*listsave))
plt.suptitle(
_('settings to convert raw adc values (unlinear and/or no factor and/or no offset)\n to useable values for input ').decode('utf8') + str(
edit), fontsize=12)
plt.xlabel(_('row adc value'), fontsize=12)
plt.ylabel(_('value in unit'), fontsize=12)
plt.show()
def __init__(self):
self.list_SK = []
self.data_SK_unit_private = []
self.SK_unit = ''
self.SK_description = ''
self.conf = Conf()
self.home = self.conf.home
self.currentpath = self.home+self.conf.get('GENERAL', 'op_folder')+'/openplotter'
Language(self.conf)
logging.basicConfig()
self.buffer = []
self.sortCol = 0
wx.Frame.__init__(self, None, title='diagnostic SignalK input', size=(650, 435))
self.Bind(wx.EVT_CLOSE, self.OnClose)
panel = wx.Panel(self, wx.ID_ANY)
self.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.icon = wx.Icon(self.currentpath + '/openplotter.ico', wx.BITMAP_TYPE_ICO)
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Openplotter. If not, see .
import sys, subprocess, wx
from classes.conf import Conf
from classes.language import Language
action=sys.argv[1]
#see actions.py
start_all_actions='ACT19'
conf = Conf()
currentpath = conf.home+conf.get('GENERAL', 'op_folder')+'/openplotter'
Language(conf)
triggers=[]
data=conf.get('ACTIONS', 'triggers')
try:
triggers=eval(data)
except:triggers=[]
#stop all
if action=='0':
i=0
for ii in triggers:
templist=ii[4]
start=0
def __init__(self, oldkey, selectvessels):
wx.Dialog.__init__(self, None, title=_('Select Signal K key'), size=(710, 460))
self.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
panel = wx.Panel(self)
panel.SetBackgroundColour(wx.Colour(230,230,230,255))
conf = Conf()
sk_folder = conf.get('GENERAL', 'sk_folder')
data = ""
try:
with open(sk_folder+'/node_modules/@signalk/signalk-schema/dist/keyswithmetadata.json') as data_file:
data = ujson.load(data_file)
except: self.ShowMessage(_('Error. File not found: ')+'keyswithmetadata.json')
SK_ = SK_settings(conf)
self.port = SK_.aktport
self.http = SK_.http
self.list_vessels = ['self']
skvesselslabel = wx.StaticText(panel, label=_('Vessel'))
self.skvessels = wx.ComboBox(panel, choices=self.list_vessels)
self.refreshBtn = wx.Button(panel, label=_('Refresh'))
self.refreshBtn.Bind(wx.EVT_BUTTON, self.OnRefreshBtn)
def __init__(self):
logging.basicConfig()
paths=Paths()
self.currentpath=paths.currentpath
#self.Check127488_pos=100
#self.Check127489_pos=100
#self.Check127505_pos=100
#self.Check130316_pos=100
self.conf=Conf()
self.N2K=N2K_send()
self.tick=0
self.list_SK=[]
Language(self.conf.get('GENERAL','lang'))
wx.Frame.__init__(self, None, title="N2K-from-SK", size=(650,435))
self.Bind(wx.EVT_CLOSE, self.OnClose)
self.ttimer=100
self.timer = wx.Timer(self)
self.Bind(wx.EVT_TIMER, self.timer_act, self.timer)
self.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL))
self.icon = wx.Icon(self.currentpath+'/openplotter.ico', wx.BITMAP_TYPE_ICO)