Skip to content

Commit

Permalink
Merge branch 'main' into first_level_cont
Browse files Browse the repository at this point in the history
  • Loading branch information
marc-vdm committed Nov 26, 2024
2 parents a9ca09f + 023eb5a commit 6cc980f
Show file tree
Hide file tree
Showing 5 changed files with 85 additions and 23 deletions.
19 changes: 12 additions & 7 deletions activity_browser/docs/wiki/Getting-Started.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,22 @@ Finally, the menu bar at the top allows you to manage Activity Browser, Plugins
### Installing a biosphere and impact categories
In the `Project` tab there is initially a button called `Set up your project with default data`.
Click this button to add the default data.
This adds a `biosphere` database which contains a number of standardized biosphere flows.

> [!NOTE]
> Once a project is set up, you cannot reset it.
This adds a `biosphere` database which contains a number of standardized biosphere flows
and compatible impact categories.

![project setup - choose type](./assets/project_setup_dialog_choose_type.png)

#### Setting up with Biosphere3 data
You can choose a biosphere version, this biosphere version will be compatible with that version of ecoinvent,
if you choose to import that later.
If you don't use ecoinvent, don't worry about this and choose the highest version.
You can choose a biosphere version, which will install a biosphere database and compatible impact categories.

> [!IMPORTANT]
> In case you want to install ecoinvent later, choosing a biosphere version will make your project compatible with
> **only** the version of biosphere you install.
> e.g. installing biosphere `3.6` will make your project only compatible with ecoinvent `3.6` databases.
>
> Setting the biosphere version is **permanent** for a project, you cannot change this version later.
>
> If you do not plan on using ecoinvent in this project, don't worry about this and choose the highest version.
![project setup - choose biosphere version](./assets/project_setup_dialog_bio_vsn.png)

Expand Down
72 changes: 58 additions & 14 deletions activity_browser/docs/wiki/Installation-Guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ You can install and start the activity-browser like this:
Skip this step if you already have a working installation of Anaconda or Miniconda, but make sure to keep your
conda installation up-to-date: `conda update -n base conda`.

You need the python package manager [Anaconda](https://anaconda.org) to install Activity Browser.
You need the python package manager [Anaconda](https://anaconda.org) to install Activity Browser.
Anaconda is somewhat like an app-store for python programs.
You can install the full [Anaconda user interface (navigator)](https://www.anaconda.com/download/success)
or just the minimal command-line installer,
[Miniconda](https://docs.anaconda.com/miniconda/#miniconda-latest-installer-links).
Expand All @@ -23,33 +24,76 @@ If needed, see also the
or the
[Conda cheat sheet](https://docs.conda.io/projects/conda/en/latest/_downloads/843d9e0198f2a193a3484886fa28163c/conda-cheatsheet.pdf).

## Add the Conda-Forge channel
The Activity Browser has many dependencies that are managed by the
[conda-forge](https://conda.io/docs/user-guide/tasks/manage-channels.html)
channel.
Open a cmd-window or terminal (in Windows you may have to use the Anaconda prompt) and type the following:
- Install the Anaconda manager of your choice from the above options.
- Start `Anaconda Prompt` from the start menu.
- This is a terminal window with `conda`, you will need this prompt for all next steps.

## Add the conda-forge channel
Open an Anaconda prompt window and type the following (and `Enter`):
```bash
conda config --prepend channels conda-forge
```

## Installing Activity Browser
You can now install Activity Browser by creating a python environment (`ab`)
<details><summary><b>More information about this step</b></summary>

Activity Browser has many dependencies that are managed by
[conda-forge](https://conda.io/docs/user-guide/tasks/manage-channels.html).
By adding the channel you can install python packages from there.

Depending on your computer and internet connection, it can take a while for this to complete.
You will need to confirm that you really want to install the environment.
The line above means:
- `conda`: a command for conda
- `config`: change something in the configuration (settings) of `conda`
- `--prepend channels`: in the channels from which conda can install things, add to the top (prepend)
- `conda-forge`: the channel name
</details>

## Creating an environment and Installing Activity Browser
Next, we create a python environment, in which we install Activity Browser

```bash
conda create -n ab -c conda-forge activity-browser
```

> [!NOTE]
> Installing Activity Browser can take some time, this depends on the speed of your internet connection and computer.
<details><summary><b>More information about this step</b></summary>

We create a separate environment, this allows Activity Browser to work with the specific versions of other libraries
it needs without interfering with other python packages.

The line above means:
- `conda`: a command for conda
- `create -n ab`: create a new e**n**vironment (`-n`) with the name `ab`
- `-c conda-forge`: from the **c**hannel (`-c`) `conda-forge`
- `activity-browser`: install the package `activity-browser`

You can have as many environments as you like, you can also install different versions of Activity Browser
in different environments, for example for different [plugins](Plugins), or just for using different version of
Activity Browser.

All environments will have access to the same projects and databases in Activity Browser.

</details>

## Activating and running Activity Browser
To run Activity Browser, you need to activate your environment with
`conda activate ab` and then run activity browser
with `activity-browser`.
To run Activity Browser, you need to activate your environment with
```bash
conda activate ab
```

And then run activity browser
with.
```bash
activity-browser
```

Congratulations! You've started Activity Browser for the first time!

# Updating Activity Browser
Every time you want to start Activity Browser, you need to start an anaconda prompt
and do `conda activate ab` and then `activity browser`.

## Updating Activity Browser
We recommend to regularly update Activity Browser to receive new features & bugfixes.
These commands will update the Activity Browser and all of its dependencies in the conda environment called `ab`.

Expand Down
4 changes: 4 additions & 0 deletions activity_browser/layouts/tabs/LCA_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,10 @@ def load_action(self) -> None:
log.info(
"Superstructure: Attempting to read as parameter scenario file."
)

if not df["Group"].dtype == object:
df["Group"] = df["Group"].astype(str)

include_default = True
if "default" not in df.columns:
query = QtWidgets.QMessageBox.question(
Expand Down
2 changes: 1 addition & 1 deletion activity_browser/layouts/tabs/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def open_activity_tab(self, key: tuple, read_only: bool = True) -> None:
)
new_tab.destroyed.connect(signals.hide_when_empty.emit)
new_tab.objectNameChanged.connect(
lambda name: self.setTabText(tab_index, name)
lambda name: self.setTabText(self.indexOf(new_tab), name)
)

self.select_tab(self.tabs[key])
Expand Down
11 changes: 10 additions & 1 deletion activity_browser/ui/wizards/project_setup_wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,6 @@ def validatePage(self):
release = ei.EcoinventRelease(settings)
release.list_versions()

# logon was unsuccesful
except requests.exceptions.HTTPError as e:
QtWidgets.QApplication.restoreOverrideCursor()

Expand All @@ -161,6 +160,16 @@ def validatePage(self):
self.message.setText("Unknown connection error, try again later.")
raise e

except requests.exceptions.ConnectionError:
QtWidgets.QApplication.restoreOverrideCursor()
self.message.setText("Cannot connect to the internet, please try again later.")
return False

except Exception as e:
# restore cursor on all exceptions
QtWidgets.QApplication.restoreOverrideCursor()
raise e

# in case of success, set the settings for permanent use
ei.permanent_setting("username", self.username.text())
ei.permanent_setting("password", self.password.text())
Expand Down

0 comments on commit 6cc980f

Please sign in to comment.