diff --git a/DisplayCAL/display_cal.py b/DisplayCAL/display_cal.py
index c76d895b..ecb2d6c8 100644
--- a/DisplayCAL/display_cal.py
+++ b/DisplayCAL/display_cal.py
@@ -1,32 +1,25 @@
# -*- coding: utf-8 -*-
"""
-DisplayCAL - display calibration and characterization powered by ArgyllCMS
+DisplayCAL - display calibration and characterization powered by ArgyllCMS.
Copyright (C) 2008, 2009 Florian Hoech
-This program is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 3 of the License, or (at your
-option) any later version.
+This program is free software;
+you can redistribute it and/or modify it under the terms of the GNU General
+Public License as published by the Free Software Foundation;
+either version 3 of the License, or (at your option) any later version.
-This program is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
-General Public License for more details.
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+or FITNESS FOR A PARTICULAR PURPOSE.
+See the GNU General Public License for more details.
-You should have received a copy of the GNU General Public License along
-with this program; if not, see
+You should have received a copy of the GNU General Public License along with
+this program; if not, see
"""
-
-import sys
-
# Standard modules
-
-from io import StringIO, BytesIO
import datetime
-
-from decimal import Decimal
import json as json_module
import math
import os
@@ -35,120 +28,113 @@
import shutil
import socket
import subprocess as sp
+import sys
import threading
import traceback
-import urllib.request
import urllib.error
import urllib.parse
+import urllib.request
+import webbrowser # Import the webbrowser module for platform-independent results # noqa: SC100
import zipfile
-
-from send2trash import send2trash
-
-from DisplayCAL.util_dict import dict_sort
-
-if sys.platform == "win32":
- import winreg
+from decimal import Decimal
from hashlib import md5
+from io import BytesIO, StringIO
from time import localtime, sleep, strftime, strptime, struct_time
from zlib import crc32
-# Import the useful webbrowser module for platform-independent results
-import webbrowser
-
-# Set no delay time to open the web page
-webbrowser.PROCESS_CREATION_DELAY = 0
-APP_IS_UPTODATE = True
+# import wexpect # noqa: SC100
-# Config
-from DisplayCAL import config
+# Custom modules
+from DisplayCAL import (
+ CGATS,
+ ICCProfile as ICCP,
+ audio,
+ ccmx,
+ colord,
+ colormath,
+ config,
+ floatspin,
+ localization as lang,
+ madvr,
+ pyi_md5pickuphelper,
+ report,
+ util_x,
+ wexpect,
+ wxenhancedplot as plot,
+ xh_bitmapctrls,
+ xh_fancytext,
+ xh_filebrowsebutton,
+ xh_floatspin,
+ xh_hstretchstatbmp,
+)
+from DisplayCAL.argyll_cgats import (
+ cal_to_fake_profile,
+ can_update_cal,
+ extract_cal_from_profile,
+ ti3_to_ti1,
+ verify_ti1_rgb_xyz,
+)
+from DisplayCAL.argyll_instruments import get_canonical_instrument_name, instruments
+from DisplayCAL.argyll_names import viewconds
+from DisplayCAL.colormath import (
+ CIEDCCT2xyY,
+ XYZ2CCT,
+ XYZ2Lab,
+ XYZ2xyY,
+ planckianCT2xyY,
+ xyY2CCT,
+)
from DisplayCAL.config import (
appbasename,
autostart,
autostart_home,
build,
- script_ext,
defaults,
enc,
exe,
exe_ext,
fs_enc,
- getbitmap,
- geticon,
get_ccxx_testchart,
get_current_profile,
- get_display_profile,
get_data_path,
- getcfg,
+ get_display_profile,
get_total_patches,
get_verified_path,
+ getbitmap,
+ getcfg,
+ geticon,
hascfg,
+ initcfg,
is_ccxx_testchart,
is_profile,
- initcfg,
isapp,
isexe,
profile_ext,
pydir,
resfiles,
+ script_ext,
setcfg,
setcfg_cond,
writecfg,
)
-
-# Custom modules
-
-from DisplayCAL import CGATS
-from DisplayCAL import ICCProfile as ICCP
-from DisplayCAL import audio
-from DisplayCAL import ccmx
-from DisplayCAL import colord
-from DisplayCAL import colormath
-from DisplayCAL import localization as lang
-from DisplayCAL import madvr
-from DisplayCAL import pyi_md5pickuphelper
-from DisplayCAL import report
-
-if sys.platform == "win32":
- from DisplayCAL import util_win
-elif sys.platform == "darwin":
- from DisplayCAL import util_mac
-from DisplayCAL import wexpect
-# import wexpect
-from DisplayCAL.argyll_cgats import (
- cal_to_fake_profile,
- can_update_cal,
- ti3_to_ti1,
- extract_cal_from_profile,
- verify_ti1_rgb_xyz,
-)
-from DisplayCAL.argyll_instruments import get_canonical_instrument_name, instruments
-from DisplayCAL.argyll_names import viewconds
-from DisplayCAL.colormath import (
- CIEDCCT2xyY,
- planckianCT2xyY,
- xyY2CCT,
- XYZ2CCT,
- XYZ2Lab,
- XYZ2xyY,
-)
from DisplayCAL.debughelpers import (
ResourceError,
getevtobjname,
getevttype,
handle_error,
)
-from DisplayCAL.edid import pnpidcache, get_manufacturer_name
+from DisplayCAL.edid import get_manufacturer_name, pnpidcache
from DisplayCAL.log import log, logbuffer
from DisplayCAL.meta import (
+ DOMAIN,
VERSION,
VERSION_BASE,
author,
development_home_page,
+ get_latest_changelog_entry,
name as appname,
- DOMAIN,
version,
version_short,
- get_latest_changelog_entry,
)
from DisplayCAL.options import (
debug,
@@ -158,17 +144,8 @@
verbose,
)
from DisplayCAL.patterngenerators import WebWinHTTPPatternGeneratorServer
-
-try:
- from DisplayCAL.chromecast_patterngenerator import (
- ChromeCastPatternGenerator as CCPG,
- )
-except ImportError:
- from types import NoneType
-
- CCPG = NoneType
-
from DisplayCAL.util_decimal import float2dec, stripzeros
+from DisplayCAL.util_dict import dict_sort
from DisplayCAL.util_io import LineCache, TarFileProper
from DisplayCAL.util_list import index_fallback_ignorecase, intlist, natsort
from DisplayCAL.util_os import (
@@ -191,15 +168,17 @@
universal_newlines,
wrap,
)
-from DisplayCAL import util_x
from DisplayCAL.worker import (
Error,
+ FilteredStream,
Info,
UnloggedError,
UnloggedInfo,
UnloggedWarning,
Warn,
Worker,
+ _applycal_bug_workaround,
+ check_argyll_bin,
check_create_dir,
check_file_isfile,
check_set_argyll_bin,
@@ -208,77 +187,56 @@
check_ti3_criteria2,
get_arg,
get_argyll_util,
- get_cfg_option_from_args,
- get_options_from_cal,
get_argyll_version,
+ get_cfg_option_from_args,
get_current_profile_path,
+ get_options_from_cal,
get_options_from_profile,
get_options_from_ti3,
+ http_request,
make_argyll_compatible_path,
parse_argument_string,
set_argyll_bin,
show_result_dialog,
- check_argyll_bin,
- http_request,
- FilteredStream,
- _applycal_bug_workaround,
)
-from DisplayCAL.wxLUT3DFrame import LUT3DFrame, LUT3DMixin
-
-try:
- from DisplayCAL.wxLUTViewer import LUTFrame
-except ImportError:
- LUTFrame = None
-
-from DisplayCAL.wxMeasureFrame import MeasureFrame
-
-try:
- from DisplayCAL.wxCCXXPlot import CCXXPlot
-except ImportError:
- CCXXPlot = None
-
from DisplayCAL.wxDisplayUniformityFrame import DisplayUniformityFrame
-from DisplayCAL.wxMeasureFrame import get_default_size
-
-try:
- from DisplayCAL.wxProfileInfo import ProfileInfoFrame
-except ImportError:
- ProfileInfoFrame = None
-
+from DisplayCAL.wxLUT3DFrame import LUT3DFrame, LUT3DMixin
+from DisplayCAL.wxMeasureFrame import MeasureFrame, get_default_size
from DisplayCAL.wxReportFrame import ReportFrame
from DisplayCAL.wxSynthICCFrame import SynthICCFrame
from DisplayCAL.wxTestchartEditor import TestchartEditor
from DisplayCAL.wxVisualWhitepointEditor import VisualWhitepointEditor
from DisplayCAL.wxaddons import (
- wx,
BetterWindowDisabler,
CustomEvent,
CustomGridCellEvent,
IdFactory,
PopupMenu,
+ wx,
)
from DisplayCAL.wxfixes import (
- ThemedGenButton,
BitmapWithThemedButton,
- set_bitmap_labels,
- TempXmlResource,
- wx_Panel,
PlateButton,
+ TempXmlResource,
+ ThemedGenButton,
get_bitmap_disabled,
+ set_bitmap_labels,
set_maxsize,
+ wx_Panel,
)
from DisplayCAL.wxwindows import (
AboutDialog,
AuiBetterTabArt,
+ AutocompleteComboBox,
BaseApp,
BaseFrame,
BetterStaticFancyText,
- BorderGradientButton,
BitmapBackgroundPanel,
BitmapBackgroundPanelText,
+ BorderGradientButton,
ConfirmDialog,
- CustomGrid,
CustomCellBoolRenderer,
+ CustomGrid,
FileBrowseBitmapButtonWithChoiceHistory,
FileDrop,
FlatShadedButton,
@@ -289,34 +247,64 @@
ProgressDialog,
TabButton,
TooltipWindow,
- get_gradient_panel,
get_dialogs,
- AutocompleteComboBox,
+ get_gradient_panel,
)
-from DisplayCAL import floatspin
-from DisplayCAL import wxenhancedplot as plot
-from DisplayCAL import xh_fancytext
-from DisplayCAL import xh_filebrowsebutton
-from DisplayCAL import xh_floatspin
-from DisplayCAL import xh_hstretchstatbmp
-from DisplayCAL import xh_bitmapctrls
-
-# wxPython
-try:
- # Only wx.lib.aui.AuiNotebook looks reasonable across _all_ platforms.
- # Other tabbed book controls like wx.Notebook or wx.aui.AuiNotebook are
- # impossible to get to look right under GTK because there's no way to
- # set the correct background color for the pages.
- from wx.lib.agw import aui
-except ImportError:
- # Fall back to wx.aui under ancient wxPython versions
- from wx import aui
+from send2trash import send2trash
+
+# wxPython # noqa: SC100
from wx import xrc
from wx.lib import delayedresult, platebtn
from wx.lib.art import flagart
from wx.lib.scrolledpanel import ScrolledPanel
+if sys.platform == "win32":
+ from DisplayCAL import util_win
+ import winreg
+elif sys.platform == "darwin":
+ from DisplayCAL import util_mac
+
+try:
+ from DisplayCAL.chromecast_patterngenerator import (
+ ChromeCastPatternGenerator as CCPG,
+ )
+except ImportError:
+ from types import NoneType
+
+ CCPG = NoneType
+
+try:
+ from DisplayCAL.wxCCXXPlot import CCXXPlot
+except ImportError:
+ CCXXPlot = None
+
+try:
+ from DisplayCAL.wxLUTViewer import LUTFrame
+except ImportError:
+ LUTFrame = None
+
+try:
+ from DisplayCAL.wxProfileInfo import ProfileInfoFrame
+except ImportError:
+ ProfileInfoFrame = None
+
+# wxPython # noqa: SC100
+try:
+ # Only wx.lib.aui.AuiNotebook looks reasonable across _all_ platforms. # noqa: SC100
+ # Other tabbed book controls like wx.Notebook or wx.aui.AuiNotebook are # noqa: SC100
+ # impossible to get to look right under GTK because there's no way to set # noqa: SC100
+ # the correct background color for the pages.
+ from wx.lib.agw import aui
+except ImportError:
+ # Fall back to wx.aui under ancient wxPython versions # noqa: SC100
+ from wx import aui
+
+# Set no delay time to open the web page
+webbrowser.PROCESS_CREATION_DELAY = 0
+
+APP_IS_UPTODATE = True
+
def show_ccxx_error_dialog(exception, path, parent):
msg = str(exception)
@@ -678,9 +666,7 @@ def app_update_confirm(
consumer,
worker.download,
ckwargs={"exit": dlname == appname},
- wargs=(
- f"https://{domain}/{folder}/{dlname}{sep}{newversion}{suffix}",
- ),
+ wargs=(f"https://{domain}/{folder}/{dlname}{sep}{newversion}{suffix}",),
progress_msg=lang.getstr("downloading"),
fancy=False,
)
@@ -825,7 +811,9 @@ def colorimeter_correction_web_check_choose(resp, parent=None):
col.i = 0
dlg_list_ctrl.SetColumnWidth(int(col), int(75 * scale)) # Type
dlg_list_ctrl.SetColumnWidth(int(col), int(415 * scale)) # Desc
- dlg_list_ctrl.SetColumnWidth(int(col), int(150 * scale)) # Display manufactuer & model
+ dlg_list_ctrl.SetColumnWidth(
+ int(col), int(150 * scale)
+ ) # Display manufactuer & model
# dlg_list_ctrl.SetColumnWidth(int(col), int(225 * scale)) # Instrument
dlg_list_ctrl.SetColumnWidth(int(col), int(90 * scale)) # Ref. instrument
dlg_list_ctrl.SetColumnWidth(int(col), int(150 * scale)) # Spectral res
@@ -949,23 +937,29 @@ def colorimeter_correction_web_check_choose(resp, parent=None):
dlg_list_ctrl.SetStringItem(
index,
int(col),
- fit_method or lang.getstr("unknown")
- if ccxx_type == "CCMX"
- else lang.getstr("not_applicable"),
+ (
+ fit_method or lang.getstr("unknown")
+ if ccxx_type == "CCMX"
+ else lang.getstr("not_applicable")
+ ),
)
dlg_list_ctrl.SetStringItem(
index,
int(col),
- str(ccxx.queryv1("FIT_AVG_DE00") or lang.getstr("unknown"))
- if ccxx_type == "CCMX"
- else lang.getstr("not_applicable"),
+ (
+ str(ccxx.queryv1("FIT_AVG_DE00") or lang.getstr("unknown"))
+ if ccxx_type == "CCMX"
+ else lang.getstr("not_applicable")
+ ),
)
dlg_list_ctrl.SetStringItem(
index,
int(col),
- str(ccxx.queryv1("FIT_MAX_DE00") or lang.getstr("unknown"))
- if ccxx_type == "CCMX"
- else lang.getstr("not_applicable"),
+ (
+ str(ccxx.queryv1("FIT_MAX_DE00") or lang.getstr("unknown"))
+ if ccxx_type == "CCMX"
+ else lang.getstr("not_applicable")
+ ),
)
dlg_list_ctrl.SetStringItem(index, int(col), created or lang.getstr("unknown"))
@@ -1238,7 +1232,6 @@ class Dummy(object):
class IncrementingInt(object):
-
"""A integer that increments by `step` each time it is used"""
def __init__(self, start=0, stop=None, step=1):
@@ -1254,7 +1247,6 @@ def __int__(self):
class ExtraArgsFrame(BaseFrame):
-
"""Extra commandline arguments window."""
def __init__(self, parent):
@@ -1347,7 +1339,6 @@ def update_controls(self):
class GamapFrame(BaseFrame):
-
"""Gamut mapping options window."""
def __init__(self, parent):
@@ -2634,9 +2625,9 @@ def update_profile_type_ctrl_items(self):
self.profile_types.insert(
profile_types_index, lang.getstr("profile.type.lut_matrix.xyz")
)
- self.profile_types_ab[
- profile_types_index
- ] = "X" # XYZ LUT + accurate matrix
+ self.profile_types_ab[profile_types_index] = (
+ "X" # XYZ LUT + accurate matrix
+ )
profile_types_index += 1
if ([1, 1, 0] < self.worker.argyll_version[0:3] < [2, 0, 2]) or (
self.worker.argyll_version[0:3] == [1, 1, 0]
@@ -2650,9 +2641,9 @@ def update_profile_type_ctrl_items(self):
profile_types_index,
lang.getstr("profile.type.lut_rg_swapped_matrix.xyz"),
)
- self.profile_types_ab[
- profile_types_index
- ] = "x" # XYZ LUT + dummy matrix (R <-> G swapped)
+ self.profile_types_ab[profile_types_index] = (
+ "x" # XYZ LUT + dummy matrix (R <-> G swapped)
+ )
profile_types_index += 1
else:
self.profile_types.insert(
@@ -2747,9 +2738,11 @@ def init_menus(self):
if sys.platform != "darwin" or wx.VERSION >= (2, 9):
file_.AppendSeparator()
self.menuitem_prefs = file_.Append(
- -1
- if wx.VERSION < (2, 9) or sys.platform != "darwin"
- else wx.ID_PREFERENCES,
+ (
+ -1
+ if wx.VERSION < (2, 9) or sys.platform != "darwin"
+ else wx.ID_PREFERENCES
+ ),
"&" + "menuitem.set_argyll_bin",
)
self.Bind(wx.EVT_MENU, self.set_argyll_bin_handler, self.menuitem_prefs)
@@ -4840,7 +4833,11 @@ def update_colorimeter_correction_matrix_ctrl_items(
ccmx_desc = self.ccmx_cached_descriptors[ccmx[1]]
items[1] += " (%s: %s)" % (
types.get(os.path.splitext(ccmx[1])[1].lower()[1:]),
- ccmx_desc if isinstance(ccmx_desc, str) else ccmx_desc.decode("utf-8"),
+ (
+ ccmx_desc
+ if isinstance(ccmx_desc, str)
+ else ccmx_desc.decode("utf-8")
+ ),
)
else:
items[1] += " (%s)" % lang.getstr("colorimeter_correction.file.none")
@@ -5914,9 +5911,11 @@ def skip_legacy_serial_ports_handler(self, event):
def calibrate_instrument_handler(self, event):
self.worker.start(
- lambda result: show_result_dialog(result, self)
- if isinstance(result, Exception)
- else None,
+ lambda result: (
+ show_result_dialog(result, self)
+ if isinstance(result, Exception)
+ else None
+ ),
self.worker.calibrate_instrument_producer,
fancy=False,
)
@@ -7624,7 +7623,7 @@ def profile_share_handler(self, event):
InfoDialog(
getattr(self, "modaldlg", self),
msg="icc.opensuse.org is not working anymore\n"
- "This functionality is temporarily disabled.",
+ "This functionality is temporarily disabled.",
ok=lang.getstr("ok"),
bitmap=geticon(32, "dialog-error"),
)
@@ -7972,9 +7971,9 @@ def profile_share_handler(self, event):
metadata["CONNECTION_type"] = connections[dlg.connection_ctrl.GetSelection()]
for ctrl in display_settings_ctrls:
if isinstance(ctrl, wx.TextCtrl) and ctrl.GetValue().strip():
- metadata[
- "OSD_settings_%s" % re.sub(r"[ .]", "_", ctrl.Name)
- ] = ctrl.GetValue().strip()
+ metadata["OSD_settings_%s" % re.sub(r"[ .]", "_", ctrl.Name)] = (
+ ctrl.GetValue().strip()
+ )
if "OSD_" not in prefixes:
prefixes.append("OSD_")
# Set meta prefix
@@ -8175,9 +8174,11 @@ def install_argyll_instrument_drivers(self, event=None, uninstall=False):
print("-" * 80)
print(lang.getstr(title))
self.worker.start(
- lambda result: show_result_dialog(result, self)
- if isinstance(result, Exception)
- else self.check_update_controls(True),
+ lambda result: (
+ show_result_dialog(result, self)
+ if isinstance(result, Exception)
+ else self.check_update_controls(True)
+ ),
self.worker.install_argyll_instrument_drivers,
wargs=(uninstall, launch_devman),
fancy=False,
@@ -9519,8 +9520,16 @@ def measurement_report_consumer(
labels_Lab = ("LAB_L", "LAB_A", "LAB_B")
for data in (ti3_ref, ti3_joined):
data_formats = list(data.DATA_FORMAT.values())
- if b"XYZ_X" in data_formats and b"XYZ_Y" in data_formats and b"XYZ_Z" in data_formats:
- if b"LAB_L" not in data_formats and b"LAB_A" not in data_formats and b"LAB_B" not in data_formats:
+ if (
+ b"XYZ_X" in data_formats
+ and b"XYZ_Y" in data_formats
+ and b"XYZ_Z" in data_formats
+ ):
+ if (
+ b"LAB_L" not in data_formats
+ and b"LAB_A" not in data_formats
+ and b"LAB_B" not in data_formats
+ ):
# add Lab fields to DATA_FORMAT if not present
data.DATA_FORMAT.add_data(labels_Lab)
has_Lab = False
@@ -9577,14 +9586,19 @@ def measurement_report_consumer(
else:
filename, ext = os.path.splitext(ccmx)
desc = cgats.get_descriptor()
- desc = lang.getstr(ext[1:] + "." + filename, default=desc.decode("utf-8"))
+ desc = lang.getstr(
+ ext[1:] + "." + filename, default=desc.decode("utf-8")
+ )
# If the description is not the same as the 'sane'
# filename, add the filename after the description
# (max 31 chars)
# See also colorimeter_correction_check_overwite, the
# way the filename is processed must be the same
argyll_compatible_path = make_argyll_compatible_path(desc)
- if re.sub(r"[\\/:;*?\"<>|]+", "_", argyll_compatible_path) != filename:
+ if (
+ re.sub(r"[\\/:;*?\"<>|]+", "_", argyll_compatible_path)
+ != filename
+ ):
ccmx = "%s <%s>" % (
desc,
ellipsis_(ccmx, 31, "m"),
@@ -9639,9 +9653,9 @@ def measurement_report_consumer(
"${PROFILE}": profile.getDescription(),
"${PROFILE_WHITEPOINT}": "%f %f %f" % wtpt_profile,
"${PROFILE_WHITEPOINT_NORMALIZED}": "%f %f %f" % wtpt_profile_norm,
- "${SIMULATION_PROFILE}": sim_profile.getDescription()
- if sim_profile
- else "",
+ "${SIMULATION_PROFILE}": (
+ sim_profile.getDescription() if sim_profile else ""
+ ),
"${TRC_GAMMA}": str(
getcfg("measurement_report.trc_gamma") if apply_trc else "null"
),
@@ -11202,8 +11216,14 @@ def profile_finish(
)
for key, name, _volume in gamuts:
try:
- gamut_coverage = profile.tags.meta.getvalue(f"GAMUT_coverage({key})")
- gamut_coverage = float(gamut_coverage) if gamut_coverage is not None else gamut_coverage
+ gamut_coverage = profile.tags.meta.getvalue(
+ f"GAMUT_coverage({key})"
+ )
+ gamut_coverage = (
+ float(gamut_coverage)
+ if gamut_coverage is not None
+ else gamut_coverage
+ )
except (TypeError, ValueError):
traceback.print_exc()
gamut_coverage = None
@@ -11220,7 +11240,10 @@ def profile_finish(
for _key, name, volume in gamuts:
vinfo.append(
"{:.1f}% {}".format(
- gamut_volume * ICCP.GAMUT_VOLUME_SRGB / volume * 100,
+ gamut_volume
+ * ICCP.GAMUT_VOLUME_SRGB
+ / volume
+ * 100,
name,
)
)
@@ -12355,9 +12378,9 @@ def colorimeter_correction_matrix_ctrl_handler(self, event, path=None):
dlg = wx.FileDialog(
self,
lang.getstr("colorimeter_correction_matrix_file.choose"),
- defaultDir=defaultDir
- if defaultFile
- else config.get_argyll_data_dir(),
+ defaultDir=(
+ defaultDir if defaultFile else config.get_argyll_data_dir()
+ ),
defaultFile=defaultFile,
wildcard=lang.getstr("filetype.ccmx") + "|*.ccmx;*.ccss",
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST,
@@ -13536,8 +13559,11 @@ def correction_type_handler(event):
dlg.manufacturer_txt_ctrl = wx.Choice(
dlg, -1, choices=natsort(list(pnpidcache.values())), size=(400, -1)
)
- manufacturer_selection = self.worker.get_display_edid().get("manufacturer", "")
- if len(manufacturer_selection) < 1: manufacturer_selection = "Unknown"
+ manufacturer_selection = self.worker.get_display_edid().get(
+ "manufacturer", ""
+ )
+ if len(manufacturer_selection) < 1:
+ manufacturer_selection = "Unknown"
dlg.manufacturer_txt_ctrl.SetStringSelection(manufacturer_selection)
boxsizer.Add(
dlg.manufacturer_txt_ctrl,
@@ -14315,7 +14341,7 @@ def check_importers(event):
break
dlg.ok.Enable(result)
- for (name, desc, instruments_, importer) in [
+ for name, desc, instruments_, importer in [
(
"i1d3",
"i1 Profiler",
@@ -16526,9 +16552,11 @@ def create_profile_name(self):
black_luminance = self.get_black_luminance()
profile_name = profile_name.replace(
"%cB",
- "\0"
- if black_luminance is None or not do_cal
- else black_luminance + "cdm²",
+ (
+ "\0"
+ if black_luminance is None or not do_cal
+ else black_luminance + "cdm²"
+ ),
)
# TRC / black output offset
@@ -16572,10 +16600,12 @@ def create_profile_name(self):
auto = self.black_point_correction_auto_cb.GetValue()
profile_name = profile_name.replace(
"%ck",
- (str(k) + "% " if 0 < k < 100 else "")
- + (lang.getstr("neutral") if k > 0 else "\0").lower()
- if trc and not auto
- else "\0",
+ (
+ (str(k) + "% " if 0 < k < 100 else "")
+ + (lang.getstr("neutral") if k > 0 else "\0").lower()
+ if trc and not auto
+ else "\0"
+ ),
)
# Black point rate
@@ -17949,7 +17979,7 @@ def load_cal_handler(
setcfg("trc.type", o[0:1])
setcfg("trc", o[1:])
continue
- if o[0:1] =="f":
+ if o[0:1] == "f":
setcfg("calibration.black_output_offset", o[1:])
continue
if o[0:1] == "a":
@@ -18652,20 +18682,26 @@ def delete_calibration_handler(self, event):
sizer.Add(chk, flag=wx.ALIGN_LEFT)
scrolled.SetupScrolling()
scrolled.MinSize = (
- int(min(
- scrolled.GetVirtualSize()[0]
- + 4 * scale
- + wx.SystemSettings_GetMetric(wx.SYS_VSCROLL_X),
- self.GetDisplay().ClientArea[2] - (12 * 3 + 32) * scale,
- )),
- int(min(
- ((chk.Size[1] + 4) * min(len(self.related_files), 20) - 4)
- * scale,
- max(
- self.GetDisplay().ClientArea[3] - dlg.Size[1] - 40 * scale,
- chk.Size[1],
- ),
- )),
+ int(
+ min(
+ scrolled.GetVirtualSize()[0]
+ + 4 * scale
+ + wx.SystemSettings_GetMetric(wx.SYS_VSCROLL_X),
+ self.GetDisplay().ClientArea[2] - (12 * 3 + 32) * scale,
+ )
+ ),
+ int(
+ min(
+ ((chk.Size[1] + 4) * min(len(self.related_files), 20) - 4)
+ * scale,
+ max(
+ self.GetDisplay().ClientArea[3]
+ - dlg.Size[1]
+ - 40 * scale,
+ chk.Size[1],
+ ),
+ )
+ ),
)
dlg.sizer0.SetSizeHints(dlg)
dlg.sizer0.Layout()
@@ -19657,9 +19693,11 @@ def __init__(self, parent, ti3, suspicious, force=False):
ConfirmDialog.__init__(
self,
parent,
- title=os.path.basename(ti3.filename)
- if ti3.filename
- else lang.getstr("measurement_file.check_sanity"),
+ title=(
+ os.path.basename(ti3.filename)
+ if ti3.filename
+ else lang.getstr("measurement_file.check_sanity")
+ ),
ok=lang.getstr("ok"),
cancel=lang.getstr("cancel"),
alt=lang.getstr("invert_selection"),
@@ -19701,7 +19739,9 @@ def __init__(self, parent, ti3, suspicious, force=False):
style = wx.BORDER_SIMPLE
else:
style = wx.BORDER_THEME
- dlg.grid = CustomGrid(dlg, -1, size=(int(940 * scale), int(200 * scale)), style=style)
+ dlg.grid = CustomGrid(
+ dlg, -1, size=(int(940 * scale), int(200 * scale)), style=style
+ )
grid = dlg.grid
grid.DisableDragRowSize()
grid.SetCellHighlightPenWidth(0)
@@ -19993,9 +20033,12 @@ def update_row(self, row, RGB, XYZ, delta, sRGB_delta, delta_to_sRGB):
grid.SetCellValue(
row,
0,
- "1"
- if (not delta or (delta["E_ok"] and delta["L_ok"])) and delta_to_sRGB["ok"]
- else "",
+ (
+ "1"
+ if (not delta or (delta["E_ok"] and delta["L_ok"]))
+ and delta_to_sRGB["ok"]
+ else ""
+ ),
)
for col in range(3):
dlg.mark_cell(