wiki_music.gui_lib module

Warning

Documentation is stil under construction some things might not be up to date.

gui_lib.qt_importer

Module for importing all Qt classes used by GUI.

Note

With the help of QtPy all major Qt bindings are supported: PyQt5, PyQt4, Pyside2 and PySide.

gui_lib.base

The base module for Qt frontend.

class wiki_music.gui_lib.base.BaseGui

Bases: PyQt5.QtWidgets.QMainWindow

Base for all GUI classes, initializes UI from Qt Designer ui files.

Then sets up needed variables. Connects buttons and input fields signals to methods. All GUI classes should subclass this class.

Warning

This class is not ment to be instantiated, only inherited.

work_dir

points to actuall selected directory with music files

Type:str
log

class logger

Type:wiki_music.utilities.utils.MultiLog
_display_image(image=None)

Will be reimpemented in wiki_music.gui_lib.data_model.

_do_nothing()

Show warning about functionality not being implemented yet.

Developement convenience function.

_initUI()

Load and set window tray icon and set application name.

gui_lib.data_model

Module that manages GUI data model and interacion with parser.

Warning

All parser interaciton should be hanhled by this class. Parser methods and attributes should not be accesed directly in GUI.

class wiki_music.gui_lib.data_model.DataModel

Bases: wiki_music.gui_lib.data_model.ParserInteract

Transfer data between GUI and parser and manage GUI data model.

This class reads data from parser to be displayed in GUI and on save or other action that requires parser it collects data in GUI and writes it to parser.

Warning

This class is not ment to be instantiated, only inherited.

cover_art

Qt class that displays the found cover art picture

Type:Optional[ResizablePixmap]
table

Qt table for displaying parser data

Type:TableItemModel
proxy

table model for data sorting

Type:NumberSortProxy
_detail(proxy_index: QModelIndex)

Display detail of the row that is clicked and sync changes to table.

Parameters:proxy_index (QModelIndex) – index of the proxy model cell, needs to be translated to real table cell index
_display_image(image: Optional[bytes] = None)

Shows cover art image preview in main window.

Parameters:image (bytes) – force displaying of the input image instead of the one contained in parser. Also the input image is saved to parser.
_gui_to_parser()

Transfers data from GUI to parser.

Warning

This operation is non-atomic, as of now it still does not have a proper locking mechanism. We rely on the fact that only GUI or the parser are trying to access data at a given time.

_input_is_present(with_warn: Optional[bool] = False) → bool

Check if apropriate input to conduct search is present.

Returns:true if all requested inputs are present
Return type:bool
_parser_to_gui()

Transfers data from parser GUI.

Warning

This operation is non-atomic, as of now it still does not have a proper locking mechanism. We rely on the fact that only GUI or the parser are trying to access data at a given time.

_text_check(row: int, col: int, text: Optional[str])

Writes changed text in detail tab to table.

Parameters:
  • row (int) – table row
  • col (int) – table column
  • text (Optional[str]) – text put in cell, if None read it from lyrics_detail
class wiki_music.gui_lib.data_model.ParserInteract

Bases: wiki_music.gui_lib.base.BaseGui

Class that represents comunication chanel between parser and GUI.

Warning

This class is not ment to be instantiated, only inherited.

_parser

parser instance doing all the heavy lifting

Type:wiki_music.library.parser.WikipediaRunner
ALBUM

Found album name.

See also

wiki_music.library.parser.base.ParserBase.ALBUM
parser attribute tied to this property
BaseGui.album_entry
Qt entry field tied to this property
BaseGui.album_entry_input
Qt entry field tied to this property
type:str
ALBUMARTIST

Found album artist name.

See also

wiki_music.library.parser.base.ParserBase.ALBUMARTIST
parser attribute tied to this property
BaseGui.band_entry
Qt entry field tied to this property
BaseGui.band_entry_input
Qt entry field tied to this property
type:str
COVERART

Album coverart.

See also

wiki_music.library.parser.base.ParserBase.COVERART
parser attribute tied to this property
type:str
DATE

