Esempio n. 1
0
 def setup_context_menu(self):
     """Setup shell context menu"""
     self.menu = QMenu(self)
     self.cut_action = create_action(self, _("Cut"),
                                     shortcut=keybinding('Cut'),
                                     icon=ima.icon('editcut'),
                                     triggered=self.cut)
     self.copy_action = create_action(self, _("Copy"),
                                      shortcut=keybinding('Copy'),
                                      icon=ima.icon('editcopy'),
                                      triggered=self.copy)
     paste_action = create_action(self, _("Paste"),
                                  shortcut=keybinding('Paste'),
                                  icon=ima.icon('editpaste'),
                                  triggered=self.paste)
     save_action = create_action(self, _("Save history log..."),
                                 icon=ima.icon('filesave'),
                                 tip=_("Save current history log (i.e. all "
                                       "inputs and outputs) in a text file"),
                                 triggered=self.save_historylog)
     self.delete_action = create_action(self, _("Delete"),
                                 shortcut=keybinding('Delete'),
                                 icon=ima.icon('editdelete'),
                                 triggered=self.delete)
     selectall_action = create_action(self, _("Select All"),
                                 shortcut=keybinding('SelectAll'),
                                 icon=ima.icon('selectall'),
                                 triggered=self.selectAll)
     add_actions(self.menu, (self.cut_action, self.copy_action,
                             paste_action, self.delete_action, None,
                             selectall_action, None, save_action) )
Esempio n. 2
0
 def setup_context_menu(self):
     """Setup shell context menu"""
     self.menu = QMenu(self)
     self.cut_action = create_action(self, _("Cut"),
                                     shortcut=keybinding('Cut'),
                                     icon=ima.icon('editcut'),
                                     triggered=self.cut)
     self.copy_action = create_action(self, _("Copy"),
                                      shortcut=keybinding('Copy'),
                                      icon=ima.icon('editcopy'),
                                      triggered=self.copy)
     paste_action = create_action(self, _("Paste"),
                                  shortcut=keybinding('Paste'),
                                  icon=ima.icon('editpaste'),
                                  triggered=self.paste)
     save_action = create_action(self, _("Save history log..."),
                                 icon=ima.icon('filesave'),
                                 tip=_("Save current history log (i.e. all "
                                       "inputs and outputs) in a text file"),
                                 triggered=self.save_historylog)
     self.delete_action = create_action(self, _("Delete"),
                                 shortcut=keybinding('Delete'),
                                 icon=ima.icon('editdelete'),
                                 triggered=self.delete)
     selectall_action = create_action(self, _("Select All"),
                                 shortcut=keybinding('SelectAll'),
                                 icon=ima.icon('selectall'),
                                 triggered=self.selectAll)
     add_actions(self.menu, (self.cut_action, self.copy_action,
                             paste_action, self.delete_action, None,
                             selectall_action, None, save_action) )
Esempio n. 3
0
 def setup_menu(self):
     """Setup context menu"""
     copy_action = create_action(self,
                                 _('Copy'),
                                 shortcut=keybinding('Copy'),
                                 icon=ima.icon('editcopy'),
                                 triggered=self.copy,
                                 context=Qt.WidgetShortcut)
     functions = ((_("To bool"), bool), (_("To complex"),
                                         complex), (_("To int"), int),
                  (_("To float"), float), (_("To str"), to_text_string))
     types_in_menu = [copy_action]
     for name, func in functions:
         # QAction.triggered works differently for PySide and PyQt
         if not API == 'pyside':
             slot = lambda _checked, func=func: self.change_type(func)
         else:
             slot = lambda func=func: self.change_type(func)
         types_in_menu += [
             create_action(self,
                           name,
                           triggered=slot,
                           context=Qt.WidgetShortcut)
         ]
     menu = QMenu(self)
     add_actions(menu, types_in_menu)
     return menu
Esempio n. 4
0
 def setup_menu(self):
     """Setup context menu"""
     self.copy_action = create_action(self, _('Copy'),
                                      shortcut=keybinding('Copy'),
                                      icon=ima.icon('editcopy'),
                                      triggered=self.copy,
                                      context=Qt.WidgetShortcut)
     menu = QMenu(self)
     add_actions(menu, [self.copy_action, ])
     return menu
Esempio n. 5
0
 def setup_menu(self):
     """Setup context menu"""
     self.copy_action = create_action(self, _('Copy'),
                                      shortcut=keybinding('Copy'),
                                      icon=ima.icon('editcopy'),
                                      triggered=self.copy,
                                      context=Qt.WidgetShortcut)
     menu = QMenu(self)
     add_actions(menu, [self.copy_action, ])
     return menu
 def setup_menu(self):
     """Setup context menu."""
     copy_action = create_action(self,
                                 _('Copy'),
                                 shortcut=keybinding('Copy'),
                                 icon=ima.icon('editcopy'),
                                 triggered=self.copy,
                                 context=Qt.WidgetShortcut)
     functions = ((_("To bool"), bool), (_("To complex"),
                                         complex), (_("To int"), int),
                  (_("To float"), float), (_("To str"), to_text_string))
     types_in_menu = [copy_action]
     for name, func in functions:
         slot = lambda func=func: self.change_type(func)
         types_in_menu += [
             create_action(self,
                           name,
                           triggered=slot,
                           context=Qt.WidgetShortcut)
         ]
     menu = QMenu(self)
     add_actions(menu, types_in_menu)
     return menu
Esempio n. 7
0
 def setup_menu(self):
     """Setup context menu"""
     copy_action = create_action(self, _('Copy'),
                                 shortcut=keybinding('Copy'),
                                 icon=ima.icon('editcopy'),
                                 triggered=self.copy,
                                 context=Qt.WidgetShortcut)
     functions = ((_("To bool"), bool), (_("To complex"), complex),
                  (_("To int"), int), (_("To float"), float),
                  (_("To str"), to_text_string))
     types_in_menu = [copy_action]
     for name, func in functions:
         # QAction.triggered works differently for PySide and PyQt
         if not API == 'pyside':
             slot = lambda _checked, func=func: self.change_type(func)
         else:
             slot = lambda func=func: self.change_type(func)
         types_in_menu += [create_action(self, name,
                                         triggered=slot,
                                         context=Qt.WidgetShortcut)]
     menu = QMenu(self)
     add_actions(menu, types_in_menu)
     return menu