@@ -117,24 +117,25 @@ def __init__(
117
117
self .__add_tools_menu ()
118
118
self .__add_help_menu ()
119
119
120
- def select_central_widget (self ):
120
+ def select_central_widget (self ) -> None :
121
121
actor = self .sender ()
122
- index_name = actor .property ("index" )
122
+ if actor :
123
+ index_name = actor .property ("index" )
123
124
124
- if index_name == "Create plot" and not self ._plot_window :
125
- self ._plot_window = PlotWindow (self .config_file , self )
126
- self .central_layout .addWidget (self ._plot_window )
127
- self .central_panels_map ["Create plot" ] = self ._plot_window
125
+ if index_name == "Create plot" and not self ._plot_window :
126
+ self ._plot_window = PlotWindow (self .config_file , self )
127
+ self .central_layout .addWidget (self ._plot_window )
128
+ self .central_panels_map ["Create plot" ] = self ._plot_window
128
129
129
- if index_name == "Simulation status" :
130
- # select the only available simulation
131
- for k , v in self .central_panels_map .items ():
132
- if isinstance (v , RunDialog ):
133
- index_name = k
134
- break
130
+ if index_name == "Simulation status" :
131
+ # select the only available simulation
132
+ for k , v in self .central_panels_map .items ():
133
+ if isinstance (v , RunDialog ):
134
+ index_name = k
135
+ break
135
136
136
- for i , widget in self .central_panels_map .items ():
137
- widget .setVisible (i == index_name )
137
+ for i , widget in self .central_panels_map .items ():
138
+ widget .setVisible (i == index_name )
138
139
139
140
@Slot (object )
140
141
def slot_add_widget (self , run_dialog : RunDialog ) -> None :
@@ -151,8 +152,9 @@ def add_sim_run_option(datetime: str) -> None:
151
152
menu = self .results_button .menu ()
152
153
if menu :
153
154
act = menu .addAction (datetime )
154
- act .setProperty ("index" , datetime )
155
- act .triggered .connect (self .select_central_widget )
155
+ if act :
156
+ act .setProperty ("index" , datetime )
157
+ act .triggered .connect (self .select_central_widget )
156
158
157
159
if self .run_dialog_counter == 2 :
158
160
# swap from button to menu selection
@@ -187,7 +189,9 @@ def post_init(self) -> None:
187
189
self .plugins_tool = PluginsTool (plugin_handler , self .notifier , self .ert_config )
188
190
if self .plugins_tool :
189
191
self .plugins_tool .setParent (self )
190
- self .menuBar ().addMenu (self .plugins_tool .get_menu ())
192
+ menubar = self .menuBar ()
193
+ if menubar :
194
+ menubar .addMenu (self .plugins_tool .get_menu ())
191
195
192
196
self ._manage_experiments_panel = ManageExperimentsPanel (
193
197
self .ert_config ,
@@ -202,7 +206,7 @@ def post_init(self) -> None:
202
206
def _add_sidebar_button (self , name : str , icon : QIcon ) -> QPushButton :
203
207
button = QPushButton (self .side_frame )
204
208
button .setFixedSize (60 , 60 )
205
- button .setCursor (QCursor (Qt .PointingHandCursor ))
209
+ button .setCursor (QCursor (Qt .CursorShape . PointingHandCursor ))
206
210
button .setStyleSheet (BUTTON_STYLE_SHEET )
207
211
pad = 30
208
212
icon_size = QSize (button .size ().width () - pad , button .size ().height () - pad )
@@ -227,7 +231,7 @@ def __add_help_menu(self) -> None:
227
231
help_link_item = help_menu .addAction (menu_label )
228
232
assert help_link_item is not None
229
233
help_link_item .setMenuRole (QAction .MenuRole .ApplicationSpecificRole )
230
- help_link_item .triggered .connect (functools .partial (webbrowser .open , link ))
234
+ help_link_item .triggered .connect (functools .partial (webbrowser .open , link )) # type: ignore
231
235
232
236
show_about = help_menu .addAction ("About" )
233
237
assert show_about is not None
0 commit comments