def WidgetJustSized(self, width_larger, height_larger): widget_size_hint = self.widget().minimumSizeHint() my_size = self.size() width_increase = 0 height_increase = 0 # + 2 because it is late and that seems to stop scrollbars lmao if width_larger: width_increase = max( 0, widget_size_hint.width() - my_size.width() + 2) if height_larger: height_increase = max( 0, widget_size_hint.height() - my_size.height() + 2) if width_increase > 0 or height_increase > 0: window = self.window() if isinstance(window, (ClientGUITopLevelWindows.DialogThatResizes, ClientGUITopLevelWindows.FrameThatResizes)): desired_size_delta = QC.QSize(width_increase, height_increase) ClientGUITopLevelWindows.ExpandTLWIfPossible( window, window._frame_key, desired_size_delta)
def SetCanvas( self, canvas_window: ClientGUICanvas.CanvasWithDetails ): self._canvas_window = canvas_window self.setFocusProxy( self._canvas_window ) vbox = QP.VBoxLayout( margin = 0 ) QP.AddToLayout( vbox, self._canvas_window ) self.setLayout( vbox ) ClientGUITopLevelWindows.SetInitialTLWSizeAndPosition( self, self._frame_key ) self.show() # just to reinforce, as Qt sometimes sets none focus for this window until it goes off and back on self._canvas_window.setFocus( QC.Qt.OtherFocusReason )
def SetPanel(self, panel): self._panel = panel if hasattr(self._panel, 'okSignal'): self._panel.okSignal.connect(self.close) vbox = QP.VBoxLayout() QP.AddToLayout(vbox, self._panel) QP.AddToLayout(vbox, self._ok, CC.FLAGS_ON_RIGHT) self.setLayout(vbox) ClientGUITopLevelWindows.SetInitialTLWSizeAndPosition( self, self._frame_key) self.show()
def SetPanel( self, panel: ClientGUIScrolledPanels.ResizingScrolledPanel ): self._panel = panel if hasattr( self._panel, 'okSignal'): self._panel.okSignal.connect( self.DoOK ) buttonbox = self._GetButtonBox() vbox = QP.VBoxLayout() QP.AddToLayout( vbox, self._panel, CC.FLAGS_EXPAND_BOTH_WAYS ) if buttonbox is not None: QP.AddToLayout( vbox, buttonbox, CC.FLAGS_ON_RIGHT ) self.setLayout( vbox ) ClientGUITopLevelWindows.SetInitialTLWSizeAndPosition( self, self._frame_key )