diff --git a/spyder/config/main.py b/spyder/config/main.py index e89d750e51e..5cd419c7016 100644 --- a/spyder/config/main.py +++ b/spyder/config/main.py @@ -294,7 +294,9 @@ ('preferences', { 'enable': True, - 'dialog_size': (990, 715), + 'dialog_size': ( + (1010, 725) if MAC else ((900, 670) if WIN else (950, 690)) + ), }), ('project_explorer', { diff --git a/spyder/plugins/editor/confpage.py b/spyder/plugins/editor/confpage.py index 4deba3f01ea..387d932dece 100644 --- a/spyder/plugins/editor/confpage.py +++ b/spyder/plugins/editor/confpage.py @@ -6,6 +6,9 @@ """Editor config page.""" +import os +import sys + from qtpy.QtWidgets import (QGridLayout, QGroupBox, QHBoxLayout, QLabel, QVBoxLayout) @@ -37,6 +40,19 @@ def __init__(self, plugin, parent): self.add_newline_box = None self.remove_trail_newline_box = None + # *********************** IMPORTANT NOTES ***************************** + # * This value needs to be ajusted if we add new options to the + # "Advanced settings" tab. + # * We need to do this so that the text of some options is not clipped. + if os.name == "nt": + min_height = 620 + elif sys.platform == "darwin": + min_height = 760 + else: + min_height = 670 + + self.setMinimumHeight(min_height) + def get_name(self): return _("Editor") @@ -44,9 +60,6 @@ def get_icon(self): return ima.icon('edit') def setup_page(self): - # We need to set this so that the text of some options is not clipped - self.setMinimumHeight(670) - newcb = self.create_checkbox # --- Display tab --- diff --git a/spyder/plugins/preferences/widgets/configdialog.py b/spyder/plugins/preferences/widgets/configdialog.py index a18da136642..65fb5b6e0ac 100644 --- a/spyder/plugins/preferences/widgets/configdialog.py +++ b/spyder/plugins/preferences/widgets/configdialog.py @@ -4,9 +4,6 @@ # Licensed under the terms of the MIT License # (see spyder/__init__.py for details) -# Standard library imports -import sys - # Third party imports from qtpy.QtCore import QSize, Qt, Signal, Slot from qtpy.QtGui import QFontMetricsF @@ -44,9 +41,13 @@ class ConfigDialog(QDialog, SpyderFontsMixin): # Constants ITEMS_MARGIN = 2 * AppStyle.MarginSize - ITEMS_PADDING = AppStyle.MarginSize - CONTENTS_WIDTH = 230 + ITEMS_PADDING = ( + AppStyle.MarginSize if (MAC or WIN) else 2 * AppStyle.MarginSize + ) + CONTENTS_WIDTH = 230 if MAC else (200 if WIN else 240) ICON_SIZE = 20 + MIN_WIDTH = 940 if MAC else (875 if WIN else 920) + MIN_HEIGHT = 700 if MAC else (660 if WIN else 670) def __init__(self, parent=None): QDialog.__init__(self, parent) @@ -59,6 +60,10 @@ def __init__(self, parent=None): self._is_shown = False self._separators = [] + # Size + self.setMinimumWidth(self.MIN_WIDTH) + self.setMinimumHeight(self.MIN_HEIGHT) + # Widgets self.pages_widget = QStackedWidget(self) self.contents_widget = QListWidget(self) @@ -189,7 +194,12 @@ def add_separator(self): # Solution taken from https://stackoverflow.com/a/24819554/438386 item = QListWidgetItem(self.contents_widget) item.setFlags(Qt.NoItemFlags) - item.setSizeHint(QSize(9, 9)) + + size = ( + AppStyle.MarginSize * 3 if (MAC or WIN) + else AppStyle.MarginSize * 5 + ) + item.setSizeHint(QSize(size, size)) hline = QFrame(self.contents_widget) hline.setFrameShape(QFrame.HLine) @@ -318,7 +328,7 @@ def _add_tooltips(self): scrollbar = self.contents_widget.verticalScrollBar() if scrollbar.isVisible(): - if sys.platform == 'darwin': + if MAC: # This is a crude heuristic to detect if we need to add # tooltips on Mac. However, it's the best we can do # (the approach for other OSes below ends up adding @@ -341,7 +351,7 @@ def _adjust_items_margin(self): We need to do this only in Mac because Qt doesn't account for the scrollbar width in most widgets. """ - if sys.platform == 'darwin': + if MAC: scrollbar = self.contents_widget.verticalScrollBar() extra_margin = ( AppStyle.MacScrollBarWidth if scrollbar.isVisible() else 0 @@ -367,7 +377,7 @@ def _adjust_separators_width(self): We need to do this only in Mac because Qt doesn't set the widths correctly when there are elided items. """ - if sys.platform == 'darwin': + if MAC: scrollbar = self.contents_widget.verticalScrollBar() for sep in self._separators: if self.CONTENTS_WIDTH != 230: