Class: QgsNewsFeedParser

Parser for published QGIS news feeds.

This class is designed to work with the specialized QGIS news feed API. See https://github.com/elpaso/qgis-feed.

Added in version 3.10.

Class Hierarchy

Inheritance diagram of qgis.core.QgsNewsFeedParser

Base classes

QObject

Methods

authcfg

Returns the authentication configuration for the parser.

dismissAll

Dismisses all current news items.

dismissEntry

Dismisses an entry with matching key.

entries

Returns a list of existing entries in the feed.

fetch

Fetches new entries from the feed's URL.

Static Methods

keyForFeed

Returns the settings key used for a feed with the given baseUrl.

Signals

entryAdded

Emitted whenever a new entry is available from the feed (as a result of a call to fetch()).

entryDismissed

Emitted whenever an entry is dismissed (as a result of a call to dismissEntry()).

entryUpdated

Emitted whenever an existing entry is available from the feed (as a result of a call to fetch()).

fetched

Emitted when entries have been fetched from the feed.

imageFetched

Emitted when the image attached to the entry with the specified key has been fetched and is now available.

class qgis.core.QgsNewsFeedParser[source]

Bases: QObject

__init__(feedUrl: QUrl, authcfg: str | None = '', parent: QObject | None = None)

Constructor for QgsNewsFeedParser, parsing the specified feedUrl.

The optional authcfg argument can be used to specify an authentication configuration to use when connecting to the feed.

Parameters:
  • feedUrl (QUrl)

  • authcfg (Optional[str] = '')

  • parent (Optional[QObject] = None)

class Entry[source]

Bases: object

Represents a single entry from a news feed.

Added in version 3.10.

content: str

HTML content of news entry

expiry: QDateTime

Optional auto-expiry time for entry

image: QPixmap

Optional image data

imageUrl: str

Optional URL for image associated with entry

key: int

Unique entry identifier

Optional URL link for entry

sticky: bool

True if entry is “sticky” and should always be shown at the top

title: str

Entry title

authcfg(self) str[source]

Returns the authentication configuration for the parser.

Return type:

str

dismissAll(self)[source]

Dismisses all current news items.

See also

dismissEntry()

dismissEntry(self, key: int)[source]

Dismisses an entry with matching key.

This removes the entry from the local store, ensuring it will never be present again.

See also

dismissAll()

Parameters:

key (int)

entries(self) List[QgsNewsFeedParser.Entry]

Returns a list of existing entries in the feed.

Return type:

List[QgsNewsFeedParser.Entry]

signal entryAdded(entry: QgsNewsFeedParser.Entry)[source]

Emitted whenever a new entry is available from the feed (as a result of a call to fetch()).

See also

fetch()

Parameters:

entry (QgsNewsFeedParser.Entry)

signal entryDismissed(entry: QgsNewsFeedParser.Entry)[source]

Emitted whenever an entry is dismissed (as a result of a call to dismissEntry()).

See also

dismissEntry()

Parameters:

entry (QgsNewsFeedParser.Entry)

signal entryUpdated(entry: QgsNewsFeedParser.Entry)[source]

Emitted whenever an existing entry is available from the feed (as a result of a call to fetch()).

See also

fetch()

Added in version 3.36.

Parameters:

entry (QgsNewsFeedParser.Entry)

fetch(self)[source]

Fetches new entries from the feed’s URL.

See also

fetched()

signal fetched(entries: List[QgsNewsFeedParser.Entry])[source]

Emitted when entries have been fetched from the feed.

See also

fetch()

Parameters:

entries (List[QgsNewsFeedParser.Entry])

signal imageFetched(key: int, pixmap: QPixmap)[source]

Emitted when the image attached to the entry with the specified key has been fetched and is now available.

Parameters:
  • key (int)

  • pixmap (QPixmap)

static keyForFeed(baseUrl: str | None) str[source]

Returns the settings key used for a feed with the given baseUrl.

Parameters:

baseUrl (Optional[str])

Return type:

str