cpmodel / FTT_StandAlone

Future Technology Transformation models
GNU General Public License v3.0
10 stars 1 forks source link

Changes (mostly to the frontend) for cross-platform use #104

Closed ct-camecon closed 5 months ago

ct-camecon commented 6 months ago

Overview

Code changes to run on non-Windows (e.g. macOS, Linux) platforms, with some minor tidying and supporting additions elsewhere.

Subject to (stress-)testing, this should close #40.

Almost all changes concern cross-platform, rather than Windows-specific, approaches to handling file and folder paths, for the most part using pathlib.

Other changes:

Approach

Focus on getting the following to run:

  1. run_file.py, which runs FTT from the terminal
  2. Backend_FTT.py, which starts the browser-based GUI to run FTT and examine model results

Note that the aim was to make changes that addressed runtime errors only, rather than just blanket replace all instances. There are various functions in Backend_FTT.py that have been left alone for this reason, even if the corrections are (probably) safe and obvious.

Also note that the EXTRACT and GAMMA tabs have not been tested, pending further developments to those parts of the model and frontend.

Untouched functions, of which there are ten, have the following comment immediately below their function signature: # TODO: Still to review for cross-platform compatibility

Tests

Tests involved alternately running python Backend_FTT.py in:

Outputs and behaviour appear to be preserved between the two versions, as well as compared to the original fork (admittedly, to this non-FTT specialist).

pv-camecon commented 6 months ago

@sgulati26 has been able to run the model using the front-end and it produces the same results as running it on a Windows machine.

I'll leave the formal review to one of the Mac users.

ct-camecon commented 6 months ago

@jp-camecon did some further tests on Windows to check for issues. Things look to be working as normal/before.

So we're just waiting for (at least) one Mac user to test this independently.

Femkemilene commented 6 months ago

@jk694exe or @zoeberger : both of you have a Mac, right? Do you have time to test this?

cormacmlynch commented 5 months ago

We just had someone with a Mac successfully run the model from the front-end in an EEIST2 FTT training session. Might still want a more formal review before merging though.

zoeberger commented 5 months ago

When trying to run the Backend.py file from a Mac, there is an issue with the "start" command (cf picture). When I tried to use the equivalent for Mac (i.e. "open"), it created an issue with the thread object (cf picture).

Screenshot 2024-04-09 at 13 00 50
ct-camecon commented 5 months ago

Could you check if you're testing the cross-platform branch? https://github.com/ct-camecon/FTT_StandAlone/tree/cross-platform

In this branch, I replaced the systemcall to the Windows start command with a more general call to the Python webbrowser module.

Femkemilene commented 5 months ago

@zoeberger: in case you missed Chris' message.