CuraActions.py 1.0 KB

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