mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-08-07 14:04:03 -06:00
Defer opening the webbrowser until the next run of the event loop
Opening a web browser from a signal handler connected to a menu crashes Cura, so instead defer the call. Fixes #63
This commit is contained in:
parent
72b1302f9e
commit
d937eb7a17
1 changed files with 15 additions and 3 deletions
|
@ -1,4 +1,8 @@
|
|||
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, pyqtProperty
|
||||
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, pyqtProperty, QUrl
|
||||
from PyQt5.QtGui import QDesktopServices
|
||||
|
||||
from UM.Event import CallFunctionEvent
|
||||
from UM.Application import Application
|
||||
|
||||
import webbrowser
|
||||
|
||||
|
@ -8,8 +12,16 @@ class CuraActions(QObject):
|
|||
|
||||
@pyqtSlot()
|
||||
def openDocumentation(self):
|
||||
webbrowser.open("http://ultimaker.com/en/support/software")
|
||||
# Starting a web browser from a signal handler connected to a menu will crash on windows.
|
||||
# So instead, defer the call to the next run of the event loop, since that does work.
|
||||
# Note that weirdly enough, only signal handlers that open a web browser fail like that.
|
||||
event = CallFunctionEvent(self._openUrl, [QUrl("http://ultimaker.com/en/support/software")], {})
|
||||
Application.getInstance().functionEvent(event)
|
||||
|
||||
@pyqtSlot()
|
||||
def openBugReportPage(self):
|
||||
webbrowser.open("http://github.com/Ultimaker/Cura/issues")
|
||||
event = CallFunctionEvent(self._openUrl, [QUrl("http://github.com/Ultimaker/Cura/issues")], {})
|
||||
Application.getInstance().functionEvent(event)
|
||||
|
||||
def _openUrl(self, url):
|
||||
QDesktopServices.openUrl(url)
|
Loading…
Add table
Add a link
Reference in a new issue