@@ -81,14 +81,14 @@ def __init__(
81
81
self .add_experiment_button ()
82
82
self .central_panels = []
83
83
self ._plot_tool = PlotTool (self .config_file , self )
84
- self .add_sidebar_button (self ._plot_tool )
84
+ self ._create_sidebar_button (self ._plot_tool )
85
85
86
86
self ._manage_experiments_tool = ManageExperimentsTool (
87
87
self .ert_config ,
88
88
self .notifier ,
89
89
self .ert_config .model_config .num_realizations ,
90
90
)
91
- self .add_sidebar_button (self ._manage_experiments_tool )
91
+ self ._create_sidebar_button (self ._manage_experiments_tool )
92
92
93
93
self .vbox_layout .addStretch ()
94
94
self .central_layout .addWidget (self .side_frame )
@@ -119,38 +119,32 @@ def post_init(self):
119
119
plugins_tool .setParent (self )
120
120
self .menuBar ().addMenu (plugins_tool .get_menu ())
121
121
122
- def add_experiment_button (self ) -> None :
122
+ def _create_sidebar_button (self , tool : Optional [ Tool ] = None ) -> QPushButton :
123
123
button = QPushButton (self .side_frame )
124
124
button .setFixedSize (80 , 80 )
125
- button .setIcon (QIcon ("img:play_circle_outlined.svg" ))
126
125
button .setCursor (QCursor (Qt .PointingHandCursor ))
127
126
button .setStyleSheet (BUTTON_STYLE_SHEET )
128
127
padding = 30
129
128
button .setIconSize (
130
129
QSize (button .size ().width () - padding , button .size ().height () - padding )
131
130
)
131
+ if tool :
132
+ button .setIcon (QIcon (tool .getIcon ()))
133
+ button .setToolTip (tool .getName ())
134
+ button .clicked .connect (tool .trigger )
135
+ self .vbox_layout .addWidget (button )
136
+ return button
137
+
138
+ def add_experiment_button (self ) -> None :
139
+ button = self ._create_sidebar_button ()
140
+ button .setIcon (QIcon ("img:play_circle_outlined.svg" ))
132
141
button .setToolTip ("Start Simulation" )
133
142
button .clicked .connect (self .toggle_visibility )
134
- self .vbox_layout .addWidget (button )
135
143
136
144
def toggle_visibility (self ) -> None :
137
145
for panel in self .central_panels :
138
146
panel .show ()
139
147
140
- def add_sidebar_button (self , tool : Tool ) -> None :
141
- button = QPushButton (self .side_frame )
142
- button .setFixedSize (80 , 80 )
143
- button .setIcon (tool .getIcon ())
144
- button .setCursor (QCursor (Qt .PointingHandCursor ))
145
- button .setStyleSheet (BUTTON_STYLE_SHEET )
146
- padding = 30
147
- button .setIconSize (
148
- QSize (button .size ().width () - padding , button .size ().height () - padding )
149
- )
150
- button .setToolTip (tool .getName ())
151
- button .clicked .connect (tool .trigger )
152
- self .vbox_layout .addWidget (button )
153
-
154
148
def __add_help_menu (self ) -> None :
155
149
menuBar = self .menuBar ()
156
150
assert menuBar is not None
@@ -171,6 +165,8 @@ def __add_help_menu(self) -> None:
171
165
show_about .setObjectName ("about_action" )
172
166
show_about .triggered .connect (self .__showAboutMessage )
173
167
168
+ self .help_menu = help_menu
169
+
174
170
def __add_tools_menu (self ) -> None :
175
171
menu_bar = self .menuBar ()
176
172
assert menu_bar is not None
0 commit comments