populse_mia.user_interface.data_viewer.data_viewer¶
This module provides an abstract base class for data viewer implemenataions in populse_mia.
Data viewers are supposed to inherit DataViewer and implement (at
least) its methods. A data viewer is given a project and documents list, and is
thus allowed to access databasing features and documents attributes.
Coding a data viewer¶
A data viewer is identified after its module name, and is currently searched
for as a submodule of populse_mia.user_interface.data_viewer. The
data viewer module may be implemented as a “regular” module (.py file) or a
package (directory) and should contain at least a
class named MiaViewer which:
is a Qt
QWidget(inheritsQWidgetas 1st inheritance as is required by Qt)implements the
DataViewerAPI (normally by inheriting it as second inheritance afterQWidgetbut this is not technically required if the API is implemented)
Classes
An abstract base class for data viewers with a minimal, extensible API. |
|
|
Custom metaclass that combines ABC and QWidget's metaclasses. |
- class populse_mia.user_interface.data_viewer.data_viewer.ABC[source]¶
Bases:
objectHelper class that provides a standard way to create an ABC using inheritance.
- _abc_impl = <_abc._abc_data object>¶
- populse_mia.user_interface.data_viewer.data_viewer.abstractmethod(funcobj)[source]¶
A decorator indicating abstract methods.
Requires that the metaclass is ABCMeta or derived from it. A class that has a metaclass derived from ABCMeta cannot be instantiated unless all of its abstract methods are overridden. The abstract methods can be called using any of the normal ‘super’ call mechanisms. abstractmethod() may be used to declare abstract methods for properties and descriptors.
Usage:
- class C(metaclass=ABCMeta):
@abstractmethod def my_abstract_method(self, arg1, arg2, argN):
…
- class populse_mia.user_interface.data_viewer.data_viewer.MetaDataViewer(name, bases, namespace, /, **kwargs)[source]¶
Bases:
wrappertype,ABCMetaCustom metaclass that combines ABC and QWidget’s metaclasses.
- class populse_mia.user_interface.data_viewer.data_viewer.DataViewer[source]¶
-
An abstract base class for data viewers with a minimal, extensible API.
This class defines a standard interface for data viewers, allowing subclasses to implement custom visualization strategies. The base methods provide a simple contract for managing and displaying documents across different viewer implementations.
The API is intentionally kept simple to provide flexibility for specific use cases while ensuring a consistent basic functionality.
- clear()[source]¶
Remove all currently displayed files.
This method provides a default implementation that removes all files currently being displayed by calling remove_files().
- close()[source]¶
Close the viewer by clearing all displayed files.
This method provides a standard way to clean up and close the viewer, ensuring all resources are released.
- abstract display_files(files)[source]¶
Display the specified document files.
This method must be implemented by subclasses to define how files are visually presented or loaded.
- Parameters:
(List) (files) – A list of files to be displayed.
- Raises:
NotImplementedError – If not overridden by a subclass.
- abstract displayed_files()[source]¶
Retrieve the list of currently displayed files.
- Return (list):
A list of files currently being displayed.
- Raises:
NotImplementedError – If not overridden by a subclass.
- abstract remove_files(files)[source]¶
Remove specified files from the display.
- Parameters:
(list) (files) – A list of files to be removed from display.
- Raises:
NotImplementedError – If not overridden by a subclass.
- abstract set_documents(project, documents)[source]¶
Set the project context and available documents.
- Parameters:
project – The project associated with the documents.
(list) (documents) – The list of available documents.
- Raises:
NotImplementedError – If not overridden by a subclass.
- _abc_impl = <_abc._abc_data object>¶