mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-12 09:17:52 -06:00
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:
parent
a9d426a3dc
commit
8c4b7456c1
2 changed files with 93 additions and 49 deletions
|
@ -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)
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue