brightway-basic-explorer 0.9.dev5__py3-none-any.whl → 0.9.dev6__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- brightway_basic_explorer/__init__.py +29 -21
- {brightway_basic_explorer-0.9.dev5.dist-info → brightway_basic_explorer-0.9.dev6.dist-info}/METADATA +26 -4
- {brightway_basic_explorer-0.9.dev5.dist-info → brightway_basic_explorer-0.9.dev6.dist-info}/RECORD +6 -6
- {brightway_basic_explorer-0.9.dev5.dist-info → brightway_basic_explorer-0.9.dev6.dist-info}/WHEEL +0 -0
- {brightway_basic_explorer-0.9.dev5.dist-info → brightway_basic_explorer-0.9.dev6.dist-info}/licenses/COPYING +0 -0
- {brightway_basic_explorer-0.9.dev5.dist-info → brightway_basic_explorer-0.9.dev6.dist-info}/top_level.txt +0 -0
|
@@ -52,19 +52,19 @@ def activity_to_json_with_params(act, params):
|
|
|
52
52
|
a["exchanges"] = exs
|
|
53
53
|
return a
|
|
54
54
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
55
|
+
def warn_dialog(msg):
|
|
56
|
+
print(f"WARNING: {msg}")
|
|
57
|
+
w = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Warning, "WARNING", msg)
|
|
58
|
+
w.show()
|
|
59
|
+
w.setMaximumSize(800, 600)
|
|
60
|
+
w.exec()
|
|
61
|
+
|
|
62
|
+
def fatal_dialog(msg):
|
|
63
|
+
print(f"ERROR: {msg}")
|
|
64
|
+
w = QtGui.QMessageBox(QtGui.QMessageBox.Icon.Critical, "ERROR", msg)
|
|
65
|
+
w.show()
|
|
66
|
+
w.setMaximumSize(800, 600)
|
|
67
|
+
w.exec()
|
|
68
68
|
|
|
69
69
|
class QStandardItemRO(QtGui.QStandardItem):
|
|
70
70
|
def __init__(self, *args, data=None, **kwargs):
|
|
@@ -117,8 +117,11 @@ class ActionMenu(QtGui.QMenu):
|
|
|
117
117
|
self.action_copy = self.addAction("Copy")
|
|
118
118
|
self.action_copy.triggered.connect(self.copy_triggered)
|
|
119
119
|
|
|
120
|
-
self.
|
|
121
|
-
self.
|
|
120
|
+
self.action_copy_ref = self.addAction("Copy Full Reference")
|
|
121
|
+
self.action_copy_ref.triggered.connect(self.copy_full_reference_triggered)
|
|
122
|
+
|
|
123
|
+
self.action_copy_code = self.addAction("Copy Activity Code")
|
|
124
|
+
self.action_copy_code.triggered.connect(self.copy_code_triggered)
|
|
122
125
|
|
|
123
126
|
if hasattr(self.parentWidget(), "explore"):
|
|
124
127
|
self.action_explore = self.addAction("Explore")
|
|
@@ -137,6 +140,12 @@ class ActionMenu(QtGui.QMenu):
|
|
|
137
140
|
text = (v["database"], v["name"], v.get("location", None), v.get("categories", tuple()), v.get("unit", None))
|
|
138
141
|
QtGui.QGuiApplication.clipboard().setText(str(text))
|
|
139
142
|
|
|
143
|
+
def copy_code_triggered(self):
|
|
144
|
+
parent = self.parentWidget()
|
|
145
|
+
v = parent.model.root.child(self.index.row(), 0).data()
|
|
146
|
+
text = (v["database"], v["code"])
|
|
147
|
+
QtGui.QGuiApplication.clipboard().setText(str(text))
|
|
148
|
+
|
|
140
149
|
def explore_triggered(self):
|
|
141
150
|
self.parentWidget().explore(self.index)
|
|
142
151
|
|
|
@@ -386,9 +395,7 @@ class SearchWindow(QtGui.QMainWindow):
|
|
|
386
395
|
text = self.keywords.text()
|
|
387
396
|
keywords = [re.sub("[^a-zA-Z0-9_-]", "", s) for s in text.split(" ") if len(s) > 0]
|
|
388
397
|
if all(len(x) < 3 for x in keywords):
|
|
389
|
-
|
|
390
|
-
w.setWindowTitle("WARNING")
|
|
391
|
-
w.exec()
|
|
398
|
+
warn_dialog("Too smalls keywords")
|
|
392
399
|
return
|
|
393
400
|
|
|
394
401
|
acts = self.db.search(" ".join(keywords), proxy=True, limit=200)
|
|
@@ -463,6 +470,9 @@ def show_activity(act, params=None):
|
|
|
463
470
|
|
|
464
471
|
app = get_app_qt4()
|
|
465
472
|
|
|
473
|
+
if isinstance(act, tuple):
|
|
474
|
+
act = bw2data.get_activity(act)
|
|
475
|
+
|
|
466
476
|
if params is None:
|
|
467
477
|
activity_json = activity_to_json(act)
|
|
468
478
|
else:
|
|
@@ -489,9 +499,7 @@ def search(database, keywords=""):
|
|
|
489
499
|
|
|
490
500
|
if isinstance(database, str):
|
|
491
501
|
if database not in bw2data.databases:
|
|
492
|
-
|
|
493
|
-
w.setWindowTitle("WARNING")
|
|
494
|
-
w.exec()
|
|
502
|
+
fatal_dialog(f"Database {database} not found !")
|
|
495
503
|
return
|
|
496
504
|
database = bw2data.Database(database)
|
|
497
505
|
|
{brightway_basic_explorer-0.9.dev5.dist-info → brightway_basic_explorer-0.9.dev6.dist-info}/METADATA
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: brightway-basic-explorer
|
|
3
|
-
Version: 0.9.
|
|
3
|
+
Version: 0.9.dev6
|
|
4
4
|
Summary: Implement basic GUI to explorer brightway ativities
|
|
5
5
|
Author-email: Benoît GSCHWIND <benoit.gschwind@minesparis.psl.eu>, OIE - Mines Paris PSL <benoit.gschwind@minesparis.psl.eu>
|
|
6
6
|
Maintainer-email: Benoît GSCHWIND <benoit.gschwind@minesparis.psl.eu>
|
|
@@ -29,13 +29,15 @@ Implement a basic activity explorer mostly to use in interractive python such as
|
|
|
29
29
|
pip install brightway_basic_explorer
|
|
30
30
|
```
|
|
31
31
|
|
|
32
|
-
#
|
|
32
|
+
# Documentation
|
|
33
33
|
|
|
34
34
|

|
|
35
35
|
|
|
36
|
+
## Show an activity
|
|
37
|
+
|
|
36
38
|
```python
|
|
37
39
|
import bw2data
|
|
38
|
-
from brightway_basic_explorer import show_activity, close_all
|
|
40
|
+
from brightway_basic_explorer import show_activity, close_all, search
|
|
39
41
|
|
|
40
42
|
db = bw2data.Database("ecoinvent-3.11-cutoff")
|
|
41
43
|
|
|
@@ -43,7 +45,27 @@ act = db.search("570kWp")
|
|
|
43
45
|
|
|
44
46
|
# Show the first activity
|
|
45
47
|
show_activity(act[0])
|
|
48
|
+
```
|
|
46
49
|
|
|
47
|
-
|
|
50
|
+
## Close all activities windows
|
|
51
|
+
|
|
52
|
+
```python
|
|
48
53
|
close_all()
|
|
49
54
|
```
|
|
55
|
+
|
|
56
|
+
## With lca_algebraic
|
|
57
|
+
|
|
58
|
+
If you are ussing lca_algebraic, you can specify parameters. Parameters are completed by default values and used in formula to compute the corresponding amount.
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
show_activity(act[0], {"paramter0": 10, "parameter1": 20})
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Search within a database:
|
|
65
|
+
|
|
66
|
+
You can search within a database. Search require at less a not too short keyword. Keyword are separated by spaces, for instance:
|
|
67
|
+
|
|
68
|
+
```python
|
|
69
|
+
search("ecoinvent-3.11-cutoff", "570kwp GLO")
|
|
70
|
+
```
|
|
71
|
+
|
{brightway_basic_explorer-0.9.dev5.dist-info → brightway_basic_explorer-0.9.dev6.dist-info}/RECORD
RENAMED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
brightway_basic_explorer/__init__.py,sha256=
|
|
1
|
+
brightway_basic_explorer/__init__.py,sha256=XOlZ3f7fbGJmHwzPz3PAtkLC3G_AzD2lXW56Ifx-Fm8,19198
|
|
2
2
|
brightway_basic_explorer/icons/emission.png,sha256=js9yLt3jihZ1x7pXfuL-cXQ0HtC57Nrfxg58YfbWpfU,154
|
|
3
3
|
brightway_basic_explorer/icons/natural_resource.png,sha256=vbXPQful4vuibRNUoM4qze4hV2-eW3OkmkePUOnWsRI,162
|
|
4
4
|
brightway_basic_explorer/icons/process.png,sha256=zlJJ3J-2geqybqiL6YwGHFka0kqEIwKZqTeUzijPcE0,240
|
|
5
5
|
brightway_basic_explorer/icons/unknown.png,sha256=92LyvebtGvewcaLjEojQOWXJzeIicIVgWqvov9XhOrc,165
|
|
6
|
-
brightway_basic_explorer-0.9.
|
|
7
|
-
brightway_basic_explorer-0.9.
|
|
8
|
-
brightway_basic_explorer-0.9.
|
|
9
|
-
brightway_basic_explorer-0.9.
|
|
10
|
-
brightway_basic_explorer-0.9.
|
|
6
|
+
brightway_basic_explorer-0.9.dev6.dist-info/licenses/COPYING,sha256=b8nnCcy_4Nd_v_okJ6mDKCvi64jkexzbSfIag7TR5mU,13827
|
|
7
|
+
brightway_basic_explorer-0.9.dev6.dist-info/METADATA,sha256=L0x8SVO98MBYaOuhMaXlPSUSJffQlP7cVj_4muV4_tw,2118
|
|
8
|
+
brightway_basic_explorer-0.9.dev6.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
9
|
+
brightway_basic_explorer-0.9.dev6.dist-info/top_level.txt,sha256=YrW7Qnd1cgs1TDGBcL5wNmDg7XSiiwYsFymP7cfL0hU,25
|
|
10
|
+
brightway_basic_explorer-0.9.dev6.dist-info/RECORD,,
|
{brightway_basic_explorer-0.9.dev5.dist-info → brightway_basic_explorer-0.9.dev6.dist-info}/WHEEL
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|