def main(): conf2 = conf.Conf() currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') language.Language(currentdir, 'openplotter-dashboards', currentLanguage) try: platform2 = platform.Platform() subprocess.call(['apt', 'install', '-y', 'grafana']) subprocess.call(['systemctl', 'stop', 'grafana-server']) subprocess.call([ 'sed', '-i', 's/http_port = 3000/http_port = 3001/g', '/usr/share/grafana/conf/defaults.ini' ]) subprocess.call([ 'sed', '-i', 's/;http_port = 3000/http_port = 3001/g', '/etc/grafana/grafana.ini' ]) subprocess.call(['systemctl', 'enable', 'grafana-server.service']) subprocess.call(['systemctl', 'start', 'grafana-server']) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e))
def main(): conf2 = conf.Conf() currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') language.Language(currentdir,'openplotter-dashboards',currentLanguage) try: platform2 = platform.Platform() subprocess.call(['systemctl', 'disable', 'kapacitor.service']) subprocess.call(['systemctl', 'stop', 'kapacitor']) subprocess.call(['systemctl', 'disable', 'influxdb.service']) subprocess.call(['systemctl', 'stop', 'influxdb']) subprocess.call(['systemctl', 'disable', 'chronograf.service']) subprocess.call(['systemctl', 'stop', 'chronograf']) subprocess.call(['apt', 'autoremove', '-y', 'influxdb', 'kapacitor', 'chronograf']) subprocess.call(['npm', 'uninstall', '--verbose', 'signalk-to-influxdb', '--save'], cwd = platform2.skDir) subprocess.call(['systemctl', 'stop', 'signalk.service']) subprocess.call(['systemctl', 'stop', 'signalk.socket']) subprocess.call(['systemctl', 'start', 'signalk.socket']) subprocess.call(['systemctl', 'start', 'signalk.service']) print(_('DONE')) except Exception as e: print(_('FAILED: ')+str(e))
def connect(self): self.platform = platform.Platform() uri = self.platform.ws+'localhost:'+self.platform.skPort+'/signalk/v1/stream?subscribe=none' token = self.conf.get('GPIO', 'token') if token: headers = {'Authorization': 'Bearer '+token} self.ws = create_connection(uri, header=headers, sslopt={"cert_reqs": ssl.CERT_NONE})
def main(): conf2 = conf.Conf() currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') language.Language(currentdir, 'openplotter-sdr-ais', currentLanguage) platform2 = platform.Platform() try: print(_('Adding rtl_ais service...')) subprocess.call((' systemctl stop openplotter-rtl_ais').split()) subprocess.call((' systemctl disable openplotter-rtl_ais').split()) subprocess.call((' systemctl daemon-reload').split()) subprocess.call( (platform2.admin + ' rm /etc/systemd/system/openplotter-rtl_ais.service').split()) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e)) try: print(_('remove rtl_ais...')) subprocess.call((' rm /usr/local/bin/rtl_ais').split()) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e))
def __init__(self, conf, currentLanguage): self.conf = conf currentdir = os.path.dirname(os.path.abspath(__file__)) language.Language(currentdir, 'openplotter-dashboards', currentLanguage) self.platform = platform.Platform() self.connections = []
def check(self): platform2 = platform.Platform() green = '' black = '' red = '' data = self.conf.get('I2C', 'sensors') try: i2c_sensors = eval(data) except: i2c_sensors = {} try: out = subprocess.check_output('ls /dev/i2c*', shell=True).decode( sys.stdin.encoding) if '/dev/i2c-0' in out: red = _('Your Raspberry Pi is too old.') if '/dev/i2c-1' in out: black = _('I2C enabled') except: if i2c_sensors: red = _( 'Please enable I2C interface in Preferences -> Raspberry Pi configuration -> Interfaces.' ) else: black = _( 'Please enable I2C interface in Preferences -> Raspberry Pi configuration -> Interfaces.' ) try: subprocess.check_output( ['systemctl', 'is-active', 'openplotter-i2c-read.service']).decode(sys.stdin.encoding) green = _('running') except: black += _(' | not running') try: setting_file = platform2.skDir + '/settings.json' with open(setting_file) as data_file: skdata = ujson.load(data_file) except: skdata = {} for i in i2c_sensors: exists = False if 'pipedProviders' in skdata: for ii in skdata['pipedProviders']: if ii['pipeElements'][0]['options']['type'] == 'SignalK': if ii['pipeElements'][0]['options']['subOptions'][ 'type'] == 'udp': if ii['pipeElements'][0]['options']['subOptions'][ 'port'] == str(i2c_sensors[i]['port']): exists = True if not exists: if not red: red = _('There is no Signal K connection for sensor: ') + i else: red += '\n' + _( 'There is no Signal K connection for sensor: ') + i return {'green': green, 'black': black, 'red': red}
def check(self): platform2 = platform.Platform() green = '' black = '' red = '' try: setting_file = platform2.skDir + '/settings.json' with open(setting_file) as data_file: data = ujson.load(data_file) except: data = {} for i in self.canList: exists = False if 'pipedProviders' in data: for ii in data['pipedProviders']: if ii['pipeElements'][0]['options']['subOptions'][ 'type'] == 'canbus-canboatjs': if i == ii['pipeElements'][0]['options']['subOptions'][ 'interface']: exists = True if not exists: if not red: red = _( 'There is no Signal K connection for interface: ') + i else: red += '\n' + _( 'There is no Signal K connection for interface: ') + i else: if not green: green = i else: green += ' | ' + i return {'green': green, 'black': black, 'red': red}
def __init__(self): import pyric.pyw as pyw self.conf = conf.Conf() self.conf_folder = self.conf.conf_folder self.platform = platform.Platform() self.currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = self.conf.get('GENERAL', 'lang') self.language = language.Language(self.currentdir,'openplotter-network',currentLanguage) wx.Frame.__init__(self, None, title=_('Network')+' '+version, size=(800,444)) self.SetFont(wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) icon = wx.Icon(self.currentdir+"/data/openplotter-network.png", wx.BITMAP_TYPE_PNG) self.SetIcon(icon) self.CreateStatusBar() font_statusBar = self.GetStatusBar().GetFont() font_statusBar.SetWeight(wx.BOLD) self.GetStatusBar().SetFont(font_statusBar) self.toolbar1 = wx.ToolBar(self, style=wx.TB_TEXT) toolHelp = self.toolbar1.AddTool(101, _('Help'), wx.Bitmap(self.currentdir+"/data/help.png")) self.Bind(wx.EVT_TOOL, self.OnToolHelp, toolHelp) if not self.platform.isInstalled('openplotter-doc'): self.toolbar1.EnableTool(101,False) toolSettings = self.toolbar1.AddTool(102, _('Settings'), wx.Bitmap(self.currentdir+"/data/settings.png")) self.Bind(wx.EVT_TOOL, self.OnToolSettings, toolSettings) self.toolbar1.AddSeparator() toolAddresses = self.toolbar1.AddTool(103, _('Addresses and Ports'), wx.Bitmap(self.currentdir+"/data/ports.png")) self.Bind(wx.EVT_TOOL, self.OnToolAddresses, toolAddresses) toolCheck = self.toolbar1.AddTool(104, _('Check Network'), wx.Bitmap(self.currentdir+"/data/check.png")) self.Bind(wx.EVT_TOOL, self.OnToolCheck, toolCheck) self.toolbar1.AddSeparator() toolDrivers = self.toolbar1.AddTool(105, _('Install Wifi Drivers'), wx.Bitmap(self.currentdir+"/data/package.png"), shortHelp=_('This does only help for unrecognized usb wlan type:') + ' 8188eu,8188fu,8192eu,8192su,8812au,8822bu,mt7610,mt7612') self.Bind(wx.EVT_TOOL, self.OnToolDrivers, toolDrivers) self.notebook = wx.Notebook(self) self.notebook.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED, self.onTabChange) self.ap = wx.Panel(self.notebook) self.output = wx.Panel(self.notebook) self.notebook.AddPage(self.ap, _('Access Point')) self.notebook.AddPage(self.output, '') self.il = wx.ImageList(24, 24) img0 = self.il.Add(wx.Bitmap(self.currentdir+"/data/ap.png", wx.BITMAP_TYPE_PNG)) img1 = self.il.Add(wx.Bitmap(self.currentdir+"/data/output.png", wx.BITMAP_TYPE_PNG)) self.notebook.AssignImageList(self.il) self.notebook.SetPageImage(0, img0) self.notebook.SetPageImage(1, img1) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(self.toolbar1, 0, wx.EXPAND) vbox.Add(self.notebook, 1, wx.EXPAND) self.SetSizer(vbox) self.pageAp() self.pageOutput() self.read_wifi_conf() maxi = self.conf.get('GENERAL', 'maximize') if maxi == '1': self.Maximize() self.Centre()
def main(): conf2 = conf.Conf() currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') language.Language(currentdir,'openplotter-sdr-vhf',currentLanguage) platform2 = platform.Platform() try: print(_('Uninstalling pavucontrol...')) subprocess.call((platform2.admin+' apt autoremove -y pavucontrol').split()) print(_('DONE')) except Exception as e: print(_('FAILED: ')+str(e)) if platform2.isRPI: try: print(_('Delete Raspberry pi settings for pulseaudio stereo...')) if not os.path.isdir(conf2.home+'/.config/pulse'): subprocess.call(('mkdir ' + conf2.home+'/.config/pulse').split()) file = conf2.home+'/.config/pulse/default.pa' if os.path.isfile(file): subprocess.call(('rm ' + conf2.home + '/.config/pulse/default.pa').split()) print(_('DONE')) except Exception as e: print(_('FAILED: ')+str(e))
def main(): conf2 = conf.Conf() currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') language.Language(currentdir, 'openplotter-SKfilter', currentLanguage) platform2 = platform.Platform() try: print(_('Installing/Updating Node-Red (Signal K embedded)...')) if platform2.skDir: subprocess.call( ['npm', 'i', '--verbose', '@signalk/signalk-node-red'], cwd=platform2.skDir) subprocess.call(['chown', '-R', conf2.user, platform2.skDir]) subprocess.call(['systemctl', 'stop', 'signalk.service']) subprocess.call(['systemctl', 'stop', 'signalk.socket']) subprocess.call(['systemctl', 'start', 'signalk.socket']) subprocess.call(['systemctl', 'start', 'signalk.service']) else: print(_('Failed. Please, install Signal K server.')) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e)) print(_('Setting version...')) try: conf2.set('APPS', 'SKfilter', version) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e))
def __init__(self, conf, currentLanguage): self.conf = conf self.platform = platform.Platform() currentdir = os.path.dirname(os.path.abspath(__file__)) language.Language(currentdir, 'openplotter-opencpn-installer', currentLanguage) self.connections = []
def main(): conf2 = conf.Conf() platform2 = platform.Platform() currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') package = 'openplotter-sdr-vhf' language.Language(currentdir, package, currentLanguage) print(_('Installing python packages...')) try: subprocess.call(['pip3', 'install', 'pyrtlsdr']) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e)) print(_('Copying udev rules...')) try: subprocess.call([ 'cp', '-f', currentdir + '/data/rtl-sdr.rules', '/etc/udev/rules.d/' ]) subprocess.call(['udevadm', 'control', '--reload-rules']) subprocess.call(['udevadm', 'trigger']) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e)) print(_('Setting version...')) try: conf2.set('APPS', 'sdr_vhf', version) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e))
def __init__(self, process): self.conf = conf.Conf() self.process = process self.platform = platform.Platform() self.currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = self.conf.get('GENERAL', 'lang') self.language = language.Language(self.currentdir,'openplotter-dashboards',currentLanguage) wx.Dialog.__init__(self, None, title=_('Process management for') + ' ' + process, size=(450,320)) pnl = wx.Panel(self) pnl.SetBackgroundColour(wx.Colour(230,230,230,255)) icon = wx.Icon(self.currentdir+"/data/openplotter-dashboards.png", wx.BITMAP_TYPE_PNG) self.SetIcon(icon) self.lblList = [_('Enable'),_('Disable')] self.systemdbox = wx.RadioBox(pnl, label = 'Autostart', choices = self.lblList, majorDimension = 1, style = wx.RA_SPECIFY_ROWS) self.systemdbox.Bind(wx.EVT_RADIOBOX,self.onSystemdBox) sbox0 = wx.BoxSizer(wx.VERTICAL) sbox0.Add(self.systemdbox, 0, wx.ALL, 5) #sbox0.Add(self.skbox, 0, wx.ALL, 5) sbox = wx.StaticBox(pnl, -1, _('Status')) self.aStatusList = [_('active'),_('inactive')] self.aStatusbox = wx.RadioBox(pnl, label = _('ActiveState'), choices = self.aStatusList, majorDimension = 1, style = wx.RA_SPECIFY_ROWS) self.aStatusbox.Enable(False) self.bStatusList = [_('running'),_('dead')] self.bStatusbox = wx.RadioBox(pnl, label = _('Substate'), choices = self.bStatusList, majorDimension = 1, style = wx.RA_SPECIFY_ROWS) self.bStatusbox.Enable(False) sbox1 = wx.StaticBoxSizer(sbox, wx.VERTICAL) sbox1.Add(self.aStatusbox, 0, wx.ALL, 5) sbox1.Add(self.bStatusbox, 0, wx.ALL, 5) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(sbox0, 1, wx.ALL, 5) hbox.AddStretchSpacer(1) hbox.Add(sbox1, 1, wx.ALL, 5) self.start = wx.Button(pnl, label=_('Start')) self.start.Bind(wx.EVT_BUTTON, self.onStart) self.stop = wx.Button(pnl, label=_('Stop')) self.stop.Bind(wx.EVT_BUTTON, self.onStop) self.restart = wx.Button(pnl, label=_('Restart')) self.restart.Bind(wx.EVT_BUTTON, self.onRestart) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(hbox, 0, wx.ALL, 0) vbox.AddStretchSpacer(1) vbox.Add(self.start, 0, wx.LEFT | wx.BOTTOM, 5) vbox.Add(self.stop, 0, wx.ALL, 5) vbox.Add(self.restart, 0, wx.ALL, 5) pnl.SetSizer(vbox) self.statusUpdate() self.Centre() self.Show(True)
def __init__(self,conf,currentLanguage): self.conf = conf currentdir = os.path.dirname(os.path.abspath(__file__)) language.Language(currentdir,'openplotter-signalk-installer',currentLanguage) self.platform2 = platform.Platform() self.connections = [] self.connections.append({'id':'skConn1', 'description':_('Signal K - Admin'), 'data':[], 'type':'TCP', 'mode':'server', 'address':'localhost', 'port':self.platform2.skPort, 'editable':'0'}) self.connections.append({'id':'skConn2', 'description':_('Signal K - NMEA 0183 output'), 'data':[], 'type':'TCP', 'mode':'server', 'address':'localhost', 'port':'10110', 'editable':'0'})
def __init__(self, conf, currentLanguage): self.conf = conf self.platform = platform.Platform() currentdir = os.path.dirname(os.path.abspath(__file__)) language.Language(currentdir,'openplotter-opencpn-installer',currentLanguage) self.initialMessage = '' if self.platform.isInstalled('opencpn'): self.initialMessage = _('Checking OpenCPN...')
def __init__(self): self.platform = platform.Platform() self.setting_file = self.platform.skDir + '/settings.json' self.data = '' try: with open(self.setting_file) as data_file: self.data = ujson.load(data_file) except: self.data = ''
def __init__(self, conf, currentLanguage): self.conf = conf self.platform = platform.Platform() currentdir = os.path.dirname(os.path.abspath(__file__)) language.Language(currentdir,'openplotter-opencpn-installer',currentLanguage) self.initialMessage = '' if self.platform.isInstalled('opencpn'): subprocess.call(['pkill', '-15', 'opencpn']) if self.conf.get('OPENCPN', 'autostart') == '1': self.initialMessage = _('Starting OpenCPN...')
def __init__(self, conf, currentLanguage): self.conf = conf currentdir = os.path.dirname(os.path.abspath(__file__)) language.Language(currentdir,'openplotter-dashboards',currentLanguage) self.platform = platform.Platform() self.nodeRed = self.platform.isSKpluginInstalled('node-red-dashboard') self.influx = self.platform.isSKpluginInstalled('signalk-to-influxdb') if self.nodeRed or self.influx: self.initialMessage = _('Checking Dashboards...') else: self.initialMessage = ''
def main(): try: platform2 = platform.Platform() if not platform2.postInstall(version,'network'): subprocess.Popen(['openplotterPostInstall', platform2.admin+' networkPostInstall']) return except: pass app = wx.App() MyFrame().Show() time.sleep(1) app.MainLoop()
def refreshSettings(self): self.platform = platform.Platform() self.notebook.ChangeSelection(0) if self.platform.skPort: self.port.SetValue(int(self.platform.skPort)) if self.platform.http == 'https://': self.ssl.SetValue(True) self.port.Disable() else: self.ssl.SetValue(False) self.port.Enable() self.toolbar1.EnableTool(105, False) self.toolbar1.EnableTool(106, False)
def main(): conf2 = conf.Conf() currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') language.Language(currentdir, 'openplotter-dashboards', currentLanguage) try: platform2 = platform.Platform() subprocess.call(['systemctl', 'disable', 'kapacitor.service']) subprocess.call(['systemctl', 'stop', 'kapacitor']) subprocess.call(['apt', '-y', 'autoremove', 'kapacitor', 'chronograf']) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e))
def main(): conf2 = conf.Conf() currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') language.Language(currentdir, 'openplotter-sdr-ais', currentLanguage) platform2 = platform.Platform() try: print(_('Install rtl_ais...')) subprocess.call((' install -m 0755 ' + currentdir + '/data/aisdecoder /usr/local/bin/').split()) subprocess.call( (' chmod 755 ' + currentdir + '/data/aisdecoder.sh').split()) #subprocess.call((' cp ' + currentdir + '/data/aisdecoder /usr/local/bin').split()) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e)) print(_('Adding rtl_ais service...')) try: fo = open('/etc/systemd/system/openplotter-aisdecoder.service', "w") fo.write( '[Unit]\n' + 'Description = Decode AIS received by rtl-sdr and send as NMEA 0183 to TCP/UDP port\n' + 'After=syslog.target network.target audit.service\n' + '[Service]\n' + 'Type=simple\n' + 'User=root\n' + 'EnvironmentFile=' + conf2.home + '/.openplotter/rtl_ais.conf\n' + 'ExecStart=' + currentdir + '/data/aisdecoder.sh $PPM\n' + 'ExecStopPost=/usr/bin/killall rtl_fm\n' + 'Restart=on-failure\n' + 'RestartSec=10\n' + 'KillMode=process\n\n' + '[Install]\n' + 'WantedBy=multi-user.target\n') fo.close() file = conf2.home + '/.openplotter/rtl_ais.conf' if not os.path.isfile(file): fo = open(file, "w") fo.write('PPM=0\n') fo.close() os.chmod(file, 0o0777) subprocess.call((' systemctl daemon-reload').split()) #subprocess.call((' systemctl enable openplotter-aisdecoder').split()) subprocess.call((' systemctl restart openplotter-aisdecoder').split()) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e))
def __init__(self): self.conf = conf.Conf() self.platform = platform.Platform() self.currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = self.conf.get('GENERAL', 'lang') self.language = language.Language(self.currentdir, 'openplotter-sdr-ais', currentLanguage) wx.Frame.__init__(self, None, title=_('Set Rtl-Sdr PPM'), size=(400, 140)) self.SetFont( wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) icon = wx.Icon(self.currentdir + "/data/openplotter-sdr-ais.png", wx.BITMAP_TYPE_PNG) self.SetIcon(icon) panel = wx.Panel(self) self.t_value = wx.StaticText( panel, label=_('(rtl-sdr frequency correction) PPM')) self.value = wx.TextCtrl(panel, size=(120, 30)) self.buttonCancel = wx.Button(panel, label=_('Cancel')) self.buttonCancel.Bind(wx.EVT_BUTTON, self.onButtonCancel) self.buttonOk = wx.Button(panel, label=_('OK')) self.buttonOk.Bind(wx.EVT_BUTTON, self.onButtonOk) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.buttonCancel, 0, wx.ALL, 10) hbox.Add(self.buttonOk, 0, wx.ALL, 10) vbox = wx.BoxSizer(wx.VERTICAL) vbox.AddSpacer(5) vbox.Add(self.t_value, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 10) vbox.Add(self.value, 0, wx.RIGHT | wx.LEFT | wx.EXPAND, 10) vbox.AddSpacer(20) #vbox.Add(self.buttonCancel, 1, wx.ALL, 5) #vbox.Add(self.buttonOk, 1, wx.ALL, 5) vbox.Add(hbox, 0, wx.ALIGN_RIGHT | wx.RIGHT, 0) panel.SetSizer(vbox) self.read()
def main(): conf2 = conf.Conf() currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') language.Language(currentdir, 'openplotter-dashboards', currentLanguage) try: platform2 = platform.Platform() subprocess.call([ 'apt', '-y', 'install', 'grafana', 'influxdb', 'kapacitor', 'chronograf' ]) subprocess.call(['npm', 'i', '--verbose', 'signalk-to-influxdb'], cwd=platform2.skDir) subprocess.call(['chown', '-R', conf2.user, platform2.skDir]) subprocess.call(['systemctl', 'stop', 'influxdb']) subprocess.call(['systemctl', 'stop', 'kapacitor']) subprocess.call(['systemctl', 'stop', 'grafana-server']) subprocess.call([ 'sed', '-i', 's/http_port = 3000/http_port = 3001/g', '/usr/share/grafana/conf/defaults.ini' ]) subprocess.call([ 'sed', '-i', 's/;http_port = 3000/http_port = 3001/g', '/etc/grafana/grafana.ini' ]) subprocess.call(['systemctl', 'unmask', 'influxdb.service']) subprocess.call(['systemctl', 'enable', 'influxdb.service']) subprocess.call(['systemctl', 'start', 'influxdb']) subprocess.call(['systemctl', 'enable', 'kapacitor.service']) subprocess.call(['systemctl', 'start', 'kapacitor']) subprocess.call(['systemctl', 'enable', 'grafana-server.service']) subprocess.call(['systemctl', 'start', 'grafana-server']) subprocess.call(['systemctl', 'stop', 'signalk.service']) subprocess.call(['systemctl', 'stop', 'signalk.socket']) subprocess.call(['systemctl', 'start', 'signalk.socket']) subprocess.call(['systemctl', 'start', 'signalk.service']) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e))
def main(): conf2 = conf.Conf() currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') language.Language(currentdir,'openplotter-dashboards',currentLanguage) try: platform2 = platform.Platform() subprocess.call(['npm', 'i', '--verbose', '@mxtommy/kip'], cwd = platform2.skDir) subprocess.call(['chown', '-R', conf2.user, platform2.skDir]) subprocess.call(['systemctl', 'stop', 'signalk.service']) subprocess.call(['systemctl', 'stop', 'signalk.socket']) subprocess.call(['systemctl', 'start', 'signalk.socket']) subprocess.call(['systemctl', 'start', 'signalk.service']) print(_('DONE')) except Exception as e: print(_('FAILED: ')+str(e))
def main(): conf2 = conf.Conf() currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') language.Language(currentdir, 'openplotter-sdr-vhf', currentLanguage) platform2 = platform.Platform() if not platform2.isInstalled('gqrx-sdr'): print(_("GQRX isn't installed")) return if platform2.isRPI: try: print(_('Set Jack plug 3.5 as output on the Raspberry pi...')) subprocess.call( (platform2.admin + ' amixer cset numid=3 1').split()) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e)) try: print(_('Install pavucontrol...')) subprocess.call( (platform2.admin + ' apt install -y pavucontrol').split()) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e)) if platform2.isRPI: try: print(_('Add Raspberry pi settings for pulseaudio stereo...')) if not os.path.isdir(conf2.home + '/.config/pulse'): subprocess.call( ('mkdir ' + conf2.home + '/.config/pulse').split()) file = conf2.home + '/.config/pulse/default.pa' if not os.path.isfile(file): subprocess.call((' cp ' + currentdir + '/data/default.pa ' + conf2.home + '/.config/pulse/').split()) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e))
def main(): conf2 = conf.Conf() currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') language.Language(currentdir, 'openplotter-can', currentLanguage) platform2 = platform.Platform() print(_('Adding openplotter-can-read service...')) try: fo = open('/etc/systemd/system/openplotter-can-read.service', "w") fo.write( '[Service]\nExecStart=openplotter-can-read\nStandardOutput=syslog\nStandardError=syslog\nWorkingDirectory=/home/' + conf2.user + '\nUser=root\n[Install]\nWantedBy=multi-user.target') fo.close() subprocess.call(['systemctl', 'daemon-reload']) subprocess.call( ['systemctl', 'enable', 'openplotter-can-read.service']) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e)) print(_('Installing/Updating "Signal K to NMEA 2000" plugin...')) try: if platform2.skDir: subprocess.call(['npm', 'i', '--verbose', 'signalk-to-nmea2000'], cwd=platform2.skDir) subprocess.call(['chown', '-R', conf2.user, platform2.skDir]) subprocess.call(['systemctl', 'stop', 'signalk.service']) subprocess.call(['systemctl', 'stop', 'signalk.socket']) subprocess.call(['systemctl', 'start', 'signalk.socket']) subprocess.call(['systemctl', 'start', 'signalk.service']) else: print(_('Failed. Please, install Signal K server.')) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e)) print(_('Setting version...')) try: conf2.set('APPS', 'can', version) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e))
def main(): conf2 = conf.Conf() currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') language.Language(currentdir, 'openplotter-signalk-installer', currentLanguage) platform2 = platform.Platform() print(_('Removing files...')) try: subprocess.call(['rm', '-rf', platform2.skDir]) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e)) print(_('Removing signalk service...')) try: subprocess.call(['systemctl', 'stop', 'signalk.service']) subprocess.call(['systemctl', 'stop', 'signalk.socket']) subprocess.call(['systemctl', 'disable', 'signalk.service']) subprocess.call(['systemctl', 'disable', 'signalk.socket']) subprocess.call(['rm', '-f', '/etc/systemd/system/signalk.service']) subprocess.call(['rm', '-f', '/etc/systemd/system/signalk.socket']) subprocess.call(['systemctl', 'daemon-reload']) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e)) print(_('Uninstalling Signal K Server...')) try: subprocess.call( ['npm', 'uninstall', '--verbose', '-g', 'signalk-server']) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e)) print(_('Removing version...')) try: conf2.set('APPS', 'signalk', '') print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e))
def main(): try: platform2 = platform.Platform() if not platform2.postInstall( version, 'myapp' ): ### replace myapp by the name of your app, use the same name in myappPostInstall and myappPreUninstall scripts. subprocess.Popen( [ 'openplotterPostInstall', platform2.admin + ' myappPostInstall' ] ) ### replace myappPostInstall by your post install entry point (see setup.py file). return except: pass app = wx.App() MyFrame().Show() time.sleep(1) app.MainLoop()
def main(): conf2 = conf.Conf() currentdir = os.path.dirname(os.path.abspath(__file__)) currentLanguage = conf2.get('GENERAL', 'lang') language.Language(currentdir, 'openplotter-dashboards', currentLanguage) try: platform2 = platform.Platform() subprocess.call( ['apt', 'install', '-y', 'influxdb', 'kapacitor', 'chronograf']) subprocess.call(['npm', 'i', '--verbose', 'signalk-to-influxdb'], cwd=platform2.skDir) subprocess.call(['chown', '-R', conf2.user, platform2.skDir]) subprocess.call(['systemctl', 'stop', 'chronograf']) subprocess.call(['systemctl', 'stop', 'influxdb']) subprocess.call(['systemctl', 'stop', 'kapacitor']) fo = open('/etc/default/chronograf', "w") fo.write('PORT=8889') fo.close() subprocess.call(['systemctl', 'unmask', 'influxdb.service']) subprocess.call(['systemctl', 'enable', 'influxdb.service']) subprocess.call(['systemctl', 'start', 'influxdb']) subprocess.call(['systemctl', 'enable', 'kapacitor.service']) subprocess.call(['systemctl', 'start', 'kapacitor']) subprocess.call(['systemctl', 'enable', 'chronograf.service']) subprocess.call(['systemctl', 'start', 'chronograf']) subprocess.call(['systemctl', 'stop', 'signalk.service']) subprocess.call(['systemctl', 'stop', 'signalk.socket']) subprocess.call(['systemctl', 'start', 'signalk.socket']) subprocess.call(['systemctl', 'start', 'signalk.service']) print(_('DONE')) except Exception as e: print(_('FAILED: ') + str(e))