1. TortoiseHg
  2. TortoiseHg
  3. thg

Commits

Yuya Nishihara  committed c62dd72

cmdui: extract helper to make dialog not expandable vertically if log hidden

  • Participants
  • Parent commits 091dd27
  • Branches default

Comments (0)

Files changed (1)

File tortoisehg/hgqt/cmdui.py

View file
  • Ignore whitespace
         self._closeBtn.setVisible(self._session.isFinished())
 
 
+def adjustWindowHeightConstraint(window, cmdcontrol):
+    """Mimic SetFizedSize constraint vertically if command log is hidden"""
+    assert window.isWindow() and window.isAncestorOf(cmdcontrol)
+    if cmdcontrol.isLogVisible():
+        window.setMaximumHeight(qtlib.QWIDGETSIZE_MAX)
+    else:
+        # recalculate size constraints
+        cmdcontrol.adjustSize()
+        window.layout().activate()
+        window.setMaximumHeight(window.minimumHeight())
+
+
 class AbstractCmdWidget(QWidget):
     """Widget to prepare Mercurial command controlled by CmdControlDialog"""
 
 
     @pyqtSlot(bool)
     def _adjustHeightByLogVisibility(self, visible):
+        adjustWindowHeightConstraint(self, self._cmdcontrol)
         if visible:
-            self.setMaximumHeight(qtlib.QWIDGETSIZE_MAX)
             self.resize(self.width(), self.sizeHint().height())
-        else:
-            # recalculate size constraints
-            self._cmdcontrol.adjustSize()
-            self.layout().activate()
-            self.setMaximumHeight(self.minimumHeight())
 
     def reject(self):
         self._cmdcontrol.reject()