cifrado r111 - in trunk: . package/cifrado



Author: bersace
Date: Sun Apr 20 11:33:19 2008
New Revision: 111
URL: http://svn.gnome.org/viewvc/cifrado?rev=111&view=rev

Log:
DÃterminer les pages à imprimer en une fois pour numÃroter
correctement les messages, mÃme si on n'en imprime qu'un.


Modified:
   trunk/ChangeLog
   trunk/package/cifrado/cifrado.py

Modified: trunk/package/cifrado/cifrado.py
==============================================================================
--- trunk/package/cifrado/cifrado.py	(original)
+++ trunk/package/cifrado/cifrado.py	Sun Apr 20 11:33:19 2008
@@ -288,6 +288,7 @@
         self.pages = []
         ms = []
         n = 0
+        no = 0
         if msg_cour is None:
             op.set_job_name("Grand-Jeu ÂÂ%sÂÂ"%(self.jeu.nom))
             # ajouter nd_chefs pages de chef
@@ -295,31 +296,33 @@
                 self.pages.append(self.jeu)
                 n+=1
 
-            i = self.jeu.messages.get_iter_first()
-            # boucler sur les messages
-            while i is not None and self.jeu.messages.iter_is_valid(i):
-                msg = self.jeu.messages.get_value(i, jeu.COL_MSG)
-                ms.append(msg)
-                i = self.jeu.messages.iter_next(i)
-
         else:
             op.set_job_name("Message ÂÂ%sÂÂ du Grand-Jeu ÂÂ%sÂÂ"%(msg_cour.titre,
                                                                   self.jeu.nom))
-            ms.append(msg_cour)
 
-        # boucler sur les Ãmissions du message
-        no = 0
-        for msg in ms:
+        i = self.jeu.messages.get_iter_first()
+        # boucler sur les messages
+        while i is not None and self.jeu.messages.iter_is_valid(i):
+            msg = self.jeu.messages.get_value(i, jeu.COL_MSG)
+            imprimer = msg_cour is None or msg_cour is msg
+
+            if imprimer:
+                ms.append(msg)
+
+            # boucler les Ãmission
             iter = self.jeu.forces.get_iter_first()
             while iter is not None and self.jeu.forces.iter_is_valid(iter):
                 force = self.jeu.forces.get_value(iter, jeu.COL_FORCE)
                 em = msg.emissions[force]
                 # ajouter le coupler message/emission si envoi
                 if em.env is True:
-                    n+=1
                     no+=1
-                    self.pages.append([no,msg,em])
+                    if imprimer:
+                        n+=1
+                        self.pages.append([no,msg,em])
                 iter = self.jeu.forces.iter_next(iter)
+            i = self.jeu.messages.iter_next(i)
+
 
         # Si aucun messages à imprimer
         if not n > 0:



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]