@@ -2613,6 +2613,7 @@ def __init__(self, owner=None):
26132613 self.display_edid = []
26142614 self.display_manufacturers = []
26152615 self.display_names = []
2616+ self.display_generic_names = []
26162617 self.display_rects = []
26172618 self.displays = []
26182619 self.instruments = []
@@ -4569,6 +4570,7 @@ def clear_argyll_info(self):
45694570 self.display_edid = []
45704571 self.display_manufacturers = []
45714572 self.display_names = []
4573+ self.display_generic_names = []
45724574 self.display_rects = []
45734575 self.displays = []
45744576 self.instruments = []
@@ -6456,6 +6458,7 @@ def enumerate_displays_and_ports(
64566458 self.display_edid = []
64576459 self.display_manufacturers = []
64586460 self.display_names = []
6461+ self.display_generic_names = []
64596462 if sys.platform == "win32":
64606463 # The ordering will work as long
64616464 # as Argyll continues using
@@ -6475,10 +6478,19 @@ def enumerate_displays_and_ports(
64756478 display_manufacturer = "Google"
64766479 self.display_manufacturers.append(display_manufacturer)
64776480 self.display_names.append(display.split(":", 1)[1].strip())
6481+ self.display_generic_names.append(
6482+ display.split(":", 1)[1].strip()
6483+ )
64786484 continue
64796485 display_name = split_display_name(display)
64806486 # Make sure we have nice descriptions
64816487 desc = []
6488+ # Generic (non-model-id-overridden) description, e.g. for
6489+ # matching against the online colorimeter correction
6490+ # database, which is keyed by generic monitor names
6491+ # ("Color LCD") rather than the machine model id
6492+ # ("MacBookPro18,1").
6493+ generic_desc = []
64826494 if sys.platform == "win32" and i < len(monitors):
64836495 # Get monitor description using win32api
64846496 device = util_win.get_active_display_device(
@@ -6502,6 +6514,7 @@ def enumerate_displays_and_ports(
65026514 )
65036515 if is_primary:
65046516 display += " [PRIMARY]"
6517+ original_display = display
65056518 # Get monitor descriptions from EDID
65066519 try:
65076520 # Important: display_name must be given for get_edid
@@ -6524,6 +6537,7 @@ def enumerate_displays_and_ports(
65246537 "monitor_name",
65256538 edid.get("ascii", str(edid["product_id"] or "")),
65266539 )
6540+ generic_monitor = monitor
65276541 if (
65286542 monitor in ("Color LCD", "iMac")
65296543 and edid["manufacturer_id"] == "APP"
@@ -6538,6 +6552,10 @@ def enumerate_displays_and_ports(
65386552 edid["monitor_name"] = monitor
65396553 if monitor and monitor not in "".join(desc):
65406554 desc = [monitor]
6555+ if generic_monitor and generic_monitor not in "".join(
6556+ generic_desc
6557+ ):
6558+ generic_desc = [generic_monitor]
65416559 else:
65426560 manufacturer = []
65436561 if sys.platform == "darwin" and i < len(self.display_rects):
@@ -6546,6 +6564,7 @@ def enumerate_displays_and_ports(
65466564 rect.width, rect.height
65476565 )
65486566 if sp_name:
6567+ generic_desc = [sp_name]
65496568 if sp_name in ("Color LCD", "iMac"):
65506569 model_id = get_model_id()
65516570 if model_id:
@@ -6555,34 +6574,48 @@ def enumerate_displays_and_ports(
65556574 # Only replace the description if it not already
65566575 # contains the monitor model
65576576 display = " @".join([" ".join(desc), display.split("@")[-1]])
6577+ if generic_desc and generic_desc[-1] not in original_display:
6578+ generic_display = " @".join(
6579+ [" ".join(generic_desc), original_display.split("@")[-1]]
6580+ )
6581+ else:
6582+ generic_display = original_display
65586583 displays[i] = display
65596584 self.display_manufacturers.append(" ".join(manufacturer))
65606585 self.display_names.append(split_display_name(display))
6586+ self.display_generic_names.append(
6587+ split_display_name(generic_display)
6588+ )
65616589 if self.argyll_version >= [1, 4, 0]:
65626590 displays.append("Web @ localhost")
65636591 self.display_edid.append({})
65646592 self.display_manufacturers.append("")
65656593 self.display_names.append("Web")
6594+ self.display_generic_names.append("Web")
65666595 if self.argyll_version >= [1, 6, 0]:
65676596 displays.append("madVR")
65686597 self.display_edid.append({})
65696598 self.display_manufacturers.append("")
65706599 self.display_names.append("madVR")
6600+ self.display_generic_names.append("madVR")
65716601 # Prisma (via DisplayCAL)
65726602 displays.append("Prisma")
65736603 self.display_edid.append({})
65746604 self.display_manufacturers.append("Q, Inc")
65756605 self.display_names.append("Prisma")
6606+ self.display_generic_names.append("Prisma")
65766607 # Resolve
65776608 displays.append("Resolve")
65786609 self.display_edid.append({})
65796610 self.display_manufacturers.append("DaVinci")
65806611 self.display_names.append("Resolve")
6612+ self.display_generic_names.append("Resolve")
65816613 # Untethered
65826614 displays.append("Untethered")
65836615 self.display_edid.append({})
65846616 self.display_manufacturers.append("")
65856617 self.display_names.append("Untethered")
6618+ self.display_generic_names.append("Untethered")
65866619 # -
65876620 self.displays = displays
65886621 setcfg("displays", displays)
@@ -9795,6 +9828,25 @@ def get_display_name(
97959828 return " ".join(display)
97969829 return ""
97979830
9831+ def get_display_generic_name(self):
9832+ """Return the generic (non-model-id-overridden) name of the current display.
9833+
9834+ Unlike :meth:`get_display_name`, this never substitutes an Apple
9835+ machine model id (e.g. "MacBookPro18,1") for a built-in display's
9836+ generic monitor name (e.g. "Color LCD"), which makes it suitable for
9837+ matching against the online colorimeter correction database (see
9838+ :func:`DisplayCAL.colorimeter_correction.build_web_check_params`) -
9839+ that database is keyed by generic monitor/model names, not by the
9840+ machine-specific model id.
9841+
9842+ Returns:
9843+ str: The display's generic name, or "" if unavailable.
9844+ """
9845+ n = getcfg("display.number") - 1
9846+ if 0 <= n < len(self.display_generic_names):
9847+ return self.display_generic_names[n]
9848+ return ""
9849+
97989850 def get_display_name_short(self, prepend_manufacturer=False, prefer_edid=False):
97999851 """Return shortened name of configured display (if possible).
98009852
0 commit comments