Fix typing. [CURA-6478]

This commit is contained in:
Remco Burema 2019-04-25 23:05:52 +02:00
parent c3a9ceaa18
commit ad9fc62ff5

View file

@ -23,6 +23,7 @@ from UM.Platform import Platform
from UM.PluginError import PluginNotFoundError from UM.PluginError import PluginNotFoundError
from UM.Resources import Resources from UM.Resources import Resources
from UM.Preferences import Preferences from UM.Preferences import Preferences
from UM.Qt.Bindings import MainWindow
from UM.Qt.QtApplication import QtApplication # The class we're inheriting from. from UM.Qt.QtApplication import QtApplication # The class we're inheriting from.
import UM.Util import UM.Util
from UM.View.SelectionPass import SelectionPass # For typing. from UM.View.SelectionPass import SelectionPass # For typing.
@ -1789,10 +1790,16 @@ class CuraApplication(QtApplication):
@pyqtSlot(result = int) @pyqtSlot(result = int)
def appWidth(self) -> int: def appWidth(self) -> int:
main_window = cast(UM.Qt.Bindings.MainWindow, QtApplication.getInstance().getMainWindow()) main_window = QtApplication.getInstance().getMainWindow()
return main_window.width() if main_window:
return main_window.width()
else:
return 0
@pyqtSlot(result = int) @pyqtSlot(result = int)
def appHeight(self) -> int: def appHeight(self) -> int:
main_window = cast(UM.Qt.Bindings.MainWindow, QtApplication.getInstance().getMainWindow()) main_window = QtApplication.getInstance().getMainWindow()
return main_window.height() if main_window:
return main_window.height()
else:
return 0