PixInsight Forum (historical)
Software Development => PCL and PJSR Development => Topic started by: Juan Conejero on 2013 April 02 04:44:18
-
[December 15th 2013: Updated for version 1.8.0.1071 Ripley]
Hi all,
As you surely know, the new PixInsight Core 1.8 application comes with a completely redesigned set of icons, which you can use in your scripts and modules, as usual, using Qt resource paths. For example, in JavaScript:
var btn = new ToolButton( this );
btn.icon = ":/icons/mail.png";
Note that you no longer need to instantiate Bitmap to set the icon property of a control. In previous versions of PixInsight, the above code should be written as follows:
var btn = new ToolButton( this );
btn.icon = new Bitmap( ":/icons/mail.png" );
Now you can simply assign a string to the icon property. This works with core resources as well as external resources (disk files).
The old core icons, namely all icon paths starting with ":/images/", still work because I have included a compatibility resource module in all PixInsight distributions. However, I urge all PixInsight developers to update their scripts and modules to use the new core icons. This is important to achieve a coherent look and feel on all platforms.
Attached to this post you'll find a little utility script that allows you to browse all available core icons conveniently on a dialog. Please let me know if you find any errors, and don't hesitate to ask for more icons, if you find that the existing set does not fulfill your needs.
(EDIT: Please see the last post in this thread)
-
The script has an error. The line 1262 that currently is:
this.browser.text = generate( 4 );
should be
this.browser.text = this.generateHTML( 4 );
-
Thanks Andrés. I have updated the original post with the fixed script.
-
Hi all,
I have updated the script attached to the first post in this thread. It is now current for PixInsight Core 1.8.0.1071 Ripley, which we have released today.
-
Update for core version >= 1.8.4.1194: A new CoreIconsBrowser script is now part of the official PixInsight distribution. It provides access to an up-to-date set of icon resources in the latest version of PixInsight.
The new CoreIconsBrowser script is now available on the official PJSR GitHub repository:
https://github.com/PixInsight/PJSR/tree/master/src/scripts/CoreIconsBrowser
To prevent confusions, the file attached to the first post in this thread has been removed.
-
Hi Juan,
The new CoreIconsBrowser fails on iMac 1193. Deleting the line solves the problem.
With this change the script runs, but maybe 20 to 30+ of the icons are missing (i.e label text is present but no icon).
Thanks,
Mike
*** Error [000]: /Users/Home/Documents/Astronomy/PixInsight/GitHub/PJSR/src/scripts/CoreIconsBrowser/CoreIconsBrowser.js, line 1645: Error: Bitmap.Bitmap(): bitmap file load error: :/icons/2.0/clear-old.png
-
Hi Mike,
There were two wrong icon names in the list, thanks for discovering them. There were other screen scaling issues as well, which I have fixed, and a problem with the default white background used by TextBox, which renders some icons invisible or very hard to see. I have just uploaded a new version to GitHub with these bugs fixed and additional controls to change the dialog's background color.