Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PR: Add an option to set cursor blinking speed in miliseconds #4758

Merged
merged 12 commits into from
Aug 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions spyder/app/mainwindow.py
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,7 @@ def get_focus_python_shell():
class MainWindow(QMainWindow):
"""Spyder main window"""
DOCKOPTIONS = QMainWindow.AllowTabbedDocks|QMainWindow.AllowNestedDocks
CURSORBLINK_OSDEFAULT = QApplication.cursorFlashTime()
SPYDER_PATH = get_conf_path('path')
BOOKMARKS = (
('numpy', "http://docs.scipy.org/doc/",
Expand Down Expand Up @@ -2540,6 +2541,11 @@ def apply_settings(self):
self.apply_panes_settings()
self.apply_statusbar_settings()

if CONF.get('main', 'use_custom_cursor_blinking'):
qapp.setCursorFlashTime(CONF.get('main', 'custom_cursor_blinking'))
else:
qapp.setCursorFlashTime(self.CURSORBLINK_OSDEFAULT)

def apply_panes_settings(self):
"""Update dockwidgets features settings"""
# Update toggle action on menu
Expand Down
1 change: 1 addition & 0 deletions spyder/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
'cpu_usage/timeout': 2000,
'use_custom_margin': True,
'custom_margin': 0,
'use_custom_cursor_blinking': False,
'show_internal_console_if_traceback': False,
'check_updates_on_startup': True,
'toolbars_visible': True,
Expand Down
35 changes: 28 additions & 7 deletions spyder/plugins/configdialog.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,8 @@
QLineEdit, QListView, QListWidget, QListWidgetItem,
QMessageBox, QPushButton, QRadioButton,
QScrollArea, QSpinBox, QSplitter, QStackedWidget,
QStyleFactory, QTabWidget, QVBoxLayout, QWidget)
QStyleFactory, QTabWidget, QVBoxLayout, QWidget,
QApplication)

# Local imports
from spyder.config.base import (_, LANGUAGE_CODES, load_lang_conf,
Expand Down Expand Up @@ -879,11 +880,31 @@ def setup_page(self):
'use_custom_margin')
margin_spin = self.create_spinbox("", _("pixels"), 'custom_margin',
0, 0, 30)
margin_box.toggled.connect(margin_spin.setEnabled)
margin_spin.setEnabled(self.get_option('use_custom_margin'))
margins_layout = QHBoxLayout()
margins_layout.addWidget(margin_box)
margins_layout.addWidget(margin_spin)
margin_box.toggled.connect(margin_spin.spinbox.setEnabled)
margin_box.toggled.connect(margin_spin.slabel.setEnabled)
margin_spin.spinbox.setEnabled(self.get_option('use_custom_margin'))
margin_spin.slabel.setEnabled(self.get_option('use_custom_margin'))

cursor_box = newcb(_("Cursor blinking:"),
'use_custom_cursor_blinking')
cursor_spin = self.create_spinbox("", _("ms"), 'custom_cursor_blinking',
default = QApplication.cursorFlashTime(),
min_=0, max_=5000, step=100)
cursor_box.toggled.connect(cursor_spin.spinbox.setEnabled)
cursor_box.toggled.connect(cursor_spin.slabel.setEnabled)
cursor_spin.spinbox.setEnabled(
self.get_option('use_custom_cursor_blinking'))
cursor_spin.slabel.setEnabled(
self.get_option('use_custom_cursor_blinking'))

margins_cursor_layout = QGridLayout()
margins_cursor_layout.addWidget(margin_box, 0, 0)
margins_cursor_layout.addWidget(margin_spin.spinbox, 0, 1)
margins_cursor_layout.addWidget(margin_spin.slabel, 0, 2)
margins_cursor_layout.addWidget(cursor_box, 1, 0)
margins_cursor_layout.addWidget(cursor_spin.spinbox, 1, 1)
margins_cursor_layout.addWidget(cursor_spin.slabel, 1, 2)
margins_cursor_layout.setColumnStretch(2, 100)

# Layout interface
comboboxes_layout = QHBoxLayout()
Expand All @@ -901,7 +922,7 @@ def setup_page(self):
interface_layout.addWidget(verttabs_box)
interface_layout.addWidget(animated_box)
interface_layout.addWidget(tear_off_box)
interface_layout.addLayout(margins_layout)
interface_layout.addLayout(margins_cursor_layout)
interface_group.setLayout(interface_layout)

# --- Status bar
Expand Down