eric6/E5Gui/E5OverrideCursor.py

changeset 8118
0ecebcd8875e
parent 7923
91e843545d9a
child 8143
2c730d5fd177
equal deleted inserted replaced
8117:aaa5e0eacd4e 8118:0ecebcd8875e
65 """ 65 """
66 def __init__(self): 66 def __init__(self):
67 """ 67 """
68 Constructor 68 Constructor
69 """ 69 """
70 self.__cursor = None 70 self.__cursorShape = None
71 71
72 def __enter__(self): 72 def __enter__(self):
73 """ 73 """
74 Special method called when entering the runtime ccontext. 74 Special method called when entering the runtime ccontext.
75 75
76 @return reference to the context manager object 76 @return reference to the context manager object
77 @rtype E5OverrideCursor 77 @rtype E5OverrideCursor
78 """ 78 """
79 self.__cursor = QGuiApplication.overrideCursor() 79 cursor = QGuiApplication.overrideCursor()
80 if self.__cursor is not None: 80 if cursor is not None:
81 self.__cursorShape = cursor.shape()
81 QGuiApplication.restoreOverrideCursor() 82 QGuiApplication.restoreOverrideCursor()
82 QGuiApplication.processEvents(QEventLoop.ExcludeUserInputEvents) 83 QGuiApplication.processEvents(QEventLoop.ExcludeUserInputEvents)
83 84
84 return self 85 return self
85 86
92 @param traceback traceback of an exception raised in the runtime 93 @param traceback traceback of an exception raised in the runtime
93 context 94 context
94 @return always returns None to not suppress any exception 95 @return always returns None to not suppress any exception
95 @rtype None 96 @rtype None
96 """ 97 """
97 if self.__cursor is not None: 98 if self.__cursorShape is not None:
98 QGuiApplication.setOverrideCursor(self.__cursor) 99 QGuiApplication.setOverrideCursor(QCursor(self.__cursorShape))
99 QGuiApplication.processEvents(QEventLoop.ExcludeUserInputEvents) 100 QGuiApplication.processEvents(QEventLoop.ExcludeUserInputEvents)
100 101
101 return None # __IGNORE_WARNING_M831__ 102 return None # __IGNORE_WARNING_M831__
102 103
103 104

eric ide

mercurial