def __init__(self, parent=None): QWidget.__init__(self, parent) self.l = l = QVBoxLayout(self) l.setContentsMargins(0, 0, 0, 0) self.search_input = si = SearchInput(self, 'highlights-search') si.do_search.connect(self.search_requested) l.addWidget(si) self.highlights = h = Highlights(self) l.addWidget(h) self.load = h.load
def __init__(self, parent=None): QWidget.__init__(self, parent) self.setFocusPolicy(Qt.FocusPolicy.NoFocus) self.l = l = QVBoxLayout(self) l.setContentsMargins(0, 0, 0, 0) self.search_input = si = SearchInput(self, 'highlights-search') si.do_search.connect(self.search_requested) l.addWidget(si) la = QLabel(_('Double click to jump to an entry')) la.setWordWrap(True) l.addWidget(la) self.highlights = h = Highlights(self) l.addWidget(h) h.jump_to_highlight.connect(self.jump_to_highlight) h.delete_requested.connect(self.remove_highlight) h.edit_requested.connect(self.edit_highlight) h.edit_notes_requested.connect(self.edit_notes) h.current_highlight_changed.connect(self.current_highlight_changed) self.load = h.load self.refresh = h.refresh self.h = h = QHBoxLayout() def button(icon, text, tt, target): b = QPushButton(QIcon(I(icon)), text, self) b.setToolTip(tt) b.setFocusPolicy(Qt.FocusPolicy.NoFocus) b.clicked.connect(target) return b self.edit_button = button('edit_input.png', _('Modify'), _('Modify the selected highlight'), self.edit_highlight) self.remove_button = button('trash.png', _('Delete'), _('Delete the selected highlights'), self.remove_highlight) self.export_button = button('save.png', _('Export'), _('Export all highlights'), self.export) h.addWidget(self.edit_button), h.addWidget( self.remove_button), h.addWidget(self.export_button) self.notes_display = nd = NotesDisplay(self) nd.notes_edited.connect(self.notes_edited) l.addWidget(nd) nd.setVisible(False) l.addLayout(h)
def __init__(self, parent=None): QWidget.__init__(self, parent) self.setFocusPolicy(Qt.NoFocus) self.l = l = QVBoxLayout(self) l.setContentsMargins(0, 0, 0, 0) self.search_input = si = SearchInput(self, 'highlights-search') si.do_search.connect(self.search_requested) l.addWidget(si) la = QLabel(_('Double click to jump to an entry')) la.setWordWrap(True) l.addWidget(la) self.highlights = h = Highlights(self) l.addWidget(h) h.jump_to_highlight.connect(self.jump_to_highlight) self.load = h.load self.refresh = h.refresh self.h = h = QHBoxLayout() l.addLayout(h) def button(icon, text, tt, target): b = QPushButton(QIcon(I(icon)), text, self) b.setToolTip(tt) b.setFocusPolicy(Qt.NoFocus) b.clicked.connect(target) return b self.add_button = button('plus.png', _('Add'), _('Create a new highlight'), self.add_highlight) self.edit_button = button('edit_input.png', _('Edit'), _('Edit the selected highlight'), self.edit_highlight) self.remove_button = button('trash.png', _('Remove'), _('Remove the selected highlight'), self.remove_highlight) h.addWidget(self.add_button), h.addWidget( self.edit_button), h.addWidget(self.remove_button)