mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-12 07:48:59 +08:00
Merge branch 'master' of github.com:Ultimaker/Cura
This commit is contained in:
commit
87293e089d
@ -105,7 +105,6 @@ class CuraPackageManager(QObject):
|
||||
while self._to_install_package_dict:
|
||||
package_id, package_info = list(self._to_install_package_dict.items())[0]
|
||||
self._installPackage(package_info)
|
||||
self._installed_package_dict[package_id] = self._to_install_package_dict[package_id]
|
||||
del self._to_install_package_dict[package_id]
|
||||
self._saveManagementData()
|
||||
|
||||
@ -307,9 +306,8 @@ class CuraPackageManager(QObject):
|
||||
|
||||
Logger.log("i", "Installing package [%s] from file [%s]", package_id, filename)
|
||||
|
||||
# If it's installed, remove it first and then install
|
||||
if package_id in self._installed_package_dict:
|
||||
self._purgePackage(package_id)
|
||||
# remove it first and then install
|
||||
self._purgePackage(package_id)
|
||||
|
||||
# Install the package
|
||||
with zipfile.ZipFile(filename, "r") as archive:
|
||||
@ -334,6 +332,8 @@ class CuraPackageManager(QObject):
|
||||
|
||||
# Remove the file
|
||||
os.remove(filename)
|
||||
# Move the info to the installed list of packages only when it succeeds
|
||||
self._installed_package_dict[package_id] = self._to_install_package_dict[package_id]
|
||||
|
||||
def __installPackageFiles(self, package_id: str, src_dir: str, dst_dir: str) -> None:
|
||||
Logger.log("i", "Moving package {package_id} from {src_dir} to {dst_dir}".format(package_id=package_id, src_dir=src_dir, dst_dir=dst_dir))
|
||||
|
43
cura_app.py
43
cura_app.py
@ -3,29 +3,42 @@
|
||||
# Copyright (c) 2018 Ultimaker B.V.
|
||||
# Cura is released under the terms of the LGPLv3 or higher.
|
||||
|
||||
import argparse
|
||||
import faulthandler
|
||||
import os
|
||||
import sys
|
||||
|
||||
from UM.Platform import Platform
|
||||
|
||||
parser = argparse.ArgumentParser(prog = "cura",
|
||||
add_help = False)
|
||||
parser.add_argument('--debug',
|
||||
action='store_true',
|
||||
default = False,
|
||||
help = "Turn on the debug mode by setting this option."
|
||||
)
|
||||
parser.add_argument('--trigger-early-crash',
|
||||
dest = 'trigger_early_crash',
|
||||
action = 'store_true',
|
||||
default = False,
|
||||
help = "FOR TESTING ONLY. Trigger an early crash to show the crash dialog."
|
||||
)
|
||||
known_args = vars(parser.parse_known_args()[0])
|
||||
|
||||
# Gets the directory for stdout and stderr
|
||||
def get_cura_dir_for_stdoutputs() -> str:
|
||||
if Platform.isWindows():
|
||||
return os.path.expanduser("~/AppData/Roaming/cura/")
|
||||
elif Platform.isLinux():
|
||||
return os.path.expanduser("~/.local/share/cura")
|
||||
elif Platform.isOSX():
|
||||
return os.path.expanduser("~/Library/Logs/cura")
|
||||
if not known_args["debug"]:
|
||||
def get_cura_dir_path():
|
||||
if Platform.isWindows():
|
||||
return os.path.expanduser("~/AppData/Roaming/cura")
|
||||
elif Platform.isLinux():
|
||||
return os.path.expanduser("~/.local/share/cura")
|
||||
elif Platform.isOSX():
|
||||
return os.path.expanduser("~/Library/Logs/cura")
|
||||
|
||||
|
||||
# Change stdout and stderr to files if Cura is running as a packaged application.
|
||||
if hasattr(sys, "frozen"):
|
||||
dir_path = get_cura_dir_for_stdoutputs()
|
||||
os.makedirs(dir_path, exist_ok = True)
|
||||
sys.stdout = open(os.path.join(dir_path, "stdout.log"), "w", encoding = "utf-8")
|
||||
sys.stderr = open(os.path.join(dir_path, "stderr.log"), "w", encoding = "utf-8")
|
||||
if hasattr(sys, "frozen"):
|
||||
dirpath = get_cura_dir_path()
|
||||
os.makedirs(dirpath, exist_ok = True)
|
||||
sys.stdout = open(os.path.join(dirpath, "stdout.log"), "w", encoding = "utf-8")
|
||||
sys.stderr = open(os.path.join(dirpath, "stderr.log"), "w", encoding = "utf-8")
|
||||
|
||||
|
||||
# WORKAROUND: GITHUB-88 GITHUB-385 GITHUB-612
|
||||
|
@ -34,7 +34,6 @@ Item
|
||||
}
|
||||
}
|
||||
|
||||
/* Hide for 3.4
|
||||
ToolboxTabButton
|
||||
{
|
||||
text: catalog.i18nc("@title:tab", "Materials")
|
||||
@ -47,7 +46,6 @@ Item
|
||||
toolbox.viewPage = "overview"
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
ToolboxTabButton
|
||||
{
|
||||
|
@ -65,7 +65,6 @@ ScrollView
|
||||
}
|
||||
}
|
||||
}
|
||||
/* Hidden in 3.4
|
||||
Label
|
||||
{
|
||||
visible: toolbox.materialsInstalledModel.items.length > 0
|
||||
@ -103,6 +102,5 @@ ScrollView
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
@ -100,8 +100,8 @@ Item {
|
||||
if (saveToButton.enabled) {
|
||||
saveToButton.clicked();
|
||||
}
|
||||
// slice button
|
||||
if (sliceButton.enabled) {
|
||||
// prepare button
|
||||
if (prepareButton.enabled) {
|
||||
sliceOrStopSlicing();
|
||||
}
|
||||
}
|
||||
@ -131,7 +131,7 @@ Item {
|
||||
Row {
|
||||
id: additionalComponentsRow
|
||||
anchors.top: parent.top
|
||||
anchors.right: saveToButton.visible ? saveToButton.left : (sliceButton.visible ? sliceButton.left : parent.right)
|
||||
anchors.right: saveToButton.visible ? saveToButton.left : (prepareButton.visible ? prepareButton.left : parent.right)
|
||||
anchors.rightMargin: UM.Theme.getSize("default_margin").width
|
||||
|
||||
spacing: UM.Theme.getSize("default_margin").width
|
||||
@ -159,14 +159,14 @@ Item {
|
||||
onPreferenceChanged:
|
||||
{
|
||||
var autoSlice = UM.Preferences.getValue("general/auto_slice");
|
||||
sliceButton.autoSlice = autoSlice;
|
||||
prepareButton.autoSlice = autoSlice;
|
||||
saveToButton.autoSlice = autoSlice;
|
||||
}
|
||||
}
|
||||
|
||||
// Slice button, only shows if auto_slice is off
|
||||
// Prepare button, only shows if auto_slice is off
|
||||
Button {
|
||||
id: sliceButton
|
||||
id: prepareButton
|
||||
|
||||
tooltip: [1, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@info:tooltip","Slice current printjob") : catalog.i18nc("@info:tooltip","Cancel slicing process")
|
||||
// 1 = not started, 2 = Processing
|
||||
@ -180,7 +180,7 @@ Item {
|
||||
anchors.rightMargin: UM.Theme.getSize("sidebar_margin").width
|
||||
|
||||
// 1 = not started, 4 = error, 5 = disabled
|
||||
text: [1, 4, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@label:Printjob", "Slice") : catalog.i18nc("@label:Printjob", "Cancel")
|
||||
text: [1, 4, 5].indexOf(base.backendState) != -1 ? catalog.i18nc("@label:Printjob", "Prepare") : catalog.i18nc("@label:Printjob", "Cancel")
|
||||
onClicked:
|
||||
{
|
||||
sliceOrStopSlicing();
|
||||
|
@ -148,9 +148,22 @@ UM.Dialog
|
||||
{
|
||||
height: childrenRect.height
|
||||
width: parent.width
|
||||
Label
|
||||
Label
|
||||
{
|
||||
text: catalog.i18nc("@action:label", "Extruder %1").arg(modelData)
|
||||
text: {
|
||||
var extruder = Number(modelData)
|
||||
var extruder_id = ""
|
||||
if(!isNaN(extruder))
|
||||
{
|
||||
extruder_id = extruder + 1 // The extruder counter start from One and not Zero
|
||||
}
|
||||
else
|
||||
{
|
||||
extruder_id = modelData
|
||||
}
|
||||
|
||||
return catalog.i18nc("@action:label", "Extruder %1").arg(extruder_id)
|
||||
}
|
||||
font.bold: true
|
||||
}
|
||||
Row
|
||||
|
@ -34,6 +34,7 @@ retraction_hop_enabled
|
||||
|
||||
[cooling]
|
||||
cool_fan_enabled
|
||||
cool_fan_speed
|
||||
|
||||
[support]
|
||||
support_enable
|
||||
|
Loading…
x
Reference in New Issue
Block a user