Found release date.

See also

wiki_music.library.parser.base.ParserBase.DATE
parser attribute tied to this property
BaseGui.year_entry
Qt entry field tied to this property
type:str
GENRE

Found genre.

See also

wiki_music.library.parser.base.ParserBase.GENRE
parser attribute tied to this property
BaseGui.genre_entry
Qt entry field tied to this property
type:str
multi_threaded

Toogle multi threaded mode for parser.

See also

wiki_music.library.parser.preload.WikiCooker.multi_threaded
parser attribute tied to this property
type:bool
number_of_tracks

Number of found tracks.

Number of tracks detected by parser on wikipedia or load from disk.

Type:int
offline_debug

Toogle offline debugging mode for parser.

See also

wiki_music.library.parser.preload.WikiCooker.offline_debug
parser attribute tied to this property
type:bool
read_files()

Reads tags from music files.

See also

wiki_music.library.parser.in_out.ParserInOut.read_files
method for reading tags from files
reinit_parser()

Sets parser attributes to their default values.

Reinitializes parser attributes so a new search can be performed.

save_ready

Tells if there are any writable files in working directory.

Type:bool
start_preload(delay: Optional[float] = None)

Starts page preload.

See also

wiki_music.library.parser.preload.WikiCooker.Preload
parser inner class controlling preload
stop_preload()

Stops running page preload.

See also

wiki_music.library.parser.preload.WikiCooker.Preload
parser inner class controlling preload
url

Wikipedia url address of the downloaded page.

See also

wiki_music.library.parser.preload.WikiCooker.url
parser attribute tied to this property
type:str
work_dir

Current working directory.

See also

wiki_music.library.parser.base.ParserBase.work_dir
parser attribute tied to this property
type:str
write_tags(indices: List[int]) → bool

Writes tags to music files.

Parameters:indices (List[int]) – indices of files to save

See also

wiki_music.library.parser.in_out.ParserInOut.write_tags
method that controls tag writing
Returns:truth if writing was successful
Return type:bool

gui_lib.main_window

Module containing Main GUI window class called by GUI entry point.

class wiki_music.gui_lib.main_window.Window(debug)

Bases: wiki_music.gui_lib.data_model.DataModel, wiki_music.gui_lib.checkers.Checkers, wiki_music.gui_lib.buttons.Buttons, wiki_music.gui_lib.cover_art.CoverArtSearch, wiki_music.gui_lib.search_and_replace.Replacer

Toplevel GUI class, main winndow with all its functionality.

_init_progress_bar(minimum: int, maximum: int)

Resets main progresbar to 0 and sets range.

Parameters:
  • minimum (int) – minimal progressbar value
  • maximum (int) – maximum progressbar value
_load2gui()

Load files, start preload and show in GUI.

_load_dropped_dir(path: str)

Handle directory dropped onto the table.

Parameters:path (str) – path to dropped directory

Start only lyric search in background thread.

_question(message: str, ignore_button: bool = False) → Union[str, bool]

Create dialog and request response from user.

Parameters:
  • message (str) – text of the message to show in dialog
  • ignore_button (bool) – whether to show ignore button
_save_tags(selected: bool = False)

Save changes to file tags, after saving reload files from disk.

_select_dir()

Select working directory, read found files and start preload.

_setup_wikisearch()

Sets up GUI input elements siganl connections.

Start wikipedia search in background thread.

gui_lib.cover_art

Module with classes for cover art picture search and download.

class wiki_music.gui_lib.cover_art.CoverArtSearch

Bases: wiki_music.gui_lib.base.BaseGui

Main class that handles cover art search.

Calls all the apropriate methods. First initialize google_images_download in a separate thread, then initializes Search dialog window. After that it reads downloaded image thumbnails and displays them inn the dialog.

image_search_thread

thread that runs the goolgle_images download in the background

Type:Thread
search_dialog

reference to dialog window showing the downloaded pictures in table

Type:SearchDialog
picture_editor

reference to dialog window that handles selected image editing

Type:PictureEdit

See also

