| 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
 137
 138
 139
 140
 141
 142
 143
 144
 145
 146
 147
 148
 149
 150
 151
 152
 153
 154
 155
 156
 157
 158
 159
 160
 
 | import wx
# -*- coding: latin-1 -*- 
 
#-- Creation des classes.
 
class MainFrame(wx.Frame):
	def __init__(self,parent,id):
		wx.Frame.__init__(self, parent,id,'PyOphta', size = (500,400))
		#--Creation  d'un conteneur
		#self.panel=wx.Panel(self)
		self.SetBackgroundColour('yellow')
		#--Creation de la barre de status
		self.CreateStatusBar()
		#--Creation de la barre de menu
		menubar=wx.MenuBar()	
 
		#--Création d'un premier menu "Patient"
		#--Création des autres menus
		patient=wx.Menu()
		agenda=wx.Menu()
		consult=wx.Menu()
		compta=wx.Menu()
		#--Peuplement de la barre de menu
		menubar.Append(patient,"Patient")
		menubar.Append(agenda,"Agenda")
		menubar.Append(consult,"Consultation")
		menubar.Append(compta,"Comptabilité")
		#--Peuplement du menu: Patient
		nouveau=patient.Append(wx.NewId(),"Nouveau","Saisir un nouveau patient")
		patient.Append(wx.NewId(),"Rechercher","Rechercher un patient")
		#--Mise en place  d'un séparateur
		patient.AppendSeparator()
		#--Poursuite peuplement du menu:  Patient
		patient.Append(wx.NewId(),"Quitter","Quitte l'application")
		#--Peuplement de agenda
		agenda.Append(wx.NewId(),"Nouveau","Prendre un rendez-vous")
		agenda.Append(wx.NewId(),"Rechercher","Rechercher le premier rendez-vous disponible")
		agenda.Append(wx.NewId(),"Consulter","Consulter l'agenda")
		#--Peuplement de "consultation"
		consult.Append(wx.NewId(),"Saisir","Saisir une nouvelle consultation")
		consult.Append(wx.NewId(),"Rechercher","Recherche multicritère d'une consultation")
		#--Peuplement du Menu Comptabilté
		#--TODO
		#--le panel est pas jaune !!!!colour et pas color
		#--Affichage de la barre de menu
		#--Cette méthode doit venir à la fin du
		#--remplissage de menubar.
		self.SetMenuBar(menubar)
		#--Accrochage de l'event wx.Menu
		self.Bind(wx.EVT_MENU, self.OnNewPatient, nouveau)
		self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
		#--Défnition de la fonction OnNewPatient
		#--Ouvre un formulaire pour la saisie
		#--des donnees patient
	def OnNewPatient(self,evt):
		form=SaisiePatient(self)
		#form.Show()
 
	def OnCloseWindow(self,evt):
		self.Destroy()
 
 
 
#--Création de la classe saisie patient
class SaisiePatient(wx.Panel):
	def __init__(self, parent):
		wx.Panel.__init__(self, parent, -1)
		#panel = wx.Panel(self)
 
		# First create the controls
		topLbl = wx.StaticText(self, -1, "État civil")
		topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD))
 
		nameLbl = wx.StaticText(self, -1, "Name:")
		name = wx.TextCtrl(self, -1, "");
 
		addrLbl = wx.StaticText(self, -1, "Address:")
		addr1 = wx.TextCtrl(self, -1, "");
		addr2 = wx.TextCtrl(self, -1, "");
 
		cstLbl = wx.StaticText(self, -1, "City, State, Zip:")
		city  = wx.TextCtrl(self, -1, "", size=(150,-1));
		state = wx.TextCtrl(self, -1, "", size=(50,-1));
		zip   = wx.TextCtrl(self, -1, "", size=(70,-1));
 
		phoneLbl = wx.StaticText(self, -1, "Phone:")
		phone = wx.TextCtrl(self, -1, "");
 
		emailLbl = wx.StaticText(self, -1, "Email:")
		email = wx.TextCtrl(self, -1, "");
 
		saveBtn = wx.Button(self, -1, "Save")
		cancelBtn = wx.Button(self, -1, "Cancel")
 
		# Now do the layout.
 
		# mainSizer is the top-level one that manages everything
		mainSizer = wx.BoxSizer(wx.VERTICAL)
		mainSizer.Add(topLbl, 0, wx.ALL, 5)
		mainSizer.Add(wx.StaticLine(self), 0,
				wx.EXPAND|wx.TOP|wx.BOTTOM, 5)
 
		# addrSizer is a grid that holds all of the address info
		addrSizer = wx.FlexGridSizer(cols=2, hgap=5, vgap=5)
		addrSizer.AddGrowableCol(1)
		addrSizer.Add(nameLbl, 0,
				wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
		addrSizer.Add(name, 0, wx.EXPAND)
		addrSizer.Add(addrLbl, 0,
				wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
		addrSizer.Add(addr1, 0, wx.EXPAND)
		addrSizer.Add((10,10)) # some empty space
		addrSizer.Add(addr2, 0, wx.EXPAND)
 
		addrSizer.Add(cstLbl, 0,
				wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
 
		# the city, state, zip fields are in a sub-sizer
		cstSizer = wx.BoxSizer(wx.HORIZONTAL)
		cstSizer.Add(city, 1)
		cstSizer.Add(state, 0, wx.LEFT|wx.RIGHT, 5)
		cstSizer.Add(zip)
		addrSizer.Add(cstSizer, 0, wx.EXPAND)
 
		addrSizer.Add(phoneLbl, 0,
				wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
		addrSizer.Add(phone, 0, wx.EXPAND)
		addrSizer.Add(emailLbl, 0,
				wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
		addrSizer.Add(email, 0, wx.EXPAND)
 
		# now add the addrSizer to the mainSizer
		mainSizer.Add(addrSizer, 0, wx.EXPAND|wx.ALL, 10)
 
		# The buttons sizer will put them in a row with resizeable
		# gaps between and on either side of the buttons
		btnSizer = wx.BoxSizer(wx.HORIZONTAL)
		btnSizer.Add((20,20), 1)
		btnSizer.Add(saveBtn)
		btnSizer.Add((20,20), 1)
		btnSizer.Add(cancelBtn)
		btnSizer.Add((20,20), 1)
 
		mainSizer.Add(btnSizer, 0, wx.EXPAND|wx.BOTTOM, 10)
 
		#Lie le sizer a panel
		self.SetSizer(mainSizer)
 
		# Fit the frame to the needs of the sizer.  The frame will
		# automatically resize the panel as needed.  Also prevent the
		# frame from getting smaller than this size.
		mainSizer.Fit(self)
		mainSizer.SetSizeHints(self)
 
##--Le main Loop
if __name__=='__main__':
	app=wx.PySimpleApp()
	frame=MainFrame(None,-1)
	frame.Show(True)		       
	app.MainLoop() | 
Partager