Fix vendor/model selector on create printer dialog (#9344)

* Make sure printer vendor matches

* Handle cases where some vendor do not have printers (such as `OrcaFilamentLibrary`)

* Ignore vendor `custom printer` from create printer vendor list

* Fix missing end bracket

* Update printer vendor and model list on create printer dialog
This commit is contained in:
Noisyfox 2025-05-01 17:12:03 +08:00 committed by GitHub
parent a9d426a3dc
commit 8c4b7456c1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 93 additions and 49 deletions

View File

@ -18,8 +18,10 @@ for entry in profiles_dir.glob('*.json'):
if entry.is_file():
entry_info = json.loads(entry.read_text())
vendor_name = entry_info.get('name', None)
if vendor_name:
if vendor_name and vendor_name != 'Custom Printer':
models = [machine.get('name', None) for machine in entry_info.get('machine_model_list', []) if machine.get('name', None)]
if not models:
continue
printers[vendor_name] = models
vendor_names = [f'"{vendor_name}",' for vendor_name in sorted(printers.keys(), key=str.casefold)]
@ -43,7 +45,7 @@ for vendor_name in sorted(printers.keys(), key=str.casefold):
models_formatted += '},\n '
models_formatted = models_formatted.rstrip()[:-1]
models_formatted = models_formatted.rstrip()[:-1] + '}'
print(models_formatted)

View File

@ -67,55 +67,96 @@ static const std::vector<std::string> filament_types = {"PLA", "rPLA", "PLA+
static const std::vector<std::string> printer_vendors =
{"Anker", "Anycubic", "Artillery", "Bambulab", "BIQU",
"Comgrow", "Creality", "Custom Printer", "Elegoo", "Flashforge",
"FLSun", "FlyingBear", "Folgertech", "InfiMech", "Kingroon",
"Orca Arena Printer", "Peopoly", "Prusa", "Qidi", "Raise3D",
"RatRig", "SecKit", "Snapmaker", "Sovol", "Tronxy",
"TwoTrees", "UltiMaker", "Vivedino", "Voron", "Voxelab",
"Vzbot", "Wanhao"};
"Blocks", "Chuanying", "Co Print", "Comgrow", "CONSTRUCT3D",
"Creality", "DeltaMaker", "Dremel", "Elegoo", "Flashforge",
"FLSun", "FlyingBear", "Folgertech", "Geeetech", "Ginger Additive",
"InfiMech", "Kingroon", "Lulzbot", "MagicMaker", "Mellow",
"Orca Arena Printer", "Peopoly", "Positron 3D", "Prusa", "Qidi",
"Raise3D", "RatRig", "RolohaunDesign", "SecKit", "Snapmaker",
"Sovol", "Thinker X400", "Tronxy", "TwoTrees", "UltiMaker",
"Vivedino", "Volumic", "Voron", "Voxelab", "Vzbot",
"Wanhao", "Z-Bolt"};
static const std::unordered_map<std::string, std::vector<std::string>> printer_model_map =
{{"Anker", {"Anker M5", "Anker M5 All-Metal Hot End", "Anker M5C"}},
{"Anycubic", {"Kossel Linear Plus", "Kossel Pulley(Linear)", "Mega Zero", "i3 Mega", "Predator"}},
{"Artillery", {"sidewinder X1", "Genius", "Hornet"}},
{"BIBO", {"BIBO2 Touch"}},
{"BIQU", {"BX"}},
{"Creality ENDER", {"Ender-3", "Ender-3 BLTouch", "Ender-3 Pro", "Ender-3 Neo",
"Ender-3 V2 Neo", "Ender-3 S1 Plus", "Ender-3 Max", "Ender-3 Max Neo",
"Ender-4", "Ender-5 Pro", "Ender-5 Pro",
"Ender-7", "Ender-2", "Ender-2 Pro"}},
{"Creality CR", {"CR-5 Pro", "CR-5 Pro H", "CR-10 SMART", "CR-10 SMART Pro", "CR-10 Mini",
"CR-10", "CR-10 v3", "CR-10 S", "CR-10 v2", "CR-10 v2",
"CR-10 S Pro", "CR-10 S Pro v2", "CR-10 S4", "CR-10 S5", "CR-20", "CR-20 Pro", "CR-200B",
"CR-8"}},
{"Creality SERMOON",{"Sermoon-D1", "Sermoon-V1", "Sermoon-V1 Pro"}},
{"FLSun", {"FLSun QQs Pro", "FLSun Q5"}},
{"gCreate", {"gMax 1.5XT Plus", "gMax 2", "gMax 2 Pro", "gMax 2 Dual 2in1", "gMax 2 Dual Chimera"}},
{"Geeetech", {"Thunder", "Thunder Pro", "Mizar s", "Mizar Pro", "Mizar", "Mizar Max",
"Mizar M", "A10 Pro", "A10 M", "A10 T", "A20", "A20 M",
"A20T", "A30 Pro", "A30 M", "A30 T", "E180", "Me Ducer",
"Me creator", "Me Creator2", "GiantArmD200", "l3 ProB", "l3 Prow", "l3 ProC"}},
{"INAT", {"Proton X Rail", "Proton x Rod", "Proton XE-750"}},
{"Infinity3D", {"DEV-200", "DEV-350"}},
{"Jubilee", {"Jubilee"}},
{"LNL3D", {"D3 v2", "D3 Vulcan", "D5", "D6"}},
{"LulzBot", {"Mini Aero", "Taz6 Aero"}},
{"MakerGear", {"Micro", "M2(V4 Hotend)", "M2 Dual", "M3-single Extruder", "M3-Independent Dual Rev.0", "M3-Independent Dual Rev.0(Duplication Mode)",
"M3-Independent Dual Rev.1", "M3-Independent Dual Rev.1(Duplication Mode)", "ultra One", "Ultra One (DuplicationMode)"}},
{"Original Prusa", {"MK4", "SL1S SPEED", "MMU3"}},
{"Papapiu", {"N1s"}},
{"Print4Taste", {"mycusini 2.0"}},
{"RatRig", {"V-core-3 300mm", "V-Core-3 400mm", "V-Core-3 500mm", "V-Minion"}},
{"Rigid3D", {"Zero2", "Zero3"}},
{"Snapmaker", {"A250", "A350"}},
{"Sovol", {"SV06", "SV06 PLUS", "SV05", "SV04", "SV03 / SV03 BLTOUCH", "SVO2 / SV02 BLTOUCH", "SVO1 / SV01 BLToUCH", "SV01 PRO"}},
{"TriLAB", {"AzteQ Industrial","AzteQ Dynamic", "DeltiQ 2", "DeltiQ 2 Plus", "DeltiQ 2 + FlexPrint 2", "DeltiQ 2 Plus + FlexPrint 2", "DeltiQ 2 +FlexPrint",
"DeltiQ 2 Plus + FlexPrint", "DeltiQ M", "DeltiQ L", "DeltiQ XL"}},
{"Trimaker", {"Nebula cloud", "Nebula", "Cosmos ll"}},
{"Ultimaker", {"Ultimaker 2"}},
{"Voron", {"v2 250mm3", "v2 300mm3", "v2 350mm3", "v1 250mm3", "v1 300mm3", "v1 350mm3",
"Zero 120mm3", "Switchwire"}},
{"Zonestar", {"Z5", "Z6", "Z5x", "Z8", "Z9"}}};
{{"Anker", {"Anker M5", "Anker M5 All-Metal Hot End", "Anker M5C"}},
{"Anycubic", {"Anycubic i3 Mega S", "Anycubic Chiron", "Anycubic Vyper", "Anycubic Kobra", "Anycubic Kobra Max",
"Anycubic Kobra Plus", "Anycubic 4Max Pro", "Anycubic 4Max Pro 2", "Anycubic Kobra 2", "Anycubic Kobra 2 Plus",
"Anycubic Kobra 2 Max", "Anycubic Kobra 2 Pro", "Anycubic Kobra 2 Neo", "Anycubic Kobra 3", "Anycubic Kobra S1"}},
{"Artillery", {"Artillery Sidewinder X1", "Artillery Genius", "Artillery Genius Pro", "Artillery Sidewinder X2", "Artillery Hornet",
"Artillery Sidewinder X3 Pro", "Artillery Sidewinder X3 Plus", "Artillery Sidewinder X4 Pro", "Artillery Sidewinder X4 Plus"}},
{"Bambulab", {"Bambu Lab X1 Carbon", "Bambu Lab X1", "Bambu Lab X1E", "Bambu Lab P1P", "Bambu Lab P1S",
"Bambu Lab A1 mini", "Bambu Lab A1"}},
{"BIQU", {"BIQU B1", "BIQU BX", "BIQU Hurakan"}},
{"Blocks", {"BLOCKS Pro S100", "BLOCKS RD50 V2", "BLOCKS RF50"}},
{"Chuanying", {"Chuanying X1"}},
{"Co Print", {"Co Print ChromaSet"}},
{"Comgrow", {"Comgrow T300", "Comgrow T500"}},
{"CONSTRUCT3D", {"Construct 1 XL", "Construct 1"}},
{"Creality", {"Creality CR-10 V2", "Creality CR-10 Max", "Creality CR-10 SE", "Creality CR-6 SE", "Creality CR-6 Max",
"Creality CR-M4", "Creality Ender-3 V2", "Creality Ender-3 V2 Neo", "Creality Ender-3 S1", "Creality Ender-3",
"Creality Ender-3 Pro", "Creality Ender-3 S1 Pro", "Creality Ender-3 S1 Plus", "Creality Ender-3 V3 SE", "Creality Ender-3 V3 KE",
"Creality Ender-3 V3", "Creality Ender-3 V3 Plus", "Creality Ender-5", "Creality Ender-5 Max", "Creality Ender-5 Plus",
"Creality Ender-5 Pro (2019)", "Creality Ender-5S", "Creality Ender-5 S1", "Creality Ender-6", "Creality Sermoon V1",
"Creality K1", "Creality K1C", "Creality K1 Max", "Creality K1 SE", "Creality K2 Plus",
"Creality Hi"}},
{"DeltaMaker", {"DeltaMaker 2", "DeltaMaker 2T", "DeltaMaker 2XT"}},
{"Dremel", {"Dremel 3D20", "Dremel 3D40", "Dremel 3D45"}},
{"Elegoo", {"Elegoo Centauri Carbon", "Elegoo Centauri", "Elegoo Neptune", "Elegoo Neptune X", "Elegoo Neptune 2",
"Elegoo Neptune 2S", "Elegoo Neptune 2D", "Elegoo Neptune 3", "Elegoo Neptune 3 Pro", "Elegoo Neptune 3 Plus",
"Elegoo Neptune 3 Max", "Elegoo Neptune 4 Pro", "Elegoo Neptune 4", "Elegoo Neptune 4 Max", "Elegoo Neptune 4 Plus",
"Elegoo OrangeStorm Giga"}},
{"Flashforge", {"Flashforge Adventurer 5M", "Flashforge Adventurer 5M Pro", "Flashforge AD5X", "Flashforge Adventurer 3 Series", "Flashforge Adventurer 4 Series",
"Flashforge Guider 3 Ultra", "Flashforge Guider 2s"}},
{"FLSun", {"FLSun Q5", "FLSun QQ-S Pro", "FLSun Super Racer (SR)", "FLSun V400", "FLSun T1",
"FLSun S1"}},
{"FlyingBear", {"FlyingBear Reborn3", "FlyingBear S1", "FlyingBear Ghost 6"}},
{"Folgertech", {"Folgertech i3", "Folgertech FT-5", "Folgertech FT-6"}},
{"Geeetech", {"Geeetech Thunder", "Geeetech Mizar M", "Geeetech Mizar S", "Geeetech Mizar Pro", "Geeetech Mizar Max",
"Geeetech Mizar", "Geeetech A10 Pro", "Geeetech A10 M", "Geeetech A10 T", "Geeetech A20",
"Geeetech A20 M", "Geeetech A20 T", "Geeetech A30 Pro", "Geeetech A30 M", "Geeetech A30 T",
"Geeetech M1"}},
{"Ginger Additive", {"ginger G1"}},
{"InfiMech", {"InfiMech TX", "InfiMech TX Hardened Steel Nozzle"}},
{"Kingroon", {"Kingroon KP3S PRO S1", "Kingroon KP3S PRO V2", "Kingroon KP3S 3.0", "Kingroon KP3S V1", "Kingroon KLP1"}},
{"Lulzbot", {"Lulzbot Taz 6", "Lulzbot Taz 4 or 5", "Lulzbot Taz Pro Dual", "Lulzbot Taz Pro S"}},
{"MagicMaker", {"MM hqs hj", "MM hqs SF", "MM hj SK", "MM BoneKing", "MM slb"}},
{"Mellow", {"M1"}},
{"Orca Arena Printer",{"Orca Arena X1 Carbon"}},
{"Peopoly", {"Peopoly Magneto X"}},
{"Positron 3D", {"The Positron"}},
{"Prusa", {"MK4IS", "MINIIS", "MK3S", "MINI", "MK3.5",
"Prusa XL", "Prusa XL 5T", "MK4S", "MK4S HF"}},
{"Qidi", {"Qidi X-Plus 4", "Qidi Q1 Pro", "Qidi X-Max 3", "Qidi X-Plus 3", "Qidi X-Smart 3",
"Qidi X-Plus", "Qidi X-Max", "Qidi X-CF Pro"}},
{"Raise3D", {"Raise3D Pro3", "Raise3D Pro3 Plus"}},
{"RatRig", {"RatRig V-Core 3 200", "RatRig V-Core 3 300", "RatRig V-Core 3 400", "RatRig V-Core 3 500", "RatRig V-Minion",
"RatRig V-Cast", "RatRig V-Core 4 300", "RatRig V-Core 4 400", "RatRig V-Core 4 500", "RatRig V-Core 4 HYBRID 300",
"RatRig V-Core 4 HYBRID 400", "RatRig V-Core 4 HYBRID 500", "RatRig V-Core 4 IDEX 300", "RatRig V-Core 4 IDEX 300 COPY MODE", "RatRig V-Core 4 IDEX 300 MIRROR MODE",
"RatRig V-Core 4 IDEX 400", "RatRig V-Core 4 IDEX 400 COPY MODE", "RatRig V-Core 4 IDEX 400 MIRROR MODE", "RatRig V-Core 4 IDEX 500", "RatRig V-Core 4 IDEX 500 COPY MODE",
"RatRig V-Core 4 IDEX 500 MIRROR MODE"}},
{"RolohaunDesign", {"Rook MK1 LDO"}},
{"SecKit", {"SecKit SK-Tank", "Seckit Go3"}},
{"Snapmaker", {"Snapmaker J1", "Snapmaker A250", "Snapmaker A350", "Snapmaker A250 Dual", "Snapmaker A350 Dual",
"Snapmaker A250 QSKit", "Snapmaker A350 QSKit", "Snapmaker A250 BKit", "Snapmaker A350 BKit", "Snapmaker A250 QS+B Kit",
"Snapmaker A350 QS+B Kit", "Snapmaker A250 Dual QSKit", "Snapmaker A350 Dual QSKit", "Snapmaker A250 Dual BKit", "Snapmaker A350 Dual BKit",
"Snapmaker A250 Dual QS+B Kit", "Snapmaker A350 Dual QS+B Kit", "Snapmaker Artisan"}},
{"Sovol", {"Sovol SV01 Pro", "Sovol SV02", "Sovol SV05", "Sovol SV06", "Sovol SV06 Plus",
"Sovol SV06 ACE", "Sovol SV06 Plus ACE", "Sovol SV07", "Sovol SV07 Plus", "Sovol SV08"}},
{"Thinker X400", {"Thinker X400"}},
{"Tronxy", {"Tronxy X5SA 400 Marlin Firmware"}},
{"TwoTrees", {"TwoTrees SP-5 Klipper", "TwoTrees SK1"}},
{"UltiMaker", {"UltiMaker 2"}},
{"Vivedino", {"Troodon 2.0 - RRF", "Troodon 2.0 - Klipper"}},
{"Volumic", {"EXO42 Performance", "EXO65 Performance", "SH65 Performance", "EXO42", "EXO65",
"SH65", "VS30SC2", "VS30SC", "VS30ULTRA", "VS30MK3",
"VS30MK2", "VS20MK2"}},
{"Voron", {"Voron 2.4 250", "Voron 2.4 300", "Voron 2.4 350", "Voron Trident 250", "Voron Trident 300",
"Voron Trident 350", "Voron 0.1", "Voron Switchwire 250"}},
{"Voxelab", {"Voxelab Aquila X2"}},
{"Vzbot", {"Vzbot 235 AWD", "Vzbot 330 AWD"}},
{"Wanhao", {"Wanhao D12-300"}},
{"Z-Bolt", {"Z-Bolt S300", "Z-Bolt S300 Dual", "Z-Bolt S400", "Z-Bolt S400 Dual", "Z-Bolt S600",
"Z-Bolt S600 Dual"}}};
static std::vector<std::string> nozzle_diameter_vec = {"0.4", "0.15", "0.2", "0.25", "0.3", "0.35", "0.5", "0.6", "0.75", "0.8", "1.0", "1.2"};
static std::unordered_map<std::string, float> nozzle_diameter_map = {{"0.15", 0.15}, {"0.2", 0.2}, {"0.25", 0.25}, {"0.3", 0.3},
@ -1704,6 +1745,7 @@ wxBoxSizer *CreatePrinterPresetDialog::create_printer_item(wxWindow *parent)
m_select_vendor->SetLabelColor(DEFAULT_PROMPT_TEXT_COLOUR);
wxArrayString printer_vendor;
for (const std::string &vendor : printer_vendors) {
assert(printer_model_map.find(vendor) != printer_model_map.end());
printer_vendor.Add(vendor);
}
m_select_vendor->Set(printer_vendor);