Way to display star ratings permanently?

dwphoto
Posts: 36
Joined: 21 Dec 07 5:04
Location: Brisbane, QLD

Re: Way to display star ratings permanently?

Post by dwphoto » 28 Jun 13 20:17

Thanks David and Hert - that new code works and I love the combination of both seeing the stars plus the version colours - a really great tweak
cheers, Dean

David Grundy
Posts: 326
Joined: 13 May 07 16:40
Location: Hong Kong

Re: Way to display star ratings permanently?

Post by David Grundy » 29 Jun 13 3:08

Another alternative ... easier on my eyes because the stars are now always the same colour so I find it easier to spot what I'm looking for on a large page of thumbnails ...
thumbs stars v5.jpg
thumbs stars v5.jpg (30.87 KiB) Viewed 5519 times

Code: Select all

%code
var
  ACatItem: TCatalogItem;
  AVersionColor: String;
  AVersionShape: String;
  ARatingColor: String;
  ARatingStar: String;
  ARatingOnStar: String;
  ARatingOffStar: String;
  i: Integer;
begin
  result := '';

  ARatingColor := 'CCCCCCCC';
  ARatingStar := 'M 3.03,4.19883 L 2.996,4.22354 L 3.00909,4.26369 L 2.97501,4.2389 L 2.94086,4.26369 L 2.95394,4.22354 L 2.92,4.19883 L 2.96193,4.19883 L 2.97501,4.1589 L 2.98801,4.19883 L 3.03,4.19883 Z ';
  ARatingOnStar := '<img size="22" path="' + ARatingStar + '" pathfillcolor="' + ARatingColor + '">';
  ARatingOffStar := '<img size="22" path="' + ARatingStar + '" pathfillstyle="none" pathstrokestyle="solid" pathstrokecolor="' + ARatingColor + '">';

  AVersionShape := 'M 1,1 L 2,2 L 1,2 L 1,1 Z';

  ACatItem := TCatalogItem.Create(nil);
  if Catalog.FindImageCombined (ImageItem, ACatItem, False, vptNone) then
  begin
    AVersionColor := '#3FCCCCCC';
    if ACatItem.IsVersion then
      AVersionColor := '#FF40FF40';
    if (ACatItem._MainVersionGUID = ACatItem.GUID) and (ACatItem.VersionCount > 0) then
      AVersionColor := '#CCFF00FF';

    result := result + '<font color="'+ AVersionColor +'"><ind y="2">';
    result := result + '<img size="22" path="' + AVersionShape + '" pathfillcolor="' + AVersionColor + '">';
    result := result + '      '; //This line adds extra space after the version symbol
    result := result + '</ind></font>';

    result := result + '<font color="'+ ARatingColor +'"><ind y="2">';
    for i := 1 to ACatItem.Rating do
      result := result + ARatingOnStar;
    for i := ACatItem.Rating + 1 to 5 do
      result := result + ARatingOffStar;
    result := result + '</ind></font>';
  end;
  ACatItem.Free;
end;
%/code
I don't know yet how fonts and spacing are defined, so it's possible that anyone else using this might need to modify the line

Code: Select all

    result := result + '      '; //This line adds extra space after the version symbol
to get sensible spacing between the version symbol and the stars. Or if the default font for thumbs info changes in future then this line also might then need to change.

... David

fbungarz
Posts: 3285
Joined: 08 Dec 06 5:03
Location: Galapagos, Ecuador

Re: Way to display star ratings permanently?

Post by fbungarz » 29 Jun 13 7:35

Hi all,
for some reasons this does not work, the bar still gets colored:
thumb.jpg
thumb.jpg (51.05 KiB) Viewed 5514 times
:(
Frank

Hert
Posts: 21341
Joined: 13 Sep 03 7:24

Re: Way to display star ratings permanently?

Post by Hert » 29 Jun 13 7:40

Frank,

The colored bar is the color label and this bar is outside of any script's control.
David's script shows a version indicator and the star ratings.
This is a User-to-User forum which means that users post questions here for other users.
Feature requests, change suggestions, or bugs can be logged in the ticketing system

fbungarz
Posts: 3285
Joined: 08 Dec 06 5:03
Location: Galapagos, Ecuador

Re: Way to display star ratings permanently?

Post by fbungarz » 29 Jun 13 7:58

So why does his screenshot NOT show the bar??? Instead it shows little colored triangles - I thought that was the whole purpose of his modifying the script!
Frank

David Grundy
Posts: 326
Joined: 13 May 07 16:40
Location: Hong Kong

Re: Way to display star ratings permanently?

Post by David Grundy » 29 Jun 13 8:09

Hi Frank

The first line below your thumbnail is PSU's own standard display which shows with every thumbnail. This is coloured red because the photo is labelled as "red" (eg by pressing "Ctrl-1" when it's selected in the Collection Viewer, or one of the other methods for doing this). I don't know how to modify this line.
Well ... I do know one way to avoid it showing a red bar: the image could be NOT labelled as "red". ;-)

