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: Added shortcut and menu option to re-run last cell #3974

Merged
merged 11 commits into from
Mar 4, 2017

Conversation

andfoy
Copy link
Member

@andfoy andfoy commented Jan 17, 2017

Fixes #3959

@andfoy andfoy added this to the v3.2 milestone Jan 17, 2017
@andfoy andfoy self-assigned this Jan 17, 2017
@ccordoba12 ccordoba12 modified the milestones: v3.2, v3.3 Feb 14, 2017
@ccordoba12
Copy link
Member

@andfoy, this one also has conflicts with 3.x. Please update it so I can merge it :-)

else:
RUN_CELL_SHORTCUT = 'Ctrl+Return'
RE_RUN_LAST_CELL_SHORTCUT = 'Ctrl+Shift+R'
Copy link
Member

Choose a reason for hiding this comment

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

Ctrl+Shift+... is reserved to give focus to plugins. Please change this one to Alt+Shift+R

@ccordoba12
Copy link
Member

Could you post a screenshot to see how the new button looks?

@ccordoba12
Copy link
Member

The icon is a bit overloaded, so I don't think we should use it for now (it took us a lot of time to come up with good icons for the run cell actions, so don't worry about it).

So to finish this PR I think you need to:

  1. Remove the icon you introduced.
  2. Leave the re-run cell action in the Run menu and remove it from the Run toolbar.
  3. Change its shortcut to Alt+Enter. Sorry for making you to change it again, but it seems more logical to me now to have all these shortcuts related to Modifier+Enter.

@andfoy
Copy link
Member Author

andfoy commented Feb 27, 2017

@ccordoba12 This is ready to go

@@ -105,9 +105,12 @@ def setup_page(self):

interface_group = QGroupBox(_("Interface"))
newcb = self.create_checkbox
fpsorting_box = newcb(_("Sort files according to full path"),
'fullpath_sorting')
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 option. It's not need anymore in the 3.x branch.

showtabbar_box = newcb(_("Show tab bar"), 'show_tab_bar')

interface_layout = QVBoxLayout()
interface_layout.addWidget(fpsorting_box)
Copy link
Member

Choose a reason for hiding this comment

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

Also remove this.

@@ -539,6 +542,9 @@ def restore_scrollbar_position(self):
def get_plugin_title(self):
"""Return widget title"""
title = _('Editor')
filename = self.get_current_filename()
if filename:
title += ' - '+to_text_string(filename)
Copy link
Member

@ccordoba12 ccordoba12 Feb 27, 2017

Choose a reason for hiding this comment

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

All these new lines are not needed either.

@@ -834,6 +840,17 @@ def get_plugin_actions(self):
triggered=self.run_cell_and_advance,
context=Qt.WidgetShortcut)

re_run_last_cell_action = create_action(self,
_("Re-run last cell"),
icon=ima.icon('run_cell'),
Copy link
Member

Choose a reason for hiding this comment

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

Please leave this action without an icon.

run_cell_advance_action, run_selected_action,
re_run_action]
run_cell_advance_action,
re_run_action, configure_action]
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 configure_action from here.

def get_cell_as_executable_code(self):
"""Return cell contents as executable code"""
def __exec_cell(self):
init_cur = QTextCursor(self.textCursor())
Copy link
Member

Choose a reason for hiding this comment

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

Rename this variable to init_cursor

@ccordoba12
Copy link
Member

Thanks @andfoy!! I did a quick review to start with, but everything looks good to me.

A test is missing but I'll add it myself after you finish my review ;-)

run_selected_action, re_run_action,
configure_action, MENU_SEPARATOR]
self.main.run_menu_actions += run_menu_actions
run_toolbar_actions = [run_action, run_cell_action,
run_cell_advance_action, run_selected_action,
run_cell_advance_action,
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for the confusion, please restore run_selected_action here. It was fine before :-)

@ccordoba12 ccordoba12 changed the title PR: Added shortcut and menu options to re-run last cell PR: Added shortcut and menu option to re-run last cell Mar 4, 2017
@ccordoba12 ccordoba12 merged commit d870791 into spyder-ide:3.x Mar 4, 2017
ccordoba12 added a commit that referenced this pull request Mar 4, 2017
@andfoy andfoy deleted the re_run_last_cell branch June 14, 2019 19:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants