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 1 commit
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
1 change: 0 additions & 1 deletion spyder/config/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@
'use_custom_margin': True,
'custom_margin': 0,
'use_custom_cursor_blinking': False,
'custom_cursor_blinking': 1000,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ccordoba12 and @jnsebgosselin I think we still need to have the option here, the only difference is that it would be None by default, and when building the spinbox, we would check if it is None and update with the default by QApplication, or just use the stored value.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I do that, then delete my .init files and restart Spyder, I get the following traceback:

Traceback (most recent call last):
  File "C:\Users\jsgosselin\spyder\spyder\app\mainwindow.py", line 2585, in edit_preferences
    widget.initialize()
  File "C:\Users\jsgosselin\spyder\spyder\plugins\configdialog.py", line 76, in initialize
    self.load_from_conf()
  File "C:\Users\jsgosselin\spyder\spyder\plugins\configdialog.py", line 332, in load_from_conf
    spinbox.setValue(self.get_option(option, default))
TypeError: setValue(self, int): argument 1 has unexpected type 'NoneType'

Copy link
Member

@ccordoba12 ccordoba12 Aug 1, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@goanpeca, there is no need to do that because values are placed here only if we plan to change/update them in the future.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But this value is OS dependent, so we can't put it here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok

'show_internal_console_if_traceback': False,
'check_updates_on_startup': True,
'toolbars_visible': True,
Expand Down
7 changes: 5 additions & 2 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 @@ -328,6 +329,7 @@ def load_from_conf(self):
if lineedit.restart_required:
self.restart_options[option] = lineedit.label_text
for spinbox, (option, default) in list(self.spinboxes.items()):
print(option, default, self.get_option(option, default))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove this print here.

spinbox.setValue(self.get_option(option, default))
spinbox.valueChanged.connect(lambda _foo, opt=option:
self.has_been_modified(opt))
Expand Down Expand Up @@ -887,7 +889,8 @@ def setup_page(self):
cursor_box = newcb(_("Cursor blinking:"),
'use_custom_cursor_blinking')
cursor_spin = self.create_spinbox("", _("ms"), 'custom_cursor_blinking',
0, 0, 5000)
default = QApplication.cursorFlashTime(),
min_ = 0, max_ = 5000, step = 10)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please remove spaces around =. They are not needed for keyword args.

cursor_box.toggled.connect(cursor_spin.spinbox.setEnabled)
cursor_box.toggled.connect(cursor_spin.slabel.setEnabled)
cursor_spin.spinbox.setEnabled(
Expand Down