main

This code contains the structure of the tool. It calls the different functions of the other python codes to create the wanted results ! It contains the definition of the application using tkinter.

Avertissement

1/ Make sure all dependencies are installed. Use the following code in a command line: py -m pip install -r requirements.txt

1/ Here is a quick explanation of the variables used:

pathways_data - a pd.Dataframe of the inputs, outputs and parameters of each « active » pathways database_endpoint_impact - a pd.Dataframe with the parameters used for each environnemental and social impact.

LCI - Life cycle inventory of the selected scenario. LCI_ref - Life cycle inventory of the selected reference. pathways_list - list of the CreatePathway objects of the selected scenario, each object represent a pathway. pathways_list_ref - list of the CreatePathway objects of the selected reference, each object represent a pathway.

database_output - a pd.Dataframe, similar to “database_endpoint_impacts” but with new columns for the impact values of the reference, and each scenario.

2/ Structure

PART 1: Function for the application generate() action_stakeholder_list() action_scenario_list() action_reference_list() stakeholder_command() import_file()

PART 2: Write the application General Home layout Application Parameters Home buttons

3/ Functions

main.action_reference_list(event)

The action_reference_list function will update the reference attribute in pa class object (pa.ref_name).

main.action_scenario_list(event)

The action_scenario_list function will update the scenario attribute in pa class object (pa.scenario_name).

main.action_stakeholder_list(event)

The action_stakeholder_list function will update the stakeholder attribute in pa class object (pa.stakeholder).

main.dim_status()

This function will store the precision dimension choice (made in Menu window) in pa.error_shown.

main.export()

It export a panda.DataFrame to an excel file. It export in the same folder as main.py. The exported name is « Export_year_month_day_hour_minute_second »

Avertissement

You should Generate a result with Generate before trying to export the results.

main.generate()

Generate will launch a new window with a matplotlib graph containing the donut with the specified parameters (stored in pa Class object).

generate() will get the file name for VarString file_path defined in the Import tk.Button Then it will load the pathway_data, database_endpoint_impact, reference and scenario databases.

Avertissement

Make sure the name of the pathways_data Database is *4.Pathways_recap* and the database for endpoints impacts is named *5.Graph_recap*

Then generate() will launch the calcul module from pathways.py and weighing.py Finally generate() will launch the plotting function from Graph.py, according to pa.mode (specific or multiple view)

main.import_file()

This function is used to select the file which contains the project data you want to evaluate Currents type of files supported: - EXCEL (.xlsx) - Open Document Format (.odf)

Avertissement

1/ Make sure the file you load is in the same directory as main.py

2/ Make sure all your scenario sheet’s name start with *SCENARIO* So the sheet name should be SCENARIO-your_scenario_name

This import() function will also update the reference and scenario list of the user’s interface.

main.stakeholder_command()

This function will hide or show the stakeholder list button depending on whether specific stakeholder is checked. It will also store in pa.mode which mode is being chosen (multiple or specific).