def genesis(self): # This method is called once per plugin, do initial setup here base = self.interface_action_base_plugin self.version = base.name + " v%d.%d.%d" % base.version # Read the plugin icons and store for potential sharing with the config widget icon_resources = self.load_resources(PLUGIN_ICONS) set_plugin_icon_resources(self.name, icon_resources) # Set the icon for this interface action # The get_icons function is a builtin function defined for all your # plugin code. It loads icons from the plugin zip file. It returns # QIcon objects, if you want the actual data, use the analogous # get_resources builtin function. # Note that if you are loading more than one icon, for performance, you # should pass a list of names to get_icons. In this case, get_icons # will return a dictionary mapping names to QIcons. Names that # are not found in the zip file will result in null QIcons. icon = get_icon('images/icon.png') # The qaction is automatically created from the action_spec defined # above self.qaction.setIcon(icon) # Call function when plugin triggered. self.qaction.triggered.connect(self.plugin_button) # Assign our menu to this action self.menu = QMenu() self.qaction.setMenu(self.menu)
def genesis(self): # This method is called once per plugin, do initial setup here base = self.interface_action_base_plugin self.version = base.name+" v%d.%d.%d"%base.version # Read the plugin icons and store for potential sharing with the config widget icon_resources = self.load_resources(PLUGIN_ICONS) set_plugin_icon_resources(self.name, icon_resources) # Set the icon for this interface action # The get_icons function is a builtin function defined for all your # plugin code. It loads icons from the plugin zip file. It returns # QIcon objects, if you want the actual data, use the analogous # get_resources builtin function. # Note that if you are loading more than one icon, for performance, you # should pass a list of names to get_icons. In this case, get_icons # will return a dictionary mapping names to QIcons. Names that # are not found in the zip file will result in null QIcons. icon = get_icon('images/icon.png') # The qaction is automatically created from the action_spec defined # above self.qaction.setIcon(icon) # Call function when plugin triggered. self.qaction.triggered.connect(self.plugin_button) # Assign our menu to this action self.menu = QMenu() self.qaction.setMenu(self.menu)
def __init__(self, gui, header, prefs, icon, books, save_size_name='epubmerge:update list dialog'): SizePersistedDialog.__init__(self, gui, save_size_name) self.gui = gui self.setWindowTitle(header) self.setWindowIcon(icon) layout = QVBoxLayout(self) self.setLayout(layout) title_layout = ImageTitleLayout(self, 'images/icon.png', header) layout.addLayout(title_layout) books_layout = QHBoxLayout() layout.addLayout(books_layout) self.books_table = StoryListTableWidget(self) books_layout.addWidget(self.books_table) button_layout = QVBoxLayout() books_layout.addLayout(button_layout) spacerItem = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) button_layout.addItem(spacerItem) self.move_up_button = QtGui.QToolButton(self) self.move_up_button.setToolTip(_('Move selected books up the list')) self.move_up_button.setIcon(QIcon(I('arrow-up.png'))) self.move_up_button.clicked.connect(self.books_table.move_rows_up) button_layout.addWidget(self.move_up_button) self.remove_button = QtGui.QToolButton(self) self.remove_button.setToolTip(_('Remove selected books from the list')) self.remove_button.setIcon(get_icon('list_remove.png')) self.remove_button.clicked.connect(self.remove_from_list) button_layout.addWidget(self.remove_button) self.move_down_button = QtGui.QToolButton(self) self.move_down_button.setToolTip(_('Move selected books down the list')) self.move_down_button.setIcon(QIcon(I('arrow-down.png'))) self.move_down_button.clicked.connect(self.books_table.move_rows_down) button_layout.addWidget(self.move_down_button) spacerItem1 = QtGui.QSpacerItem(20, 40, QtGui.QSizePolicy.Minimum, QtGui.QSizePolicy.Expanding) button_layout.addItem(spacerItem1) options_layout = QHBoxLayout() button_box = QDialogButtonBox(QDialogButtonBox.Ok | QDialogButtonBox.Cancel) button_box.accepted.connect(self.accept) button_box.rejected.connect(self.reject) options_layout.addWidget(button_box) layout.addLayout(options_layout) # Cause our dialog size to be restored from prefs or created on first usage self.resize_dialog() self.books_table.populate_table(books)