Icon sets

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
22 messages Options
12
Wed
Reply | Threaded
Open this post in threaded view
|

Icon sets

Wed
I am a long time user of QCad. But I am very excited to see LibreCAD offering a alternative. I offered my services touching up the icons though. Inkscape is one of my favourite tools and the existing icons had a few inconsistencies.

Here I offer the svg source files.

According to discussion on IRC, it would be preferable to generate the rasterized images automatically instead of manually in order to avoid human errors.

This one holds all the buttons. The page size is adjusted to the image size
librecad-icons_icons_wed.svg

This holds a few action and information icons, as well as a few I haven't been able to identify:
librecad-icons_symbols_wed.svg
These are however not lined up.
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

hsd8
25.09.2012 22:21, Wed [via LibreCAD] пишет:

This holds a few action and information icons, as well as a few I haven't been able to identify:
librecad-icons_symbols_wed.svg
These are however not lined up.


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/Icon-sets-tp5707060.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD-dev, click here.
NAML


Wherefore Python Icons?


Wed
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

Wed
There was one in the original file. So I got the original from the python web site. What purpose it serves, I don't know.
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

luke
In reply to this post by Wed
Your icon svg only has three crosses on a transparent background for me.

The way I'd generate the PNG icons would be to export the svg to png, grab your favourite scripting language, and write a small imagemagick script to cut the png up, everything hard-coded.
Wed
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

Wed
The icon svg show one of the many layers. They are all stacked on top of each other. All other layers are closed, ie invisible.

As I close one layer and open another, the page is exported to a png.

If I were a coder, I might have written some sort of script. But I am not. The problem isn't huge though. Once all the icons have been exported, the names are there for the next round.
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

Rallaz
To rasterize the icons:
open librecad-icons_icons_wed.svg with Inkscape and set all layers visible (is easy with layer->layers...) and save as lc-icons.svg

in command line execute:
inkscape -C -j -z -w 124 -h 124 -y 0 -i layer5 -e menu_splines.png lc-icons.svg
the above line generates "menu_splines.png" of size 124x124 and trasparent background
using only the object with id="layer5"

Read http://inkscape.org/doc/inkscape-man.html for more info.

To automate it, is required a bash script that read the svg and generate the command line parsing:
     inkscape:groupmode="layer"
     id="layer5"
     inkscape:label="menu_splines"
Wed
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

Wed
Rallaz wrote
inkscape -C -j -z -w 124 -h 124 -y 0 -i layer5 -e menu_splines.png lc-icons.svg
Do I have to type the bold above manually for each image? If so, nothing is gained. A few mouseclicks and the same typing will do the same.

I will see if I can read through the manpages to have it insert the layer name as well. I am at work at the moment though.
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

Rallaz
Wed wrote
Do I have to type the bold above manually for each image? If so, nothing is gained. A few mouseclicks and the same typing will do the same.
Yes, you have to type the command line for each image, and nothing is gained.
And no, do NOT have to type the command line for each image, if anyone write a bash script that write for you.
Modifing the file areacuter-cut.sh
http://wiki.colivre.net/pub/Aurium/InkscapeAreaCuter/areacuter.tar.gz
are solved but you need someone who knows "sed"

Rallaz
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

dxli

Can we keep the filenames and path in svg? So only loop through all layers

On Sep 26, 2012 7:33 AM, "Rallaz [via LibreCAD]" <[hidden email]> wrote:
Wed wrote
Do I have to type the bold above manually for each image? If so, nothing is gained. A few mouseclicks and the same typing will do the same.
Yes, you have to type the command line for each image, and nothing is gained.
And no, do NOT have to type the command line for each image, if anyone write a bash script that write for you.
Modifing the file areacuter-cut.sh
http://wiki.colivre.net/pub/Aurium/InkscapeAreaCuter/areacuter.tar.gz
are solved but you need someone who knows "sed"

Rallaz


If you reply to this email, your message will be added to the discussion below:
http://forum.librecad.org/Icon-sets-tp5707060p5707069.html
To start a new topic under LibreCAD-dev, email [hidden email]
To unsubscribe from LibreCAD-dev, click here.
NAML
Wed
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

Wed
Here they are: lc_icons.tar.gz
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

perepujal
In reply to this post by Wed
El dt 25 de 09 de 2012 a les 11:21 -0700, en/na Wed [via LibreCAD] va
escriure:

> I am a long time user of QCad. But I am very excited to see LibreCAD
> offering a alternative. I offered my services touching up the icons
> though. Inkscape is one of my favourite tools and the existing icons
> had a few inconsistencies.
>
> Here I offer the svg source files.
>
> According to discussion on IRC, it would be preferable to generate the
> rasterized images automatically instead of manually in order to avoid
> human errors.
>
> This one holds all the buttons. The page size is adjusted to the image
> size
> librecad-icons_icons_wed.svg
>
Attached is a rough bash script that exports the layers from this file
to pngs.
it does this by creating a temporary svg for each layer, then calling
rsvg with the name of the file to be created(the layer name plus
the .png extension)
It depends highly on the specific syntax of this file, same number of
spaces at the key blocks, so I am pretty sure that will do wrong for
some other files, but is a start.
launch it as exportsvglayers.sh librecad-icons_icons_wed.svg

