Add lab-inventory and door warning generation to gen-all-inventories.py.
authorW. Trevor King <wking@drexel.edu>
Mon, 2 Apr 2012 16:59:04 +0000 (12:59 -0400)
committerW. Trevor King <wking@drexel.edu>
Mon, 2 Apr 2012 16:59:04 +0000 (12:59 -0400)
contrib/gen-all-inventories.py

index 85e70183cd227f8085012644f9fe086c01ec90fd..37fc41fbc45c41485dbf214930a423c9456b0523 100755 (executable)
@@ -18,6 +18,7 @@ def filename(location, extension='.pdf'):
 
 
 def generate_inventories():
+    "Per-location inventories for each location."
     for location in _models.Location.objects.all():
         chemical_instances = location.chemical_instances.all()
         dg = _doc.DocGen(chemical_instances=chemical_instances)        
@@ -25,6 +26,23 @@ def generate_inventories():
         with open(filename(location), 'wb') as f:
             f.write(pdf)
 
+def generate_inventory():
+    "Single inventory for the whole lab"
+    chemical_instances = _models.ChemicalInstance.objects.all()
+    dg = _doc.DocGen(chemical_instances=chemical_instances)        
+    pdf = dg.inventory()
+    with open('inventory.pdf', 'wb') as f:
+        f.write(pdf)
+
+def generate_door_warning():
+    "Door warning for the whole lab"
+    chemical_instances = _models.ChemicalInstance.objects.all()
+    dg = _doc.DocGen(chemical_instances=chemical_instances)        
+    pdf = dg.door_warning()
+    with open('door-warning.pdf', 'wb') as f:
+        f.write(pdf)    
 
 if __name__ == '__main__':
     generate_inventories()
+    generate_inventory()
+    generate_door_warning()