Skip to content

Commit

Permalink
Find/Replace: Remove bottom margin
Browse files Browse the repository at this point in the history
- That margin is not necessary anymore with the new dock tabbar style.
- Also improve its placement in the IPython console.
  • Loading branch information
ccordoba12 committed Jul 18, 2023
1 parent 7dadbe1 commit 0f84ef9
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
6 changes: 6 additions & 0 deletions spyder/plugins/editor/plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
RunContext, RunConfigurationMetadata, RunConfiguration,
SupportedExtensionContexts, ExtendedContext)
from spyder.plugins.toolbar.api import ApplicationToolbars
from spyder.utils.stylesheet import MARGIN_SIZE
from spyder.widgets.mixins import BaseEditMixin
from spyder.widgets.simplecodeeditor import SimpleCodeEditor

Expand Down Expand Up @@ -368,6 +369,11 @@ def __init__(self, parent, ignore_last_opened_files=False):
self.find_widget.hide()
self.register_widget_shortcuts(self.find_widget)

# TODO: This is a hack! Remove it after migrating to the new API
self.find_widget.layout().setContentsMargins(
2 * MARGIN_SIZE, MARGIN_SIZE, 2 * MARGIN_SIZE, MARGIN_SIZE
)

# Start autosave component
# (needs to be done before EditorSplitter)
self.autosave = AutosaveForPlugin(self)
Expand Down
13 changes: 12 additions & 1 deletion spyder/plugins/ipythonconsole/widgets/main_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def __init__(self, name=None, plugin=None, parent=None):
pager_label_css.setValues(**{
'background-color': f'{QStylePalette.COLOR_ACCENT_2}',
'color': f'{QStylePalette.COLOR_TEXT_1}',
'margin': '2px 1px 0px 1px',
'margin': '2px 1px 1px 1px',
'padding': '5px',
'qproperty-alignment': 'AlignCenter',
'border-radius': f'{QStylePalette.SIZE_BORDER_RADIUS}'
Expand All @@ -345,6 +345,17 @@ def __init__(self, name=None, plugin=None, parent=None):
# Find/replace widget
self.find_widget = FindReplace(self)
self.find_widget.hide()

# Manually adjust margins for the find/replace widget
if not self.get_conf('vertical_tabs', section='main'):
# Remove an extra pixel that it's not present in other plugins
layout.addSpacing(-1)

# Align close button with the one in other plugins
self.find_widget.setStyleSheet("margin-left: 1px")
else:
self.find_widget.setStyleSheet("margin-bottom: 1px")

layout.addWidget(self.find_widget)

# Manually adjust pane margins, don't know why this is necessary.
Expand Down
5 changes: 4 additions & 1 deletion spyder/widgets/findreplace.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
from spyder.plugins.editor.utils.editor import TextHelper
from spyder.utils.qthelpers import create_toolbutton
from spyder.utils.sourcecode import get_eol_chars
from spyder.utils.stylesheet import MARGIN_SIZE
from spyder.widgets.comboboxes import PatternComboBox


Expand Down Expand Up @@ -71,7 +72,9 @@ def __init__(self, parent, enable_replace=False):
self.is_code_editor = None

glayout = QGridLayout()
glayout.setContentsMargins(6, 3, 6, 3)
glayout.setContentsMargins(
2 * MARGIN_SIZE, MARGIN_SIZE, 2 * MARGIN_SIZE, 0
)
self.setLayout(glayout)

self.close_button = create_toolbutton(
Expand Down

0 comments on commit 0f84ef9

Please sign in to comment.