Debian Codegraph @

tests/data/display_data.py

raw
1 """Sample DisplayData class."""
2
3 import sys
4
5
6 class DisplayData:
7 """Sample Display."""
8
9 DISPLAY_DATA_1 = {
10 "name": b"Monitor 1, Output DP-2",
11 "description": b"Monitor 1, Output DP-2 at 0, 0, width 1280, height 1024",
12 "pos": (0, 0),
13 "size": (1280, 1024),
14 "size_mm": (338, 270),
15 "x11_screen": 0,
16 "screen": 0,
17 "ramdac_screen": 0,
18 "icc_profile_atom_id": 551,
19 "edid": b"\x00\xff\xff\xff\xff\xff\xff\x00Zc:z\x0f\x01\x01\x011\x1e\x01\x04"
20 b'\xb5<"x;\xb0\x91\xabRN\xa0&\x0fPT\xbf\xef\x80\xe1\xc0\xd1\x00\xd1\xc0'
21 b"\xb3\x00\xa9@\x81\x80\x81\x00\x81\xc0V^\x00\xa0\xa0\xa0)P0 5\x00UP!"
22 b"\x00\x00\x1a\x00\x00\x00\xff\x00W8U204900104\n\x00\x00\x00\xfd\x00"
23 b"\x18K\x0fZ\x1e\x00\n \x00\x00\x00\xfc\x00VP2768a\n "
24 b'\x01{\x02\x03"\xf1U\x90\x1f\x05\x14ZY\x04\x13\x1e\x1d\x0f\x0e\x07'
25 b"\x06\x12\x11\x16\x15\x03\x02\x01#\t\x7f\x07\x83\x01\x00\x00\x02:"
26 b"\x80\x18q8-@X,E\x00UP!\x00\x00\x1e\x01\x1d\x80\x18q\x1c\x16 X,%"
27 b"\x00UP!\x00\x00\x9e\x02:\x80\xd0r8-@\x10,E\x80UP!\x00\x00\x1e\x01"
28 b"\x1d\x00rQ\xd0\x1e n(U\x00UP!\x00\x00\x1eXM\x00\xb8\xa18\x14@\xf8,K"
29 b"\x00UP!\x00\x00\x1e\x00\x00\x00\xd2",
30 "output": 472,
31 "icc_profile_output_atom_id": 551,
32 }
33
34 DISPLAY_DATA_2 = {
35 "blue_x": 0.1474609375,
36 "blue_y": 0.04296875,
37 "checksum": 44,
38 "checksum_valid": True,
39 "edid": b"\x00\xff\xff\xff\xff\xff\xff\x00\x10\xac\xe0@L405\x05\x1b\x01\x04"
40 b"\xb57\x1fx:U\xc5\xafO3\xb8%\x0bPT\xa5K\x00qO\xa9@\x81\x80"
41 b"\xd1\xc0\x01\x01\x01\x01\x01\x01\x01\x01V^\x00\xa0\xa0\xa0)P0 "
42 b"5\x00)7!\x00\x00\x1a\x00\x00\x00\xff\x00TYPR371U504L\n\x00\x00"
43 b"\x00\xfc\x00DELL UP2516D\n\x00\x00\x00\xfd\x002K\x1eX\x19\x01\n "
44 b" \x01,\x02\x03\x1c\xf1O\x90\x05\x04\x03\x02\x07\x16\x01\x06\x11\x12"
45 b"\x15\x13\x14\x1f#\t\x1f\x07\x83\x01\x00\x00\x02:\x80\x18q8-@X,E\x00"
46 b")7!\x00\x00\x1e~9\x00\xa0\x808\x1f@0 :\x00)7!\x00\x00\x1a"
47 b"\x01\x1d\x00rQ\xd0\x1e n(U\x00)7!\x00\x00\x1e\xbf\x16\x00\xa0\x808"
48 b"\x13@0 :\x00)7!\x00\x00\x1a\x00\x00\x00\x00\x00\x00\x00\x00"
49 b"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
50 b"\x00\x00\x00\x86",
51 "edid_revision": 4,
52 "edid_version": 1,
53 "ext_flag": 1,
54 "features": 58,
55 "gamma": 2.2,
56 "green_x": 0.2001953125,
57 "green_y": 0.7197265625,
58 "hash": "40cf706d53476076b828fb8a78af796d",
59 "header": b"\x00\xff\xff\xff\xff\xff\xff\x00",
60 "manufacturer": "Dell, Inc.",
61 "manufacturer_id": "DEL",
62 "max_h_size_cm": 55,
63 "max_v_size_cm": 31,
64 "monitor_name": "DELL UP2516D",
65 "product_id": 16608,
66 "red_x": 0.6845703125,
67 "red_y": 0.3095703125,
68 "serial_32": 892351564,
69 "serial_ascii": "TYPR371U504L",
70 "week_of_manufacture": 5,
71 "white_x": 0.3134765625,
72 "white_y": 0.3291015625,
73 "year_of_manufacture": 2017,
74 }
75
76 DISPWIN_OUTPUT_1 = b"""Test display patch window, Set Video LUTs, Install profiles, Version 3.3.0
77 Author: Graeme W. Gill, licensed under the AGPL Version 3
78 Diagnostic: -d parameter '0' is out of range
79 usage: dispwin [options] [calfile]
80 -v Verbose mode
81 -d n Choose the display from the following list (default 1)
82 1 = 'Built-in Retina Display, at 0, 0, width 1728, height 1117 (Primary Display)'
83 -dweb[:port] Display via web server at port (default 8080)
84 -dcc[:n] Display via n'th ChromeCast (default 1, ? for list)
85 -d dummy Display via dummy (non-existant, invisible) display
86 -P ho,vo,ss[,vs] Position test window and scale it
87 -F Fill whole screen with black background
88 -E Video encode output as (16-235)/255 "TV" levels
89 -i Run forever with random values
90 -G filename Display RGB colors from CGATS (ie .ti1) file
91 -C r.rr,g.gg,b.bb Add this RGB color to list to be displayed
92 -m Manually cycle through values
93 -Y msec patch delay in msec (default 2000)
94 -f Test grey ramp fade
95 -r Test just Video LUT loading & Beeps
96 -n Test native output (rather than through Video LUT and C.M.)
97 -s filename Save the currently loaded Video LUT to 'filename'
98 -c Load a linear display calibration
99 -V Verify that calfile/profile cal. is currently loaded in LUT
100 -I Install profile for display and use its calibration
101 -U Un-install profile for display
102 -S d Specify the install/uninstall scope for OS X [nlu] or X11/Vista [lu]
103 d is one of: n = network, l = local system, u = user (default)
104 -L Load installed profile & calibration
105 -D [level] Print debug diagnostics to stderr
106 calfile Load calibration (.cal or .icc) into Video LUT"""
107
108 DISPWIN_OUTPUT_2 = b"""Test display patch window, Set Video LUTs, Install profiles, Version 3.3.0
109 Author: Graeme W. Gill, licensed under the AGPL Version 3
110 Diagnostic: -d parameter '0' is out of range
111 usage: dispwin [options] [calfile]
112 -v Verbose mode
113 -d n Choose the display from the following list (default 1)
114 1 = 'Built-in Retina Display, at 0, 0, width 1728, height 1117 (Primary Display)'
115 2 = 'DELL U2720Q, at 1728, -575, width 3008, height 1692'
116 -dweb[:port] Display via web server at port (default 8080)
117 -dcc[:n] Display via n'th ChromeCast (default 1, ? for list)
118 -d dummy Display via dummy (non-existant, invisible) display
119 -P ho,vo,ss[,vs] Position test window and scale it
120 -F Fill whole screen with black background
121 -E Video encode output as (16-235)/255 "TV" levels
122 -i Run forever with random values
123 -G filename Display RGB colors from CGATS (ie .ti1) file
124 -C r.rr,g.gg,b.bb Add this RGB color to list to be displayed
125 -m Manually cycle through values
126 -Y msec patch delay in msec (default 2000)
127 -f Test grey ramp fade
128 -r Test just Video LUT loading & Beeps
129 -n Test native output (rather than through Video LUT and C.M.)
130 -s filename Save the currently loaded Video LUT to 'filename'
131 -c Load a linear display calibration
132 -V Verify that calfile/profile cal. is currently loaded in LUT
133 -I Install profile for display and use its calibration
134 -U Un-install profile for display
135 -S d Specify the install/uninstall scope for OS X [nlu] or X11/Vista [lu]
136 d is one of: n = network, l = local system, u = user (default)
137 -L Load installed profile & calibration
138 -D [level] Print debug diagnostics to stderr
139 calfile Load calibration (.cal or .icc) into Video LUT"""
140
141 DISPWIN_OUTPUT_3 = b"""Test display patch window, Set Video LUTs, Install profiles, Version 3.3.0
142 Author: Graeme W. Gill, licensed under the AGPL Version 3
143 Diagnostic: -d parameter '0' is out of range
144 usage: dispwin [options] [calfile]
145 -v Verbose mode
146 -d n Choose the display from the following list (default 1)
147 -dweb[:port] Display via web server at port (default 8080)
148 -dcc[:n] Display via n'th ChromeCast (default 1, ? for list)
149 -d dummy Display via dummy (non-existant, invisible) display
150 -P ho,vo,ss[,vs] Position test window and scale it
151 -F Fill whole screen with black background
152 -E Video encode output as (16-235)/255 "TV" levels
153 -i Run forever with random values
154 -G filename Display RGB colors from CGATS (ie .ti1) file
155 -C r.rr,g.gg,b.bb Add this RGB color to list to be displayed
156 -m Manually cycle through values
157 -Y msec patch delay in msec (default 2000)
158 -f Test grey ramp fade
159 -r Test just Video LUT loading & Beeps
160 -n Test native output (rather than through Video LUT and C.M.)
161 -s filename Save the currently loaded Video LUT to 'filename'
162 -c Load a linear display calibration
163 -V Verify that calfile/profile cal. is currently loaded in LUT
164 -I Install profile for display and use its calibration
165 -U Un-install profile for display
166 -S d Specify the install/uninstall scope for OS X [nlu] or X11/Vista [lu]
167 d is one of: n = network, l = local system, u = user (default)
168 -L Load installed profile & calibration
169 -D [level] Print debug diagnostics to stderr
170 calfile Load calibration (.cal or .icc) into Video LUT"""
171
172 DISPWIN_OUTPUT_4 = b"""Test display patch window, Set Video LUTs, Install profiles, Version 3.3.0
173 Author: Graeme W. Gill, licensed under the AGPL Version 3
174 Diagnostic: -d parameter '0' is out of range
175 usage: dispwin [options] [calfile]
176 -v Verbose mode
177 -d n Choose the display from the following list (default 1)
178 let's say for some reason these lines
179 don't match the requested format
180 -dweb[:port] Display via web server at port (default 8080)
181 -dcc[:n] Display via n'th ChromeCast (default 1, ? for list)
182 -d dummy Display via dummy (non-existant, invisible) display
183 -P ho,vo,ss[,vs] Position test window and scale it
184 -F Fill whole screen with black background
185 -E Video encode output as (16-235)/255 "TV" levels
186 -i Run forever with random values
187 -G filename Display RGB colors from CGATS (ie .ti1) file
188 -C r.rr,g.gg,b.bb Add this RGB color to list to be displayed
189 -m Manually cycle through values
190 -Y msec patch delay in msec (default 2000)
191 -f Test grey ramp fade
192 -r Test just Video LUT loading & Beeps
193 -n Test native output (rather than through Video LUT and C.M.)
194 -s filename Save the currently loaded Video LUT to 'filename'
195 -c Load a linear display calibration
196 -V Verify that calfile/profile cal. is currently loaded in LUT
197 -I Install profile for display and use its calibration
198 -U Un-install profile for display
199 -S d Specify the install/uninstall scope for OS X [nlu] or X11/Vista [lu]
200 d is one of: n = network, l = local system, u = user (default)
201 -L Load installed profile & calibration
202 -D [level] Print debug diagnostics to stderr
203 calfile Load calibration (.cal or .icc) into Video LUT"""
204
205 DISPWIN_OUTPUT_5 = b"""Test display patch window, Set Video LUTs, Install profiles, Version 3.3.0
206 Author: Graeme W. Gill, licensed under the AGPL Version 3
207 Diagnostic: -d parameter '0' is out of range
208 usage: dispwin [options] [calfile]
209 -v Verbose mode
210 -d n Choose the display from the following list (default 1)
211 1 = 'Built-in Retina Display, at 0, 0, width 1728, so we have a partial match'
212 -dweb[:port] Display via web server at port (default 8080)
213 -dcc[:n] Display via n'th ChromeCast (default 1, ? for list)
214 -d dummy Display via dummy (non-existant, invisible) display
215 -P ho,vo,ss[,vs] Position test window and scale it
216 -F Fill whole screen with black background
217 -E Video encode output as (16-235)/255 "TV" levels
218 -i Run forever with random values
219 -G filename Display RGB colors from CGATS (ie .ti1) file
220 -C r.rr,g.gg,b.bb Add this RGB color to list to be displayed
221 -m Manually cycle through values
222 -Y msec patch delay in msec (default 2000)
223 -f Test grey ramp fade
224 -r Test just Video LUT loading & Beeps
225 -n Test native output (rather than through Video LUT and C.M.)
226 -s filename Save the currently loaded Video LUT to 'filename'
227 -c Load a linear display calibration
228 -V Verify that calfile/profile cal. is currently loaded in LUT
229 -I Install profile for display and use its calibration
230 -U Un-install profile for display
231 -S d Specify the install/uninstall scope for OS X [nlu] or X11/Vista [lu]
232 d is one of: n = network, l = local system, u = user (default)
233 -L Load installed profile & calibration
234 -D [level] Print debug diagnostics to stderr
235 calfile Load calibration (.cal or .icc) into Video LUT"""
236
237 DISPWIN_OUTPUT_6 = b"""Test display patch window, Set Video LUTs, Install profiles, Version 3.3.0
238 Author: Graeme W. Gill, licensed under the AGPL Version 3
239 Diagnostic: -d parameter '0' is out of range
240 usage: dispwin [options] [calfile]
241 -v Verbose mode
242 -d n Choose the display from the following list (default 1)
243 1 = 'Monitor 1, Output Virtual-1 at 0, 0, width 1920, height 1080'
244 -dweb[:port] Display via web server at port (default 8080)
245 -dcc[:n] Display via n'th ChromeCast (default 1, ? for list)
246 -d dummy Display via dummy (non-existant, invisible) display
247 -P ho,vo,ss[,vs] Position test window and scale it
248 -F Fill whole screen with black background
249 -E Video encode output as (16-235)/255 "TV" levels
250 -i Run forever with random values
251 -G filename Display RGB colors from CGATS (ie .ti1) file
252 -C r.rr,g.gg,b.bb Add this RGB color to list to be displayed
253 -m Manually cycle through values
254 -Y msec patch delay in msec (default 2000)
255 -f Test grey ramp fade
256 -r Test just Video LUT loading & Beeps
257 -n Test native output (rather than through Video LUT and C.M.)
258 -s filename Save the currently loaded Video LUT to 'filename'
259 -c Load a linear display calibration
260 -V Verify that calfile/profile cal. is currently loaded in LUT
261 -I Install profile for display and use its calibration
262 -U Un-install profile for display
263 -S d Specify the install/uninstall scope for OS X [nlu] or X11/Vista [lu]
264 d is one of: n = network, l = local system, u = user (default)
265 -L Load installed profile & calibration
266 -D [level] Print debug diagnostics to stderr
267 calfile Load calibration (.cal or .icc) into Video LUT"""
268
269 DISPWIN_OUTPUT_7 = b"""Test display patch window, Set Video LUTs, Install profiles, Version 3.3.0
270 Author: Graeme W. Gill, licensed under the AGPL Version 3
271 Diagnostic: -d parameter '0' is out of range
272 usage: dispwin [options] [calfile]
273 -v Verbose mode
274 -d n Choose the display from the following list (default 1)
275 1 = 'Built-in Retina Display, at 0, 0, width 1728, height 1117 (Primary Display)'
276 2 = 'DELL UP2516D, at -2560, -323, width 2560, height 1440'
277 -dweb[:port] Display via web server at port (default 8080)
278 -dcc[:n] Display via n'th ChromeCast (default 1, ? for list)
279 -d dummy Display via dummy (non-existant, invisible) display
280 -P ho,vo,ss[,vs] Position test window and scale it
281 -F Fill whole screen with black background
282 -E Video encode output as (16-235)/255 "TV" levels
283 -i Run forever with random values
284 -G filename Display RGB colors from CGATS (ie .ti1) file
285 -C r.rr,g.gg,b.bb Add this RGB color to list to be displayed
286 -m Manually cycle through values
287 -Y msec patch delay in msec (default 2000)
288 -f Test grey ramp fade
289 -r Test just Video LUT loading & Beeps
290 -n Test native output (rather than through Video LUT and C.M.)
291 -s filename Save the currently loaded Video LUT to 'filename'
292 -c Load a linear display calibration
293 -V Verify that calfile/profile cal. is currently loaded in LUT
294 -I Install profile for display and use its calibration
295 -U Un-install profile for display
296 -S d Specify the install/uninstall scope for OS X [nlu] or X11/Vista [lu]
297 d is one of: n = network, l = local system, u = user (default)
298 -L Load installed profile & calibration
299 -D [level] Print debug diagnostics to stderr
300 calfile Load calibration (.cal or .icc) into Video LUT"""
301
302 @classmethod
303 def CFG_DATA(self, name, fallback=True, raw=False, cfg=None):
304 return {
305 "3dlut.tab.enable": 0,
306 "3dlut.tab.enable.backup": 0,
307 "app.dpi": 72.0 if sys.platform == "darwin" else 96.0,
308 "argyll.dir": None,
309 "argyll.version": "0.0.0",
310 "calibration.use_video_lut.backup": 1,
311 "displays": [
312 "Monitor 1, Output DP-2 @ 0, 0, 1280x1024",
313 ],
314 "display.number": 0,
315 }[name]
316
317 values_to_smooth = [
318 2.3293030318929384,
319 2.3293030318929384,
320 2.3426010372805486,
321 2.355899255439649,
322 2.3694314039614146,
323 2.382963559969191,
324 2.3544295784237055,
325 2.325894148385542,
326 2.31237864362089,
327 2.298863114871476,
328 2.284257393638482,
329 2.2696516724054874,
330 2.2554919758895817,
331 2.2413324132212455,
332 2.228930828649169,
333 2.216534872357199,
334 2.2209686877389485,
335 2.225402599021943,
336 2.2314347684988607,
337 2.237466937975778,
338 2.240495779254389,
339 2.243524139923591,
340 2.2463668023639056,
341 2.249212582329651,
342 2.259645930327104,
343 2.2700766987102226,
344 2.2676119750357664,
345 2.26514725136131,
346 2.2689192971808345,
347 2.272691467738244,
348 2.271807024935035,
349 2.2709214642763333,
350 2.2659462953971485,
351 2.2609671314876794,
352 2.2497755371588553,
353 2.238585027759058,
354 2.236434508653862,
355 2.2342839895486666,
356 2.233290317040858,
357 2.2322967602292785,
358 2.23393579763363,
359 2.2355742286184195,
360 2.234195110024527,
361 2.2328135846940014,
362 2.2221777867439694,
363 2.2115426084432537,
364 2.216398043394586,
365 2.221253478345919,
366 2.216669809165891,
367 2.212084440641238,
368 2.207992966303771,
369 2.203904686093491,
370 2.2073046355349235,
371 2.210702635568557,
372 2.2032725416809096,
373 2.195842447793262,
374 2.1985575301349205,
375 2.201273018299861,
376 2.200510485741649,
377 2.199747048662873,
378 2.201464894333514,
379 2.203184843223363,
380 2.207752729002515,
381 2.2123201947894233,
382 2.2126881581315416,
383 2.21305612147366,
384 2.2038316219757528,
385 2.194605971244157,
386 2.1909004523391036,
387 2.187199409716638,
388 2.18914533225574,
389 2.191090683580704,
390 2.1906565472102946,
391 2.1902225204154284,
392 2.1952671612214343,
393 2.2003118020274397,
394 2.2064622584991818,
395 2.212612936178298,
396 2.212736442951479,
397 2.2128551476873,
398 2.207003590564385,
399 2.2011527621337197,
400 2.199855531566799,
401 2.198558300999878,
402 2.1997248123751523,
403 2.200891471583813,
404 2.2052362641362024,
405 2.209581946815164,
406 2.209081169916441,
407 2.2085709540482528,
408 2.18468599452245,
409 2.1608006937236754,
410 2.132649822043214,
411 2.1044989503627525,
412 2.08789147368802,
413 2.071285613314871,
414 2.0390831980523547,
415 2.00688112036438,
416 1.9882057163732578,
417 1.9695344209710133,
418 1.9695344209710133,
419 ]
420
421 expected_smooth_values = [
422 2.3293030318929384,
423 2.3337357003554753,
424 2.3426011082043785,
425 2.355977232227204,
426 2.3694314064567514,
427 2.3689415141181036,
428 2.354429095592813,
429 2.3309007901433794,
430 2.31237863562597,
431 2.2984997173769495,
432 2.284257393638482,
433 2.269800347311184,
434 2.255492020505438,
435 2.2419184059199986,
436 2.228932704742538,
437 2.222144796248439,
438 2.2209687197060304,
439 2.2259353517532507,
440 2.2314347684988607,
441 2.2364658285763426,
442 2.2404956190512526,
443 2.2434622405139617,
444 2.2463678415390493,
445 2.2517417716735535,
446 2.2596450704556594,
447 2.2657782013576977,
448 2.2676119750357664,
449 2.26722617452597,
450 2.2689193387601296,
451 2.2711392632847045,
452 2.2718066523165374,
453 2.2695582615361722,
454 2.2659449637203872,
455 2.2588963213478945,
456 2.249775898801864,
457 2.2415983578572587,
458 2.2364345086538626,
459 2.234669605081129,
460 2.2332903556062678,
461 2.233174291634589,
462 2.233935595493776,
463 2.234568378758859,
464 2.2341943077789828,
465 2.2297288271541658,
466 2.2221779932937413,
467 2.216706146193936,
468 2.216398043394586,
469 2.218107110302132,
470 2.2166692427176824,
471 2.212249072036967,
472 2.2079940310128334,
473 2.206400762644062,
474 2.207303985732324,
475 2.20709327092813,
476 2.2032725416809096,
477 2.19922417320303,
478 2.198557665409348,
479 2.2001136780588104,
480 2.2005101842347945,
481 2.2005741429126786,
482 2.2014655954065834,
483 2.2041341555197973,
484 2.2077525890051004,
485 2.21092036064116,
486 2.2126881581315416,
487 2.209858633860318,
488 2.20383123823119,
489 2.196446015186338,
490 2.1909019444332993,
491 2.1890817314371604,
492 2.1891451418510273,
493 2.1902975210155797,
494 2.1906565837354757,
495 2.1920487429490527,
496 2.195267161221434,
497 2.200680407249352,
498 2.2064623322349735,
499 2.210603879209653,
500 2.212734842272359,
501 2.210865060401055,
502 2.2070038334618016,
503 2.2026706280883013,
504 2.199855531566799,
505 2.1993795483139427,
506 2.199724861652948,
507 2.201950849365056,
508 2.20523656084506,
509 2.2079664602892692,
510 2.209078023593286,
511 2.200779372829048,
512 2.1846858807647926,
513 2.1593788367631137,
514 2.132649822043214,
515 2.108346748697995,
516 2.0878920124552143,
517 2.066086761685082,
518 2.0390833105772015,
519 2.011390011596664,
520 1.9882070859028838,
521 1.9757581861050948,
522 1.9695344209710133,
523 ]
524
525 @property
526 def Geometry(self):
527 """Return a wx Rect as display geometry."""
528 from wx import Rect
529
530 return Rect(
531 self.DISPLAY_DATA_1["pos"][0],
532 self.DISPLAY_DATA_1["pos"][1],
533 self.DISPLAY_DATA_1["size"][0],
534 self.DISPLAY_DATA_1["size"][1],
535 )
536
537 @staticmethod
538 def enumerate_displays() -> list[dict]:
539 """Return the display data itself."""
540 return [DisplayData.DISPLAY_DATA_1]
541
542 @staticmethod
543 def dispwin_output_1(*args, **kwargs) -> bytes:
544 """Return dispwin output."""
545 return DisplayData.DISPWIN_OUTPUT_1
546
547 @staticmethod
548 def dispwin_output_2(*args, **kwargs) -> bytes:
549 """Return dispwin output."""
550 return DisplayData.DISPWIN_OUTPUT_2