def generate_versions(f, plants): v = IniParser() v.read('versions.ini') for app in v.sections(): f.write('<tr>\n') f.write('<th>%s</th>\n' % app) for i in plants: tooltip = ' title = \'%s%s\'' % (app, create_tooltip(i)) o = ('', '') if app in i.versions: o = i.versions[app] ver = o[0] hash = o[1] current = v.get(app, 'current').split(',' ' ') testing = v.get(app, 'testing').split(',' ' ') if ver in current: style = ' class="green"' elif ver in testing: style = ' class="yellow"' else: style = ' class="pink"' #endif if hash != v.get(app, 'v%s' % ver): style = ' class="red"' if not hash and not ver: style = ' class="grey"' f.write('<td%s%s>%s</td>\n' % (tooltip, style, ver)) #endfor f.write('</tr>\n')
def generate_ini_hashes(f, plants): h = IniParser() h.read('hashes.ini') for ini in h.sections(): f.write('<tr>\n') f.write('<th>%s</th>\n' % ini) for i in plants: tooltip = ' title = \'%s%s\'' % (ini, create_tooltip(i)) if ini in i.ini_hashes: hash = 'h%s' % i.ini_hashes[ini] style = ' class="pink"' if h.has_option(ini, hash): val = h.get(ini, hash) app = val.split(':')[0] if (h.get(ini, hash) == '' or (app in i.versions and i.versions[app][0] in h.get(ini, hash))) \ and (not h.has_option(ini, '%s_motherboard' % hash) or i.motherboard in h.get(ini, '%s_motherboard' % hash)): style = ' class="green"' if h.has_option(ini, '%s_message' % hash): hash = h.get(ini, '%s_message' % hash) else: hash = '' else: style = ' class="yellow"' #endif #endif else: hash = '' style = ' class="grey"' #endif f.write('<td%s%s>%s</td>\n' % (tooltip, style, hash)) #endfor f.write('</tr>\n')
def assign_materials_to_silos(adaptivity): log.info('assign_materials_to_silos function called') pom = {'AGG': 'Aggregate', 'CEM': 'Cement', 'ADM': 'Admixture', 'WTR': 'Water'} ret = {} f = './temp/ini/placemnt.ini' if not os.path.isfile(f): return ret i = IniParser() i.read(f) for silo in adaptivity: base = silo[0:3] number = silo[3:] for s in i.sections(): if pom[base] in s and 'Silo%s' % number in s: ret[silo] = i.get(s, 'Name') #endif #endfor #endfor return ret