Module examples.example
Classes
class QFlowApp (*args, **kwargs)-
Expand source code
@QFlow.app( title='QFlow App Title', geometry=[100, 100, 800, 600], icon=lambda: QIcon(), animatedEvents={ 'fadeIn': True, 'fadeOut': True } ) # The class is initialized with predefined arguments using the decorator corresponding to the class class QFlowApp(QFlow.App): def __init__(self): # Definition of window self.secondaryWindow = QFlowSecondaryWindow() # Definition of screens self.mainScreen = QFlowMainScreen(parent=self) self.secondMovementScreen = QFlowSecondMovementScreen(parent=self) # Adding screens self.addScreen(screen=self.mainScreen) self.addScreen(screen=self.secondMovementScreen) # The main screen is set with parameters self.setScreen(name=self.mainScreen.name, args={ 'from': self.name, 'to': self.mainScreen.name }) # Creation of window with parameters self.createWindow(self.secondaryWindow, args={ 'from': self.name, 'to': self.secondaryWindow.name }) # A notification is created Notify(message='Hello', parent=self)An application class that extends Window functionality for main application windows.
This class provides all the functionality of a Window plus additional application-level features like strict window management and enhanced screen handling.
Ancestors
- QFlow.modules.app.app.App
- QFlow.modules.window.window.Window
- PyQt6.QtWidgets.QMainWindow
- PyQt6.QtWidgets.QWidget
- PyQt6.QtCore.QObject
- PyQt6.sip.wrapper
- PyQt6.QtGui.QPaintDevice
- PyQt6.sip.simplewrapper
class QFlowMainScreen (*args, **kwargs)-
Expand source code
@QFlow.screen( name='mainScreen', autoreloadUI=True, parentType=QFlow.App ) # The class is initialized with predefined arguments using the decorator corresponding to the class class QFlowMainScreen(QFlow.Screen): def __init__(self, parent): self.args['parent'] = parent """ The 'parent' argument is added to the predefined arguments using the 'args' property on each object using the 'screen' decorator. """ # The arguments are passed to super init super().__init__(**self.args) def effect(self): """ It runs whenever the screen is created or set. """ # The parameters that were previously passed to the object are obtained self.params = QFlow.hooks.Params(self) # For debug print(json.dumps(self.params.get(), indent=4)) def UI(self): """ Function where the entire screen UI is executed and must be initialized """ self.label = QLabel('Hello!') self.nameLabel = QLabel(f'Screen: {self.name}') self.screenSelectionInput = QLineEdit() self.screenSelectionInput.setPlaceholderText('Screen Name') self.moveToButton = QPushButton('Move to') # The parent (window || app) is obtained and a screen is set self.moveToButton.clicked.connect( lambda: self.parent() .setScreen( name=self.screenSelectionInput .text() .strip() ) ) self.screenSelectionLayout = QHBoxLayout() self.screenSelectionLayout.addWidget(self.moveToButton) self.screenSelectionLayout.addWidget(self.screenSelectionInput) self.reloadButton = QPushButton('Reload UI') self.reloadButton.clicked.connect(self.reloadUI) self.mainLayout = QVBoxLayout() self.mainLayout.addWidget(self.label) self.mainLayout.addWidget(self.nameLabel) self.mainLayout.addLayout(self.screenSelectionLayout) self.mainLayout.addWidget(self.reloadButton) # The main layout is established self.setLayout(self.mainLayout)A class that provides screen properties and screen management capabilities. Can be used as a base class or through composition.
Ancestors
- QFlow.modules.screen.screen.Screen
- PyQt6.QtWidgets.QWidget
- PyQt6.QtCore.QObject
- PyQt6.sip.wrapper
- PyQt6.QtGui.QPaintDevice
- PyQt6.sip.simplewrapper
Methods
def UI(self)-
Expand source code
def UI(self): """ Function where the entire screen UI is executed and must be initialized """ self.label = QLabel('Hello!') self.nameLabel = QLabel(f'Screen: {self.name}') self.screenSelectionInput = QLineEdit() self.screenSelectionInput.setPlaceholderText('Screen Name') self.moveToButton = QPushButton('Move to') # The parent (window || app) is obtained and a screen is set self.moveToButton.clicked.connect( lambda: self.parent() .setScreen( name=self.screenSelectionInput .text() .strip() ) ) self.screenSelectionLayout = QHBoxLayout() self.screenSelectionLayout.addWidget(self.moveToButton) self.screenSelectionLayout.addWidget(self.screenSelectionInput) self.reloadButton = QPushButton('Reload UI') self.reloadButton.clicked.connect(self.reloadUI) self.mainLayout = QVBoxLayout() self.mainLayout.addWidget(self.label) self.mainLayout.addWidget(self.nameLabel) self.mainLayout.addLayout(self.screenSelectionLayout) self.mainLayout.addWidget(self.reloadButton) # The main layout is established self.setLayout(self.mainLayout)Function where the entire screen UI is executed and must be initialized
def effect(self)-
Expand source code
def effect(self): """ It runs whenever the screen is created or set. """ # The parameters that were previously passed to the object are obtained self.params = QFlow.hooks.Params(self) # For debug print(json.dumps(self.params.get(), indent=4))It runs whenever the screen is created or set.
class QFlowSecondMovementScreen (*args, **kwargs)-
Expand source code
@QFlow.screen( name='secondMovementScreen', autoreloadUI=True ) # The class is initialized with predefined arguments using the decorator corresponding to the class class QFlowSecondMovementScreen(QFlow.Screen): def __init__(self, parent): self.args['parent'] = parent """ The 'parent' argument is added to the predefined arguments using the 'args' property on each object using the 'screen' decorator. """ # The arguments are passed to super init super().__init__(**self.args) def UI(self): """ Function where the entire screen UI is executed and must be initialized """ self.nameLabel = QLabel(f'Screen: {self.name}') self.reloadButton = QPushButton('Go back') self.reloadButton.clicked.connect(self.parent().goBack) self.mainLayout = QVBoxLayout() self.mainLayout.addWidget(self.nameLabel) self.mainLayout.addWidget(self.reloadButton) # The main layout is established self.setLayout(self.mainLayout)A class that provides screen properties and screen management capabilities. Can be used as a base class or through composition.
Ancestors
- QFlow.modules.screen.screen.Screen
- PyQt6.QtWidgets.QWidget
- PyQt6.QtCore.QObject
- PyQt6.sip.wrapper
- PyQt6.QtGui.QPaintDevice
- PyQt6.sip.simplewrapper
Methods
def UI(self)-
Expand source code
def UI(self): """ Function where the entire screen UI is executed and must be initialized """ self.nameLabel = QLabel(f'Screen: {self.name}') self.reloadButton = QPushButton('Go back') self.reloadButton.clicked.connect(self.parent().goBack) self.mainLayout = QVBoxLayout() self.mainLayout.addWidget(self.nameLabel) self.mainLayout.addWidget(self.reloadButton) # The main layout is established self.setLayout(self.mainLayout)Function where the entire screen UI is executed and must be initialized
class QFlowSecondaryScreen (*args, **kwargs)-
Expand source code
@QFlow.screen( name='secondaryScreen', autoreloadUI=True, parentType=QFlow.Window ) # The class is initialized with predefined arguments using the decorator corresponding to the class class QFlowSecondaryScreen(QFlow.Screen): def __init__(self, parent): self.args['parent'] = parent """ The 'parent' argument is added to the predefined arguments using the 'args' property on each object using the 'screen' decorator. """ # The arguments are passed to super init super().__init__(**self.args) def UI(self): """ Function where the entire screen UI is executed and must be initialized """ self.label = QLabel('Hello!') self.nameLabel = QLabel(f'Screen: {self.name}') self.reloadButton = QPushButton('Reload UI') self.reloadButton.clicked.connect(self.reloadUI) self.mainLayout = QVBoxLayout() self.mainLayout.addWidget(self.label) self.mainLayout.addWidget(self.nameLabel) self.mainLayout.addWidget(self.reloadButton) # The main layout is established self.setLayout(self.mainLayout)A class that provides screen properties and screen management capabilities. Can be used as a base class or through composition.
Ancestors
- QFlow.modules.screen.screen.Screen
- PyQt6.QtWidgets.QWidget
- PyQt6.QtCore.QObject
- PyQt6.sip.wrapper
- PyQt6.QtGui.QPaintDevice
- PyQt6.sip.simplewrapper
Methods
def UI(self)-
Expand source code
def UI(self): """ Function where the entire screen UI is executed and must be initialized """ self.label = QLabel('Hello!') self.nameLabel = QLabel(f'Screen: {self.name}') self.reloadButton = QPushButton('Reload UI') self.reloadButton.clicked.connect(self.reloadUI) self.mainLayout = QVBoxLayout() self.mainLayout.addWidget(self.label) self.mainLayout.addWidget(self.nameLabel) self.mainLayout.addWidget(self.reloadButton) # The main layout is established self.setLayout(self.mainLayout)Function where the entire screen UI is executed and must be initialized
class QFlowSecondaryWindow (*args, **kwargs)-
Expand source code
@QFlow.window( name='secondaryWindow', title='QFlow Secondary Window', geometry=[150, 150, 400, 300], icon=lambda: QIcon(), animatedEvents={ 'fadeIn': True, 'fadeOut': True } ) # The class is initialized with predefined arguments using the decorator corresponding to the class class QFlowSecondaryWindow(QFlow.Window): def __init__(self): # Definition of screen self.secondaryScreen = QFlowSecondaryScreen(self) # Adding screen self.addScreen(screen=self.secondaryScreen) # The main screen is set self.setScreen(name=self.secondaryScreen.name) def effect(self): """ It runs whenever the screen is created or set. """ # The parameters that were previously passed to the object are obtained self.params = QFlow.hooks.Params(self) # For debug print(json.dumps(self.params.get(), indent=4))A window class that provides window properties and screen management capabilities.
This class allows you to configure the title, geometry, and icon of a window, while also providing built-in screen management functionality.
Ancestors
- QFlow.modules.window.window.Window
- PyQt6.QtWidgets.QMainWindow
- PyQt6.QtWidgets.QWidget
- PyQt6.QtCore.QObject
- PyQt6.sip.wrapper
- PyQt6.QtGui.QPaintDevice
- PyQt6.sip.simplewrapper
Methods
def effect(self)-
Expand source code
def effect(self): """ It runs whenever the screen is created or set. """ # The parameters that were previously passed to the object are obtained self.params = QFlow.hooks.Params(self) # For debug print(json.dumps(self.params.get(), indent=4))It runs whenever the screen is created or set.