notes#

Module contains the widgets used to add and edit item cards/notes.

Classes:

CardWidget(extra_data[, read_only, parent])

Card widget represents a single note item.

CardsScrollWidget([parent])

Widget used to store a list of :class:`CardWidget`s.

CardsWidget(index[, parent])

This is the main cards/notes widget.

DragIndicatorButton([parent])

Dotted button indicating a draggable item.

DragOverlayWidget([parent])

Widget responsible for indicating files are being loaded.

Lockfile(index[, parent])

Lockfile to prevent another user from modifying the database whilst an edit is in progress.

OverlayWidget([parent])

Widget responsible for indicating files are being loaded.

RemoveNoteButton([parent])

Button used to remove a note item.

SyntaxHighlighter(document[, parent])

TextEditor([parent])

Functions:

close()

Closes the CardsWidget editor.

show(index)

Shows the CardsWidget editor.

class bookmarks.notes.CardWidget(extra_data, read_only=False, parent=None)[source]#

Bases: QWidget

Card widget represents a single note item.

It has a title and a main note editor. Use set_card_data() to set, and get_card_data() to retrieve the card contents.

Methods:

eventFilter(self, watched, event)

get_card_data()

Returns the title and note of the card.

set_card_data([title, body, extra_data])

Sets the note contents and extra data.

eventFilter(self, watched: PySide2.QtCore.QObject, event: PySide2.QtCore.QEvent) bool[source]#
get_card_data()[source]#

Returns the title and note of the card.

Returns:

Title, body and extra data of the card.

Return type:

dict

set_card_data(title='', body='', extra_data={})[source]#

Sets the note contents and extra data.

Parameters:
  • title (str) – The note’s title.

  • body (str) – The note’s content.

  • extra_data (dict) – Extra data about the note.

class bookmarks.notes.CardsScrollWidget(parent=None)[source]#

Bases: QScrollArea

Widget used to store a list of :class:`CardWidget`s.

The widget implements user sorting by custom drag and drop mechanisms.

Methods:

add_card(title, body[, extra_data, read_only])

Add a new CardWidget to the list.

dragEnterEvent(event)

Event handler.

eventFilter(widget, event)

Custom event filter.

add_card(title, body, extra_data={}, read_only=False)[source]#

Add a new CardWidget to the list.

Parameters:
  • title (str) – Title of the note.

  • body (str) – Note.

dragEnterEvent(event)[source]#

Event handler.

eventFilter(widget, event)[source]#

Custom event filter.

class bookmarks.notes.CardsWidget(index, parent=None)[source]#

Bases: QDialog

This is the main cards/notes widget.

Methods:

done(r)

Close the window.

get_cards_data()

Get all cards data.

init_data()

Load cards data stored in the database.

save()

Save the note items to the database.

sizeHint()

Returns a size hint.

Attributes:

index

The QModelIndex of the current item.

done(r)[source]#

Close the window.

get_cards_data()[source]#

Get all cards data.

Returns:

A dictionary of each card item’s data.

Return type:

dict

init_data()[source]#

Load cards data stored in the database.

save()[source]#

Save the note items to the database.

sizeHint()[source]#

Returns a size hint.

property index#

The QModelIndex of the current item.

class bookmarks.notes.DragIndicatorButton(parent=None)[source]#

Bases: QLabel

Dotted button indicating a draggable item.

The button is responsible for initiating a QDrag operation and setting the mime data. The data is populated with the TodoEditor’s text and the custom mime type. The latter is needed to accept the drag operation in the target drop widget.

Methods:

mouseMoveEvent(event)

Event handler.

mousePressEvent(event)

Event handler.

mouseMoveEvent(event)[source]#

Event handler.

mousePressEvent(event)[source]#

Event handler.

class bookmarks.notes.DragOverlayWidget(parent=None)[source]#

Bases: OverlayWidget

Widget responsible for indicating files are being loaded.

Methods:

paintEvent(self, event)

paintEvent(self, event: PySide2.QtGui.QPaintEvent) None[source]#
class bookmarks.notes.Lockfile(index, parent=None)[source]#

Bases: QSettings

Lockfile to prevent another user from modifying the database whilst an edit is in progress.

Methods:

init_lock()

Creates a lock file.

init_lock()[source]#

Creates a lock file.

This will prevent others from editing the notes of this time whilst we have the editor open.

class bookmarks.notes.OverlayWidget(parent=None)[source]#

Bases: QWidget

Widget responsible for indicating files are being loaded.

Methods:

paintEvent(self, event)

paintEvent(self, event: PySide2.QtGui.QPaintEvent) None[source]#
class bookmarks.notes.RemoveNoteButton(parent=None)[source]#

Bases: ClickableIconButton

Button used to remove a note item.

Methods:

action()

Remove note item action.

action()[source]#

Remove note item action.

class bookmarks.notes.SyntaxHighlighter(document, parent=None)[source]#

Bases: QSyntaxHighlighter

Methods:

highlightBlock(self, text)

highlightBlock(self, text: str) None[source]#
class bookmarks.notes.TextEditor(parent=None)[source]#

Bases: QTextBrowser

Methods:

keyPressEvent(event)

Key press event handler.

mouseMoveEvent(self, ev)

mouseReleaseEvent(self, ev)

showEvent(event)

Event handler.

keyPressEvent(event)[source]#

Key press event handler.

mouseMoveEvent(self, ev: PySide2.QtGui.QMouseEvent) None[source]#
mouseReleaseEvent(self, ev: PySide2.QtGui.QMouseEvent) None[source]#
showEvent(event)[source]#

Event handler.

bookmarks.notes.close()[source]#

Closes the CardsWidget editor.

bookmarks.notes.show(index)[source]#

Shows the CardsWidget editor.

Parameters:

index (QModelIndex) – The item’s