Skip to content

Commit

Permalink
Dialogs: Call setMinimumSize and adjustSize
Browse files Browse the repository at this point in the history
Fix an issue with PySide 6.6.0 where dialogs are spawned with minimal
size, in each case far too small.
  • Loading branch information
mborgerson committed Nov 29, 2023
1 parent 0602568 commit ea1c256
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 11 deletions.
4 changes: 3 additions & 1 deletion angrmanagement/ui/dialogs/analysis_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,10 @@ def __init__(self, analyses: AnalysesConfiguration, workspace: "Workspace", pare
self._workspace: Workspace = workspace
self._analyses: AnalysesConfiguration = analyses
self._mappers: Sequence[AnalysisOptionWidgetMapper] = []
self.setWindowTitle("Run Analysis")
self._init_widgets()
self.setWindowTitle("Run Analysis")
self.setMinimumSize(self.sizeHint())
self.adjustSize()

def sizeHint(self, *args, **kwargs): # pylint: disable=unused-argument,no-self-use
return QSize(800, 600)
Expand Down
5 changes: 2 additions & 3 deletions angrmanagement/ui/dialogs/assemble_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,8 @@ def __init__(self, address: int, instance: "Instance", parent=None):

self._init_widgets()
self.setWindowTitle(f"Assemble Patch at {self._patch_addr:#x}")

def sizeHint(self): # pylint:disable=no-self-use
return QSize(400, 150)
self.setMinimumWidth(500)
self.adjustSize()

#
# Private methods
Expand Down
5 changes: 4 additions & 1 deletion angrmanagement/ui/dialogs/command_palette.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,13 +221,16 @@ class PaletteDialog(QDialog):

def __init__(self, model, delegate=None, parent=None):
super().__init__(parent)
self.setWindowTitle("Palette")
self._model = model
self._delegate = delegate or PaletteItemDelegate()
self._init_widgets()

self.selected_item = None

self.setWindowTitle("Palette")
self.setMinimumSize(self.sizeHint())
self.adjustSize()

def sizeHint(self): # pylint:disable=no-self-use
return QSize(500, 400)

Expand Down
7 changes: 3 additions & 4 deletions angrmanagement/ui/dialogs/function.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@ def __init__(self, function, parent=None):
super().__init__(parent)
self.workspace = GlobalInfo.main_window.workspace
self.function = function
self._init_widgets()
self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint)
self.setWindowTitle(f"Function {self.function.name}")
self._init_widgets()

def sizeHint(self, *args, **kwargs): # pylint: disable=unused-argument,no-self-use
return QSize(600, 300)
self.setMinimumWidth(600)
self.adjustSize()

def _init_widgets(self):
font = QFont(Conf.disasm_font)
Expand Down
6 changes: 4 additions & 2 deletions angrmanagement/ui/dialogs/xref.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ def __init__(
):
super().__init__(parent)

self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint | Qt.WindowCloseButtonHint)

self._variable_manager = variable_manager
self._variable = variable
self._xrefs_manager = xrefs_manager
Expand All @@ -54,6 +52,10 @@ def __init__(

self._init_widgets()

self.setWindowFlags(self.windowFlags() & ~Qt.WindowContextHelpButtonHint | Qt.WindowCloseButtonHint)
self.setMinimumSize(self.sizeHint())
self.adjustSize()

def sizeHint(self, *args, **kwargs): # pylint: disable=unused-argument,no-self-use
return QSize(600, 400)

Expand Down

0 comments on commit ea1c256

Please sign in to comment.