# Path: sirenicons.py
# class Icons:
#     def __init__(self):
#         config = configparser.RawConfigParser()
#         if len(sys.argv) > 1:
#             config_file = sys.argv[1]
#         else:
#             config_file = getModelFile('SIREN.ini')
#         config.read(config_file)
#         self.icons = {'Biomass': 'biomass_g.png', 'CST': 'solar_g.png', 'Fossil': 'fossil_g.png',
#                       'Geothermal': 'hot_rocks_g.png', 'Hydro': 'hydro_g.png',
#                       'Other': 'question.png', 'PV': 'solar_pv_g.png',
#                       'Solar Thermal': 'solar_g.png', 'Wave': 'wave_g.png', 'Wind': 'wind_g.png'}
#         try:
#             technologies = config.get('Power', 'technologies').split()
#             for tec in technologies:
#                 tec = techClean(tec)
#                 try:
#                     self.icons[tec] = config.get(tec, 'icon')
#                 except:
#                     pass
#             technologies = config.get('Power', 'fossil_technologies').split()
#             for tec in technologies:
#                 tec = techClean(tec)
#                 try:
#                     self.icons[tec] = config.get(tec, 'icon')
#                 except:
#                     pass
#         except:
#             pass
# 
#     def getIcon(self, technology):
#         if technology in list(self.icons.keys()):
#             return self.icons[technology]
#         tech = technology
#         if technology == 'Biogas':
#             tech = 'Biomass'
#         elif 'PV' in technology:
#             tech = 'PV'
#         elif technology[:6] == 'Fossil':
#             tech = 'Fossil'
#         try:
#             return self.icons[tech]
#         except:
#             return 'question.png'
# 
# Path: senuser.py
# def techClean(tech, full=False):
#     cleantech = tech.replace('_', ' ').title()
#     cleantech = cleantech.replace('Bm', 'BM')
#     cleantech = cleantech.replace('Ccgt', 'CCGT')
#     cleantech = cleantech.replace('Ccg', 'CCG')
#     cleantech = cleantech.replace('Cst', 'CST')
#     cleantech = cleantech.replace('Lng', 'LNG')
#     cleantech = cleantech.replace('Ocgt', 'OCGT')
#     cleantech = cleantech.replace('Ocg', 'OCG')
#     cleantech = cleantech.replace('Phs', 'PHS')
#     cleantech = cleantech.replace('Pv', 'PV')
#     if full:
#         alll = [['Cf', 'CF'], ['hi ', 'HI '], ['Lcoe', 'LCOE'], ['Mw', 'MW'],
#                 ['ni ', 'NI '], ['Npv', 'NPV'], ['Re', 'RE'], ['Tco2E', 'tCO2e']]
#         for each in alll:
#             cleantech = cleantech.replace(each[0], each[1])
#     return cleantech


import os
import xlwt
import displayobject
from PyQt5 import QtCore, QtWidgets
from PyQt5 import QtGui, QtWidgets
from sirenicons import Icons
from senuser import techClean
                        elif hdr_types[cl] == 'float':
                            try:
                                txt = self.table.item(rw, cl).text().strip()
                                txt = txt.replace(',', '')
                            except:
                                pass
                        if ',' in txt:
                            line += '"' + txt + '"'
                        else:
                            line += txt
                tf.write(line + '\n')
            tf.close()
        else:
            wb = xlwt.Workbook()
            ws = wb.add_sheet(iam)
            hdr_types = []
            dec_fmts = []
            xl_lens = []
            hdr_rows = 0
            for cl in range(self.table.columnCount()):
                hdr = self.table.horizontalHeaderItem(cl).text()
                if hdr[0] != '%':
                    ws.write(0, cl, hdr)
                txt = self.hdrs[hdr]
                try:
                    hdr_types.append(self.labels[txt.lower()])
                    txt = txt.lower()
                except:
                    try:
                        hdr_types.append(self.labels[txt])

# Path: sirenicons.py
# class Icons:
#     def __init__(self):
#         config = configparser.RawConfigParser()
#         if len(sys.argv) > 1:
#             config_file = sys.argv[1]
#         else:
#             config_file = getModelFile('SIREN.ini')
#         config.read(config_file)
#         self.icons = {'Biomass': 'biomass_g.png', 'CST': 'solar_g.png', 'Fossil': 'fossil_g.png',
#                       'Geothermal': 'hot_rocks_g.png', 'Hydro': 'hydro_g.png',
#                       'Other': 'question.png', 'PV': 'solar_pv_g.png',
#                       'Solar Thermal': 'solar_g.png', 'Wave': 'wave_g.png', 'Wind': 'wind_g.png'}
#         try:
#             technologies = config.get('Power', 'technologies').split()
#             for tec in technologies:
#                 tec = techClean(tec)
#                 try:
#                     self.icons[tec] = config.get(tec, 'icon')
#                 except:
#                     pass
#             technologies = config.get('Power', 'fossil_technologies').split()
#             for tec in technologies:
#                 tec = techClean(tec)
#                 try:
#                     self.icons[tec] = config.get(tec, 'icon')
#                 except:
#                     pass
#         except:
#             pass
# 
#     def getIcon(self, technology):
#         if technology in list(self.icons.keys()):
#             return self.icons[technology]
#         tech = technology
#         if technology == 'Biogas':
#             tech = 'Biomass'
#         elif 'PV' in technology:
#             tech = 'PV'
#         elif technology[:6] == 'Fossil':
#             tech = 'Fossil'
#         try:
#             return self.icons[tech]
#         except:
#             return 'question.png'
# 
# Path: senuser.py
# def techClean(tech, full=False):
#     cleantech = tech.replace('_', ' ').title()
#     cleantech = cleantech.replace('Bm', 'BM')
#     cleantech = cleantech.replace('Ccgt', 'CCGT')
#     cleantech = cleantech.replace('Ccg', 'CCG')
#     cleantech = cleantech.replace('Cst', 'CST')
#     cleantech = cleantech.replace('Lng', 'LNG')
#     cleantech = cleantech.replace('Ocgt', 'OCGT')
#     cleantech = cleantech.replace('Ocg', 'OCG')
#     cleantech = cleantech.replace('Phs', 'PHS')
#     cleantech = cleantech.replace('Pv', 'PV')
#     if full:
#         alll = [['Cf', 'CF'], ['hi ', 'HI '], ['Lcoe', 'LCOE'], ['Mw', 'MW'],
#                 ['ni ', 'NI '], ['Npv', 'NPV'], ['Re', 'RE'], ['Tco2E', 'tCO2e']]
#         for each in alll:
#             cleantech = cleantech.replace(each[0], each[1])
#     return cleantech


# Path: displaytable.py
import os
import xlwt
import displayobject
from PyQt5 import QtCore, QtWidgets
from PyQt5 import QtGui, QtWidgets
from sirenicons import Icons
from senuser import techClean

                        elif hdr_types[cl] == 'float':
                            try:
                                txt = self.table.item(rw, cl).text().strip()
                                txt = txt.replace(',', '')
                            except:
                                pass
                        if ',' in txt:
                            line += '"' + txt + '"'
                        else:
                            line += txt
                tf.write(line + '\n')
            tf.close()
        else:
            wb = xlwt.Workbook()
            ws = wb.add_sheet(iam)
            hdr_types = []
            dec_fmts = []
            xl_lens = []
            hdr_rows = 0
            for cl in range(self.table.columnCount()):
                hdr = self.table.horizontalHeaderItem(cl).text()
                if hdr[0] != '%':
                    ws.write(0, cl, hdr)
                txt = self.hdrs[hdr]
                try:
                    hdr_types.append(self.labels[txt.lower()])
                    txt = txt.lower()
                except:
                    try:
                        hdr_types.append(self.labels[txt])

                    except: