GUI Utils
- class discopygal.gui.GraphicsScenePlus.GraphicsScenePlus(gui)
Extender for Qt’s QGraphicsScene Add support for general useful capabilities which are not supported natively for QGraphicsScene
Adding signals for mouse (left and right) clicks, and scroll for zoom in/out
- left_click_signal
Signal when user left mouse clicks the graphics view
- mousePressEvent(event)
Handle mouse (left or right) press events
- Parameters:
event (
QEvent
) – mouse press event
- right_click_signal
Signal when user right mouse clicks the graphics view
- wheelEvent(event)
Handle mouse wheel events
- Parameters:
event (
QEvent
) – mouse wheel event
- class discopygal.gui.logger.Logger(text_edit_widget)
Widget class that represents a GUI log window in the app You can append text to the log in different colors
- append_text(string)
Append text the the bottom of the log. The appended text’s color will be the one selected in the ‘color’ brush member of the widget
- Parameters:
string (
str
) – new text to append
- color = <PyQt5.QtGui.QBrush object>
color of the text that will be drawn next
- set_color(color)
Change the drawing color of the text
- Parameters:
color (
QColor
) – new color
- class discopygal.gui.logger.Writer(logger: Logger)
A QObject that handles writing to the logger widget
- Parameters:
logger (
Logger
) – logger widget reference
- append_text_signal
Signal that is fired when text is appended to the logger
- change_color_signal
Signal that is fired when brush color is changed
- set_color(color)
Set the brush color of the logger, and emit a signal
- Parameters:
color (
QColor
) – brush color of the logger
- write(string)
Write text into the logger, and emit a signal
- Parameters:
string (
str
) – new text to append
- class discopygal.gui.MainWindowsPlus.MainWindowPlus(gui)
Extender for Qt’s QMainWindow Add support for general useful capabilities which are not supported natively for QMainWindow
Adding file dragging capability and +/- keys for zoom in/out
- dragEnterEvent(event)
Handle drag enter events
- Parameters:
event (
QEvent
) – drag enter event
- dragMoveEvent(event)
Handle drag move events
- Parameters:
event (
QEvent
) – drag move event
- dropEvent(event)
Handle drog events
- Parameters:
event (
QEvent
) – drop event
- keyPressEvent(event)
Handle key press events
- Parameters:
event (
QEvent
) – key press event
- signal_drop
Signal when user drags a file to the app
- class discopygal.gui.Worker.Worker(fn, *args)
Task worker that can run a function in parallel to GUI. Function’s result is returned in the ‘finished’ signal
- Parameters:
fn (function(...->object)) – function that the worker runs
*args (
object
,object
, …) – arguments to be passed to function
- run()
Initialise the runner function with passed args, kwargs.
- stop()
Stop the current task