The second line is the output from the script. If you're using the first version of the script this would be a coloured bar with stars on it; if you're using the one I most recently posted it will just have the coloured triangle.

... David

[Edited for (I hope) improved clarity]

Preston B
Posts: 400
Joined: 24 Feb 10 19:01
Location: Columbia, CA

Re: Way to display star ratings permanently?

Post by Preston B » 29 Jun 13 15:04

Hi Guys,

The output from this script looks great! However, not having used scripts in PSu before, where do I put the code? Please provide exact steps.

Thanks,

--P
Preston Birdwell
Columbia, CA

Photo Supreme on Puget Systems Obsidian: Win 10-64 bit Intel i5Quad Core 3.3Ghz 32GB RAM, and Puget Systems Traverse Laptop. Chamonix 4x5 and Nikon D-7100.

Please visit my web site at www.gildedmoon.com

fbungarz
Posts: 3285
Joined: 08 Dec 06 5:03
Location: Galapagos, Ecuador

Re: Way to display star ratings permanently?

Post by fbungarz » 29 Jun 13 15:40

Hi David
so what causes the colors of the star respective triangle? I obviously falsely assumed they would be the output from the color bar, which is just as disturbing visually as the background bar of the stars.
I wish one could at least make it look like IDI.
:(
Frank
Last edited by fbungarz on 29 Jun 13 17:06, edited 1 time in total.

fbungarz
Posts: 3285
Joined: 08 Dec 06 5:03
Location: Galapagos, Ecuador

Re: Way to display star ratings permanently?

Post by fbungarz » 29 Jun 13 17:04

seeing the stars plus the version colours
I actually didn't notice that the colors of the triangle or stars denote the versions NOT the color label (of course !!!). Are these colors configurable per version, how? It did throw me off that your colors were different then mine...
Sorry for the confusion.

Frank
Last edited by fbungarz on 29 Jun 13 17:09, edited 1 time in total.

David Grundy
Posts: 326
Joined: 13 May 07 16:40
Location: Hong Kong

Re: Way to display star ratings permanently?

Post by David Grundy » 29 Jun 13 17:06

Hi Preston

In the Collection viewer, at the top-right corner of the view, there's an icon labelled "View". Click on this, and an option dialog opens underneath it.
The second title bar in the dialog is labelled "Custom Thumb Info". Underneath this there is a box where you can put in the script.

So, just copy the whole script in one step, and paste the whole thing into the box. You don't need to be able to read what's in the box. (If there's something already there you can remove it first, for example by clicking in the box, press ctrl-a to select all text in the box, and press Delete).

Once you put a script into one line, the thumbs will immediately update with the information (assuming it works). And an additional box for another script will appear below the one you just filled up, in case you want to add another line of info as well.

(BTW I couldn't find this in the manual; I did a forum search a few days ago because I also couldn't work it out!)

... David

David Grundy
Posts: 326
Joined: 13 May 07 16:40
Location: Hong Kong

Re: Way to display star ratings permanently?

Post by David Grundy » 29 Jun 13 17:21

Hi Frank

Indeed, I wanted to do this because I find it difficult to see the little version indicator tabs and the star number (with a thin font, dark on light, I can't see it well). My implementation only gets part-way there.
At present the triangles have the following meanings:
- dark grey (almost the same colour as the background) = no versions
- purple = main version
- green = any other version

I don't yet know how to identify any versions specifically except the main version.

The colours are defined in these lines:
ARatingColor := 'CCCCCCCC'; //This is the colour for the stars - pale grey
although it appears I forgot to specify "#" in this case. Ooops ... and ... hmmm, why does it still work?

AVersionColor := '#3FCCCCCC';// This is the colour for unversioned images
if ACatItem.IsVersion then
AVersionColor := '#FF40FF40';// This is the colour for non-main verisons
if (ACatItem._MainVersionGUID = ACatItem.GUID) and (ACatItem.VersionCount > 0) then
AVersionColor := '#CCFF00FF';// This is the colour for main versions


I got these colours with some trial end error; I was too lazy to figure out how colours work with 8 digits instead of the 6 I was expecting. If you fill these with alternative sets of hex digits, you'll get different colours, but as mentioned I don't know how to determine which specific version is displayed so the colours are probably the easy bit.

... David

David Grundy
Posts: 326
Joined: 13 May 07 16:40
Location: Hong Kong

Re: Way to display star ratings permanently?

Post by David Grundy » 29 Jun 13 17:32

Edit: I have removed the previous content of this post because it didn't make a sufficiently relevant point. It belongs to another thread, another time.

Instead let me just say that I don't use colour labels much. I agree the colour bars are more visually dominant than I would prefer, but it never occurred to me to suggest making it different! For most purposes, I have a private label category (ie my Manage DB labels are never written out to the files) for workflow statuses of various files, and for most other things which might otherwise have been done with colour labels.

Preston B
Posts: 400
Joined: 24 Feb 10 19:01
Location: Columbia, CA

Re: Way to display star ratings permanently?

Post by Preston B » 29 Jun 13 19:41

Hi David,

Thank you for posting the steps for adding your code. It works great for me.

Just a thought, but you might want to post the code and the procedure in the Photo Supreme forum>Announcements>Tips for working with Photo Supreme thread.

Your script is very nicely done, indeed, and should be shared.

--P
Preston Birdwell
Columbia, CA

Photo Supreme on Puget Systems Obsidian: Win 10-64 bit Intel i5Quad Core 3.3Ghz 32GB RAM, and Puget Systems Traverse Laptop. Chamonix 4x5 and Nikon D-7100.

Please visit my web site at www.gildedmoon.com

David Grundy
Posts: 326
Joined: 13 May 07 16:40
Location: Hong Kong

Re: Way to display star ratings permanently?

Post by David Grundy » 27 Jul 13 14:50

Here's another way.
I wanted to replace a row of stars with a specific shape for each rating. I suspect this is faster to process visually, especially when scanning visually for images with a particular rating. But I could easily be wrong.

I don't know if it's better, but anyway may as well add it to this list in this thread.
Rating square 2.jpg
Rating square 2.jpg (66.64 KiB) Viewed 5371 times
In the example the ratings are
Row 1: 5,1,0,4
Row 2: 4,2,4,3
As before, the purple and green triangles show when something is a Main Version or Other Version respectively.
The proportion of the yellow square that filled in with yellow shows what rating the file has.

Code: Select all

%code
// 2013-07-27 v6 Replace stars with a part-filled square
// 2013-07-13 v5b, modified colours
// 2013-06-30 v5a, split version indicator from rating stars
// 2013-06 early versions based on code by Hert
// Note to self: Colours seem to be specified as ARGB Hex

var
  ACatItem: TCatalogItem;
  AVersionColor: String;
  AVersionShape: String;
  ARatingNumber: Integer;
  ARatingColor: String;
  ASetRatingColor: String;
  ARatingShape1: String;
  ARatingShape2: String;
  i: Integer;
begin
  result := '';

  ARatingColor := '#FFCFCF00'; //#### Yellow colour for rating shapes
  ASetRatingColor := '" pathfillcolor="' + ARatingColor + '" pathstrokestyle="solid" pathstrokecolor="' + ARatingColor + '">';

  ARatingShape1 := 'M 0,0 '; //#### First part of rating shape
  ARatingShape2 := ' L 5,5 L 0,5 L 0,0 Z'; //#### Last part of rating shape

  AVersionShape := 'M 0,0 L 1,1 L 0,1 L 0,0 Z'; //#### Triangle shape for the version indicator

  ACatItem := TCatalogItem.Create(nil);
  if Catalog.FindImageCombined (ImageItem, ACatItem, False, vptNone) then
  begin

//#### Show a shape coloured to indicated versions

    AVersionColor := '#FF333333'; //#### Dark gray colour for Solo (unVersioned) files
    if ACatItem.IsVersion then
      AVersionColor := '#FF33FF33'; //#### Bright green colour for non-Main Versions
    if (ACatItem._MainVersionGUID = ACatItem.GUID) and (ACatItem.VersionCount > 0) then
      AVersionColor := '#FFCC00CC'; //#### Purple colour for Main Versions

    result := result + '<font color="'+ AVersionColor +'"><ind y="2">';
    result := result + '<img size="22" path="' + AVersionShape + '" pathfillcolor="' + AVersionColor + '">';
    result := result + '   '; //####This line adds extra space after the version symbol
    result := result + '</ind></font>';

//#### Show a shape to indicate the rating
 
    ARatingNumber := ACatItem.Rating;
    result := result + '<font color="'+ ARatingColor +'"><ind y="2">';
    result := result + '<img size="22" path="' +  ARatingShape1;
    result := result + ' L '+inttostr(ARatingNumber)+' '+inttostr(5 - ARatingNumber)+' ';
    result := result + ARatingShape2;
    result := result + ASetRatingColor;
    result := result + '</ind></font>';

  end;
  ACatItem.Free;
end;
%/code
... David

ykuendig
Posts: 4
Joined: 12 Oct 13 11:05

Re: Way to display star ratings permanently?

Post by ykuendig » 13 Oct 13 13:27

I have also modified the script a bit to show file-size, gps-state and recipe in addition.
For all of you who are interested:

Code: Select all

%code
var
  ACatItem: TCatalogItem;
  AVersionColor: String;
  AVersionShape: String;
  ARatingColor: String;
  ARatingStar: String;
  ARatingOnStar: String;
  ARatingOffStar: String;
  i: Integer;
begin
  result := '';

  ARatingColor := '#CCCCCCCC';
  ARatingStar := 'M 3.03,4.19883 L 2.996,4.22354 L 3.00909,4.26369 L 2.97501,4.2389 L 2.94086,4.26369 L 2.95394,4.22354 L 2.92,4.19883 L 2.96193,4.19883 L 2.97501,4.1589 L 2.98801,4.19883 L 3.03,4.19883 Z ';
  ARatingOnStar := '<img size="22" path="' + ARatingStar + '" pathfillcolor="' + ARatingColor + '">';
  ARatingOffStar := '<img size="19" path="' + ARatingStar + '" pathfillstyle="none" pathstrokestyle="solid" pathstrokecolor="' + ARatingColor + '">';

  AVersionShape := 'M 1,1 L 2,2 L 1,2 L 1,1 Z';

  ACatItem := TCatalogItem.Create(nil);
  if Catalog.FindImageCombined (ImageItem, ACatItem, False, vptNone) then
  begin
    AVersionColor := '#3FCCCCCC';
    if ACatItem.IsVersion then
      AVersionColor := '#FF40FF40';
    if (ACatItem._MainVersionGUID = ACatItem.GUID) and (ACatItem.VersionCount > 0) then
      AVersionColor := '#CCFF00FF';

//#### Show Versioning Triangle
    result := result + '<font size="08" color="'+ AVersionColor +'"><ind y="2">';
    result := result + '<img size="22" path="' + AVersionShape + '" pathfillcolor="' + AVersionColor + '">';
    result := result + ' '; //This line adds extra space
    result := result + '</ind></font>';


//#### Show Star Rating
    result := result + '<font size="08" color="'+ ARatingColor +'">';
    for i := 1 to ACatItem.Rating do
      result := result + '<ind y="2">' + ARatingOnStar;
    for i := ACatItem.Rating + 1 to 5 do
      result := result + '<ind y="3">' + ARatingOffStar;
    result := result + ' '; //This line adds extra space
    result := result + '</ind></font>';

//#### Show File Size
    result := result + '<FONT size="08" color="#CFFFFF00"><ind y="3">%ImageFileSizeShort';
    result := result + ' '; //This line adds extra space
    result := result + '</ind></font>';

//#### Show GPS indicator
    if ImageItem.HasGPS then
    result := result + '<FONT size="08" color="#FF40FF40"><ind y="3">GPS'
      else
    result := result + '<FONT size="08" color="#3FCCCCCC"><ind y="3">GPS';
    result := result + ' '; //This line adds extra space
    result := result + '</ind></FONT>';

//#### Show Recipe indicator
    if ImageItem._HasRecipe then
    result := result + '<FONT size="08" color="#FFFF4040"><ind y="3">R'
      else
    result := result + '<FONT size="08" color="#3FCCCCCC"><ind y="3">R';
//    result := result + ' '; //This line adds extra space
    result := result + '</ind></FONT>';

  end;
  ACatItem.Free;
end;
%/code
Yves

Post Reply