CuraActions.py 1.0 KB

123456789101112131415161718192021222324252627
  1. from PyQt5.QtCore import QObject, QUrl
  2. from PyQt5.QtGui import QDesktopServices
  3. from UM.FlameProfiler import pyqtSlot
  4. from UM.Event import CallFunctionEvent
  5. from UM.Application import Application
  6. class CuraActions(QObject):
  7. def __init__(self, parent = None):
  8. super().__init__(parent)
  9. @pyqtSlot()
  10. def openDocumentation(self):
  11. # Starting a web browser from a signal handler connected to a menu will crash on windows.
  12. # So instead, defer the call to the next run of the event loop, since that does work.
  13. # Note that weirdly enough, only signal handlers that open a web browser fail like that.
  14. event = CallFunctionEvent(self._openUrl, [QUrl("http://ultimaker.com/en/support/software")], {})
  15. Application.getInstance().functionEvent(event)
  16. @pyqtSlot()
  17. def openBugReportPage(self):
  18. event = CallFunctionEvent(self._openUrl, [QUrl("http://github.com/Ultimaker/Cura/issues")], {})
  19. Application.getInstance().functionEvent(event)
  20. def _openUrl(self, url):
  21. QDesktopServices.openUrl(url)