Hope this helps
Pere


>


exportsvglayers.sh (874 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

xnakos
Hi, guys! Just a quick question. Is it not possible to directly use the svg format in LibreCAD? I believe QT4 has this capability. What do the devs say? It would be much cleaner and more versatile.
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

dxli
I'm not clear on this as well.

First, how to use svg icons? as you are asking here.

Second, we need native svg file format support so we can save and open drawings in svg. Someone has started this investigation, but we don't have any implementation yet. Let's hope native svg support can be in 2.1

Finally, keep Qt5 in mind as well as Qt4.

xnakos wrote
Hi, guys! Just a quick question. Is it not possible to directly use the svg format in LibreCAD? I believe QT4 has this capability. What do the devs say? It would be much cleaner and more versatile.
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

xnakos
Using inkscape I created an svg. Page size 700px x 700px, i.e. square. I created a 3d cube inside the page and saved it as zoompan.svg in ./LibreCAD/librecad/res/actions/

I had a fresh LibreCAD copy just cloned from github. I went on and changed those two files in these positions:

./LibreCAD/librecad/src/actions/rs_actionzoompan.cpp:        action->setIcon(QIcon(":/actions/zoompan.png"));
./LibreCAD/librecad/res/actions/actions.qrc:<file>zoompan.png</file>

and turned zoompan.png into zoompan.svg in both files.

I compiled and launched LibreCAD after that. The 3d cube was used as the icon. Simple as that!

edit: I also created two more layers with more stuff over the 3d cube. After running make, everything appeared fine again!
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

dxli
wed is making all icons into one big svg, so it's easier to maintain.

the svg must contain all png file names (and the paths), so all the png files can be generated automatically.

We need this for easier maintenance in long run, and to avoid human errors.

In the mean time, setting up this task can clean up leftover png files in the source tree.
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

dxli
then, Qt's QIcon class can read svg file directly.

we still need a way to auto generate individual svg files for each icon here, given a big svg file which contains all icons.
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

xnakos
I think a quick way to go is this. SVG is a text file actually. Open it with a text editor and you can see the organization of groups (layers). It is actually XML. Even without fully parsing the XML, you can create a regular expression to match all stuff like

     id="layer104"
     inkscape:label="tool_redo"

This (id and name of image to be created) is all you need to call inkscape externally (as a shell command), as Rallaz suggested. Using a script of course. One way to deal with paths is to incorporate the path in the label. For instance, to have something like

     id="layer104"
     inkscape:label="$dir1$dir2$tool_redo"

("$dir1$dir2$tool_redo" is the layer name in inkscape in this case) $ could be the directory separator, which would mean that dir1/dir2/tool_redo.svg will be the SVG exported for that layer. All non-existing directories would be created. I guess that "/" could be used as the directory separator as well! ;) This approach would, of course, mean that if the directory structure changed, all names of layers under a changing directory should change. So, another approach would be to create dummy (empty) layers that would somehow encode the parent directory path of the following normal layers till another dummy layer comes. Let's say


     id="layer103"
     inkscape:label="$asdf$jkl"

     id="layer104"
     inkscape:label="tool_redo"

     id="layer105"
     inkscape:label="tool_foo"

could mean that asdf/jkl/tool_redo.svg and asdf/jkl/tool_foo.svg would be created. I like this approach better. I could also create a python script for you, if you wish. Although the task is really simple.
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

xnakos
Here is a python script that does most of the work.

explode.py

Usage: python explode.py <svg filename goes here>

For now, it creates a temp folder and puts all created svgs in it.

Using an external command was not needed (since we are not talking about conversion to png). More testing is welcome (the results seem fine, though). Don't worry about visibility of the layers in the original svg. It is handled in the script.
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

dxli
Thanks!

I should be able play with.
Reply | Threaded
Open this post in threaded view
|

Re: Icon sets

xnakos
I can provide a full solution tomorrow. What I suggest is this:

1. The "/" character is not used for normal layer names (I believe this holds now).

2. The default exporting directory is the current directory (override immediately to avoid that).

3. Overriding the exporting directory occurs using dummy layers in the huge svg in this way:

    ./    for using the current directory for exporting
    ./asdf/    for creating a directory asdf in the current directory and putting everything that follows, unless overriden, there
    ./asdf/zxcv/    for creating the directory structure and putting everything that follows, unless overriden, there

    ./asf/sdf/&./uidfh/sdfjhk/&./sdfhj/cuyud/ for inserting the stuff that follows into multiple directories (for redundancy fans)

Tell me what you think. I tested using python 2.7.3 and the first inkscape svg given in this thread. I also took a random svg and tried it with LibreCAD, built it and it worked fine as an icon.

Known issue: Thumbnails are not working when viewing the svgs in gnome. But there is a solution. Open the svg as a text file and replace all occurences of "ns0:" with "" (nothing) (without the quotes). Of course, this can be fixed very easily using the script too.

Have in mind that the layers in the svg are stored in reverse, that is the layer at the bottom (when viewing it in inkscape) is the first layer (group element) that appears in the svg/xml file.
12