Skip to content

Commit d42fa17

Browse files
committed
More compact LCA results
1 parent ab02b7b commit d42fa17

2 files changed

Lines changed: 25 additions & 6 deletions

File tree

activity_browser/layouts/pages/lca_results/LCA_results.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def __init__(self, parent=None):
237237
self.export_plot: Optional[ExportPlot] = None
238238
self.export_table: Optional[ExportTable] = None
239239

240-
self.scenario_box = QtWidgets.QComboBox()
240+
self.scenario_box = SmallComboBox()
241241
self.pt_layout = QtWidgets.QVBoxLayout()
242242
self.layout = QtWidgets.QVBoxLayout()
243243
self.setLayout(self.layout)
@@ -903,6 +903,16 @@ def update_plot(self):
903903
def update_table(self):
904904
super().update_table(self.df)
905905

906+
class SmallComboBox(QtWidgets.QComboBox):
907+
"""A small combo box that does not expand to fill the available space."""
908+
909+
def __init__(self, parent=None):
910+
super().__init__(parent)
911+
self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
912+
self.setMinimumWidth(100)
913+
self.setMaximumWidth(200)
914+
self.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContentsOnFirstShow)
915+
906916

907917
class ContributionTab(NewAnalysisTab):
908918
"""Parent class for any 'XXX Contributions' sub-tab."""
@@ -913,9 +923,9 @@ def __init__(self, parent, **kwargs):
913923
self.combobox_menu = Combobox(
914924
func=QtWidgets.QComboBox(self),
915925
func_label=QtWidgets.QLabel("Reference Flow:"),
916-
method=QtWidgets.QComboBox(self),
926+
method=SmallComboBox(self),
917927
method_label=QtWidgets.QLabel("Impact Category:"),
918-
agg=QtWidgets.QComboBox(self),
928+
agg=SmallComboBox(self),
919929
agg_label=QtWidgets.QLabel("Aggregate by:"),
920930
scenario=self.scenario_box,
921931
scenario_label=QtWidgets.QLabel("Scenario:"),

activity_browser/ui/web/tree_navigator.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,15 @@
3131

3232
log = getLogger(__name__)
3333

34+
class SmallComboBox(QtWidgets.QComboBox):
35+
"""A small combo box that does not expand to fill the available space."""
36+
37+
def __init__(self, parent=None):
38+
super().__init__(parent)
39+
self.setSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
40+
self.setMinimumWidth(100)
41+
self.setMaximumWidth(200)
42+
self.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContentsOnFirstShow)
3443

3544
class TreeNavigatorWidget(BaseNavigatorWidget):
3645
HELP_TEXT = """
@@ -58,9 +67,9 @@ def __init__(self, cs_name, parent=None):
5867

5968
# Additional Qt objects
6069
self.scenario_label = QtWidgets.QLabel("Scenario: ")
61-
self.func_unit_cb = QtWidgets.QComboBox()
62-
self.method_cb = QtWidgets.QComboBox()
63-
self.scenario_cb = QtWidgets.QComboBox()
70+
self.func_unit_cb = SmallComboBox()
71+
self.method_cb = SmallComboBox()
72+
self.scenario_cb = SmallComboBox()
6473
self.tag_cb = CheckableComboBox()
6574
self.cutoff_sb = QtWidgets.QDoubleSpinBox()
6675
self.max_calc_sb = QtWidgets.QDoubleSpinBox()

0 commit comments

Comments
 (0)