mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-25 15:44:04 -06:00
Added some missing typing.
Since i was changing some stuff here, i better leave it more typed as I found it. CURA-5814
This commit is contained in:
parent
45da5b9130
commit
3ad113f70f
1 changed files with 10 additions and 10 deletions
|
@ -4,7 +4,7 @@
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
import time
|
import time
|
||||||
from typing import cast, TYPE_CHECKING, Optional
|
from typing import cast, TYPE_CHECKING, Optional, Callable
|
||||||
|
|
||||||
import numpy
|
import numpy
|
||||||
|
|
||||||
|
@ -421,7 +421,7 @@ class CuraApplication(QtApplication):
|
||||||
)
|
)
|
||||||
|
|
||||||
# Runs preparations that needs to be done before the starting process.
|
# Runs preparations that needs to be done before the starting process.
|
||||||
def startSplashWindowPhase(self):
|
def startSplashWindowPhase(self) -> None:
|
||||||
super().startSplashWindowPhase()
|
super().startSplashWindowPhase()
|
||||||
|
|
||||||
self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png")))
|
self.setWindowIcon(QIcon(Resources.getPath(Resources.Images, "cura-icon.png")))
|
||||||
|
@ -527,15 +527,15 @@ class CuraApplication(QtApplication):
|
||||||
self._qml_engine.addImageProvider("print_job_preview", PrintJobPreviewImageProvider.PrintJobPreviewImageProvider())
|
self._qml_engine.addImageProvider("print_job_preview", PrintJobPreviewImageProvider.PrintJobPreviewImageProvider())
|
||||||
|
|
||||||
@pyqtProperty(bool)
|
@pyqtProperty(bool)
|
||||||
def needToShowUserAgreement(self):
|
def needToShowUserAgreement(self) -> bool:
|
||||||
return self._need_to_show_user_agreement
|
return self._need_to_show_user_agreement
|
||||||
|
|
||||||
def setNeedToShowUserAgreement(self, set_value = True):
|
def setNeedToShowUserAgreement(self, set_value = True) -> None:
|
||||||
self._need_to_show_user_agreement = set_value
|
self._need_to_show_user_agreement = set_value
|
||||||
|
|
||||||
# DO NOT call this function to close the application, use checkAndExitApplication() instead which will perform
|
# DO NOT call this function to close the application, use checkAndExitApplication() instead which will perform
|
||||||
# pre-exit checks such as checking for in-progress USB printing, etc.
|
# pre-exit checks such as checking for in-progress USB printing, etc.
|
||||||
def closeApplication(self):
|
def closeApplication(self) -> None:
|
||||||
Logger.log("i", "Close application")
|
Logger.log("i", "Close application")
|
||||||
main_window = self.getMainWindow()
|
main_window = self.getMainWindow()
|
||||||
if main_window is not None:
|
if main_window is not None:
|
||||||
|
@ -562,11 +562,11 @@ class CuraApplication(QtApplication):
|
||||||
|
|
||||||
showConfirmExitDialog = pyqtSignal(str, arguments = ["message"])
|
showConfirmExitDialog = pyqtSignal(str, arguments = ["message"])
|
||||||
|
|
||||||
def setConfirmExitDialogCallback(self, callback):
|
def setConfirmExitDialogCallback(self, callback: Callable) -> None:
|
||||||
self._confirm_exit_dialog_callback = callback
|
self._confirm_exit_dialog_callback = callback
|
||||||
|
|
||||||
@pyqtSlot(bool)
|
@pyqtSlot(bool)
|
||||||
def callConfirmExitDialogCallback(self, yes_or_no: bool):
|
def callConfirmExitDialogCallback(self, yes_or_no: bool) -> None:
|
||||||
self._confirm_exit_dialog_callback(yes_or_no)
|
self._confirm_exit_dialog_callback(yes_or_no)
|
||||||
|
|
||||||
## Signal to connect preferences action in QML
|
## Signal to connect preferences action in QML
|
||||||
|
@ -574,7 +574,7 @@ class CuraApplication(QtApplication):
|
||||||
|
|
||||||
## Show the preferences window
|
## Show the preferences window
|
||||||
@pyqtSlot()
|
@pyqtSlot()
|
||||||
def showPreferences(self):
|
def showPreferences(self) -> None:
|
||||||
self.showPreferencesWindow.emit()
|
self.showPreferencesWindow.emit()
|
||||||
|
|
||||||
@override(Application)
|
@override(Application)
|
||||||
|
@ -596,7 +596,7 @@ class CuraApplication(QtApplication):
|
||||||
|
|
||||||
showDiscardOrKeepProfileChanges = pyqtSignal()
|
showDiscardOrKeepProfileChanges = pyqtSignal()
|
||||||
|
|
||||||
def discardOrKeepProfileChanges(self):
|
def discardOrKeepProfileChanges(self) -> bool:
|
||||||
has_user_interaction = False
|
has_user_interaction = False
|
||||||
choice = self.getPreferences().getValue("cura/choice_on_profile_override")
|
choice = self.getPreferences().getValue("cura/choice_on_profile_override")
|
||||||
if choice == "always_discard":
|
if choice == "always_discard":
|
||||||
|
@ -612,7 +612,7 @@ class CuraApplication(QtApplication):
|
||||||
return has_user_interaction
|
return has_user_interaction
|
||||||
|
|
||||||
@pyqtSlot(str)
|
@pyqtSlot(str)
|
||||||
def discardOrKeepProfileChangesClosed(self, option):
|
def discardOrKeepProfileChangesClosed(self, option: str) -> None:
|
||||||
global_stack = self.getGlobalContainerStack()
|
global_stack = self.getGlobalContainerStack()
|
||||||
if option == "discard":
|
if option == "discard":
|
||||||
for extruder in global_stack.extruders.values():
|
for extruder in global_stack.extruders.values():
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue