Hi,
could someone tell me how to create the serialized string of a plugin icon?
I would like to add one for my new plugin.
Thank you.
Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.
Icon serialize
Re: Icon serialize
Make a 16x16 24bpp png file of the icon, then you can to convert it into base64 form, or you could also leave it as a file and just put the file name in your plugin icon property.
The base64 functions are available in a default python installation, you could make a little script that converts a given file into base64. Or you can use an online converter like this one; just input the image in the file box and hit convert.
http://www.motobit.com/util/base64-decoder-encoder.asp
Finally insert the base64 encoded icon file in the icon property, look for examples in the other plugins that have icons in them.
Hope this helped!
-jinxdone
The base64 functions are available in a default python installation, you could make a little script that converts a given file into base64. Or you can use an online converter like this one; just input the image in the file box and hit convert.
http://www.motobit.com/util/base64-decoder-encoder.asp
Finally insert the base64 encoded icon file in the icon property, look for examples in the other plugins that have icons in them.
Hope this helped!
-jinxdone
- Pako
- Plugin Developer
- Posts: 2294
- Joined: Sat Nov 11, 2006 1:31 pm
- Location: Czech Republic
- Contact:
Re: Icon serialize
Try this script from Bitmonster:Found here:http://www.eventghost.org/forum/viewtopic.php?f=1&t=245
Pako
Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="884">
<Macro Name="Convert PNG to Python" Expanded="True">
<Action Name="Convert PNG to Python">
EventGhost.PythonScript(u'import base64\nimport wx\n\ndef Main():\n dialog = wx.FileDialog(None, wildcard="PNG files (*.png)|*.png")\n dialog.ShowModal()\n filePath = dialog.GetPath()\n dialog.Destroy()\n if not filePath:\n return\n \n fd = open(filePath, "rb")\n data = base64.b64encode(fd.read())\n fd.close()\n\n s = " icon = (\\n"\n while len(data) > 68:\n s += \' "\' + data[:68] + \'"\\n\'\n data = data[68:]\n s += \' "\' + data + \'"\\n\'\n s += " )\\n"\n \n eg.result = s\n\n\neg.CallWait(Main)\n\n')
</Action>
<Action>
System.SetClipboard(u'{eg.result}')
</Action>
</Macro>
</EventGhost>Pako
Re: Icon serialize
It doesnt like my png...Any specs for png format? I tried 16x16x24 but no luck.
eg 0.3.7.1076
Vista, x32, SP1
Vista, x32, SP1
Re: Icon serialize
You could open one of the existing .png icons that come with EG with your image editing program, for example \EventGhost\plugins\TechnoTrendIr\icon.png. I hope you can pick the correct properties for the image that way. I didn't have any problems creating icons though using GIMP.
Does the image show up in EG if you save the icon as icon.png file in the same directory as the plugin? If that is working ok then the image file itself should be fine.
Does the image show up in EG if you save the icon as icon.png file in the same directory as the plugin? If that is working ok then the image file itself should be fine.
- Bitmonster
- Site Admin
- Posts: 2239
- Joined: Mon Feb 06, 2006 10:28 pm
Re: Icon serialize
It must have an alpha channel, so it needs to have 32bits depth.
Please post software-related questions in the forum - PMs will only be answered, if really private, thanks!
Re: Icon serialize
Yep.. Sorry! That one was my mistake. The image has to be with alpha channel as well.
Thanks for correcting me Bitmonster.
Thanks for correcting me Bitmonster.