Skip to content

Commit

Permalink
Resize dialog in BaseDataPanel for better size management
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreRaybaut committed Aug 2, 2024
1 parent b94eae2 commit be1ff39
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions cdl/core/gui/panel/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -988,23 +988,24 @@ def create_new_dialog(
if options is not None:
plot_options = plot_options.copy(options)

# Resize the dialog so that it's at least MINDIALOGSIZE (absolute values),
# and at most MAXDIALOGSIZE (% of the main window size):
minwidth, minheight = self.MINDIALOGSIZE
maxwidth = int(self.mainwindow.width() * self.MAXDIALOGSIZE)
maxheight = int(self.mainwindow.height() * self.MAXDIALOGSIZE)
size = min(minwidth, maxwidth), min(minheight, maxheight)

# pylint: disable=not-callable
dlg = PlotDialog(
parent=self.parent(),
title=title,
edit=edit,
options=plot_options,
toolbar=toolbar,
size=size,
)
dlg.setWindowIcon(get_icon("DataLab.svg"))

# Resize the dialog so that it's at least MINDIALOGSIZE (absolute values),
# and at most MAXDIALOGSIZE (% of the main window size):
minwidth, minheight = self.MINDIALOGSIZE
maxwidth = int(self.mainwindow.width() * self.MAXDIALOGSIZE)
maxheight = int(self.mainwindow.height() * self.MAXDIALOGSIZE)
dlg.resize(min(minwidth, maxwidth), min(minheight, maxheight))

if tools is not None:
for tool in tools:
dlg.get_manager().add_tool(tool)
Expand Down

0 comments on commit be1ff39

Please sign in to comment.