home *** CD-ROM | disk | FTP | other *** search
/ Maximum CD 2011 January / maximum-cd-2011-01.iso / DiscContents / calibre-0.7.26.msi / file_1176 (.txt) < prev    next >
Encoding:
Python Compiled Bytecode  |  2010-10-31  |  3.1 KB  |  82 lines

  1. # Source Generated with Decompyle++
  2. # File: in.pyc (Python 2.6)
  3.  
  4. __license__ = 'GPL v3'
  5. __copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
  6. __docformat__ = 'restructuredtext en'
  7. from functools import partial
  8. from PyQt4.Qt import QToolButton, QAction, QIcon, QObject
  9. from calibre.gui2 import Dispatcher
  10.  
  11. class InterfaceAction(QObject):
  12.     name = 'Implement me'
  13.     priority = 1
  14.     popup_type = QToolButton.MenuButtonPopup
  15.     auto_repeat = False
  16.     action_spec = ('text', 'icon', None, None)
  17.     dont_add_to = frozenset([])
  18.     dont_remove_from = frozenset([])
  19.     all_locations = frozenset([
  20.         'toolbar',
  21.         'toolbar-device',
  22.         'context-menu',
  23.         'context-menu-device'])
  24.     action_type = 'global'
  25.     
  26.     def __init__(self, parent, site_customization):
  27.         QObject.__init__(self, parent)
  28.         self.setObjectName(self.name)
  29.         self.gui = parent
  30.         self.site_customization = site_customization
  31.  
  32.     
  33.     def do_genesis(self):
  34.         self.Dispatcher = partial(Dispatcher, parent = self)
  35.         self.create_action()
  36.         self.gui.addAction(self.qaction)
  37.         self.genesis()
  38.  
  39.     
  40.     def create_action(self, spec = None, attr = 'qaction'):
  41.         if spec is None:
  42.             spec = self.action_spec
  43.         
  44.         (text, icon, tooltip, shortcut) = spec
  45.         if icon is not None:
  46.             action = QAction(QIcon(I(icon)), text, self.gui)
  47.         else:
  48.             action = QAction(text, self.gui)
  49.         action.setAutoRepeat(self.auto_repeat)
  50.         text = None if tooltip else text
  51.         action.setToolTip(text)
  52.         action.setStatusTip(text)
  53.         action.setWhatsThis(text)
  54.         action.setAutoRepeat(False)
  55.         if shortcut:
  56.             action.setShortcut(shortcut)
  57.         
  58.         setattr(self, attr, action)
  59.         return action
  60.  
  61.     
  62.     def genesis(self):
  63.         pass
  64.  
  65.     
  66.     def location_selected(self, loc):
  67.         pass
  68.  
  69.     
  70.     def library_changed(self, db):
  71.         pass
  72.  
  73.     
  74.     def initialization_complete(self):
  75.         pass
  76.  
  77.     
  78.     def shutting_down(self):
  79.         return True
  80.  
  81.  
  82.