11
11
QFrame ,
12
12
QHBoxLayout ,
13
13
QMainWindow ,
14
+ QMenu ,
14
15
QPushButton ,
15
16
QVBoxLayout ,
16
17
)
44
45
background-color: rgba(255, 255, 255, 200);
45
46
}
46
47
"""
48
+ MENU_ITEM_STYLE_SHEET : str = """
49
+ QMenu:item {
50
+ border: 2px solid darkgrey;
51
+ border-radius: 5px;
52
+ background-color: rgba(255, 255, 255, 0);
53
+ padding-top:5px;
54
+ padding-left: 5px;
55
+ background: rgba(0,0,0,0);
56
+ font-weight: bold;
57
+ font-size: 13px;
58
+ }
59
+ QMenu:item:selected {
60
+ background-color: rgba(255, 255, 255, 200);
61
+ }
62
+ """
47
63
48
64
49
65
class ErtMainWindow (QMainWindow ):
@@ -64,6 +80,8 @@ def __init__(
64
80
self .log_handler = log_handler
65
81
66
82
self .setWindowTitle (f"ERT - { config_file } - { find_ert_info ()} " )
83
+ self .central_panels = []
84
+ self .central_panels_index = 0
67
85
68
86
self .plugin_manager = plugin_manager
69
87
self .central_widget = QFrame (self )
@@ -79,7 +97,6 @@ def __init__(
79
97
self .side_frame .setLayout (self .vbox_layout )
80
98
81
99
self .add_experiment_button ()
82
- self .central_panels = []
83
100
self ._plot_tool = PlotTool (self .config_file , self )
84
101
self ._create_sidebar_button (self ._plot_tool )
85
102
@@ -133,6 +150,8 @@ def _create_sidebar_button(self, tool: Optional[Tool] = None) -> QPushButton:
133
150
button .setToolTip (tool .getName ())
134
151
button .clicked .connect (tool .trigger )
135
152
self .vbox_layout .addWidget (button )
153
+ button .setProperty ("INDEX" , self .central_panels_index )
154
+ self .central_panels_index += 1
136
155
return button
137
156
138
157
def add_experiment_button (self ) -> None :
@@ -141,6 +160,15 @@ def add_experiment_button(self) -> None:
141
160
button .setToolTip ("Start Simulation" )
142
161
button .clicked .connect (self .toggle_visibility )
143
162
163
+ menu = QMenu ()
164
+ menu .addAction ("Single Test Run" )
165
+ menu .addAction ("Ensemble Experiment" )
166
+ menu .addAction ("Manual Update" )
167
+ menu .addAction ("ES MDA" )
168
+ menu .addAction ("Ensemble Smoother" )
169
+ menu .setStyleSheet (MENU_ITEM_STYLE_SHEET )
170
+ button .setMenu (menu )
171
+
144
172
def toggle_visibility (self ) -> None :
145
173
for panel in self .central_panels :
146
174
panel .show ()
0 commit comments