Skip to content

Commit

Permalink
Amélioration gestion nbr créneaux dans Progression
Browse files Browse the repository at this point in the history
  • Loading branch information
cedrick-f committed Apr 6, 2018
1 parent e07b3dd commit 7fcb85f
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
6 changes: 3 additions & 3 deletions pySequence.iss
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

;This file is part of pySequence
;
; Copyright (C) 2012-2017 Cédrick FAURY
; Copyright (C) 2012-2018 Cédrick FAURY
;
;pySequence is free software; you can redistribute it and/or modify
;it under the terms of the GNU General Public License as published by
Expand All @@ -20,7 +20,7 @@
[ISPP]
#define AppName "pySequence"
#define AppVersion "7.1"
#define AppVersionInfo "7.1.15"
#define AppVersionInfo "7.1.16"
#define AppVersionBase "7"

#define AppURL "https://github.com/cedrick-f/pySequence"
Expand All @@ -33,7 +33,7 @@ AppVersion={#AppVersion}
AppVerName={#AppName} {#AppVersion}

AppPublisher=Cédrick Faury
AppCopyright=Copyright © 2011-2017 Cédrick Faury
AppCopyright=Copyright © 2011-2018 Cédrick Faury
VersionInfoVersion = {#AppVersionInfo}

;Répertoire de base contenant les fichiers
Expand Down
4 changes: 3 additions & 1 deletion src/objects_wx.py
Original file line number Diff line number Diff line change
Expand Up @@ -5980,7 +5980,7 @@ def construire(self):
sb = wx.StaticBoxSizer(titre, wx.VERTICAL)

self.nbrCreneaux = Variable(u"Nombre de créneaux", lstVal = self.GetDocument().nbrCreneaux,
typ = VAR_ENTIER_POS, bornes = [1,5])
typ = VAR_ENTIER_POS, bornes = [self.GetDocument().GetNbrCreneauxMini(),5])
self.ctrlCreneaux = VariableCtrl(pageGen, self.nbrCreneaux, coef = 1, signeEgal = False,
help = u"Nombre de créneaux horaire", sizeh = 40*SSCALE,
sliderAGauche = True, scale = SSCALE)
Expand Down Expand Up @@ -6124,6 +6124,8 @@ def EvtVariable(self, event):
if self.GetDocument().SetNbrCreneaux(var.v[0]):
modif = u"Modification du nombre de creneaux de la Progression"
self.sendEvent(modif = modif)
else:
self.nbrCreneaux.setValeur(var.v[0]+1)

self.Refresh()

Expand Down
9 changes: 8 additions & 1 deletion src/pysequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -4657,12 +4657,19 @@ def GetNbrPeriodesEffectif(self):
"""
return len(self.GetPositions())

######################################################################################
def GetNbrCreneauxMini(self):
u""" Renvoie le nombre de créneau minimum autorisé
--> nombre de créneaux utilisés dans les Sequences ou Projets
"""
return max([s.creneaux[-1]+1 for s in self.sequences_projets])

######################################################################################
def SetNbrCreneaux(self, nc):
u""" Modifie le nombre de créneaux horaire utilisés dans la progression
Vérifie avant qu'on ne passe pas en dessous du nombre de créneaux utilisés dans les Sequences ou Projets
"""
nc_sp = max([s.creneaux[-1]+1 for s in self.sequences_projets])
nc_sp = self.GetNbrCreneauxMini()
if nc >= nc_sp:
self.nbrCreneaux = nc
return True
Expand Down

0 comments on commit 7fcb85f

Please sign in to comment.