Merge branch '5.2'

This commit is contained in:
Remco Burema 2022-10-12 15:33:26 +02:00
commit d3305585fc
5 changed files with 26 additions and 15 deletions

View File

@ -38,6 +38,12 @@ class CompatibleMachineModel(ListModel):
def _update(self) -> None:
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
machine_manager = CuraApplication.getInstance().getMachineManager()
@ -48,11 +54,8 @@ class CompatibleMachineModel(ListModel):
# initialize & add current active material:
for extruder in printer.extruders:
materials = [{
"brand": extruder.activeMaterial.brand,
"name": extruder.activeMaterial.name,
"hexcolor": extruder.activeMaterial.color,
}]
materials = [_makeMaterial(
extruder.activeMaterial.brand, extruder.activeMaterial.name, extruder.activeMaterial.color)]
extruder_configs[extruder.getPosition()] = {
"position": extruder.getPosition(),
"core": extruder.hotendID,
@ -66,11 +69,9 @@ class CompatibleMachineModel(ListModel):
Logger.log("w", f"No active extruder for position {extruder.position}.")
continue
extruder_configs[extruder.position]["materials"].append({
"brand": extruder.material.brand,
"name": extruder.material.name,
"hexcolor": extruder.material.color
})
entry = _makeMaterial(extruder.material.brand, extruder.material.name, extruder.material.color)
if entry not in extruder_configs[extruder.position]["materials"]:
extruder_configs[extruder.position]["materials"].append(entry)
if any([len(extruder["materials"]) > 0 for extruder in extruder_configs.values()]):
self.appendItem({

View File

@ -89,12 +89,13 @@ class MachineListModel(ListModel):
other_machine_stacks.sort(key = lambda machine: machine.getName().upper())
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:
definition_id = abstract_machine.definition.getId()
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.sort(key=lambda machine: machine.getName().upper())
other_machine_stacks.remove(abstract_machine)
if abstract_machine in online_machine_stacks:

View File

@ -13,8 +13,8 @@
!define MAIN_APP_EXE "{{ main_app }}"
!define INSTALL_TYPE "SetShellVarContext all"
!define REG_ROOT "HKLM"
!define REG_APP_PATH "Software\Microsoft\Windows\CurrentVersion\App Paths\${APP_NAME}"
!define UNINSTALL_PATH "Software\Microsoft\Windows\CurrentVersion\Uninstall\${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}-${VERSION}"
!define REG_START_MENU "Start Menu Folder"
@ -163,7 +163,7 @@ Delete "$INSTDIR\uninstall.exe"
Delete "$INSTDIR\${APP_NAME} website.url"
!endif
RmDir "$INSTDIR"
RmDir /r /REBOOTOK "$INSTDIR"
!ifdef REG_START_MENU
!insertmacro MUI_STARTMENU_GETFOLDER "Application" $SM_Folder

View File

@ -32,7 +32,7 @@ Item
{
profileName: model.name
icon: model.icon
tooltipText: model.description ? model.description : ""
selected: Cura.MachineManager.activeIntentCategory == model.intent_category

View File

@ -19,6 +19,7 @@ Rectangle
property bool selected: false
property string profileName: ""
property string icon: ""
property alias tooltipText: tooltip.text
signal clicked()
@ -30,6 +31,14 @@ Rectangle
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
{
width: intentIcon.width