Skip to content

Commit

Permalink
Bugfix affichage comp élève dans Prj
Browse files Browse the repository at this point in the history
  • Loading branch information
cedrick-f committed Jun 6, 2020
1 parent 39d0fef commit 0bdbef6
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 32 deletions.
40 changes: 12 additions & 28 deletions src/draw_cairo_prj2.py
Original file line number Diff line number Diff line change
Expand Up @@ -1300,21 +1300,15 @@ def drawBoutonCompetence(self, objet, dicIndic, y, h = None):
self.ctx.set_line_width (0.0004 * COEF)
dicIndic, dictype = dicIndic
prjeval = objet.GetProjetRef()

# if objet.code == "Elv":
# print("drawBoutonCompetence", dicIndic, dictype)
for s in dicIndic:

# if s in dicIndic.keys():
x = self.xComp[s]-self.wColComp/2

rect = (x, y-h/2, self.wColComp, h)

objet.GetDocument().zones_sens.append(Zone_sens([rect], obj = objet, param = s))

# if s in objet.GetDocument().rectComp.keys() and objet.GetDocument().rectComp[s] != None:
# objet.GetDocument().rectComp[s].append(rect)
# else:
# objet.GetDocument().rectComp[s] = [rect]

objet.pts_caract.append((x,y))

indics = dicIndic[s]
Expand All @@ -1323,35 +1317,25 @@ def drawBoutonCompetence(self, objet, dicIndic, y, h = None):
for a, indic in enumerate(indics):
deja = False
for i, part in enumerate(prjeval.listeParties):
# if objet.code == "Elv":
# print(indic, part)
if part in dictype[s][a] \
and (hasattr(objet, 'phaseCompatible') and objet.phaseCompatible(i)):

# for part in dictype[s][a]:
# if part in prjeval.parties:
if indic: # Rose ou bleu
# typeIndic = indic.getType(prjeval, exclu = False)
#
# if 'C' in typeIndic:
# d = -1
# elif 'S'

if part == prjeval.listeParties[0]: # Conduite
d = -1
else: # Soutenance
d = 1
and (not hasattr(objet, 'phaseCompatible') or objet.phaseCompatible(i)):

if indic: # Rose ou bleu
if part == prjeval.listeParties[0]:
d = -1 # Conduite
else:
d = 1 # Soutenance
self.ctx.set_source_rgba (*self.getCoulComp(part))

else:
d = 0
self.ctx.set_source_rgba (1, 1, 1, 0)

if d != 0: # Un rectangle coloré
if deja != 0: # On a jéja mis un rectangle ici (position deja)
if deja:
self.ctx.rectangle(x+a*dx, y, dx, h/2)
# else:
# self.ctx.rectangle(x+a*dx, y-h/2, dx, h/2-dh)
if deja: # On a déja mis un rectangle ici (position deja)
self.ctx.rectangle(x+a*dx, y, dx, h/2)

else:
self.ctx.rectangle(x+a*dx, y-h/2+d*dh, dx, h-dh)
Expand Down
11 changes: 7 additions & 4 deletions src/objects_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -19848,13 +19848,15 @@ def SetCompetences(self):
if self.onUndoRedo():
self.sendEvent(modif = modif, draw = True, verif = True)
else:
wx.CallAfter(self.sendEvent, modif = modif, draw = True, verif = True)
self.sendEvent(modif = modif, draw = True, verif = True)
# wx.CallAfter(self.sendEvent, modif = modif, draw = True, verif = True)

self.tache.projet.Verrouiller()

# ul = self.soup.find(id = "comp")
# ul.clear()
# self.Construire(self.dic , self.tache, self.prj, self.code, check = True)
self.SetPage()
# self.SetPage()
self.Update()


Expand All @@ -19867,8 +19869,9 @@ def OnCheck(self, evt):
self.tache.AjouterCompetence(code)
else:
self.tache.EnleverCompetence(code)

wx.CallAfter(self.SetCompetences)
evt.Skip()
self.SetCompetences()
# wx.CallAfter(self.SetCompetences)

##########################################################################################
def OnClick(self, evt):
Expand Down

0 comments on commit 0bdbef6

Please sign in to comment.