@@ -524,69 +524,13 @@ _profile_getattr(CmsProfileObject* self, cmsInfoType field)
524524 return PyUnicode_FromString ("" );
525525}
526526
527- static PyObject *
528- cms_profile_getattr_product_name (CmsProfileObject * self , void * closure )
529- {
530- // name was "%s - %s" (model, manufacturer) || Description ,
531- // but if the Model and Manufacturer were the same or the model
532- // was long, Just the model, in 1.x
533- PyObject * model = _profile_getattr (self , cmsInfoModel );
534- PyObject * manufacturer = _profile_getattr (self , cmsInfoManufacturer );
535- PyObject * result ;
536-
537- if (!PyUnicode_GetSize (model ) && !PyUnicode_GetSize (manufacturer )){
538- return _profile_getattr (self , cmsInfoDescription );
539- }
540- if (!PyUnicode_GetSize (manufacturer ) || PyUnicode_GetSize (model )> 30 ){
541- return model ;
542- }
543- result = PyUnicode_Concat (model ,
544- PyUnicode_FromString (" - " ));
545- result = PyUnicode_Concat (result ,_profile_getattr (self , cmsInfoManufacturer ));
546- return result ;
547- }
548-
549527static PyObject *
550528cms_profile_getattr_product_desc (CmsProfileObject * self , void * closure )
551529{
552530 // description was Description != 'Copyright' || or "%s - %s" (manufacturer, model) in 1.x
553531 return _profile_getattr (self , cmsInfoDescription );
554532}
555533
556- void _info_concat (PyObject * * ret , PyObject * elt ){
557- if (PyUnicode_GetSize (elt )){
558- * ret = PyUnicode_Concat (* ret , elt );
559- * ret = PyUnicode_Concat (* ret , PyUnicode_FromString ("\r\n\r\n" ));
560- }
561- }
562-
563- static PyObject *
564- cms_profile_getattr_product_info (CmsProfileObject * self , void * closure )
565- {
566- // info was description \r\n\r\n copyright \r\n\r\n K007 tag \r\n\r\n whitepoint
567- PyObject * description = _profile_getattr (self , cmsInfoDescription );
568- PyObject * copyright = _profile_getattr (self , cmsInfoCopyright );
569- PyObject * ret = PyUnicode_FromString ("" );
570-
571- _info_concat (& ret , description );
572- _info_concat (& ret , copyright );
573-
574- if (cmsIsTag (self -> profile , cmsSigMediaWhitePointTag )){
575- cmsCIEXYZ * WhitePt ;
576- cmsCIExyY xyyWhitePt ;
577- cmsFloat64Number tempK ;
578-
579- WhitePt = (cmsCIEXYZ * ) cmsReadTag (self -> profile , cmsSigMediaWhitePointTag );
580- cmsXYZ2xyY (& xyyWhitePt , WhitePt );
581- if (cmsTempFromWhitePoint (& tempK , & xyyWhitePt )){
582- char tempstr [10 ];
583- snprintf (tempstr , 10 , "%5.0f" , tempK );
584- _info_concat (& ret , PyUnicode_FromFormat ("White Point: %sK" , tempstr ));
585- }
586- }
587- return ret ;
588- }
589-
590534/* use these four for the individual fields.
591535 */
592536static PyObject *
@@ -633,9 +577,7 @@ cms_profile_getattr_color_space(CmsProfileObject* self, void* closure)
633577
634578/* FIXME: add more properties (creation_datetime etc) */
635579static struct PyGetSetDef cms_profile_getsetters [] = {
636- { "product_name" , (getter ) cms_profile_getattr_product_name },
637580 { "product_desc" , (getter ) cms_profile_getattr_product_desc },
638- { "product_info" , (getter ) cms_profile_getattr_product_info },
639581 { "product_description" , (getter ) cms_profile_getattr_product_description },
640582 { "product_manufacturer" , (getter ) cms_profile_getattr_product_manufacturer },
641583 { "product_model" , (getter ) cms_profile_getattr_product_model },
0 commit comments