main¶
Bundles common gui functions and classes
When creating a standalone app, you can use jukeboxcore.gui.main.init_gui() to make sure there is a running QApplication. Usually the launcher will do that for you. Then use set_main_style to apply the main_stylesheet to your app. That way all the plugins have a consistent look.
- jukeboxcore.gui.main.app = None¶
The QApplication app instance when using jukebox.core.gui.main.get_qapp()
- jukeboxcore.gui.main.get_qapp()[source]¶
Return an instance of QApplication. Creates one if neccessary.
Returns: a QApplication instance Return type: QApplication Raises: None
- jukeboxcore.gui.main.load_all_resources()[source]¶
Load all resources inside this package
When compiling qt resources, the compiled python file will register the resource on import.
Warning
This will simply import all modules inside this package
- jukeboxcore.gui.main.set_main_style(widget)[source]¶
Load the main.qss and apply it to the application
Parameters: widget (QtGui.QWidget) – The widget to apply the stylesheet to. Can also be a QApplication. setStylesheet is called on the widget. Returns: None Return type: None Raises: None
- jukeboxcore.gui.main.init_gui()[source]¶
Initialize a QApplication and apply the main style to it
Returns: None Return type: None Raises: None
- jukeboxcore.gui.main.wrap(ptr, base=None)[source]¶
Wrap the given pointer with shiboken and return the appropriate QObject
Returns: if ptr is not None returns a QObject that is cast to the appropriate class Return type: QObject | None Raises: None
- jukeboxcore.gui.main.dt_to_qdatetime(dt)[source]¶
Convert a python datetime.datetime object to QDateTime
Parameters: dt (datetime.datetime) – the datetime object Returns: the QDateTime conversion Return type: QtCore.QDateTime Raises: None
- jukeboxcore.gui.main.get_icon(name, aspix=False, asicon=False)[source]¶
Return the real file path to the given icon name If aspix is True return as QtGui.QPixmap, if asicon is True return as QtGui.QIcon.
Parameters: Returns: The real file path to the given icon name. If aspix is True return as QtGui.QPixmap, if asicon is True return as QtGui.QIcon. If both are True, a QtGui.QIcon is returned.
Return type: string
Raises: None
- class jukeboxcore.gui.main.JB_Gui(*args, **kwargs)[source]¶
Bases: object
A mixin class for top-level widgets liek main windows, widgets, dialogs etc
This class tracks its instances. So all classes that use this mixedin are tracked. Additionally each class that uses this mixin keeps track of its own instances and instances of its own class+subclasses
Constructs a new JB_Gui that will be tracked
Raises: None - classmethod allinstances()[source]¶
Return all instances that inherit from JB_Gui
Returns: all instances that inherit from JB_Gui Return type: list Raises: None
- classmethod classinstances()[source]¶
Return all instances of the current class
JB_Gui will not return the instances of subclasses A subclass will only return the instances that have the same type as the subclass. So it won’t return instances of further subclasses.
Returns: all instnaces of the current class Return type: list Raises: None
- class jukeboxcore.gui.main.JB_MainWindow(*args, **kwargs)[source]¶
Bases: jukeboxcore.gui.main.JB_Gui, PySide.QtGui.QMainWindow
A main window class that should be used for all main windows
It is useful for tracking all main windows and we can already set common attributes.
Constructs a new JB_MainWindow. Arguments are passed on to QMainWindow
Raises: None - staticMetaObject = <PySide.QtCore.QMetaObject object at 0x0000000004F76748>¶
- class jukeboxcore.gui.main.JB_Dialog(*args, **kwargs)[source]¶
Bases: jukeboxcore.gui.main.JB_Gui, PySide.QtGui.QDialog
A dialog class that should be used for all generic dialogs
It is useful for tracking all dialogs and we can already set common attributes.
Constructs a new JB_MainWindow. Arguments are passed on to QMainWindow
Raises: None - staticMetaObject = <PySide.QtCore.QMetaObject object at 0x0000000004F76788>¶