mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 23:17:32 -06:00
Add property of the print job being made by the current user
According to the Account API, is this print job made by the same user? This property is a bit inaccurate, in that this matches by the user name. The user name might be duplicate in some systems. Contributes to issue CURA-9220.
This commit is contained in:
parent
99d93fa58a
commit
8871fd6224
1 changed files with 10 additions and 1 deletions
|
@ -1,4 +1,4 @@
|
|||
# Copyright (c) 2018 Ultimaker B.V.
|
||||
# Copyright (c) 2022 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
from typing import Optional, TYPE_CHECKING, List
|
||||
|
@ -6,6 +6,8 @@ from typing import Optional, TYPE_CHECKING, List
|
|||
from PyQt6.QtCore import pyqtSignal, pyqtProperty, QObject, pyqtSlot, QUrl
|
||||
from PyQt6.QtGui import QImage
|
||||
|
||||
from cura.CuraApplication import CuraApplication
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from cura.PrinterOutput.PrinterOutputController import PrinterOutputController
|
||||
from cura.PrinterOutput.Models.PrinterOutputModel import PrinterOutputModel
|
||||
|
@ -86,6 +88,13 @@ class PrintJobOutputModel(QObject):
|
|||
self._owner = owner
|
||||
self.ownerChanged.emit()
|
||||
|
||||
@pyqtProperty(bool, notify = ownerChanged)
|
||||
def isMine(self) -> bool:
|
||||
"""
|
||||
Returns whether this print job was sent by the currently logged in user.
|
||||
"""
|
||||
return self._owner == CuraApplication.getInstance().getCuraAPI().account.userName
|
||||
|
||||
@pyqtProperty(QObject, notify=assignedPrinterChanged)
|
||||
def assignedPrinter(self):
|
||||
return self._assigned_printer
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue