Skip to content

Commit

Permalink
On opening a batch, show PPN, title, Volume no. of previously entered…
Browse files Browse the repository at this point in the history
… carriers
  • Loading branch information
bitsgalore committed May 8, 2019
1 parent c5431df commit 58f077d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions iromlab/iromlab.pyw
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import os
import csv
import imp
import time
import glob
import xml.etree.ElementTree as ETree
import threading
import uuid
Expand Down Expand Up @@ -188,6 +189,27 @@ class carrierEntry(tk.Frame):
logging.info(''.join(['*** Opening existing batch ', config.batchFolder, ' ***']))

if config.batchFolder != '':
# Get directory listing of job files sorted by creation time
jobFiles = list(filter(os.path.isfile, glob.glob(config.jobsFolder + '/*')))
jobFiles.sort(key=lambda x: os.path.getctime(x))
jobCount = 1

for job in jobFiles:
# Open job file, read contents to list
fj = open(job, "r", encoding="utf-8")
fjCSV = csv.reader(fj)
jobList = next(fjCSV)
fj.close()

if jobList[0] != 'EOB':
PPN = jobList[1]
title = jobList[2]
volumeNo = jobList[3]

# Add PPN/Title + Volume number to treeview widget
self.tv.insert('', 0, text=str(jobCount), values=(PPN, title, volumeNo))
jobCount += 1

# Update state of buttons /widgets, taking into account whether batch was
# finalized by user
self.bNew.config(state='disabled')
Expand Down

0 comments on commit 58f077d

Please sign in to comment.