wiki_music.external_libraries.google_images_download
submodule that handles downloading cover art images
wiki_music.gui_lib.cover_art.SearchDialog
class that shows dialog downloaded cover art images and some basic search controls
wiki_music.gui_lib.cover_art.PictureEdit
handles editing of downloaded pictures
_async_loader()

Periodically checks background thread for new downloaded images.

When a new image is found it is loaded and passed to GUI dialog to display. Chceck is scheduled every 50ms.

See also

wiki_music.gui_lib.cover_art.PictureEdit
dialog window that displays the downloaded images
_load_more()

Method that raises the maximum number of images to download.

_manual_load(from_where: str)

Handle user manual picture load from file or url.

Parameters:from_where (str) – possible choices are url or file
_select_picture(index: int)

Method that initializes classes for selected picture editing.

Parameters:index (int) – position of the picture in downloade pictures list

Method that takes care of cover art search, download and edit.

See also

_async_loader()
method that loads results to GUI
_select_picture()
method that stats picture edit dialog
class wiki_music.gui_lib.cover_art.PictureContainer(bytes_image: bytes, log: wiki_music.utilities.utils.MultiLog)

Bases: wiki_music.gui_lib.custom_classes.pictures.SelectablePixmap

Holds the selected picture that is being edited.

The raw picture is stored in bytes data. Which are the loaded by PIL for manipulation or by GUI to display.

Warning

This class has the ability to select parts of picture with a rubberband so it should be used only for editing pictures.

Parameters:
  • bytes_image (bytes) – the picture that will be edited in bytes format
  • log (wiki_music.utilities.util.MultiLog) – logger instance of creating class
bytes_image_orig

original image in byres format

Type:bytes
bytes_image_edit

original image with applied compession

Type:bytes
bytes_image_crop

cropped version of original image without compression

Type:Optional[bytes]
bytes_image_resz

resized version of original image without compression

Type:Optional[bytes]
log

class logger

Type:wiki_music.utilities.util.MultiLog
disksizeChanged

signal that is emited whenever the disk size of image changes by compresion, resize or crop

Type:Signal(str)
dimensionsChanged

signal emited on picture resize or crop

Type:Signal(int, int)

See also

wiki_music.gui_lib.custom_classes.SelectablePixmap
inhereted class which implements the ability to select with rubberband
compress_image(quality: int)

Apply defined compresion to image and show result.

Parameters:quaility (int) – value between 1 and 99 setting the compresion level

See also

wiki_music.utilitie.gui_utils.comp_res()
compresses image using PIL
crop_image(quality: int)

Crops image to part selected by rubberband.

After cropping appliy set level of compresin and shows image in GUI.

Parameters:quaility (int) – value between 1 and 99 setting the compresion level

See also

wiki_music.utilitie.gui_utils.comp_res()
compresses image using PIL
current_image_c

Get image to compress.

Returns:the appropriate image version
Return type:bytes
current_image_r

Get image to resize.

Returns:the appropriate image version
Return type:bytes
resize_image(x: int, y: int, quality: int)

Resize image to set dimensions, apply defined compresion.

Parameters:
  • quaility (int) – value between 1 and 99 setting the compresion level
  • x (int) – horizontal image dimension in pixels
  • y (int) – vertical image dimension in pixels

See also

wiki_music.utilitie.gui_utils.comp_res()
compresses and resizes image using PIL
save_image(path: pathlib.Path)

Save current version of the image to file with name Folder.jpg.

class wiki_music.gui_lib.cover_art.PictureEdit(dimensions: Tuple[int, int], clicked_image: bytes, log: wiki_music.utilities.utils.MultiLog, save_dir: str)

Bases: PyQt5.QtWidgets.QDialog

Manages picture editor window.

Takes care of cropping, resizing and compressing abilities.

Parameters:
  • dimensions (Tuple[int, int]) – dimensions of the image being edited
  • clicked_image (bytes) – the image to edit in bytes format
  • log (wiki_music.utilities.utils.MultiLog) – main GUI class logger
  • save_dir (str) – directory in which the edited image will be saved if the option is chosen
