1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25 import wx
26 import wx.stc
27 from Utile.constantesGUI import *
28 from GUI.Legende import *
29 from GUI.Parametres import *
30 import traceback
31 import FMPanel
32 import MediteAppli.synthetic
33
34
35 import __main__
36
37
38 -class MainPanel(wx.Notebook):
39 """ Notebook gérant les différents panels autour d'une comparaison """
40 - def __init__(self, parent, planTravail):
41 wx.Notebook.__init__(self, parent, -1)
42 self.planTravail = planTravail
43 compPanel = ComparaisonPanel(self, self.planTravail)
44 self.InsertPage(0, compPanel, "Comparaison", True)
45
46
47 self.Refresh()
49 """Renvoie le panel de comparaison """
50 return self.GetPage(0)
51 - def isTreePanel(self):
55 - def setTitre(self, titre):
56 self.getComparaisonPanel().setTitre(titre)
57 - def addStatPanel(self,frequencyMatrix,textMatrix):
58 """ Ajoute des pages avec les panels de stat
59 pre: isinstance(frequencyMatrix,MediteAppli.Synthetic.TagFrequencyMatrix)
60 isinstance(frequencyMatrix,MediteAppli.Synthetic.TextFrequencyMatrix)
61 """
62 fmPanelHisto = FMPanel.FMPanelHisto(self,frequencyMatrix)
63 self.AddPage(fmPanelHisto, u"Histogrammes", True)
64
65 fmPanelCam = FMPanel.FMPanelCamembert(self,frequencyMatrix)
66 self.AddPage(fmPanelCam, u"Etiquetage", True)
67
68 fm2 = MediteAppli.synthetic.TagFrequencyMatrix2(frequencyMatrix)
69 fmPanelCam2 = FMPanel.FMPanelCamembert2(self,fm2)
70 self.AddPage(fmPanelCam2, u"Etiquetage2", True)
71
72 fm3 = MediteAppli.synthetic.TagFrequencyMatrix3(frequencyMatrix)
73 fmPanelCam3 = FMPanel.FMPanelCamembert3(self,fm3)
74 self.AddPage(fmPanelCam3, u"Etiquetage3", True)
75
76 fmPanelCam4 = FMPanel.FMPanelCamembert4(self,textMatrix)
77 self.AddPage(fmPanelCam4, u"Etiquetage4", True)
78
79
81 """ Classe du panel principal permettant d'afficher les informations du dossier genetique courant
82 les deux fenetres des états source et cible, et les fenetres transformations et commentaire
83 """
84 - def __init__(self, parent, planTravail):
85 wx.Panel.__init__(self, parent, -1)
86
87 self.planTravail = planTravail
88 self.initialised = False
89
90 self.remainingSpace = wx.Panel(self, -1, style=wx.SUNKEN_BORDER)
91 self.fenetreMedite = parent.GetParent().GetParent()
92
93 w,h = self.fenetreMedite.GetSize()
94 w2 = (w/2)-10
95
96
97
98 infoDGWin = wx.SashLayoutWindow(self, ID_WINDOW_TOP, wx.DefaultPosition,
99 wx.Size(300, 200), wx.NO_BORDER|wx.SW_3DSASH)
100 infoDGWin.SetDefaultSize(wx.Size(1000, 50))
101 infoDGWin.SetMinimumSizeY(50)
102 infoDGWin.SetOrientation(wx.LAYOUT_HORIZONTAL)
103 infoDGWin.SetAlignment(wx.LAYOUT_TOP)
104 infoDGWin.SetSashVisible(wx.SASH_BOTTOM, True)
105
106 fe = wx.FontEnumerator()
107 fe.EnumerateFacenames()
108 listFont = fe.GetFacenames()
109 listFont.sort()
110 s1 = wx.StaticText(self, -1, "Police : ", (150, 10))
111 self.lbFont = wx.ListBox(self, -1, wx.DefaultPosition, (180, 10),
112 listFont, wx.LB_SINGLE)
113 self.Bind(wx.EVT_LISTBOX, self.OnSelectFont, id=self.lbFont.GetId())
114
115 self.textAuteur = wx.StaticText(infoDGWin, -1, "Auteur : ", (10, 10))
116
117 nomAuteur = self.planTravail.getAuteur()
118 if nomAuteur == '': ecrireA = u"DG Non Charg\xe9"
119 else: ecrireA = nomAuteur
120
121 self.textInfoAuteur= wx.StaticText(infoDGWin, -1, ecrireA, (70, 10))
122
123
124 nomOeuvre = self.planTravail.getOeuvre()
125 if nomOeuvre == '': ecrireO = u"DG Non Charg\xe9 "
126 else: ecrireO = nomOeuvre
127
128 self.textOeuvre = wx.StaticText(infoDGWin, -1, "Oeuvre : ",(w2+100, 10), (90, -1))
129 self.textInfoOeuvre= wx.StaticText(infoDGWin, -1,ecrireO,(w2+170, 10))
130
131
132 nomVS = self.planTravail.getVersionSource()
133 self.textVS = wx.StaticText(infoDGWin, -1, "VS : ",(10, 30))
134 self.textInfoVersionS= wx.StaticText(infoDGWin, -1, nomVS, (35, 30))
135
136
137 nomFS = self.planTravail.getEtatSource()
138 self.textFS = wx.StaticText(infoDGWin, -1, "FS : ",(200, 30))
139 self.textInfoEtatS= wx.StaticText(infoDGWin, -1, nomFS, (225, 30))
140
141 self.indiceS = wx.TextCtrl(infoDGWin, -1, "",wx.Point(w2-50,28),wx.Size(30,18),wx.TE_READONLY)
142
143
144 nomVC = self.planTravail.getVersionCible()
145 self.textVC = wx.StaticText(infoDGWin, -1, "VC : ",(w2+100, 30))
146 self.textInfoVersionC= wx.StaticText(infoDGWin, -1, nomVC, (w2+125, 30))
147
148
149 nomFC = self.planTravail.getEtatCible()
150 self.textFC = wx.StaticText(infoDGWin, -1, "FC : ",(w2+300, 30))
151 self.textInfoEtatC= wx.StaticText(infoDGWin, -1, nomFC, (w2+325, 30))
152
153 self.indiceC = wx.TextCtrl(infoDGWin, -1, "",wx.Point(w2+20,28),wx.Size(30,18),wx.TE_READONLY)
154
155 infoDGWin.SetAutoLayout(True)
156 self.topWindow = infoDGWin
157
158
159
160 infoResultat = wx.SashLayoutWindow(self, ID_WINDOW_BOTTOM,
161 wx.DefaultPosition, wx.Size(300, 200),
162 wx.NO_BORDER|wx.SW_3D)
163 infoResultat.SetDefaultSize(wx.Size(1000, 200))
164 infoResultat.SetOrientation(wx.LAYOUT_HORIZONTAL)
165 infoResultat.SetAlignment(wx.LAYOUT_BOTTOM)
166 infoResultat.SetSashVisible(wx.SASH_TOP, True)
167
168 ID_NB = 6545
169 self.nb=wx.Notebook(infoResultat, ID_NB, style=wx.NB_BOTTOM)
170 self.nb.SetBestFittingSize(wx.Size(1000, 200))
171
172 self.transformations=wx.TextCtrl(self.nb, -1, "", wx.DefaultPosition, wx.DefaultSize,
173 wx.TE_MULTILINE|wx.TE_READONLY)
174 self.nb.AddPage(self.transformations,"TRANSFORMATIONS")
175
176 self.commentaire=wx.TextCtrl(self.nb, -1, "", wx.DefaultPosition, wx.DefaultSize,
177 wx.TE_MULTILINE)
178 self.nb.AddPage(self.commentaire,"COMMENTAIRE")
179
180 self.legende = PanelLegende(self.nb, self.fenetreMedite)
181 self.nb.AddPage(self.legende,"LEGENDE")
182
183 self.param = PanelParametres(self.nb, self.fenetreMedite)
184 self.nb.AddPage(self.param,"PARAMETRES")
185 wx.EVT_NOTEBOOK_PAGE_CHANGING(self,ID_NB, self.OnNBPageChanging)
186
187 self.bottomWindow = infoResultat
188 self.bottomWindow.Refresh()
189
190
191 winLeft = wx.SashLayoutWindow(self, ID_WINDOW_LEFT,
192 wx.DefaultPosition, wx.Size(200, 30),
193 wx.NO_BORDER|wx.SW_3D)
194
195 winLeft.SetDefaultSize(wx.Size(w2, 1000))
196 winLeft.SetOrientation(wx.LAYOUT_VERTICAL)
197 winLeft.SetAlignment(wx.LAYOUT_LEFT)
198 winLeft.SetSashVisible(wx.SASH_RIGHT, True)
199 winLeft.SetExtraBorderSize(0)
200 self.textWindowLeft = wx.TextCtrl(winLeft, -1, "", wx.DefaultPosition, wx.DefaultSize,
201 wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2)
202 self.textWindowLeft.SetValue(u"état source")
203 wx.EVT_LEFT_DOWN(self.textWindowLeft, self.indiceBlocLeft)
204
205 self.leftWindow = winLeft
206
207
208 winRight = wx.SashLayoutWindow(self, ID_WINDOW_RIGHT,
209 wx.DefaultPosition, wx.Size(200, 30),
210 wx.NO_BORDER|wx.SW_3D)
211 winRight.SetDefaultSize(wx.Size(w2, 1000))
212 winRight.SetOrientation(wx.LAYOUT_VERTICAL)
213 winRight.SetAlignment(wx.LAYOUT_RIGHT)
214 winRight.SetSashVisible(wx.SASH_LEFT, True)
215 winRight.SetExtraBorderSize(0)
216 self.textWindowRight = wx.TextCtrl(winRight, -1, "", wx.DefaultPosition, wx.DefaultSize,
217 wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2)
218 self.textWindowRight.SetValue(u"état cible")
219 wx.EVT_LEFT_DOWN(self.textWindowRight, self.indiceBlocRight)
220
221 self.rightWindow = winRight
222
223 wx.EVT_SASH_DRAGGED_RANGE(self, ID_WINDOW_TOP,ID_WINDOW_BOTTOM, self.OnSashDrag)
224 wx.EVT_SIZE(self, self.OnSize)
225
228
231
233 face = self.lbFont.GetStringSelection()
234 font = wx.Font(10, wx.DEFAULT, wx.NORMAL, wx.NORMAL, False, face)
235
236 self.textWindowLeft.SetFont(font)
237 self.textWindowRight.SetFont(font)
238 self.transformations.SetFont(font)
239 self.commentaire.SetFont(font)
240
241 - def OnNBPageChanging(self,event):
242 self.legende.bInser.SetBackgroundColour(self.legende.coulInsert)
243 self.legende.bSupp.SetBackgroundColour(self.legende.coulSupp)
244 self.legende.bRemp.SetBackgroundColour(self.legende.coulRemp)
245
246
248 if event.GetDragStatus() == wx.SASH_STATUS_OUT_OF_RANGE:
249 return
250 eID = event.GetId()
251 if eID == ID_WINDOW_TOP:
252 self.topWindow.SetDefaultSize(wx.Size(1000, event.GetDragRect().height))
253 elif eID == ID_WINDOW_LEFT:
254 self.leftWindow.SetDefaultSize(wx.Size(event.GetDragRect().width, 1000))
255 elif eID == ID_WINDOW_RIGHT :
256 self.rightWindow.SetDefaultSize(wx.Size(event.GetDragRect().width, 1000))
257 elif eID == ID_WINDOW_BOTTOM:
258 self.bottomWindow.SetDefaultSize(wx.Size(1000, event.GetDragRect().height))
259
260 wx.LayoutAlgorithm().LayoutWindow(self, self.remainingSpace)
261 self.remainingSpace.Refresh()
262
263
265 wx.LayoutAlgorithm().LayoutWindow(self)
266 w,h=event.GetSize()
267 self.size(w)
269 w,h=self.fenetreMedite.GetSize()
270 self.size(w)
272 width=w/2
273 self.leftWindow.SetDefaultSize(wx.Size(width, 1000))
274 self.rightWindow.SetDefaultSize(wx.Size(w-width, 1000))
275
276
277
278
279
280
285
290
291
320
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
387
388 n = 0
389 tableau = pTransfo.getBlocsCommuns()
390 for cple in tableau[:len(tableau)/2] :
391
392 if indice>=cple[0] and indice<cple[1]:
393 return n, indice-cple[0]
394 n+=1
395 return None,None
396
398
399
400
401
402
403 n=0
404 indiceC = indice+pTransfo.getLgSource()
405 tableau = pTransfo.getBlocsCommuns()
406
407 taille = len(tableau)/2
408 for cple in tableau :
409 if indiceC>=cple[0] and indiceC<cple[1]:
410 return n-taille, indiceC-cple[0]
411 n+=1
412 return None,None
413
415 blocs = pTransfo.getBlocsCommuns()
416 cple = blocs[numBloc]
417 return cple[0]
418
420 lgTextS = pTransfo.getLgSource()
421 blocs = pTransfo.getBlocsCommuns()
422 taille = len(blocs)/2
423 i = numBloc+taille
424
425 cple = blocs[i]
426 indice = cple[0]-lgTextS
427 return indice
428
430 pairesBlocsDepl = pTransfo.getPairesBlocsDeplaces()
431 lgTextS = pTransfo.getLgSource()
432 for b1,b2 in pairesBlocsDepl:
433 if (indice >= b1[0] and indice<b1[1]):
434 return b2[0]-lgTextS
435
437 pairesBlocsDepl = pTransfo.getPairesBlocsDeplaces()
438 lgTextS = pTransfo.getLgSource()
439 for b1,b2 in pairesBlocsDepl:
440 if (indice+lgTextS >= b2[0] and indice+lgTextS<b2[1]):
441 return b1[0]
442
444 - def __init__(self, parent, planTravail):
445 wx.Panel.__init__(self, parent, -1)
446 self.planTravail = planTravail
447 self.initialised = False
448 self.fenetreMedite = parent.GetParent().GetParent()
449
450 self.remainingSpace = wx.Panel(self, -1, style=wx.SUNKEN_BORDER)
451 self.Bind(wx.wx.EVT_SASH_DRAGGED_RANGE, self.OnSashDrag,
452 id=ID_WINDOW_TOP, id2=ID_WINDOW_BOTTOM,)
453 self.Bind(wx.wx.EVT_SIZE, self.OnSize)
454
455 w,h = self.fenetreMedite.GetSize()
456 w2 = (w/2)-10
457
458
459
460 infoDGWin = wx.SashLayoutWindow(self, ID_WINDOW_TOP, wx.DefaultPosition,
461 wx.Size(300, 200), wx.NO_BORDER|wx.SW_3DSASH)
462 infoDGWin.SetDefaultSize(wx.Size(1000, 50))
463 infoDGWin.SetMinimumSizeY(50)
464 infoDGWin.SetOrientation(wx.LAYOUT_HORIZONTAL)
465 infoDGWin.SetAlignment(wx.LAYOUT_TOP)
466 infoDGWin.SetSashVisible(wx.SASH_BOTTOM, True)
467
468
469
470
471
472
473
474
475
476
477 btn = wx.Button(infoDGWin, -1, "Police", (200, 6))
478 self.Bind(wx.wx.EVT_BUTTON, self.OnSelectFont, btn)
479
480 self.textAuteur = wx.StaticText(infoDGWin, -1, "Auteur : ", (10, 10))
481
482 nomAuteur = self.planTravail.getAuteur()
483 if nomAuteur == '': ecrireA = u"DG Non Charg\xe9"
484 else: ecrireA = nomAuteur
485
486 self.textInfoAuteur= wx.StaticText(infoDGWin, -1, ecrireA, (70, 10))
487
488
489 nomOeuvre = self.planTravail.getOeuvre()
490 if nomOeuvre == '': ecrireO = u"DG Non Charg\xe9 "
491 else: ecrireO = nomOeuvre
492
493 self.textOeuvre = wx.StaticText(infoDGWin, -1, "Oeuvre : ",(w2+100, 10), (90, -1))
494 self.textInfoOeuvre= wx.StaticText(infoDGWin, -1,ecrireO,(w2+170, 10))
495
496
497 nomVS = self.planTravail.getVersionSource()
498 self.textVS = wx.StaticText(infoDGWin, -1, "VS : ",(10, 30))
499 self.textInfoVersionS= wx.StaticText(infoDGWin, -1, nomVS, (35, 30))
500
501
502 nomFS = self.planTravail.getEtatSource()
503 self.textFS = wx.StaticText(infoDGWin, -1, "FS : ",(200, 30))
504 self.textInfoEtatS= wx.StaticText(infoDGWin, -1, nomFS, (225, 30))
505
506 self.indiceS = wx.TextCtrl(infoDGWin, -1, "",wx.Point(w2-50,28),wx.Size(30,18),wx.TE_READONLY)
507
508
509 nomVC = self.planTravail.getVersionCible()
510 self.textVC = wx.StaticText(infoDGWin, -1, "VC : ",(w2+100, 30))
511 self.textInfoVersionC= wx.StaticText(infoDGWin, -1, nomVC, (w2+125, 30))
512
513
514 nomFC = self.planTravail.getEtatCible()
515 self.textFC = wx.StaticText(infoDGWin, -1, "FC : ",(w2+300, 30))
516 self.textInfoEtatC= wx.StaticText(infoDGWin, -1, nomFC, (w2+325, 30))
517
518 self.indiceC = wx.TextCtrl(infoDGWin, -1, "",wx.Point(w2+20,28),wx.Size(30,18),wx.TE_READONLY)
519
520
521 self.topWindow = infoDGWin
522
523
524
525 infoResultat = wx.SashLayoutWindow(self, ID_WINDOW_BOTTOM,
526 wx.DefaultPosition, wx.Size(300, 200),
527 wx.NO_BORDER|wx.SW_3D)
528 infoResultat.SetDefaultSize(wx.Size(1000, 200))
529 infoResultat.SetOrientation(wx.LAYOUT_HORIZONTAL)
530 infoResultat.SetAlignment(wx.LAYOUT_BOTTOM)
531 infoResultat.SetSashVisible(wx.SASH_TOP, True)
532
533 ID_NB = 6545
534 self.nb=wx.Notebook(infoResultat, ID_NB, style=wx.NB_BOTTOM)
535
536 self.nb.SetInitialSize(wx.Size(1000, 200))
537
538 options = wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2
539 if __main__.RTL: options |= wx.TE_RIGHT
540 self.transformations=wx.TextCtrl(self.nb, -1, "", wx.DefaultPosition, wx.DefaultSize,
541 options)
542 self.nb.AddPage(self.transformations,"TRANSFORMATIONS")
543
544 self.commentaire=wx.TextCtrl(self.nb, -1, "", wx.DefaultPosition, wx.DefaultSize,
545 wx.TE_MULTILINE|wx.TE_RICH2)
546 self.nb.AddPage(self.commentaire,"COMMENTAIRE")
547
548 self.legende = PanelLegende(self.nb, self.fenetreMedite)
549 self.nb.AddPage(self.legende,"LEGENDE")
550
551 self.param = PanelParametres(self.nb, self.fenetreMedite)
552 self.nb.AddPage(self.param,"PARAMETRES")
553 wx.EVT_NOTEBOOK_PAGE_CHANGING(self,ID_NB, self.OnNBPageChanging)
554
555 self.bottomWindow = infoResultat
556 self.bottomWindow.Refresh()
557
558
559 winLeft = wx.SashLayoutWindow(self, ID_WINDOW_LEFT,
560 wx.DefaultPosition, wx.Size(200, 30),
561 wx.NO_BORDER|wx.SW_3D)
562
563 winLeft.SetDefaultSize(wx.Size(w2, 1000))
564 winLeft.SetOrientation(wx.LAYOUT_VERTICAL)
565 winLeft.SetAlignment(wx.LAYOUT_LEFT)
566 winLeft.SetSashVisible(wx.SASH_RIGHT, True)
567 winLeft.SetExtraBorderSize(0)
568 options = wx.TE_MULTILINE|wx.TE_READONLY|wx.TE_RICH2
569 if __main__.RTL: options |= wx.TE_RIGHT
570 self.textWindowLeft = wx.TextCtrl(winLeft, -1, "", wx.DefaultPosition, wx.DefaultSize,
571 options)
572
573
574
575 wx.EVT_LEFT_DOWN(self.textWindowLeft, self.indiceBlocLeft)
576
577 self.leftWindow = winLeft
578
579
580 winRight = wx.SashLayoutWindow(self, ID_WINDOW_RIGHT,
581 wx.DefaultPosition, wx.Size(200, 30),
582 wx.NO_BORDER|wx.SW_3D)
583 winRight.SetDefaultSize(wx.Size(w2, 1000))
584 winRight.SetOrientation(wx.LAYOUT_VERTICAL)
585 winRight.SetAlignment(wx.LAYOUT_RIGHT)
586 winRight.SetSashVisible(wx.SASH_LEFT, True)
587 winRight.SetExtraBorderSize(0)
588 self.textWindowRight = wx.TextCtrl(winRight, -1, "", wx.DefaultPosition, wx.DefaultSize,
589 options)
590
591
592 wx.EVT_LEFT_DOWN(self.textWindowRight, self.indiceBlocRight)
593
594 self.rightWindow = winRight
595
597 data = wx.FontData()
598 data.EnableEffects(True)
599 textAttribute = wx.TextAttr()
600 self.textWindowRight.GetStyle(0, textAttribute)
601
602 data.SetInitialFont(self.textWindowLeft.GetFont())
603 data.SetColour(textAttribute.GetTextColour())
604
605 dlg = wx.FontDialog(self, data)
606 if dlg.ShowModal() == wx.ID_OK:
607 data = dlg.GetFontData()
608 font = data.GetChosenFont()
609 colour = data.GetColour()
610 self.textWindowLeft.SetFont(font)
611 self.textWindowRight.SetFont(font)
612 self.transformations.SetFont(font)
613 self.commentaire.SetFont(font)
614 self.fenetreMedite.affichageCouleur()
615 dlg.Destroy()
616
617 -class stylTxt(wx.stc.StyledTextCtrl):
619 wx.stc.StyledTextCtrl.__init__(self,parent,id)
620 self.SetMarginWidth(0, 0)
621 self.SetMarginWidth(1, 0)
622 self.SetMarginWidth(2, 0)
623 self.StyleSetSpec(0, "bold,underline" )
624 self.StyleSetSpec(1, "back:#0000FF" )
625 self.StyleSetSpec(2, "back:#00FF00" )
626
628 return self.GetCurrentPos()
629
634
636 self.StartStyling(deb, 0x1f)
637 self.SetStyling(fin-deb, style)
638