mirror of
https://github.com/Ultimaker/Cura.git
synced 2025-07-07 15:07:28 -06:00
Merge branch '15.06'
Conflicts: cura/CuraApplication.py
This commit is contained in:
commit
d659e5b8b8
4 changed files with 55 additions and 7 deletions
41
cura/CrashHandler.py
Normal file
41
cura/CrashHandler.py
Normal file
|
@ -0,0 +1,41 @@
|
||||||
|
import sys
|
||||||
|
import platform
|
||||||
|
import traceback
|
||||||
|
import webbrowser
|
||||||
|
|
||||||
|
from PyQt5.QtCore import QT_VERSION_STR, PYQT_VERSION_STR
|
||||||
|
from PyQt5.QtWidgets import QDialog, QDialogButtonBox, QVBoxLayout, QLabel, QTextEdit
|
||||||
|
|
||||||
|
def show():
|
||||||
|
dialog = QDialog()
|
||||||
|
dialog.setWindowTitle("Oops!")
|
||||||
|
|
||||||
|
layout = QVBoxLayout(dialog)
|
||||||
|
|
||||||
|
label = QLabel(dialog)
|
||||||
|
layout.addWidget(label)
|
||||||
|
label.setText("<p>An uncaught exception has occurred!</p><p>Please use the information below to post a bug report at <a href=\"http://github.com/Ultimaker/Cura/issues\">http://github.com/Ultimaker/Cura/issues</a></p>")
|
||||||
|
|
||||||
|
textarea = QTextEdit(dialog)
|
||||||
|
layout.addWidget(textarea)
|
||||||
|
|
||||||
|
try:
|
||||||
|
from UM.Application import Application
|
||||||
|
version = Application.getInstance().getVersion()
|
||||||
|
except:
|
||||||
|
version = "Unknown"
|
||||||
|
|
||||||
|
trace = "".join(traceback.format_exception(sys.exc_info()[0], sys.exc_info()[1], sys.exc_info()[2]))
|
||||||
|
|
||||||
|
crash_info = "Version: {0}\nPlatform: {1}\nQt: {2}\nPyQt: {3}\n\nException:\n{4}"
|
||||||
|
crash_info = crash_info.format(version, platform.platform(), QT_VERSION_STR, PYQT_VERSION_STR, trace)
|
||||||
|
|
||||||
|
textarea.setText(crash_info)
|
||||||
|
|
||||||
|
buttons = QDialogButtonBox(QDialogButtonBox.Close, dialog)
|
||||||
|
layout.addWidget(buttons)
|
||||||
|
buttons.addButton("Open Web Page", QDialogButtonBox.HelpRole)
|
||||||
|
buttons.rejected.connect(lambda: dialog.close())
|
||||||
|
buttons.helpRequested.connect(lambda: webbrowser.open("http://github.com/Ultimaker/Cura/issues"))
|
||||||
|
|
||||||
|
dialog.exec_()
|
11
cura_app.py
11
cura_app.py
|
@ -3,7 +3,12 @@
|
||||||
# Copyright (c) 2015 Ultimaker B.V.
|
# Copyright (c) 2015 Ultimaker B.V.
|
||||||
# Cura is released under the terms of the AGPLv3 or higher.
|
# Cura is released under the terms of the AGPLv3 or higher.
|
||||||
|
|
||||||
import cura.CuraApplication
|
try:
|
||||||
|
import cura.CuraApplication
|
||||||
|
|
||||||
|
app = cura.CuraApplication.CuraApplication.getInstance()
|
||||||
|
app.run()
|
||||||
|
except Exception as e:
|
||||||
|
import cura.CrashHandler
|
||||||
|
cura.CrashHandler.show()
|
||||||
|
|
||||||
app = cura.CuraApplication.CuraApplication.getInstance()
|
|
||||||
app.run()
|
|
||||||
|
|
|
@ -201,18 +201,18 @@ class PrinterConnection(SignalEmitter):
|
||||||
continue # Could not set the baud rate, go to the next
|
continue # Could not set the baud rate, go to the next
|
||||||
time.sleep(1.5) # Ensure that we are not talking to the bootloader. 1.5 sec seems to be the magic number
|
time.sleep(1.5) # Ensure that we are not talking to the bootloader. 1.5 sec seems to be the magic number
|
||||||
sucesfull_responses = 0
|
sucesfull_responses = 0
|
||||||
timeout_time = time.time() + 5
|
timeout_time = time.time() + 15
|
||||||
self._serial.write(b"\n")
|
self._serial.write(b"\n")
|
||||||
self._sendCommand("M105") # Request temperature, as this should (if baudrate is correct) result in a command with "T:" in it
|
self._sendCommand("M105") # Request temperature, as this should (if baudrate is correct) result in a command with "T:" in it
|
||||||
|
|
||||||
while timeout_time > time.time():
|
while timeout_time > time.time():
|
||||||
line = self._readline()
|
line = self._readline()
|
||||||
if line is None:
|
if line is None:
|
||||||
self.setIsConnected(False) # Something went wrong with reading, could be that close was called.
|
self.setIsConnected(False) # Something went wrong with reading, could be that close was called.
|
||||||
return
|
return
|
||||||
|
|
||||||
if b"T:" in line:
|
if b"T:" in line:
|
||||||
self._serial.timeout = 0.5
|
self._serial.timeout = 0.5
|
||||||
self._serial.write(b"\n")
|
|
||||||
self._sendCommand("M105")
|
self._sendCommand("M105")
|
||||||
sucesfull_responses += 1
|
sucesfull_responses += 1
|
||||||
if sucesfull_responses >= self._required_responses_auto_baud:
|
if sucesfull_responses >= self._required_responses_auto_baud:
|
||||||
|
@ -220,6 +220,8 @@ class PrinterConnection(SignalEmitter):
|
||||||
self.setIsConnected(True)
|
self.setIsConnected(True)
|
||||||
Logger.log("i", "Established printer connection on port %s" % self._serial_port)
|
Logger.log("i", "Established printer connection on port %s" % self._serial_port)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
Logger.log("e", "Baud rate detection for %s failed", self._serial_port)
|
||||||
self.close() # Unable to connect, wrap up.
|
self.close() # Unable to connect, wrap up.
|
||||||
self.setIsConnected(False)
|
self.setIsConnected(False)
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,7 @@ UM.Dialog {
|
||||||
Label {
|
Label {
|
||||||
id: version
|
id: version
|
||||||
|
|
||||||
text: "Cura 15.06"
|
text: "Cura %1".arg(UM.Application.version)
|
||||||
font: UM.Theme.fonts.large
|
font: UM.Theme.fonts.large
|
||||||
anchors.horizontalCenter : logo.horizontalCenter
|
anchors.horizontalCenter : logo.horizontalCenter
|
||||||
anchors.horizontalCenterOffset : (logo.width * 0.25)
|
anchors.horizontalCenterOffset : (logo.width * 0.25)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue