Skip to content

Commit be1ff39

Browse files
committed
Resize dialog in BaseDataPanel for better size management
1 parent b94eae2 commit be1ff39

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

cdl/core/gui/panel/base.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -988,23 +988,24 @@ def create_new_dialog(
988988
if options is not None:
989989
plot_options = plot_options.copy(options)
990990

991+
# Resize the dialog so that it's at least MINDIALOGSIZE (absolute values),
992+
# and at most MAXDIALOGSIZE (% of the main window size):
993+
minwidth, minheight = self.MINDIALOGSIZE
994+
maxwidth = int(self.mainwindow.width() * self.MAXDIALOGSIZE)
995+
maxheight = int(self.mainwindow.height() * self.MAXDIALOGSIZE)
996+
size = min(minwidth, maxwidth), min(minheight, maxheight)
997+
991998
# pylint: disable=not-callable
992999
dlg = PlotDialog(
9931000
parent=self.parent(),
9941001
title=title,
9951002
edit=edit,
9961003
options=plot_options,
9971004
toolbar=toolbar,
1005+
size=size,
9981006
)
9991007
dlg.setWindowIcon(get_icon("DataLab.svg"))
10001008

1001-
# Resize the dialog so that it's at least MINDIALOGSIZE (absolute values),
1002-
# and at most MAXDIALOGSIZE (% of the main window size):
1003-
minwidth, minheight = self.MINDIALOGSIZE
1004-
maxwidth = int(self.mainwindow.width() * self.MAXDIALOGSIZE)
1005-
maxheight = int(self.mainwindow.height() * self.MAXDIALOGSIZE)
1006-
dlg.resize(min(minwidth, maxwidth), min(minheight, maxheight))
1007-
10081009
if tools is not None:
10091010
for tool in tools:
10101011
dlg.get_manager().add_tool(tool)

0 commit comments

Comments
 (0)