Skip to content

Commit

Permalink
Send all action to active front instead of first tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Carreau committed Oct 4, 2011
1 parent b9cf9e4 commit 6ee799b
Showing 1 changed file with 39 additions and 20 deletions.
59 changes: 39 additions & 20 deletions IPython/frontend/qt/console/qtconsoleapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,10 @@ def initMenuBar(self):
# as we are not sure of instanciating a _frontend which support all
# theses actions, but there might be a better way
try:
pass
self.print_action = QtGui.QAction("Print",
self,
shortcut="Ctrl+P",
triggered=self.undo_active_frontend)
triggered=self.print_action_active_frontend)
self.fileMenu.addAction(self.print_action)
except AttributeError:
print "trying to add unexisting action (print), skipping"
Expand All @@ -202,17 +201,22 @@ def initMenuBar(self):
print "trying to add unexisting action (Export), skipping"

try:
self.fileMenu.addAction(self._frontend.select_all_action)
self.select_all_action = QtGui.QAction("Select All",
self,
shortcut="Ctrl+A",
triggered=self.select_all_active_frontend
)
self.fileMenu.addAction(self.select_all_action)
except AttributeError:
print "trying to add unexisting action, skipping"
print "trying to add unexisting action (select all), skipping"

try:
self.undo_action = QtGui.QAction("Undo",
self,
shortcut="Ctrl+Z",
statusTip="Undo last action if possible",
triggered=self.undo_active_frontend)

self,
shortcut="Ctrl+Z",
statusTip="Undo last action if possible",
triggered=self.undo_active_frontend
)
self.editMenu.addAction(self.undo_action)
except AttributeError:
print "trying to add unexisting action (undo), skipping"
Expand All @@ -225,20 +229,35 @@ def initMenuBar(self):
triggered=self.redo_active_frontend)
self.editMenu.addAction(self.redo_action)
except AttributeError:
print "trying to add unexisting action(redo), skipping"
print "trying to add unexisting action (redo), skipping"

try:
pass#self.fontMenu.addAction(self.increase_font_size_active_frontend)
self.increase_font_size = QtGui.QAction("Increase Font Size",
self,
shortcut="Ctrl++",
triggered=self.increase_font_size_active_frontend
)
self.fontMenu.addAction(self.increase_font_size)
except AttributeError:
print "trying to add unexisting action (increase font size), skipping"

try:
pass#self.fontMenu.addAction(self.decrease_font_size_active_frontend)
self.decrease_font_size = QtGui.QAction("Decrease Font Size",
self,
shortcut="Ctrl+-",
triggered=self.decrease_font_size_active_frontend
)
self.fontMenu.addAction(self.decrease_font_size)
except AttributeError:
print "trying to add unexisting action (decrease font size), skipping"

try:
pass#self.fontMenu.addAction(self.reset_font_size_active_frontend)
self.reset_font_size = QtGui.QAction("Reset Font Size",
self,
shortcut="Ctrl+0",
triggered=self.reset_font_size_active_frontend
)
self.fontMenu.addAction(self.reset_font_size)
except AttributeError:
print "trying to add unexisting action (reset font size), skipping"

Expand Down Expand Up @@ -326,20 +345,20 @@ def whos_magic_active_frontend(self):
self.activeFrontend().whos_magic()

def print_action_active_frontend(self):
self.activeFrontend().print_action()
self.activeFrontend().print_action.trigger()

def export_action_active_frontend(self):
self.activeFrontend().export_action()
self.activeFrontend().export_action.trigger()

def select_all_action_frontend(self):
self.activeFrontend().select_all_action()
def select_all_active_frontend(self):
self.activeFrontend().select_all_action.trigger()

def increase_font_size_active_frontend(self):
self.activeFrontend().increase_font_size()
self.activeFrontend().increase_font_size.trigger()
def decrease_font_size_active_frontend(self):
self.activeFrontend().decrease_font_size()
self.activeFrontend().decrease_font_size.trigger()
def reset_font_size_active_frontend(self):
self.activeFrontend().reset_font_size()
self.activeFrontend().reset_font_size.trigger()
#---------------------------------------------------------------------------
# QWidget interface
#---------------------------------------------------------------------------
Expand Down

0 comments on commit 6ee799b

Please sign in to comment.