WindowMixin
Base classes
Subclasses
Class |
Module |
Description |
Window |
prettyqt.gui.window |
|
PaintDeviceWindowMixin |
prettyqt.gui.paintdevicewindow |
|
QuickWindowMixin |
prettyqt.quick.quickwindow |
|
⋔ Inheritance diagram
graph TD
1473245538720["gui.WindowMixin"]
1473299815024["core.ObjectMixin"]
140713234304496["builtins.object"]
1473245537744["gui.SurfaceMixin"]
1473299815024 --> 1473245538720
140713234304496 --> 1473299815024
1473245537744 --> 1473245538720
140713234304496 --> 1473245537744
🛈 DocStrings
Bases: ObjectMixin
, SurfaceMixin
Source code in prettyqt\gui\window.py
| class WindowMixin(core.ObjectMixin, gui.SurfaceMixin):
def __repr__(self):
return get_repr(self)
def add_shortcut(
self,
keysequence: datatypes.KeyCombinationType,
callback: Callable | None = None,
context: constants.ShortcutContextStr | constants.ShortcutContext = "window",
) -> gui.Shortcut:
if not isinstance(keysequence, gui.QKeySequence):
keysequence = gui.KeySequence(keysequence)
context = constants.SHORTCUT_CONTEXT.get_enum_value(context)
return gui.Shortcut(keysequence, self, callback, context=context)
def set_visibility(self, visibility: VisibilityStr | gui.QWindow.Visibility):
"""Set window visibility.
Args:
visibility: window visibility
"""
self.setVisibility(VISIBILITY.get_enum_value(visibility))
def get_visibility(self) -> VisibilityStr:
"""Get the current window visibility.
Returns:
window visibility
"""
return VISIBILITY.inverse[self.visibility()]
def start_system_resize(self, edge: constants.EdgeStr | constants.Edge) -> bool:
"""Start system resize.
Args:
edge: edge to resize
"""
return self.startSystemResize(constants.EDGES.get_enum_value(edge))
def get_screen(self) -> gui.Screen:
return gui.Screen(self.screen())
def get_cursor(self) -> gui.Cursor:
return gui.Cursor(self.cursor())
def get_icon(self) -> gui.Icon | None:
icon = self.icon()
return None if icon.isNull() else gui.Icon(icon)
def set_modality(
self, modality: constants.WindowModalityStr | constants.WindowModality
) -> None:
"""Set modality for the window.
Args:
modality: modality for the window
"""
self.setModality(constants.WINDOW_MODALITY.get_enum_value(modality))
def get_modality(self) -> constants.WindowModalityStr:
return constants.WINDOW_MODALITY.inverse[self.modality()]
def set_file_path(self, file_path: os.PathLike):
path = os.fspath(file_path)
self.setFilePath(path)
def get_file_path(self) -> pathlib.Path:
return pathlib.Path(self.filePath())
def get_type(self) -> constants.WindowTypeStr:
return constants.WINDOW_TYPE.inverse[self.type()]
def get_window_state(self) -> constants.WindowStateStr:
return constants.WINDOW_STATES.inverse[self.windowState()]
def get_window_states(self) -> list[constants.WindowStateStr]:
return constants.WINDOW_STATES.get_list(self.windowStates())
|
get_visibility() -> VisibilityStr
Get the current window visibility.
Source code in prettyqt\gui\window.py
| def get_visibility(self) -> VisibilityStr:
"""Get the current window visibility.
Returns:
window visibility
"""
return VISIBILITY.inverse[self.visibility()]
|
set_modality(modality: constants.WindowModalityStr | constants.WindowModality) -> None
Set modality for the window.
Parameters:
Name |
Type |
Description |
Default |
modality |
WindowModalityStr | WindowModality
|
|
required
|
Source code in prettyqt\gui\window.py
| def set_modality(
self, modality: constants.WindowModalityStr | constants.WindowModality
) -> None:
"""Set modality for the window.
Args:
modality: modality for the window
"""
self.setModality(constants.WINDOW_MODALITY.get_enum_value(modality))
|
set_visibility(visibility: VisibilityStr | gui.QWindow.Visibility)
Set window visibility.
Parameters:
Name |
Type |
Description |
Default |
visibility |
VisibilityStr | Visibility
|
|
required
|
Source code in prettyqt\gui\window.py
| def set_visibility(self, visibility: VisibilityStr | gui.QWindow.Visibility):
"""Set window visibility.
Args:
visibility: window visibility
"""
self.setVisibility(VISIBILITY.get_enum_value(visibility))
|
start_system_resize(edge: constants.EdgeStr | constants.Edge) -> bool
Start system resize.
Parameters:
Name |
Type |
Description |
Default |
edge |
EdgeStr | Edge
|
|
required
|
Source code in prettyqt\gui\window.py
| def start_system_resize(self, edge: constants.EdgeStr | constants.Edge) -> bool:
"""Start system resize.
Args:
edge: edge to resize
"""
return self.startSystemResize(constants.EDGES.get_enum_value(edge))
|