def __init__(self, choice=0): # state conditions / rules # .../ pre-conditions to certain actions self.heard_word = False self.learned_word = False self.found_obj = False self.reached_obj = False # num images of obj # times heard word # times said word self.move = Movement() self.emote = Emote() self.language = Language() # load LanguageModel
def __init__(self, parent): Language(lang) wx.Frame.__init__(self, parent) dlg = wx.MessageDialog(self, text, _('Message'), wx.OK | wx.ICON_WARNING) dlg.ShowModal() sys.exit()
def __init__(self): self.option = sys.argv[1] self.text_sms = sys.argv[2] self.text_sms = unicode(self.text_sms, 'utf-8') self.phone = sys.argv[3] self.conf = Conf() self.home = self.conf.home self.currentpath = self.home + self.conf.get( 'GENERAL', 'op_folder') + '/openplotter' Language(self.conf) wx.Frame.__init__(self, None, title=_('Test SMS'), size=(500, 260)) 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) self.SetIcon(self.icon) self.CreateStatusBar() self.text = wx.StaticText(self, label=_('Error'), pos=(10, 10)) self.output = wx.TextCtrl(self, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_DONTWRAP, size=(480, 110), pos=(10, 50)) self.button_close = wx.Button(self, label=_('Close'), pos=(300, 170)) self.Bind(wx.EVT_BUTTON, self.close, self.button_close) self.button_calculate = wx.Button(self, label=_('Start'), pos=(400, 170)) self.Bind(wx.EVT_BUTTON, self.calculate, self.button_calculate) if self.option == 'i': self.text.SetLabel( _('Press start to check the settings and connect to the GSM device' )) if self.option == 't': self.text.SetLabel( _('Press start to send the text "').decode('utf8') + self.text_sms + _('"\nto the number "').decode('utf8') + self.phone + '"') self.Centre()
def __init__(self): self.list_SK = [] self.static_list = [[]] self.sortCol = 0 self.conf = Conf() self.home = self.conf.home self.currentpath = self.home + self.conf.get( 'GENERAL', 'op_folder') + '/openplotter' Language(self.conf) self.data = []
def __init__(self): self.option=sys.argv[1] paths=Paths() self.currentpath=paths.currentpath self.conf=Conf() Language(self.conf.get('GENERAL','lang')) wx.Frame.__init__(self, None, title=_('Fine calibration'), size=(500,300)) 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) self.SetIcon(self.icon) self.CreateStatusBar() self.text=wx.StaticText(self, label=_('Error'), pos=(10, 10)) self.output = wx.TextCtrl(self, style=wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_DONTWRAP, size=(480,110), pos=(10,90)) self.button_close =wx.Button(self, label=_('Close'), pos=(300, 210)) self.Bind(wx.EVT_BUTTON, self.close, self.button_close) self.button_calculate =wx.Button(self, label=_('Calculate'), pos=(400, 210)) self.Bind(wx.EVT_BUTTON, self.calculate, self.button_calculate) if self.option=='c': self.text.SetLabel(_('Press Calculate and wait for the system to calculate\nthe ppm value with the selected channel. Put the obtained\nvalue in "Correction (ppm)" field and enable SDR-AIS\nreception. Estimated time: 1 min.')) if self.option=='b': self.text.SetLabel(_('Press Calculate and wait for the system to check the band.\nWrite down the strongest channel (power). If you do not find\nany channel try another band. Estimated time: 5 min.')) self.Centre()
# You should have received a copy of the GNU General Public License # along with Openplotter. If not, see <http://www.gnu.org/licenses/>. 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 for iii in templist: if iii[0]==start_all_actions:
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) self.SetIcon(self.icon) self.list = wx.ListCtrl(panel, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER) self.list.InsertColumn(0, 'SignalK', width=400) self.list.InsertColumn(1, _('SK Unit'), width=80) self.list.InsertColumn(2, _('Unit'), width=80) self.list.InsertColumn(3, _('Description'), width=500) self.sort_UnitSK = wx.Button(panel, label=_('Sort SK Unit')) self.sort_UnitSK.Bind(wx.EVT_BUTTON, self.on_sort_UnitSK) self.sort_Unit = wx.Button(panel, label=_('Sort Unit')) self.Bind(wx.EVT_BUTTON, self.on_sort_Unit, self.sort_Unit) self.sort_SK = wx.Button(panel, label=_('Sort SK')) self.sort_SK.Bind(wx.EVT_BUTTON, self.on_sort_SK) self.change_selected = wx.Button(panel, label=_('change selected')) self.change_selected.Bind(wx.EVT_BUTTON, self.on_change_selected) list_convert = [ 'Hz', 'Hz RPM', 'J', 'J Ah(12V)', 'J Ah(24V)', 'K', 'K C', 'K F', 'm', 'm ft', 'm nm', 'm km', 'm/s', 'm/s kn', 'm/s kmh', 'm/s mph', 'm3', 'm3 dm3', 'm3 gal', 'm3/s', 'm3/s l/h', 'm3/s gal/h', 'Pa', 'Pa hPa', 'Pa Bar', 'rad', 'rad deg', 's', 's h', 's d', 's y', 'ratio', 'ratio %' ] self.select_Unit_t = wx.StaticText(panel, label=_('convert')) self.select_Unit = wx.ComboBox(panel, choices=list_convert, style=wx.CB_READONLY, size=(150, 32)) vbox = wx.BoxSizer(wx.VERTICAL) hlistbox = wx.BoxSizer(wx.HORIZONTAL) hbox = wx.BoxSizer(wx.HORIZONTAL) hlistbox.Add(self.list, 1, wx.ALL | wx.EXPAND, 5) hbox.Add(self.sort_SK, 0, wx.RIGHT | wx.LEFT, 5) hbox.Add(self.sort_UnitSK, 0, wx.RIGHT | wx.LEFT, 5) hbox.Add(self.sort_Unit, 0, wx.RIGHT | wx.LEFT, 5) hbox.Add((0, 0), 1, wx.RIGHT | wx.LEFT, 5) hbox.Add(self.change_selected, 0, wx.RIGHT | wx.LEFT, 5) hbox.Add(self.select_Unit_t, 0, wx.LEFT | wx.TOP, 5) hbox.Add(self.select_Unit, 0, wx.RIGHT | wx.LEFT, 5) vbox.Add(hlistbox, 1, wx.ALL | wx.EXPAND, 0) vbox.Add(hbox, 0, wx.ALL | wx.EXPAND, 0) panel.SetSizer(vbox) self.CreateStatusBar() self.read() self.sorting() self.Show(True)
def __init__(self): logging.basicConfig() self.conf = Conf() self.home = self.conf.home self.currentpath = self.home+self.conf.get('GENERAL', 'op_folder')+'/openplotter' #self.Check127488_pos=100 #self.Check127489_pos=100 #self.Check127505_pos=100 #self.Check130316_pos=100 self.N2K=N2K_send() self.tick=0 self.list_SK=[] Language(self.conf) 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) self.SetIcon(self.icon) iL=20; self.Check126992 = wx.CheckBox(self, label=_('126992 System_Time'), pos=(20, iL)) iL+=20; self.Check127245 = wx.CheckBox(self, label=_('127245 Rudder'), pos=(20, iL)) iL+=20; self.Check127250 = wx.CheckBox(self, label=_('127250 Heading'), pos=(20, iL)) iL+=20 self.Check127257 = wx.CheckBox(self, label=_('127257 Attitude'), pos=(20, iL)) iL+=20 self.Check127488 = wx.CheckBox(self, label=_('127488 Engine_Rapid'), pos=(20, iL)) iL+=20 self.Check127488_1 = wx.CheckBox(self, label=_('127488 Engine_Rapid starbord'), pos=(20, iL)) iL+=20 self.Check127489 = wx.CheckBox(self, label=_('127489 Engine'), pos=(20, iL)) iL+=20 self.Check127489_1 = wx.CheckBox(self, label=_('127489 Engine starbord'), pos=(20, iL)) iL+=20 self.Check127505 = wx.CheckBox(self, label=_('127505 FluidLevel fuel'), pos=(20, iL)) iL+=20 self.Check127505_1 = wx.CheckBox(self, label=_('127505 FluidLevel water'), pos=(20, iL)) iL+=20 self.Check127505_2 = wx.CheckBox(self, label=_('127505 FluidLevel gray water'), pos=(20, iL)) iL+=20 self.Check127505_3 = wx.CheckBox(self, label=_('127505 FluidLevel black water'), pos=(20, iL)) iL+=20 self.Check127508 = wx.CheckBox(self, label=_('127508 Battery_Status'), pos=(20, iL)) iL+=20; self.Check128259 = wx.CheckBox(self, label=_('128259 Speed'), pos=(20, iL)) iL+=20 self.Check128267 = wx.CheckBox(self, label=_('128267 Depth'), pos=(20, iL)) iL+=20 self.Check128275 = wx.CheckBox(self, label=_('128275 Distance_Log'), pos=(20, iL)) iL+=20 self.Check129025 = wx.CheckBox(self, label=_('129025 Position_Rapid'), pos=(20, iL)) iL+=20 self.Check129026 = wx.CheckBox(self, label=_('129026 COG_SOG'), pos=(20, iL)) iL=100 self.Check130306 = wx.CheckBox(self, label=_('130306 Wind Data'), pos=(320, iL)) iL+=20 self.Check130310 = wx.CheckBox(self, label=_('130310 Environmental_Parameters'), pos=(320, iL)) iL+=20 self.Check130311 = wx.CheckBox(self, label=_('130311 Environmental_Parameters'), pos=(320, iL)) iL+=20 self.Check130316 = wx.CheckBox(self, label=_('130316 Temperature refrigerator'), pos=(320, iL)) iL+=20 self.Check130316_1 = wx.CheckBox(self, label=_('130316 Temperature exhaust'), pos=(320, iL)) self.Bind(wx.EVT_CHECKBOX, self.updCB) self.XallBtn = wx.Button(self, label=_('all'),size=(70, 32), pos=(550, 20)) self.Bind(wx.EVT_BUTTON, self.allBtn, self.XallBtn) self.XnoneBtn = wx.Button(self, label=_('none'),size=(70, 32), pos=(550, 60)) self.Bind(wx.EVT_BUTTON, self.noneBtn, self.XnoneBtn) self.Centre() self.Show(True) self.defvar() self.aktPGN() self.cycle250=time.time() self.cycle250_2=time.time()+0.111 self.cycle500=time.time()+0.123 self.cycle500_2=time.time()+0.241 self.cycle500_3=time.time()+0.363 self.cycle500_4=time.time()-0.025 self.cycle1000=time.time()+0.087 self.cycle1000_2=time.time()+0.207 self.start() self.timer.Start(self.ttimer)
class Action: def __init__(self, choice=0): # state conditions / rules # .../ pre-conditions to certain actions self.heard_word = False self.learned_word = False self.found_obj = False self.reached_obj = False # num images of obj # times heard word # times said word self.move = Movement() self.emote = Emote() self.language = Language() # load LanguageModel def choose(self): list_of_functions = [ 'go_to_object', 'find_object', 'find_face', 'gesture', 'learn_word', 'predict_word', 'emote' ] # until Q-learning dictates what this is choice = random.choice(list_of_functions) if choice == 'predict_word': if self.heard_word and self.learned_word: self.language.predict_word(robot, extension_feed) elif choice == 'learn_word': if self.heard_word: self.language.learn_word(robot, extension_feed, intension_feed) elif choice == 'go_to_object': if self.found_obj: self.move.go_to_object(robot) elif choice == 'gesture': if self.found_obj and self.reached_obj: self.move.gesture(robot) elif choice == 'find_object': find_object(robot) elif choice == 'find_face': self.move.find_face(robot) elif choice == 'emote': emotional_display = self.emote.display() robot.play_anim(emotional_display[0]).wait_for_completed() def find_object(self): print('Find objects started') looking = True while looking: if self.Decisionobj_q.empty(): self.found_obj = False self.Decision.robot.drive_wheels(l_wheel_speed=-10, r_wheel_speed=10) else: self.found_obj = True self.Decision.robot.stop_all_motors() self.Decision.robot.wait_for_all_actions_completed() looking = False
def __init__(self): self.conf = Conf() self.home = self.conf.home self.currentpath = self.conf.get('GENERAL', 'op_folder') Language(self.conf) style = wx.DEFAULT_DIALOG_STYLE | wx.RESIZE_BORDER wx.Dialog.__init__(self, None, title=_('Generate N2K from Signal K'),style=style) self.Bind(wx.EVT_CLOSE, self.when_closed) self.SetInitialSize((720, 400)) #self.SetAutoLayout(1) #self.SetupScrolling() self.icon = wx.Icon(self.currentpath + '/static/icons/openplotter.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(self.icon) self.panel = wx.Panel(self) self.list_N2Kgen = [ ['126992','System Time',''], ['127245','Rudder','steering.rudderAngle'], ['127250','Heading','navigation.headingMagnetic'], ['127257','Attitude','navigation.attitude.pitch, navigation.attitude.roll, navigation.attitude.yaw'], ['127488','Engine_Rapid','propulsion.port.revolutions'], ['127488_1','Engine_Rapid','propulsion.starboard.revolutions'], ['127489','Engine','propulsion.port.oilTemperature, propulsion.port.temperature'], ['127489_1','Engine','propulsion.starboard.oilTemperature, propulsion.starboard.temperature'], ['127505','FluidLevel','tanks.fuel.standard.capacity, tanks.fuel.standard.currentLevel'], ['127505_1','FluidLevel','tanks.liveWell.standard.capacity, tanks.liveWell.standard.currentLevel'], ['127505_2','FluidLevel','tanks.wasteWater.standard.capacity, tanks.wasteWater.standard.currentLevel'], ['127505_3','FluidLevel','tanks.blackWater.standard.capacity, tanks.blackWater.standard.currentLevel'], ['127508','Battery_Status','electrical.batteries.service.voltage, electrical.batteries.service.current, electrical.batteries.service.temperature'], ['128259','Speed','navigation.speedOverGround, navigation.speedThroughWater'], ['128267','Depth','environment.depth.belowTransducer, environment.depth.surfaceToTransducer'], ['128275','Distance_Log','navigation.log, navigation.logTrip'], ['129025','Position_Rapid','navigation.position.latitude, navigation.position.longitude'], ['129026','COG_SOG','navigation.courseOverGroundTrue, navigation.speedOverGround'], ['130306_2','Wind Data','environment.wind.angleApparent, environment.wind.speedApparent'], ['130306_3','Wind Data','environment.wind.angleTrueWater, environment.wind.speedTrue'], ['130310','Environmental_Parameters','environment.outside.pressure, environment.outside.temperature, environment.water.temperature'], ['130311','Environmental_Parameters','environment.outside.pressure, environment.inside.humidity, environment.water.temperature'], ['130316','Temperature','environment.inside.refrigerator.temperature'], ['130316_1','Temperature','propulsion.port.exhaustTemperature'] ] self.list_N2K = CheckListCtrl(self.panel, 100) self.list_N2K.InsertColumn(0, _('PGN'), width=100) self.list_N2K.InsertColumn(1, _('description'), width=250) self.list_N2K.InsertColumn(2, _('Signal K variable'), width=920) self.list_N2K.Bind(wx.EVT_LIST_ITEM_SELECTED, self.on_selected) OK = wx.Button(self.panel, label=_('Apply changes')) OK.Bind(wx.EVT_BUTTON, self.on_OK) hlistbox = wx.BoxSizer(wx.HORIZONTAL) hlistbox.Add(self.list_N2K, 1, wx.ALL | wx.EXPAND, 5) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(hlistbox, 1, wx.ALL | wx.EXPAND, 0) vbox.Add(OK, 0, wx.ALL, 5) self.panel.SetSizer(vbox) for ii in self.list_N2Kgen: self.list_N2K.Append(ii) data = self.conf.get('N2K', 'pgn_generate') try: self.PGN_list = eval(data) except: self.PGN_list = [] i=0 for ii in self.list_N2Kgen: if str(ii[0]) in self.PGN_list: self.list_N2K.CheckItem(i) i += 1
def __init__(self): # This creates a UDP socket self.sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) # This opens the OpenPlotter configuration file in ~/.openplotter/openplotter.conf self.conf = Conf() Language(self.conf) title = _('Demo tool') wx.Frame.__init__(self, None, title=title, size=(600, 360)) self.SetFont( wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) self.icon = wx.Icon(op_folder + '/static/icons/openplotter.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(self.icon) panel = wx.Panel(self) info = wx.StaticText( panel, label=_('To create tools see ~/.openplotter/tools/README.md.')) # Getting info from OpenPlotter configuration file. When reading from demo tool conf file or OpenPlotter conf file, if section or option do not exist, they will be created with no value. op_data_box = wx.StaticBox(panel, -1, _(' OpenPlotter config data ')) version = _('OpenPlotter version: ').decode('utf8') + self.conf.get( 'GENERAL', 'version') + ' ' + self.conf.get('GENERAL', 'state') text1 = wx.StaticText(panel, label=version) sk_key_box = wx.StaticBox(panel, -1, _(' Working with Signal K ')) text2 = wx.StaticText(panel, label=_('Select a Signal K key')) self.SKkey = wx.TextCtrl(panel, style=wx.CB_READONLY) self.SKkey.SetValue(conf2.get('SIGNALK', 'key')) self.edit_skkey = wx.Button(panel, label=_('Edit')) # This uses the OpenPlotter class to select a signal k key self.edit_skkey.Bind(wx.EVT_BUTTON, self.onEditSkkey) text3 = wx.StaticText(panel, label=_('Write some text to publish')) self.data = wx.TextCtrl(panel) self.data.SetValue(conf2.get('SIGNALK', 'data')) self.button_publish = wx.Button(panel, label=_('Publish')) self.button_publish.Bind(wx.EVT_BUTTON, self.onPublish) button_cancel = wx.Button(panel, label=_('Cancel')) self.Bind(wx.EVT_BUTTON, self.on_cancel, button_cancel) button_ok = wx.Button(panel, label=_('OK')) self.Bind(wx.EVT_BUTTON, self.on_ok, button_ok) v_boxSizer1 = wx.StaticBoxSizer(op_data_box, wx.VERTICAL) v_boxSizer1.AddSpacer(5) v_boxSizer1.Add(text1, 0, wx.ALL | wx.EXPAND, 5) h_boxSizer1 = wx.BoxSizer(wx.HORIZONTAL) h_boxSizer1.Add(self.SKkey, 1, wx.ALL | wx.EXPAND, 5) h_boxSizer1.Add(self.edit_skkey, 0, wx.ALL | wx.EXPAND, 5) h_boxSizer2 = wx.BoxSizer(wx.HORIZONTAL) h_boxSizer2.Add(self.data, 1, wx.ALL | wx.EXPAND, 5) h_boxSizer2.Add(self.button_publish, 0, wx.ALL | wx.EXPAND, 5) v_boxSizer2 = wx.StaticBoxSizer(sk_key_box, wx.VERTICAL) v_boxSizer2.AddSpacer(5) v_boxSizer2.Add(text2, 0, wx.ALL | wx.EXPAND, 5) v_boxSizer2.Add(h_boxSizer1, 0, wx.ALL | wx.EXPAND, 5) v_boxSizer2.Add(text3, 0, wx.ALL | wx.EXPAND, 5) v_boxSizer2.Add(h_boxSizer2, 0, wx.ALL | wx.EXPAND, 5) buttons = wx.BoxSizer(wx.HORIZONTAL) buttons.Add((0, 0), 1, wx.ALL | wx.EXPAND, 0) buttons.Add(button_cancel, 0, wx.ALL | wx.EXPAND, 10) buttons.Add(button_ok, 0, wx.ALL | wx.EXPAND, 10) vbox3 = wx.BoxSizer(wx.VERTICAL) vbox3.Add(info, 0, wx.ALL | wx.EXPAND, 10) vbox3.Add(v_boxSizer1, 0, wx.ALL | wx.EXPAND, 5) vbox3.Add(v_boxSizer2, 0, wx.ALL | wx.EXPAND, 5) vbox3.Add(buttons, 0, wx.ALL | wx.EXPAND, 0) panel.SetSizer(vbox3) self.Centre()
def __init__(self): self.ttimer = 40 self.conf = Conf() self.home = self.conf.home self.currentpath = self.home + self.conf.get( 'GENERAL', 'op_folder') + '/openplotter' try: self.ser = serial.Serial(self.conf.get('N2K', 'can_usb'), 115200, timeout=0.5) except: print 'failed to start N2K output setting on ' + self.conf.get( 'N2K', 'can_usb') sys.exit(0) Language(self.conf) Buf_ = (0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0) self.Buffer = bytearray(Buf_) self.Zustand = 6 self.buffer = 0 self.PGN_list = [] self.list_N2K_txt = [] self.list_count = [] self.p = 0 wx.Frame.__init__(self, None, title="N2K setting", size=(650, 435)) self.Bind(wx.EVT_CLOSE, self.OnClose) 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) self.SetIcon(self.icon) panel = wx.Panel(self, 100) wx.StaticText(panel, wx.ID_ANY, label="TX PGN", style=wx.ALIGN_CENTER, pos=(10, 5)) self.list_N2K = CheckListCtrl(panel, 400, 260) self.list_N2K.SetBackgroundColour((230, 230, 230)) self.list_N2K.SetPosition((10, 25)) self.list_N2K.InsertColumn(0, _('PGN'), width=90) self.list_N2K.InsertColumn(1, _('info'), width=200) wx.StaticText(panel, wx.ID_ANY, label="enabled transmit PGN:", style=wx.ALIGN_CENTER, pos=(10, 300)) self.printing = wx.StaticText(panel, size=(600, 70), pos=(10, 320)) self.check_b = wx.Button(panel, label=_('check'), size=(70, 32), pos=(550, 20)) self.Bind(wx.EVT_BUTTON, self.check, self.check_b) self.apply_b = wx.Button(panel, label=_('apply'), size=(70, 32), pos=(550, 60)) self.Bind(wx.EVT_BUTTON, self.apply, self.apply_b) self.Centre() self.read_N2K() self.timer.Start(self.ttimer) self.check(0) self.Show(True)
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 self.Zustand = 6 self.list_iter = [] wx.Frame.__init__(self, None, title='diagnostic N2K output', size=(650, 435)) self.Bind(wx.EVT_CLOSE, self.OnClose) panel = wx.Panel(self, wx.ID_ANY) 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) self.SetIcon(self.icon) self.list = wx.ListCtrl(panel, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER, size=(540, 370), pos=(5, 5)) self.list.InsertColumn(0, _('PGN'), wx.LIST_FORMAT_RIGHT, width=62) self.list.InsertColumn(1, _('SRC'), wx.LIST_FORMAT_RIGHT, width=38) self.list.InsertColumn(2, _('DST'), wx.LIST_FORMAT_RIGHT, width=38) self.list.InsertColumn(3, _('Name'), width=180) self.list.InsertColumn(4, _('Interval'), wx.LIST_FORMAT_RIGHT, width=45) self.list.InsertColumn(5, _('Data'), width=350) sort_SRC = wx.Button(panel, label=_('Sort SRC')) sort_SRC.Bind(wx.EVT_BUTTON, self.on_sort_SRC) sort_PGN = wx.Button(panel, label=_('Sort PGN')) sort_PGN.Bind(wx.EVT_BUTTON, self.on_sort_PGN) hlistbox = wx.BoxSizer(wx.HORIZONTAL) hlistbox.Add(self.list, 1, wx.ALL | wx.EXPAND, 5) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(sort_SRC, 0, wx.RIGHT | wx.LEFT, 5) hbox.Add(sort_PGN, 0, wx.RIGHT | wx.LEFT, 5) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(hlistbox, 1, wx.ALL | wx.EXPAND, 0) vbox.Add(hbox, 0, wx.ALL | wx.EXPAND, 0) panel.SetSizer(vbox) self.CreateStatusBar() self.Show(True) self.status = '' self.data = [] self.timer.Start(self.ttimer)
except socket.error, error_msg: error = _('Failed to connect with localhost:10110. Error: ') + str( error_msg[0]) print error sock_in = '' time.sleep(7) else: error = 0 #end thread1 # no loop conf = Conf() Language(conf.get('GENERAL', 'lang')) global triggers triggers = [] global sock_in global error sock_in = '' error = 0 a = DataStream(conf) actions = Actions(conf) nodata = '' sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) read_triggers()
def __init__(self): self.ttimer = 100 self.conf = Conf() self.home = self.conf.home self.currentpath = self.home + self.conf.get( 'GENERAL', 'op_folder') + '/openplotter' Language(self.conf) self.list_iter = [] titleadd = '' if len(sys.argv) > 2: titleadd = sys.argv[2] wx.Frame.__init__(self, None, title=titleadd, size=(650, 435)) self.Bind(wx.EVT_CLOSE, self.OnClose) panel = wx.Panel(self, wx.ID_ANY) 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) self.SetIcon(self.icon) self.logger = wx.TextCtrl(panel, style=wx.TE_MULTILINE | wx.TE_READONLY | wx.TE_DONTWRAP | wx.LC_SORT_ASCENDING) self.list = wx.ListCtrl(panel, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER) self.list.InsertColumn(0, _('Device'), width=50) self.list.InsertColumn(1, _('Type'), width=50) self.list.InsertColumn(2, _('Interval'), wx.LIST_FORMAT_RIGHT, width=50) self.list.InsertColumn(3, _('Data'), width=500) self.button_pause = wx.Button(panel, label=_('Pause'), pos=(555, 160)) self.button_pause.Bind(wx.EVT_BUTTON, self.pause) sort = wx.Button(panel, label=_('Sort'), pos=(555, 200)) sort.Bind(wx.EVT_BUTTON, self.sort) nmea = wx.Button(panel, label=_('NMEA info'), pos=(555, 240)) nmea.Bind(wx.EVT_BUTTON, self.nmea_info) self.pause_all = 0 htextbox = wx.BoxSizer(wx.HORIZONTAL) htextbox.Add(self.logger, 1, wx.ALL | wx.EXPAND, 5) hlistbox = wx.BoxSizer(wx.HORIZONTAL) hlistbox.Add(self.list, 1, wx.ALL | wx.EXPAND, 5) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(self.button_pause, 0, wx.RIGHT | wx.LEFT, 5) hbox.Add(sort, 0, wx.RIGHT | wx.LEFT, 5) hbox.Add(nmea, 0, wx.RIGHT | wx.LEFT, 5) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(htextbox, 1, wx.ALL | wx.EXPAND, 0) vbox.Add(hlistbox, 1, wx.ALL | wx.EXPAND, 0) vbox.Add(hbox, 0, wx.ALL | wx.EXPAND, 0) panel.SetSizer(vbox) self.CreateStatusBar() self.Show(True) self.s2 = '' self.status = '' self.data = [] self.baudc = 0 self.baud = 0 self.timer.Start(self.ttimer)
def __init__(self): self.SK_unit = '' self.SK_description = '' self.SK_unit_priv = 0 self.SK_Faktor_priv = 1 self.SK_Offset_priv = 0 self.ws = None self.thread = threading._DummyThread self.private_unit_s = 1 logging.basicConfig() self.buffer = [] self.list_SK = [] self.list_SK_unit = [] self.sortCol = 0 self.conf = Conf() self.home = self.conf.home self.currentpath = self.conf.get('GENERAL', 'op_folder') SK_ = SK_settings(self.conf) self.ws_name = SK_.ws + SK_.ip + ":" + str( SK_.aktport) + "/signalk/v1/stream?subscribe=self" Language(self.conf) wx.Frame.__init__(self, None, title='diagnostic Signal K input', size=(770, 435)) self.Bind(wx.EVT_CLOSE, self.OnClose) panel = wx.Panel(self, wx.ID_ANY) 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 + '/static/icons/openplotter.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(self.icon) self.list = wx.ListCtrl(panel, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER) self.list.InsertColumn(0, _('SRC'), width=200) self.list.InsertColumn(1, _('Signal K'), width=310) self.list.InsertColumn(2, _('Value'), wx.LIST_FORMAT_RIGHT, width=190) self.list.InsertColumn(3, _('Unit'), width=45) self.list.InsertColumn(4, _('Interval'), wx.LIST_FORMAT_RIGHT, width=55) self.list.InsertColumn(5, _('Status'), width=50) self.list.InsertColumn(6, _('Description'), width=500) self.list.InsertColumn(7, _('label'), width=100) self.list.InsertColumn(8, _('type'), width=90) self.list.InsertColumn(9, _('pgn'), width=70) self.list.InsertColumn(10, _('src'), width=50) self.list.InsertColumn(11, _('sentence'), width=50) self.list.InsertColumn(12, _('talker'), width=50) sort_SRC = wx.Button(panel, label=_('Sort SRC')) sort_SRC.Bind(wx.EVT_BUTTON, self.on_sort_SRC) sort_SK = wx.Button(panel, label=_('Sort SK')) sort_SK.Bind(wx.EVT_BUTTON, self.on_sort_SK) show_keys = wx.Button(panel, label=_('Show All SK keys')) show_keys.Bind(wx.EVT_BUTTON, self.on_show_keys) self.private_unit = wx.CheckBox(panel, label=_('private Unit'), pos=(360, 32)) self.private_unit.Bind(wx.EVT_CHECKBOX, self.on_private_unit) self.private_unit.SetValue(self.private_unit_s) unit_setting = wx.Button(panel, label=_('Unit Setting')) unit_setting.Bind(wx.EVT_BUTTON, self.on_unit_setting) vbox = wx.BoxSizer(wx.VERTICAL) hlistbox = wx.BoxSizer(wx.HORIZONTAL) hbox = wx.BoxSizer(wx.HORIZONTAL) hlistbox.Add(self.list, 1, wx.ALL | wx.EXPAND, 5) hbox.Add(sort_SRC, 0, wx.RIGHT | wx.LEFT, 5) hbox.Add(sort_SK, 0, wx.RIGHT | wx.LEFT, 5) hbox.Add(show_keys, 0, wx.RIGHT | wx.LEFT, 5) hbox.Add((0, 0), 1, wx.RIGHT | wx.LEFT, 5) hbox.Add(self.private_unit, 0, wx.RIGHT | wx.LEFT, 5) hbox.Add(unit_setting, 0, wx.RIGHT | wx.LEFT, 5) vbox.Add(hlistbox, 1, wx.ALL | wx.EXPAND, 0) vbox.Add(hbox, 0, wx.ALL | wx.EXPAND, 0) panel.SetSizer(vbox) self.CreateStatusBar() self.read() self.start() self.Show(True) self.status = '' self.data = [] self.baudc = 0 self.baud = 0 self.timer.Start(self.ttimer) self.no_action = 0 self.no_action_limit = 5000 / self.ttimer
def __init__(self): self.conf = Conf() Language(self.conf.get('GENERAL', 'lang')) wx.Frame.__init__(self, None, title=_('Connection'), size=(550, 385)) self.SetFont( wx.Font(10, wx.FONTFAMILY_DEFAULT, wx.FONTSTYLE_NORMAL, wx.FONTWEIGHT_NORMAL)) self.icon = wx.Icon(currentpath + '/openplotter.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(self.icon) self.in_out = sys.argv[1] self.con_type = sys.argv[2] wx.StaticText(self, label=_('Name'), pos=(25, 35)) self.name = wx.TextCtrl(self, -1, size=(120, 32), pos=(20, 55)) if self.con_type == 'serial': if self.in_out == 'in': wx.StaticBox(self, label=_(' Serial input '), size=(530, 90), pos=(10, 10)) if self.in_out == 'out': wx.StaticBox(self, label=_(' Serial output '), size=(530, 90), pos=(10, 10)) self.SerialCheck() wx.StaticText(self, label=_('Port'), pos=(155, 35)) self.deviceComboBox = wx.ComboBox(self, choices=self.SerDevLs, style=wx.CB_DROPDOWN, size=(155, 32), pos=(150, 55)) if self.SerDevLs: self.deviceComboBox.SetValue(self.SerDevLs[0]) self.bauds = ['4800', '9600', '19200', '38400', '57600', '115200'] wx.StaticText(self, label=_('Bauds'), pos=(320, 35)) self.baudComboBox = wx.ComboBox(self, choices=self.bauds, style=wx.CB_READONLY, size=(90, 32), pos=(315, 55)) self.baudComboBox.SetValue('4800') if self.con_type == 'network': if self.in_out == 'in': wx.StaticBox(self, label=_(' Network input '), size=(530, 90), pos=(10, 10)) self.gpsd = wx.Button(self, label=_('GPSD'), pos=(440, 55)) self.Bind(wx.EVT_BUTTON, self.create_gpsd, self.gpsd) if self.in_out == 'out': wx.StaticBox(self, label=_(' Network output '), size=(530, 90), pos=(10, 10)) self.type = ['TCP', 'UDP'] wx.StaticText(self, label=_('Type'), pos=(155, 35)) self.typeComboBox = wx.ComboBox(self, choices=self.type, style=wx.CB_READONLY, size=(70, 32), pos=(150, 55)) self.typeComboBox.SetValue('TCP') wx.StaticText(self, label=_('Address'), pos=(235, 35)) self.address = wx.TextCtrl(self, -1, size=(120, 32), pos=(230, 55)) wx.StaticText(self, label=_('Port'), pos=(365, 35)) self.port = wx.TextCtrl(self, -1, size=(55, 32), pos=(360, 55)) wx.StaticBox(self, label=_(' Filter '), size=(530, 195), pos=(10, 105)) self.mode_filter = [ _('none'), _('Accept only sentences:'), _('Ignore sentences:') ] self.filter = wx.ComboBox(self, choices=self.mode_filter, style=wx.CB_READONLY, size=(220, 32), pos=(20, 130)) self.filter.SetValue(self.mode_filter[0]) wx.StaticText(self, label=_('Filtering'), pos=(25, 175)) self.sentences = wx.TextCtrl(self, -1, style=wx.CB_READONLY, size=(400, 32), pos=(20, 195)) self.sentences.SetBackgroundColour( wx.SystemSettings_GetColour(wx.SYS_COLOUR_INACTIVECAPTION)) self.delete = wx.Button(self, label=_('Delete'), pos=(440, 195)) self.Bind(wx.EVT_BUTTON, self.delete_sentences, self.delete) wx.StaticText(self, label=_('Talker - Sentence'), pos=(25, 240)) self.talker = wx.TextCtrl(self, -1, size=(35, 32), pos=(20, 260)) wx.StaticText(self, label=_('-'), pos=(60, 265)) self.sent = wx.TextCtrl(self, -1, size=(45, 32), pos=(70, 260)) self.add_sent = wx.Button(self, label=_('Add sentence'), pos=(160, 260)) self.Bind(wx.EVT_BUTTON, self.add_sentence, self.add_sent) self.sentences.SetValue(_('nothing')) self.talker.SetValue('**') self.sent.SetValue('***') self.ok = wx.Button(self, label=_('OK'), pos=(440, 310)) self.Bind(wx.EVT_BUTTON, self.ok_conn, self.ok) self.cancel = wx.Button(self, label=_('Cancel'), pos=(330, 310)) self.Bind(wx.EVT_BUTTON, self.cancel_conn, self.cancel) self.Centre()
def __init__(self): self.ttimer = 40 self.conf = Conf() self.home = self.conf.home self.currentpath = self.conf.get('GENERAL', 'op_folder') self.SK_settings = SK_settings(self.conf) baudrate = self.SK_settings.ngt1_baudrate can_device = self.SK_settings.ngt1_device if baudrate and can_device: try: self.ser = serial.Serial(can_device, baudrate, timeout=0.5) except: print 'failed to start N2K input diagnostic on ' + can_device sys.exit(0) else: sys.exit(0) Language(self.conf) 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 self.Zustand = 6 self.list_iter = [] wx.Frame.__init__(self, None, title='diagnostic N2K input', size=(650, 435)) self.Bind(wx.EVT_CLOSE, self.OnClose) panel = wx.Panel(self, wx.ID_ANY) 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 + '/static/icons/openplotter.ico', wx.BITMAP_TYPE_ICO) self.SetIcon(self.icon) self.list = wx.ListCtrl(panel, -1, style=wx.LC_REPORT | wx.SUNKEN_BORDER) self.list.InsertColumn(0, _('PGN'), wx.LIST_FORMAT_RIGHT, width=62) self.list.InsertColumn(1, _('SRC'), wx.LIST_FORMAT_RIGHT, width=38) self.list.InsertColumn(2, _('DST'), wx.LIST_FORMAT_RIGHT, width=38) self.list.InsertColumn(3, _('Name'), width=180) self.list.InsertColumn(4, _('Interval'), wx.LIST_FORMAT_RIGHT, width=45) self.list.InsertColumn(5, _('Data'), width=350) sort_SRC = wx.Button(panel, label=_('Sort SRC')) sort_SRC.Bind(wx.EVT_BUTTON, self.on_sort_SRC) sort_PGN = wx.Button(panel, label=_('Sort PGN')) sort_PGN.Bind(wx.EVT_BUTTON, self.on_sort_PGN) hlistbox = wx.BoxSizer(wx.HORIZONTAL) hlistbox.Add(self.list, 1, wx.ALL | wx.EXPAND, 5) hbox = wx.BoxSizer(wx.HORIZONTAL) hbox.Add(sort_SRC, 0, wx.RIGHT | wx.LEFT, 5) hbox.Add(sort_PGN, 0, wx.RIGHT | wx.LEFT, 5) vbox = wx.BoxSizer(wx.VERTICAL) vbox.Add(hlistbox, 1, wx.ALL | wx.EXPAND, 0) vbox.Add(hbox, 0, wx.ALL | wx.EXPAND, 0) panel.SetSizer(vbox) self.CreateStatusBar() self.Show(True) self.status = '' self.data = [] self.baudc = 0 self.baud = 0 self.timer.Start(self.ttimer)