Skip to content

Commit

Permalink
Merge pull request #15183 from ccordoba12/more-style-fixes
Browse files Browse the repository at this point in the history
PR: More style fixes
  • Loading branch information
ccordoba12 committed Apr 8, 2021
2 parents 0d6b0ad + 7e714d3 commit d923927
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 13 deletions.
7 changes: 5 additions & 2 deletions spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@
from spyder import dependencies
from spyder.app import tour
from spyder.app.utils import (create_splash_screen, delete_lsp_log_files,
qt_message_handler, setup_logging,
set_opengl_implementation, Spy)
qt_message_handler, set_links_color,
setup_logging, set_opengl_implementation, Spy)
from spyder.config.base import (_, DEV, get_conf_path, get_debug_level,
get_home_dir, get_module_source_path,
get_safe_mode, is_pynsist, running_in_mac_app,
Expand Down Expand Up @@ -2289,6 +2289,9 @@ def main(options, args):
pass
CONF.set('main', 'previous_crash', previous_crash)

# **** Set color for links ****
set_links_color(app)

# **** Create main window ****
mainwindow = None
try:
Expand Down
17 changes: 16 additions & 1 deletion spyder/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
# Third-party imports
import psutil
from qtpy.QtCore import QCoreApplication, Qt
from qtpy.QtGui import QPixmap
from qtpy.QtGui import QColor, QPalette, QPixmap
from qtpy.QtWidgets import QSplashScreen

# Local imports
Expand All @@ -26,6 +26,7 @@
from spyder.utils.image_path_manager import get_image_path
from spyder.utils.qthelpers import file_uri
from spyder.utils.external.dafsa.dafsa import DAFSA
from spyder.utils.stylesheet import QStylePalette

# For spyder-ide/spyder#7447.
try:
Expand Down Expand Up @@ -183,3 +184,17 @@ def create_splash_screen():
splash = None

return splash


def set_links_color(app):
"""
Fix color for links.
This is taken from QDarkstyle, which is MIT licensed.
"""
color = QStylePalette.COLOR_ACCENT_3
qcolor = QColor(color)

app_palette = app.palette()
app_palette.setColor(QPalette.Normal, QPalette.Link, qcolor)
app.setPalette(app_palette)
2 changes: 1 addition & 1 deletion spyder/plugins/editor/widgets/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -3195,7 +3195,7 @@ def __init__(self, plugin, menu_actions, toolbar_list, menu_list):
self.toolbars.append(toolbar)
if menu_list:
quit_action = create_action(self, _("Close window"),
icon="close_panel",
icon=ima.icon("close_pane"),
tip=_("Close this window"),
triggered=self.close)
self.menus = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
DEFAULT_ATTR_COLS, DEFAULT_ATTR_DETAILS, ToggleColumnTreeView,
TreeItem, TreeModel, TreeProxyModel)
from spyder.utils.icon_manager import ima
from spyder.utils.qthelpers import (add_actions, create_plugin_layout,
create_toolbutton, qapplication)
from spyder.utils.qthelpers import add_actions, create_toolbutton, qapplication
from spyder.utils.stylesheet import PANES_TOOLBAR_STYLESHEET
from spyder.widgets.simplecodeeditor import SimpleCodeEditor


Expand Down Expand Up @@ -185,6 +185,7 @@ def _setup_menu(self, show_callable_attributes=False,
toggled=self._toggle_show_callable_attributes_action)
callable_attributes.setCheckable(True)
callable_attributes.setChecked(show_callable_attributes)
callable_attributes.setStyleSheet(str(PANES_TOOLBAR_STYLESHEET))
self.tools_layout.addWidget(callable_attributes)

special_attributes = create_toolbutton(
Expand All @@ -193,20 +194,21 @@ def _setup_menu(self, show_callable_attributes=False,
toggled=self._toggle_show_special_attributes_action)
special_attributes.setCheckable(True)
special_attributes.setChecked(show_special_attributes)
special_attributes.setStyleSheet(str(PANES_TOOLBAR_STYLESHEET))
self.tools_layout.addSpacing(5)
self.tools_layout.addWidget(special_attributes)

self.tools_layout.addStretch()

self.options_button = create_toolbutton(
self, text=_('Options'), icon=ima.icon('tooloptions'))
self.options_button.setStyleSheet(str(PANES_TOOLBAR_STYLESHEET))
self.options_button.setPopupMode(QToolButton.InstantPopup)

self.show_cols_submenu = QMenu(self)
self.show_cols_submenu.setObjectName('checkbox-padding')
self.options_button.setMenu(self.show_cols_submenu)
# Don't show menu arrow and remove padding
self.options_button.setStyleSheet(
("QToolButton::menu-indicator{image: none;}\n"
"QToolButton{padding: 3px;}"))
self.show_cols_submenu.setStyleSheet(str(PANES_TOOLBAR_STYLESHEET))
self.tools_layout.addWidget(self.options_button)

@Slot()
Expand All @@ -226,9 +228,13 @@ def _toggle_show_special_attributes_action(self):

def _setup_views(self):
"""Creates the UI widgets."""
layout = QVBoxLayout()
layout.setContentsMargins(0, 0, 0, 0)
layout.setSpacing(0)

layout.addLayout(self.tools_layout)
self.central_splitter = QSplitter(self, orientation=Qt.Vertical)
layout = create_plugin_layout(self.tools_layout,
self.central_splitter)
layout.addWidget(self.central_splitter)
self.setLayout(layout)

# Stretch last column?
Expand Down
2 changes: 1 addition & 1 deletion spyder/utils/icon_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ def __init__(self):
'editcut': [('mdi.content-cut',), {'color': self.MAIN_FG_COLOR}],
'editclear': [('mdi.delete',), {'color': self.MAIN_FG_COLOR}],
'selectall': [('mdi.select-all',), {'color': self.MAIN_FG_COLOR}],
'exit': [('mdi.power',), {'color': SpyderPalette.COLOR_ERROR_1}],
'exit': [('mdi.power',), {'color': self.MAIN_FG_COLOR}],
'advanced': [('mdi.package-variant',), {'color': self.MAIN_FG_COLOR}],
'bug': [('mdi.bug',), {'color': self.MAIN_FG_COLOR}],
'window_nofullscreen': [('mdi.arrow-collapse-all',), {'color': self.MAIN_FG_COLOR}],
Expand Down

0 comments on commit d923927

Please sign in to comment.