# Path: classes/conf.py
# class Conf:
# 	def __init__(self):
# 		self.home = os.path.expanduser('~')
# 		if 'root' in self.home:
# 			self.home = '/home/'+os.path.expanduser(os.environ["SUDO_USER"])
# 		self.conf_folder = self.home+'/.openplotter'
# 		self.data_conf = ConfigParser.SafeConfigParser()
# 		self.read()
# 
# 	def read(self):
# 		self.data_conf.read(self.conf_folder+'/openplotter.conf')
# 
# 	def write(self):
# 		with open(self.conf_folder+'/openplotter.conf', 'wb') as configfile:
# 			self.data_conf.write(configfile)
# 
# 	def get(self, section, item):
# 		result = ''
# 		try:
# 			result = self.data_conf.get(section, item)
# 		except ConfigParser.NoSectionError:
# 			self.read()
# 			try:
# 				self.data_conf.add_section(section)
# 			except ConfigParser.DuplicateSectionError: pass
# 			self.data_conf.set(section, item, '')
# 			self.write()
# 		except ConfigParser.NoOptionError:
# 			self.set(section, item, '')
# 		return result
# 
# 	def set(self, section, item, value):
# 		self.read()
# 		try:
# 			self.data_conf.set(section, item, value)
# 		except ConfigParser.NoSectionError:
# 			self.data_conf.add_section(section)
# 			self.data_conf.set(section, item, value)
# 		self.write()
# 
# 	def has_option(self, section, item):
# 		return self.data_conf.has_option(section, item)
# 
# 	def has_section(self, section):
# 		return self.data_conf.has_section(section)
# 
# 	def add_section(self, section):
# 		return self.data_conf.add_section(section)
# 
# Path: classes/language.py
# class Language:
# 
# 	def __init__(self, conf):
# 
# 		home = conf.home
# 		op_folder = conf.get('GENERAL', 'op_folder')+'/openplotter'
# 		locale_folder = home+op_folder+'/locale'
# 		language = conf.get('GENERAL', 'lang')
# 
# 		gettext.install('openplotter', locale_folder, unicode=False)
# 		presLan_en = gettext.translation('openplotter', locale_folder, languages=['en'])
# 		presLan_ca = gettext.translation('openplotter', locale_folder, languages=['ca'])
# 		presLan_es = gettext.translation('openplotter', locale_folder, languages=['es'])
# 		presLan_fr = gettext.translation('openplotter', locale_folder, languages=['fr'])
# 		presLan_nl = gettext.translation('openplotter', locale_folder, languages=['nl'])
# 		presLan_de = gettext.translation('openplotter', locale_folder, languages=['de'])
# 		presLan_it = gettext.translation('openplotter', locale_folder, languages=['it'])
# 		presLan_eu = gettext.translation('openplotter', locale_folder, languages=['eu'])
# 		presLan_gl = gettext.translation('openplotter', locale_folder, languages=['gl'])
# 
# 		if language=='en':presLan_en.install()
# 		if language=='ca':presLan_ca.install()
# 		if language=='es':presLan_es.install()
# 		if language=='fr':presLan_fr.install()
# 		if language=='nl':presLan_nl.install()
# 		if language=='de':presLan_de.install()
# 		if language=='it':presLan_it.install()
# 		if language=='eu':presLan_eu.install()
# 		if language=='gl':presLan_gl.install()


import wx, sys, socket, threading, time
from classes.conf import Conf
from classes.language import Language
		
		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'))

# Path: classes/conf.py
# class Conf:
# 	def __init__(self):
# 		self.home = os.path.expanduser('~')
# 		if 'root' in self.home:
# 			self.home = '/home/'+os.path.expanduser(os.environ["SUDO_USER"])
# 		self.conf_folder = self.home+'/.openplotter'
# 		self.data_conf = ConfigParser.SafeConfigParser()
# 		self.read()
# 
# 	def read(self):
# 		self.data_conf.read(self.conf_folder+'/openplotter.conf')
# 
# 	def write(self):
# 		with open(self.conf_folder+'/openplotter.conf', 'wb') as configfile:
# 			self.data_conf.write(configfile)
# 
# 	def get(self, section, item):
# 		result = ''
# 		try:
# 			result = self.data_conf.get(section, item)
# 		except ConfigParser.NoSectionError:
# 			self.read()
# 			try:
# 				self.data_conf.add_section(section)
# 			except ConfigParser.DuplicateSectionError: pass
# 			self.data_conf.set(section, item, '')
# 			self.write()
# 		except ConfigParser.NoOptionError:
# 			self.set(section, item, '')
# 		return result
# 
# 	def set(self, section, item, value):
# 		self.read()
# 		try:
# 			self.data_conf.set(section, item, value)
# 		except ConfigParser.NoSectionError:
# 			self.data_conf.add_section(section)
# 			self.data_conf.set(section, item, value)
# 		self.write()
# 
# 	def has_option(self, section, item):
# 		return self.data_conf.has_option(section, item)
# 
# 	def has_section(self, section):
# 		return self.data_conf.has_section(section)
# 
# 	def add_section(self, section):
# 		return self.data_conf.add_section(section)
# 
# Path: classes/language.py
# class Language:
# 
# 	def __init__(self, conf):
# 
# 		home = conf.home
# 		op_folder = conf.get('GENERAL', 'op_folder')+'/openplotter'
# 		locale_folder = home+op_folder+'/locale'
# 		language = conf.get('GENERAL', 'lang')
# 
# 		gettext.install('openplotter', locale_folder, unicode=False)
# 		presLan_en = gettext.translation('openplotter', locale_folder, languages=['en'])
# 		presLan_ca = gettext.translation('openplotter', locale_folder, languages=['ca'])
# 		presLan_es = gettext.translation('openplotter', locale_folder, languages=['es'])
# 		presLan_fr = gettext.translation('openplotter', locale_folder, languages=['fr'])
# 		presLan_nl = gettext.translation('openplotter', locale_folder, languages=['nl'])
# 		presLan_de = gettext.translation('openplotter', locale_folder, languages=['de'])
# 		presLan_it = gettext.translation('openplotter', locale_folder, languages=['it'])
# 		presLan_eu = gettext.translation('openplotter', locale_folder, languages=['eu'])
# 		presLan_gl = gettext.translation('openplotter', locale_folder, languages=['gl'])
# 
# 		if language=='en':presLan_en.install()
# 		if language=='ca':presLan_ca.install()
# 		if language=='es':presLan_es.install()
# 		if language=='fr':presLan_fr.install()
# 		if language=='nl':presLan_nl.install()
# 		if language=='de':presLan_de.install()
# 		if language=='it':presLan_it.install()
# 		if language=='eu':presLan_eu.install()
# 		if language=='gl':presLan_gl.install()


# Path: diagnostic-N2K-output.py
import wx, sys, socket, threading, time
from classes.conf import Conf
from classes.language import Language

		
		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)