@@ -161,7 +161,7 @@ def create_screenshot(
161161 plotmethod : str = "mapplot" , minwidth = None ,
162162 ) -> str :
163163 """Generate a screenshot of the GUI."""
164- from PyQt5 .QtWidgets import QApplication
164+ from PyQt5 .QtWidgets import QApplication , QSizePolicy
165165 from psy_view .ds_widget import DatasetWidget
166166 from psyplot .data import open_dataset
167167
@@ -182,15 +182,17 @@ def create_screenshot(
182182 if minwidth :
183183 ds_widget .setMinimumWidth (minwidth )
184184
185- ds_widget .show () # to make sure we can see everything
186-
187185 options = {"ds_widget" : ds_widget }
188186 exec ("w = " + code , options )
189187 w = options ['w' ]
190188
191189 if enable is not None :
192190 w .setEnabled (enable )
193191
192+ w .setSizePolicy (QSizePolicy .Maximum , QSizePolicy .Maximum )
193+
194+ ds_widget .show () # to make sure we can see everything
195+
194196 w .grab ().save (osp .join (confdir , output ))
195197 ds_widget .close_sp ()
196198 ds_widget .close ()
@@ -236,7 +238,7 @@ def add_line(self, line: str) -> None:
236238 def generate (self ) -> None :
237239 """Generate the content."""
238240 self .add_line (f".. { self .target_directive } :: { self .img_name } " )
239-
241+
240242 for option , val in self .options .items ():
241243 self .add_line (f" :{ option } : { val } " )
242244
@@ -288,7 +290,7 @@ def generate(self):
288290 indent = " "
289291 for line in self .content :
290292 self .add_line (indent + line )
291-
293+
292294
293295
294296def setup (app ):
0 commit comments