picture

class holding the picture and its metods

Type:PictureContainer
original_ratio

save original ratio of the picture

Type:float
editingFinished

signal to emit the edited picture when choice is accepted

Type:Signal
_aspect_ratio_sync(dim: int, activated: str)

Synchronize the aspect ratio spinboxes.

Parameters:
  • dim (int) – the current value in spinbox which activated this method
  • activated (str) – x or y the spinbox which activated this methos
_get_compressed(comp_value: int, activated: str)

Compresses the image to desired value.

Parameters:
  • comp_value (int) – compression value from interval (1, 99)
  • activated (str) – where to get the value from, spinbox or slider

See also

PictureContainer.compress_image()
method activated to apply the compression to picture
_get_crop_ratio(value: str)

Sets the desired aspect ratio for cropping.

See also

PictureContainer.set_aspect_ratio()
method activated to apply the aspect ratio to picture

Paremeters(), ----------()

value()
str ratio value can be one of: wiki_music.constants.gui_const.ASPECT_RATIOS
Raises:ValueError – if the passed value is not a valid ratio format
_setup_overlay()

Connect all the dialog elements to coresponding signals.

clipboard

Clipboard checkbox state.

Type:bool
compresion

Current compresion slider and spinbox value.

Type:int
image_dims

Edited image dimensions.

Type:Tuple[int, int]
picture_save()

Saves picture to Folder.jpg in directory with edited music files.

Warning

Copying to clipboard is disabled for now

See also

PictureContainer.save_image()
method activated to save picture to file
PictureContainer.send2clipboard()
method activated to paste picture to clipboard
preserve_ratio

Preserve ration checkbox state.

Type:bool
save_file

Save to disk checkbox state.

Type:bool
set_image_dims(x: int, y: int)

Passes current image dimension to spinboxes.

Parameters:
  • x (int) – horizontal dimension in pixels
  • y (int) – vertical dimension in pixels
class wiki_music.gui_lib.cover_art.SearchDialog(query: str)

Bases: PyQt5.QtWidgets.QDialog

Manages the search dialog window.

Displays found picture thumbnails and houses some basic search controls.

Parameters:query (str) – search phrase passed to google images download
table

special subclass of Qt ImageTable that can hold pictures in cells and can add new pictures on the fly

Type:wiki_music.gui_lib.custom_classes.ImageTable
pictureClicked

signal emited when table cell is clicked

Type:Signal(int)

See also

wiki_music.ui.cover_art_base.Ui_cover_art_search
this is the template class for this class layout
wiki_music.gui_lib.custom_classes.ImageTable
this is the class that manages the table itself
add_pic(dimension: str, thumbnail: bytes)

Add new picture to the table.

Parameters:
  • dimension (str) – formated string with image dimension and size in Kb
  • thumbnail (bytes) – raw image thumbnail in bytes format
max_columns

Get fixed predefined number of row columns.

Returns:predefined number of table columns
Return type:int
table_cell_clicked(row: int, col: int)

Emits signal when cell in table is clicked with picture list index.

Position index in list is calculated from rom the row and column.

Parameters:
  • row (int) – row pocition of clicked cell
  • col (int) – column position of clicked cell

gui_lib.custom_classes

Module housing custom Qt classes designed to support the GUI.

class wiki_music.gui_lib.custom_classes.NumberSortProxy

Bases: PyQt5.QtCore.QSortFilterProxyModel

Custom table proxy model which can sort numbers not only strings.

lessThan(left_index: QModelIndex, right_index: QModelIndex) → bool

Reimplemented comparator method to handle numbers correctly.

Parameters:
  • left_index (QModelIndex) – index of the left compared element
  • right_index (QModelIndex) – index of the right compared element
class wiki_music.gui_lib.custom_classes.ImageTable(parent: Optional[PyQt5.QtWidgets.QWidget] = None)

Bases: PyQt5.QtWidgets.QTableWidget

Table with cells holding Images with short text in cells.

Parameters:
  • parent (QWidget) – reterence to parent widget for centering
  • Attribures
  • ----------
  • MAX_COLUMNS (int) – constant saying how many columns should the table have
  • actualCol (int) – holds the position of actual column

See also

ImageItem
each cell holds one of these widgets
add_pic(label: str, picture: bytes)

Add one picture to table.

Pictures are added in row until the row has ImageTable.MAX_COLUMNS pictures then we switch to the next row.

Parameters:
  • label (str) – short text to display under picture
  • picture (bytes) – picture to display
Raises:

ValueError – when method tries to add picture in column with index > ImageTable.MAX_COLUMNS

ij

Actual free cell where next picture should be added.

Type:Tuple[int, int]
resizeToContents()

Resizes table rows and columns to fit largest cell contents.

class wiki_music.gui_lib.custom_classes.ResizablePixmap(bytes_image: bytes, stretch: bool = True)

Bases: PyQt5.QtWidgets.QLabel

Picture that can be arbitrarilly resized while keeping its aspect ratio.

Parameters:bytes_image_edit (bytes) – image that is displayed
static _bytes2pixmap(raw_image: bytes) → PyQt5.QtGui.QPixmap

Convert bytes image to QPixmap.

Parameters:raw_image (bytes) – bytes image to be converted
Returns:image as Qt QPixmap
Return type:QPixmap
static _pixmap2bytes(pixmap: PyQt5.QtGui.QPixmap) → bytes

Convert QPixmap to bytes image.

Parameters:pixmap (QPixmap) – Qt QPixmap to be converted
Returns:bytes image
Return type:bytes
image_dims

Actual image dimensions.

Returns:image width and height
Return type:Tuple[int, int]
resizeEvent(event: PyQt5.QtCore.QEvent)

Reimplement behaviour on resize with scaling enabled.

Parameters:event (QEvent) – the event that triggered this method
scale(fromResize: bool = False)

Handle picture scaling.

Parameters:fromResize (bool) – special handling if this method was called after resize, but only in subclasses
update_pixmap(bytes_image: bytes)

Changes displayed image for a new one.

Parameters:bytes_image (bytes) – new image to display in bytes format
class wiki_music.gui_lib.custom_classes.RememberDir(window_instance: object)

Bases: object

Context manager for remembering last opened directory.

Parameters:window_instance (object) – reference to the window in which the context was initialized to center the directory selection dialog
_start_dir

remembered directory if it could be read from file

Type:str
get_dir() → Tuple[str, bool]

Shows a folder selection dialog with the last visited dir as root.

After the user has selected directory it is remenbered, returned to user and upon context exit saved to file.

Returns:
  • str – string with directory name
  • bool – True if some directory was selected, False if dialog was canceled
class wiki_music.gui_lib.custom_classes.TableItemModel

Bases: PyQt5.QtGui.QStandardItemModel

Make table columns indexable by its names. Add easy column manipulation.

Overrides the default impementation. adds __getitem__

_format_col(column: Union[int, str]) → int

Convert column header name to index.

Parameters:column (Union[int, str]) – column integer index or header name
Returns:column index
Return type:int
getColumn(column: Union[int, str], split: Optional[bool] = False) → list

Return whole table column as python list.

Parameters:
  • column (Union[int, str]) – column integer index or header name
  • split (bool) – is strings in each column cell should be split on ‘,’ to list
Returns:

list of column cell items

Return type:

list

match_all(string: str, columns: Sequence[Union[str, int]], role: PyQt5.QtCore.Qt.ItemDataRole, flags: PyQt5.QtCore.Qt.MatchFlags) → List[QModelIndex]

Matches all indices without restrictions in selected table columns.

Parameters:
  • string (str) – string to search for
  • columns (List[Union[str, int]]) – column indeces or header names, can be mixed
  • role (Qt.ItemDataRole) – model data role to search
  • flags (Qt.MatchFlags) – Qt match flags
Returns:

matching model indices

Return type:

List[QModelIndex]

setColumn(column: Union[int, str], value_list: list)

Write python list to Qt table column.

Parameters:
  • column (Union[int, str]) – column integer index or header name
  • value_list (list) – values to put in column
set_python_item(row: int, column: int, item: Any)

Casts python type to Qt and passes its ownership table.

Parameters:
  • row (int) – row index
  • column (int) – column index
  • item (Any) – items to put into table
class wiki_music.gui_lib.custom_classes.SelectablePixmap(bytes_image: bytes)

Bases: wiki_music.gui_lib.custom_classes.pictures.ResizablePixmap

Pixmap whose part can be selected with selection rubberband.

Warning

The solution is copied from stackoverflow and is not yet properly documented.

References

https://stackoverflow.com/questions/58053735/get-real-size-of-qpixmap-in-qlabel

currentQRubberBand

holds reference to current rubberband

Type:Optional[_ResizableRubberBand]
rubberBandOffset

rubberband upper left corner offset from the point where the mouse was clicked before dragging start

Type:Optional[QPoint]
moveDirection

direction in which rubberband edge is dragged when resizing

Type:Optional[Qt.Orientation]
rubberBandRatio

forced aspect ratio of rubberband

Type:Optional[float]
pixmapRect

rectangle defining the pixmap borders

Type:QRect
selectionActive

signal emited whenerver new rubberband selection is created destroyed

Type:Signal(bool)
_update_ratio()

If rubberband is created updates its aspect ratio.

cancel_selection()

Cancels the current selection and destroys the rubberband.

create_selection(pos: PyQt5.QtCore.QPoint)

Create new rubberband selection.

Parameters:pos (QPoint) – clicked position

Note

If old selection existed new is created only if mouse click happens outside of that selection. Othervise the current selection is moved.

eventFilter(source, event: PyQt5.QtCore.QEvent)

Filteres GUI events to call special method on resize event.

Parameters:
  • source – source that caused the event
  • event (QEvent) – type of event
Returns:

result of the superclass eventFilter

Return type:

Callable

mouseMoveEvent(event: PyQt5.QtCore.QEvent)

Handles mouse movement events concerning the rubberband.

The movement after mouse button is clicked and held can cause two actions. If the click occured in the margins than the selection is resized by dragging the edge. If it is inside the selection rectangle then the selection rubberband is moved by drgging.

Parameters:event (QEvent) – the calling event
mousePressEvent(event: PyQt5.QtCore.QEvent)

Handles left mouse button cliks.

If the clicked position is inside the current selection than that selection is moved. If it is outside tahn a new selection is created. If the click is in selection margins than the picture is resized by dragging one of the edges.

Parameters:event (QEvent) – calling event

See also

SelectablePixmap.updateMargins()
method responsible for creating margins and keeping them up to date
mouseReleaseEvent(event: PyQt5.QtCore.QEvent)

Handles mouse release events and cleans up the data afterwards.

Resets: rubberBandOffset, originQPoint, moveDirection

scale(fromResize: bool = False)

Handle picture and selection scaling caused by window resize.

Parameters:fromResize (bool) – tells the type if event that requested scaling
set_aspect_ratio(ratio: Optional[float])

Sets aspect ratio for rubberband.

Parameters:ratio (float) – desired aspect ratio
updateMargins()

Update picture margins formouse event tracking.

Whenever the rubberband rectangle geometry changes, create virtual rectangles for corners and sides to ease up mouse event checking.

class wiki_music.gui_lib.custom_classes.CustomQTableView(*args, **kwargs)

Bases: PyQt5.QtWidgets.QTableView

Table view implementing drag & drop actions.

This is a custom widget for QtDesigner, its location must remain the same, otherwise UIC compiler will not find it at compile time. If it should be moved than QtableView widget promote settings must be changed accordingly. This class has to reimplement all three methods for drag & drop to work.

Accepts only drops with paths to file or directory

FileDropped

signal emited when folder is dropped to table

Type:Signal(Path)
_selected_rows_save

save selected rows when search and replace is active

Type:Optional[List[int]]

References

https://stackoverflow.com/questions/19622014/how-do-i-use-promote-to-in-qt-designer-in-pyqt4 https://www.learnpyqt.com/courses/qt-creator/embed-pyqtgraph-custom-widgets-qt-app/

_model

Underlying table data model.

Type:TableItemModel
_move_match_cursor(direction: int)

Move search cursor to the next position.

Parameters:direction (int) – direction of the move +1 = next, -1 = previous
_proxy

Underlying proxy model.

Type:NumberSortProxy
_reset()

Restore to original non-highlight state before search.

_set(value: bool)

Set roles for found items to True or False.

Parameters:value (bool) – all roles will be set to this value
_sort_indices_by_view()

Sort indeces by their position in table, top to bottom.

dragEnterEvent(event: QEnterEvent)

Handle start of a mouse drag, allow only data with file loactions.

Parameters:event (QEnterEvent) – object containing info about occuring event
dragMoveEvent(event: QMoveEvent)

Handle mouse drag movement, allow only data with file loactions.

Parameters:event (QMoveEvent) – object containing info about occuring event
dropEvent(event: QDropEvent)

Handle data drop into the table.

Only the first address is used, others are discarded.

Parameters:event (QDropEvent) – object containing info about occuring event and dropped data
replace_all(search_str: str, replace_str: str, only_one: Optional[bool] = False)

Replaces one currently selected occurence.

Parameters:
  • search_str (str) – string to look for
  • replace_str (str) – string to use as replacement
  • only_one (bool) – replace only the first occurence
replace_one(search_str: str, replace_str: str)

Replaces one currently selected occurence.

Parameters:
  • search_str (str) – string to look for
  • replace_str (str) – string to use as replacement

See also

replace_all()

search_next()

Move search cursor to the next position.

search_previous()

Move search cursor to the previous position.

search_string(string: str, case_sensitive: bool, support_re: bool, support_wildcard: bool, col_indices: List[int])

Search all table fields for string match.

Parameters:
  • string (str) – string to search for
  • case_sensitive (bool) – if True search will be case sensitive
  • support_re (bool) – support regular expressions
  • support_wildcard (bool) – support widlcard operators
  • col_indices (List[int]) – list of column indices where search will be performed

References

https://doc-snapshots.qt.io/4.8/qt.html#MatchFlag-enum https://stackoverflow.com/questions/60639974/visual-position-of-item-in-qtableview/60642965?noredirect=1#comment107304241_60642965

selected_rows(to_source: bool = True) → List[int]

Returns indices of selected table rows.

Parameters:to_source (bool) – map proxy indices to source model
Returns:indices of selected rows
Return type:List[int]
set_search_visibility(tab_index: int)

Sets flags that tells if search tab is visible.

Parameters:tab_index (int) – tab index
class wiki_music.gui_lib.custom_classes.CheckableListModel

Bases: PyQt5.QtGui.QStandardItemModel

Builds list view with checkable items.

References

https://stackoverflow.com/questions/846684/a-listview-of-checkboxes-in-pyqt

add(item_name: str, checked: Optional[bool] = False)

Add one row to checkabel list.

item_name: str
name of the list item
checked: Optional[bool]
control if item will be in checked state upon insertion
get_checked_indices() → List[int]

Return list of indices of items that are checked.

Returns:list with checked indices
Return type:List[int]
class wiki_music.gui_lib.custom_classes.ProgressBar(dialog_name: str, minimum: int, maximum: int, parent: QWidget, run_me_later: Optional[Callable[[...], Any]] = None, thread_pool: Optional[ThreadPool] = None)

Bases: object

Class controling GUI progressbar and pooling threadpool for progress.

Parameters:
  • dialog_name (str) – name of the progressbar dialog
  • minimum (int) – minimum progressbar value
  • maximum (int) – maximum progressbar value
  • parent (QWidget) – parent object reference for centering, this should be Qapplication instance
  • run_me_later (Optional[Callable[.., Any]]) – callable that should be executed after treadpool is finished, it will be called with one keyword argument: collect=True
  • thread_pool (Optional["ThreadPool"]) – reference to the underlying threadpool