mirror of
https://git.mirrors.martin98.com/https://github.com/Ultimaker/Cura
synced 2025-08-15 05:15:54 +08:00
Merge branch '5.2'
This commit is contained in:
commit
d3305585fc
@ -38,6 +38,12 @@ class CompatibleMachineModel(ListModel):
|
|||||||
def _update(self) -> None:
|
def _update(self) -> None:
|
||||||
self.clear()
|
self.clear()
|
||||||
|
|
||||||
|
def _makeMaterial(brand, name, color):
|
||||||
|
if name.lower() in ["", "empty"]:
|
||||||
|
return {"brand": "", "name": "(empty)", "hexcolor": "#ffffff"}
|
||||||
|
else:
|
||||||
|
return {"brand": brand, "name": name, "hexcolor": color}
|
||||||
|
|
||||||
from cura.CuraApplication import CuraApplication
|
from cura.CuraApplication import CuraApplication
|
||||||
machine_manager = CuraApplication.getInstance().getMachineManager()
|
machine_manager = CuraApplication.getInstance().getMachineManager()
|
||||||
|
|
||||||
@ -48,11 +54,8 @@ class CompatibleMachineModel(ListModel):
|
|||||||
|
|
||||||
# initialize & add current active material:
|
# initialize & add current active material:
|
||||||
for extruder in printer.extruders:
|
for extruder in printer.extruders:
|
||||||
materials = [{
|
materials = [_makeMaterial(
|
||||||
"brand": extruder.activeMaterial.brand,
|
extruder.activeMaterial.brand, extruder.activeMaterial.name, extruder.activeMaterial.color)]
|
||||||
"name": extruder.activeMaterial.name,
|
|
||||||
"hexcolor": extruder.activeMaterial.color,
|
|
||||||
}]
|
|
||||||
extruder_configs[extruder.getPosition()] = {
|
extruder_configs[extruder.getPosition()] = {
|
||||||
"position": extruder.getPosition(),
|
"position": extruder.getPosition(),
|
||||||
"core": extruder.hotendID,
|
"core": extruder.hotendID,
|
||||||
@ -66,11 +69,9 @@ class CompatibleMachineModel(ListModel):
|
|||||||
Logger.log("w", f"No active extruder for position {extruder.position}.")
|
Logger.log("w", f"No active extruder for position {extruder.position}.")
|
||||||
continue
|
continue
|
||||||
|
|
||||||
extruder_configs[extruder.position]["materials"].append({
|
entry = _makeMaterial(extruder.material.brand, extruder.material.name, extruder.material.color)
|
||||||
"brand": extruder.material.brand,
|
if entry not in extruder_configs[extruder.position]["materials"]:
|
||||||
"name": extruder.material.name,
|
extruder_configs[extruder.position]["materials"].append(entry)
|
||||||
"hexcolor": extruder.material.color
|
|
||||||
})
|
|
||||||
|
|
||||||
if any([len(extruder["materials"]) > 0 for extruder in extruder_configs.values()]):
|
if any([len(extruder["materials"]) > 0 for extruder in extruder_configs.values()]):
|
||||||
self.appendItem({
|
self.appendItem({
|
||||||
|
@ -89,12 +89,13 @@ class MachineListModel(ListModel):
|
|||||||
other_machine_stacks.sort(key = lambda machine: machine.getName().upper())
|
other_machine_stacks.sort(key = lambda machine: machine.getName().upper())
|
||||||
|
|
||||||
abstract_machine_stacks = CuraContainerRegistry.getInstance().findContainerStacks(is_abstract_machine = "True")
|
abstract_machine_stacks = CuraContainerRegistry.getInstance().findContainerStacks(is_abstract_machine = "True")
|
||||||
abstract_machine_stacks.sort(key = lambda machine: machine.getName(), reverse = True)
|
abstract_machine_stacks.sort(key = lambda machine: machine.getName().upper())
|
||||||
for abstract_machine in abstract_machine_stacks:
|
for abstract_machine in abstract_machine_stacks:
|
||||||
definition_id = abstract_machine.definition.getId()
|
definition_id = abstract_machine.definition.getId()
|
||||||
online_machine_stacks = machines_manager.getMachinesWithDefinition(definition_id, online_only = True)
|
online_machine_stacks = machines_manager.getMachinesWithDefinition(definition_id, online_only = True)
|
||||||
|
|
||||||
online_machine_stacks = list(filter(lambda machine: machine.hasNetworkedConnection(), online_machine_stacks))
|
online_machine_stacks = list(filter(lambda machine: machine.hasNetworkedConnection(), online_machine_stacks))
|
||||||
|
online_machine_stacks.sort(key=lambda machine: machine.getName().upper())
|
||||||
|
|
||||||
other_machine_stacks.remove(abstract_machine)
|
other_machine_stacks.remove(abstract_machine)
|
||||||
if abstract_machine in online_machine_stacks:
|
if abstract_machine in online_machine_stacks:
|
||||||
|
@ -13,8 +13,8 @@
|
|||||||
!define MAIN_APP_EXE "{{ main_app }}"
|
!define MAIN_APP_EXE "{{ main_app }}"
|
||||||
!define INSTALL_TYPE "SetShellVarContext all"
|
!define INSTALL_TYPE "SetShellVarContext all"
|
||||||
!define REG_ROOT "HKLM"
|
!define REG_ROOT "HKLM"
|
||||||
!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${APP_NAME}"
|
!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${APP_NAME}-${VERSION}"
|
||||||
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}"
|
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${APP_NAME}-${VERSION}"
|
||||||
|
|
||||||
!define REG_START_MENU "Start Menu Folder"
|
!define REG_START_MENU "Start Menu Folder"
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ Delete "$INSTDIR\uninstall.exe"
|
|||||||
Delete "$INSTDIR\${APP_NAME} website.url"
|
Delete "$INSTDIR\${APP_NAME} website.url"
|
||||||
!endif
|
!endif
|
||||||
|
|
||||||
RmDir "$INSTDIR"
|
RmDir /r /REBOOTOK "$INSTDIR"
|
||||||
|
|
||||||
!ifdef REG_START_MENU
|
!ifdef REG_START_MENU
|
||||||
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $SM_Folder
|
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $SM_Folder
|
||||||
|
@ -32,7 +32,7 @@ Item
|
|||||||
{
|
{
|
||||||
profileName: model.name
|
profileName: model.name
|
||||||
icon: model.icon
|
icon: model.icon
|
||||||
|
tooltipText: model.description ? model.description : ""
|
||||||
|
|
||||||
selected: Cura.MachineManager.activeIntentCategory == model.intent_category
|
selected: Cura.MachineManager.activeIntentCategory == model.intent_category
|
||||||
|
|
||||||
|
@ -19,6 +19,7 @@ Rectangle
|
|||||||
property bool selected: false
|
property bool selected: false
|
||||||
property string profileName: ""
|
property string profileName: ""
|
||||||
property string icon: ""
|
property string icon: ""
|
||||||
|
property alias tooltipText: tooltip.text
|
||||||
|
|
||||||
signal clicked()
|
signal clicked()
|
||||||
|
|
||||||
@ -30,6 +31,14 @@ Rectangle
|
|||||||
onClicked: base.clicked()
|
onClicked: base.clicked()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UM.ToolTip
|
||||||
|
{
|
||||||
|
id: tooltip
|
||||||
|
visible: mouseArea.containsMouse
|
||||||
|
targetPoint: Qt.point(base.x + (base.width / 2), base.y + (base.height / 2))
|
||||||
|
width: UM.Theme.getSize("tooltip").width
|
||||||
|
}
|
||||||
|
|
||||||
Item
|
Item
|
||||||
{
|
{
|
||||||
width: intentIcon.width
|
width: intentIcon.width
|
||||||
|
Loading…
x
Reference in New Issue
Block a user