# 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
            strout = string
        else:
            strout = techClean(string, full=True)
            if string != '' and string in self.units:
                i = self.units.find(string)
                j = self.units.find(' ', i)
                if j < 0:
                    j = len(self.units)
                strout = strout + ' (' + self.units[i + 1 + len(string):j] + ')'
        self.hdrs[strout] = string
        return strout

    def populate(self):
        self.labels = {}
        self.lens = {}
        try:
            self.hdrs
        except:
            self.hdrs = {}
        if self.fields is not None:
            if '#' in self.fields:
                self.labels['#'] = 'int'
                self.lens['#'] = [len(str(len(self.objects))), 0]   # or int(math.log10(...))+1
            for fld in self.fields:
                if fld[0] == '%':
                    self.labels[fld] = 'str'
                    self.lens[fld] = 0
        for thing in self.objects:
            for prop in dir(thing):
                if prop[:2] != '__' and prop[-2:] != '__':

# 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

            strout = string
        else:
            strout = techClean(string, full=True)
            if string != '' and string in self.units:
                i = self.units.find(string)
                j = self.units.find(' ', i)
                if j < 0:
                    j = len(self.units)
                strout = strout + ' (' + self.units[i + 1 + len(string):j] + ')'
        self.hdrs[strout] = string
        return strout

    def populate(self):
        self.labels = {}
        self.lens = {}
        try:
            self.hdrs
        except:
            self.hdrs = {}
        if self.fields is not None:
            if '#' in self.fields:
                self.labels['#'] = 'int'
                self.lens['#'] = [len(str(len(self.objects))), 0]   # or int(math.log10(...))+1
            for fld in self.fields:
                if fld[0] == '%':
                    self.labels[fld] = 'str'
                    self.lens[fld] = 0
        for thing in self.objects:
            for prop in dir(thing):
                if prop[:2] != '__' and prop[-2:] != '__':

                    if self.fields is not None: