Application

Main QtPyVCP Application Module

Contains the VCPApplication class with core function and VCP loading logic.

class qtpyvcp.app.application.VCPApplication(theme=None, stylesheet=None, custom_fonts=[])[source]
loadVCPMainWindow(opts, vcp_file=None)[source]

Loads a VCPMainWindow instance defined by a Qt .ui file, a Python .py file, or from a VCP python package.

Parameters:
  • vcp_file (str) – The path or name of the VCP to load.

  • opts (OptDict) – A OptDict of options to pass to the VCPMainWindow subclass.

Return type:

VCPMainWindow instance

loadPyFile(pyfile, opts)[source]

Load a .py file, performs some sanity checks to try and determine if the file actually contains a valid VCPMainWindow subclass, and if the checks pass, create and return an instance.

This is an internal method, users will usually want to use loadVCP instead.

Parameters:
  • pyfile (str) – The path to a .py file to load.

  • opts (OptDict) – A OptDict of options to pass to the VCPMainWindow subclass.

Return type:

VCPMainWindow instance

loadStylesheet(stylesheet, watch=False)[source]

Loads a QSS stylesheet file containing styles to be applied to specific Qt and/or QtPyVCP widget classes.

Parameters:
  • stylesheet (str) – Path to the .qss stylesheet to load.

  • watch (bool) – Whether to watch and re-load on .qss file changes.

loadCustomFont(font)[source]

Loads custom front from a file or directory.

addApplicationFont(font_path)[source]

Loads a font file into the font database. The path can specify the location of a font file or a qresource.

getWidget(name)[source]

Searches for a widget by name in the application windows.

Parameters:

name (str) – ObjectName of the widget.

Returns: QWidget

logPerformance()[source]

Logs total CPU usage (in percent), as well as per-thread usage.