| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
 100
 101
 102
 103
 104
 105
 106
 107
 108
 109
 110
 111
 112
 113
 114
 115
 116
 117
 118
 119
 120
 121
 122
 123
 124
 125
 126
 127
 128
 129
 130
 131
 132
 133
 134
 135
 136
 
 | class ConfigurationDialog(wx.Dialog,WndProcHookMixin):
	def __init__(self, parent, enable=True):
		WndProcHookMixin.__init__(self)
		wx.Dialog.__init__(self, None, -1, "Configuration", size=(405,320))
		panel = wx.Panel(self)
 
		staticBox1 = wx.StaticBox(self, -1, "AAAAA:")
		StaticBoxSizer1 = wx.StaticBoxSizer(staticBox1, wx.VERTICAL)	
		COM_Label = wx.StaticText(panel, -1, "Modem port:")
		if enable:
			list = self.__ReadComList()
			list.sort(self.sort_COM)
			self.COM = wx.Choice(panel,choices=list)
			print self.COM.GetStrings()
			if str("COM"+str(VarGlobal.COM_Port)) in self.COM.GetStrings():
				self.COM.SetStringSelection(str("COM"+str(VarGlobal.COM_Port)))
		else:
			self.COM = wx.TextCtrl(panel,size=(10,-1),value=VarGlobal.COM_Port)
			self.COM.SetMaxLength(2)
		Speed_Label = wx.StaticText(panel, -1, "          Modem speed:")
		self.SpeedListBox = wx.Choice(panel,choices=VarGlobal.SpeedList)
		self.SpeedListBox.SetStringSelection(VarGlobal.COM_Speed)
		Trace_Label = wx.StaticText(panel, -1, "Trace port:")
		if enable:
			list = self.__ReadComList()
			list.sort(self.sort_COM)
			self.COM2 = wx.Choice(panel,choices=list)
			if str("COM"+str(VarGlobal.Trace_Port)) in self.COM2.GetStrings():
				self.COM2.SetStringSelection(str("COM"+str(VarGlobal.Trace_Port)))
		else:
			self.COM2 = wx.TextCtrl(panel,size=(10,-1),value=VarGlobal.Trace_Port)
			self.COM2.SetMaxLength(2)
		Speed_Label2 = wx.StaticText(panel, -1, "          Trace speed:")
		self.SpeedListBox2 = wx.Choice(panel,choices=VarGlobal.SpeedList)
		self.SpeedListBox2.SetStringSelection(VarGlobal.Trace_Speed)	
		# Layout
		sizer = wx.GridBagSizer(hgap=10,vgap=10)
		sizer.Add(COM_Label,pos=(0,0),flag=wx.TOP,border=3)
		sizer.Add(self.COM,(0,1))
		sizer.Add(Speed_Label,pos=(0,2),flag=wx.TOP,border=3)
		sizer.Add(self.SpeedListBox,(0,3))
		sizer.Add(Trace_Label,pos=(1,0),flag=wx.TOP,border=3)
		sizer.Add(self.COM2,(1,1))
		sizer.Add(Speed_Label2,pos=(1,2),flag=wx.TOP,border=3)
		sizer.Add(self.SpeedListBox2,(1,3))		
		panel.SetSizer(sizer)
 
		StaticBoxSizer1.Add(panel,0,wx.ALL,10)
		self.SetSizer(StaticBoxSizer1)
 
		# Layout
		Box = wx.BoxSizer(wx.VERTICAL)
		Box.Add(panel, 0,wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP,20)	
 
		# Enable or not
		self.Enable(enable)
		path = "Logs"		
		# if the folder "Logs doesn't exist it will created
		if os.path.exists(os.path.abspath(os.getcwd() + "\\" + path)):
			VarGlobal.log_dir = os.path.abspath(os.getcwd() + "\\" + path)
		elif os.path.exists(os.path.abspath(os.path.dirname(os.getcwd()) + "\\" + path)):
			VarGlobal.log_dir = os.path.abspath(os.path.dirname(os.getcwd()) + "\\" + path)				
		else:
			os.mkdir(os.path.abspath(os.getcwd() + "\\" + path))		
			VarGlobal.log_dir = os.path.abspath(os.path.abspath(os.getcwd() + "\\" + path))
		self.enable = enable
 
		#wx.Panel.__init__(self,parent)
		# Create objects to display
		staticBox2 = wx.StaticBox(self, -1, "Log/Trace:")  # static ox with title and line arround it
		StaticBoxSizer2 = wx.StaticBoxSizer(staticBox2,wx.VERTICAL)  # enables to put several widgets into a row or a column
 
		panel2 = wx.Panel(self)
		LogDirLabel = wx.StaticText(panel2, -1, label = "Directory:     ")
		self.log_dir = wx.TextCtrl(panel2, -1, size=(220,-1),value=VarGlobal.log_dir)  #taille du champs en pixels
		self.log_dir.SetMaxLength(120) #taille du champs
		LogBrowseLabel = wx.Button(panel2, -1, " ... ", size=(20,20))
		self.Bind(wx.EVT_BUTTON, self.OnButtonBrowse, LogBrowseLabel)	
		LogNameLabel = wx.StaticText(panel2, -1, label = "Name:         ")
		self.log_name = wx.TextCtrl(panel2, -1, size=(220,-1),value=VarGlobal.log_name)
		self.log_name.SetMaxLength(50) #taille du champs
		if enable:
			# Event to catch USB COM Arrival/Remove10
			#self.GetParent().hookMsgHandler(self.__onDeviceArrival,self.__onDeviceRemove)
			pass
		else:
			ToolTip = "To modify those options please see Configuration menu"
			self.SetToolTip(wx.ToolTip(ToolTip))
			panel2.SetToolTip(wx.ToolTip(ToolTip))
			LogDirLabel.SetToolTip(wx.ToolTip(ToolTip))
			Speed_Label.SetToolTip(wx.ToolTip(ToolTip))
			LogBrowseLabel.SetToolTip(wx.ToolTip(ToolTip))
			LogDirLabel.SetToolTip(wx.ToolTip(ToolTip))
 
		# Layout
		sizer2 = wx.GridBagSizer(hgap=7,vgap=7)
		sizer2.Add(LogDirLabel,pos=(0,0),flag=wx.TOP,border=3)
		sizer2.Add(self.log_dir,pos=(0,1),flag=wx.TOP,border=3) #span=(0,1),flag=wx.EXPAND)
		sizer2.Add(LogBrowseLabel,pos=(0,2),flag=wx.TOP,border=3)
		sizer2.Add(LogNameLabel,pos=(1,0),flag=wx.TOP,border=3)
		sizer2.Add(self.log_name,pos=(1,1),flag=wx.TOP,border=3) #span=(0,1),flag=wx.EXPAND)	
		panel2.SetSizer(sizer2)
		StaticBoxSizer2.Add(panel2,0,wx.ALL,10)
		print "staticBox1 avant = ", staticBox1			
		self.SetSizer(StaticBoxSizer2)
		print "staticBox1 apres = ", staticBox1
 
		# Enable or not
		self.Enable(enable)		
 
		#self.GPRS = GPRS(self)
		ButtonPanel = wx.Panel(self)
		self.SaveButton = wx.Button(ButtonPanel, -1, "Save")
		self.CancelButton = wx.Button(ButtonPanel, -1, "Cancel")
		#print staticBox1
		#print staticBox2
		#Box.Add(staticBox2, 0,wx.EXPAND|wx.LEFT|wx.RIGHT|wx.TOP,20)
 
		ButtonBox = wx.BoxSizer(wx.HORIZONTAL)
		ButtonBox.Add(self.SaveButton, 0,wx.RIGHT,15)
		ButtonBox.Add(self.CancelButton, 0)
		ButtonPanel.SetSizer(ButtonBox)
		Box.Add(ButtonPanel, 0,wx.LEFT|wx.RIGHT|wx.TOP|wx.ALIGN_CENTER_HORIZONTAL,20)
 
		#self.SetSizer(Box)
 
		# Events
		self.Bind(wx.EVT_BUTTON, self.__OnSave, self.SaveButton)			# When Clic on Save Button
		self.Bind(wx.EVT_BUTTON, self.__OnCancel, self.CancelButton)		# When Clic on Cancel Button
		self.Bind(wx.EVT_TEXT, self.__OnTxtChange)							# When Text Change active or desactive buttons
		self.Bind(wx.EVT_CHOICE, self.__OnTxtChange)						# When List box Change active or desactive buttons
		self.Bind(wx.EVT_CLOSE, self.__OnClose)								# When List box Change active or desactive buttons
 
		self.__OnTxtChange()												# Init activation of buttons
 
		self.ShowModal()													# Display Dialog | 
Partager