Extensions update

Bug #278423 reported by inductiveload
4
Affects Status Importance Assigned to Milestone
Inkscape
Triaged
Wishlist
Alexandre Prokoudine

Bug Description

I have written two new extensions ("Draw from Triangle" and "Sequential Labels") and updated a third ("3D Polyhedron")

The "Draw from Triangle" extension takes a triangle drawn as a path (only the first three nodes of a path are counted) and allows you to draw on many triangle-related geometrical objects such as circumcircles, excentral triangles, etc. It also allows entry of custom trilinear coordinated and triangle centre functions, as well as computation of basic triangle properties such as area and semiperimeter.

The "Sequential Label" extension allows you to draw a series of text labels (i.e. 1,2,3 or a,b,c or A,B,C or i,ii,ii,iv or I, II, III, IV) along with a decorative outline (circle, rectangle, star, polygon). A custom rule can be used for the sequence, and the starting point is variable. Also, the decorations can be made such that every decoration is just a clone of the first, allowing quick changes to appearances. One can choose to put each label and decoration in a separate subgroup.

The changes to "3D Polyhedron" are mostly to improve readability of the (hastily and untidily written). No new functionality is introduced at this stage.

The changes are included in the attached SVN patch.

Revision history for this message
inductiveload (inductiveload) wrote :
Revision history for this message
Alexandre Prokoudine (alexandre-prokoudine) wrote :

Grabbing your patch to test

Changed in inkscape:
assignee: nobody → alexandre-prokoudine
importance: Undecided → Medium
milestone: none → 0.47
Revision history for this message
Alexandre Prokoudine (alexandre-prokoudine) wrote :

Well, I think "Draw from Triangle" really should be a set of LPEs.

And "Sequential Label" does not show up for me in Render menu (neither in any other menu).

I will apply tha patch for "3D Polyhedron" shortly.

Revision history for this message
inductiveload (inductiveload) wrote :

I'm not too sure how to implement LPEs, but I will look into it.

As for the Sequential Labels, it shows up for me just fine. Maybe the version in the patch is old, but I'm fairly sure that I stopped working on it once I made that patch. Anyway, the version that works for me is attached.

Revision history for this message
inductiveload (inductiveload) wrote :
Revision history for this message
Alexandre Prokoudine (alexandre-prokoudine) wrote :

Yes, the new version of the render labels extensions works for me now. Which would be the right way to add letters from other alphabets (e.g. Cyrillic based)?

Revision history for this message
Alexandre Prokoudine (alexandre-prokoudine) wrote :

With "Regular Polygon":

Traceback (most recent call last):
  File "/usr/share/inkscape/extensions/render_sequential_labels.py", line 329, in <module>
    e.affect()
  File "/usr/share/inkscape/extensions/inkex.py", line 172, in affect
    self.effect()
  File "/usr/share/inkscape/extensions/render_sequential_labels.py", line 316, in effect
    draw_decoration(so, dec_pos, st, group)
  File "/usr/share/inkscape/extensions/render_sequential_labels.py", line 181, in draw_decoration
    draw_SVG_poly_star(options, position, st, 'PolygonDec', parent, id)
  File "/usr/share/inkscape/extensions/render_sequential_labels.py", line 75, in draw_SVG_poly_star
    poly = inkex.etree.SubElement(parent, inkex.addNS('path','svg'), poly_attribs )
  File "lxml.etree.pyx", line 2342, in lxml.etree.SubElement (src/lxml/lxml.etree.c:21249)
  File "apihelpers.pxi", line 174, in lxml.etree._makeSubElement (src/lxml/lxml.etree.c:27048)
  File "apihelpers.pxi", line 246, in lxml.etree._initNodeAttributes (src/lxml/lxml.etree.c:27760)
  File "apihelpers.pxi", line 1323, in lxml.etree._attributeValidOrRaise (src/lxml/lxml.etree.c:36387)
ValueError: Invalid attribute name u'sodipodi:type'

With "Star":

Traceback (most recent call last):
  File "/usr/share/inkscape/extensions/render_sequential_labels.py", line 329, in <module>
    e.affect()
  File "/usr/share/inkscape/extensions/inkex.py", line 172, in affect
    self.effect()
  File "/usr/share/inkscape/extensions/render_sequential_labels.py", line 316, in effect
    draw_decoration(so, dec_pos, st, group)
  File "/usr/share/inkscape/extensions/render_sequential_labels.py", line 183, in draw_decoration
    draw_SVG_poly_star(options, position, st, 'StarDec', parent, id)
  File "/usr/share/inkscape/extensions/render_sequential_labels.py", line 75, in draw_SVG_poly_star
    poly = inkex.etree.SubElement(parent, inkex.addNS('path','svg'), poly_attribs )
  File "lxml.etree.pyx", line 2342, in lxml.etree.SubElement (src/lxml/lxml.etree.c:21249)
  File "apihelpers.pxi", line 174, in lxml.etree._makeSubElement (src/lxml/lxml.etree.c:27048)
  File "apihelpers.pxi", line 246, in lxml.etree._initNodeAttributes (src/lxml/lxml.etree.c:27760)
  File "apihelpers.pxi", line 1323, in lxml.etree._attributeValidOrRaise (src/lxml/lxml.etree.c:36387)
ValueError: Invalid attribute name u'sodipodi:type'

Revision history for this message
Alexandre Prokoudine (alexandre-prokoudine) wrote :

Updated "Polyhedron 3D" is now in SVN. I think I will also commit "Draw from Triangle", but please fix "Sequential Labels" before we can commit it as well.

Revision history for this message
Alexandre Prokoudine (alexandre-prokoudine) wrote :

"Draw from triangle" added to SVN

Revision history for this message
inductiveload (inductiveload) wrote :

Fixed the "Sequential Labels". This error was due to a change to the LXML parser, which no longer accepts colons in the XML describing the shape.

Also added support for arbitrary Unicode alphabets. I have already included upper and lowercase Cyrillic and Greek, and Hebrew. To add more, simply add an entry in the .inx file for that alphabet, and add a corresponding alphabet in the .py script under "set_alphabet()". Everything else, including length, is handled automatically.

Revision history for this message
inductiveload (inductiveload) wrote :
Changed in inkscape:
status: New → In Progress
Revision history for this message
inductiveload (inductiveload) wrote :

I've cleaned up the Sequential Labels code a bit, and added Chinese number formats, as well as Cyrillic, Hebrew and Greek from before.

The Roman numerals, Chinese numerals and alphabetical (a,b,c,...,aa,ab..) numerals are now in their own modules for clarity (and can then be used by others if they want).

Revision history for this message
uwesch (uwesch) wrote :

I get an error message in inkscape rev 21773

--------------------------------

Traceback (most recent call last):

  File "c:\Download\Inkscape21773-10072009\inkscape\share\extensions\polyhedron_3d.py", line 516, in <module>

    e.affect()

  File "c:\Download\Inkscape21773-10072009\inkscape\share\extensions\inkex.py", line 198, in affect

    self.effect()

  File "c:\Download\Inkscape21773-10072009\inkscape\share\extensions\polyhedron_3d.py", line 451, in effect

    obj.set_type(so)#set the type (face or edge) as per the settings

  File "c:\Download\Inkscape21773-10072009\inkscape\share\extensions\polyhedron_3d.py", line 335, in set_type

    inkex.errormsg(_('No edge data found in specified file\n'))

NameError: global name '_' is not defined

--------------------------------
i created a rectangle and used the effect. In the attachement are the setings for the effect

Revision history for this message
inductiveload (inductiveload) wrote :

Well there are two problems here. The first is that the following text needs to be added where Python modules are declared to allow for the internationalisation thing to work. I am away from home for a few months, so if someone can just insert this it will be great as I don't have my computer to do it with.

import gettext
_ = gettext.gettext

The extension was trying to give an error message - it would seem that the .obj file you're trying to feed to the extension doesn't contain edge data. You need to select the model as "face-specified", as opposed to "edge-specified".

Perhaps to reduce confusion, change line 335 to

inkex.errormsg(_('No edge data found in specified file\n'))
inkex.errormsg(_('Try selecting "Face Specified" in the Model File tab\n'))

and line 329 to

inkex.errormsg(_('No face data found in specified file\n'))
inkex.errormsg(_('Try selecting "Edge Specified" in the Model File tab\n'))

I'm not quite sure what you created the rectangle for. The extension will generate everything itself - it doesn't need a rectangle to act on.

Revision history for this message
su_v (suv-lp) wrote :

browsing the online SVN tree, it looks like the changes of rev. 18714:
  share/extensions/*.py: Use gettext for (many) error messages.
  share/extensions/inkex.py: (errormsg): New function.

got lost with rev. 20241:
  From trunk

diff: <http://inkscape.svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/extensions/polyhedron_3d.py?r1=20240&r2=20241>

Revision history for this message
Alvin Penner (apenner) wrote :

thanks inductiveload, changes committed to rev 21842

Revision history for this message
su_v (suv-lp) wrote :

fix confirmed with Inkscape 0.47pre1 on OS X 10.5.7 using polyhedron_3d.py (rev. 21842)
thanks Alvin & inductiveload!

tags: added: extensions-plugins
removed: extensions
Revision history for this message
inductiveload (inductiveload) wrote :

Hi Prokoudine? I was wondering if the improvement to the Sequential Labels extension was OK. If it is, perhaps it could be included at some point?

There is support for multiple alphabets (already has Russian, Greek and Hebrew, and it is easily extended), as well as separate .py modules for different numeral schemes (currently have Chinese and Roman numerals).

Revision history for this message
inductiveload (inductiveload) wrote :

Nevermind, it's in 0.47pre4, I just didn't notice it! Sorry about that. Should this bug then be tagged as "Fix Released" or something, as all the parts have been dealt with now?

Revision history for this message
su_v (suv-lp) wrote :

> Nevermind, it's in 0.47pre4
No (t yet) - I can't find 'render_sequential_labels.py' in the SVN repository <http://inkscape.svn.sourceforge.net/viewvc/inkscape/inkscape/trunk/share/extensions/> nor in the 0.47pre4 package for OS X. Could it be that it's in your local install only?

Revision history for this message
inductiveload (inductiveload) wrote :

Yes, ~suv, you're right! I had no idea Inkscape would keep extensions in that folder even when I install over the directory. In that case, could it be included at some point? It's been a year since I posted the last revision, and I think it is a relatively useful extension. Thanks.

Revision history for this message
su_v (suv-lp) wrote :

> would keep extensions in that folder even when I install over the directory
<http://thread.gmane.org/gmane.comp.graphics.inkscape.devel/31010>?

> could it be included at some point?
I don't have SVN access nor do I know if it would go in for 0.47 despite feature freeze. All I could do at the moment is test it with a current build from SVN on OS X and report back if there are any new issue since the last tests done in 2008-10-12.

If it doesn't make it in time for 0.47 you might consider adding it to the list in the Inkscape Extensions repository <http://wiki.inkscape.org/wiki/index.php/Extension_repository> and either link to comment #12 (which has 'seqLabels.rar' attached) or put it on a intermediary hosting site (e.g. like the 'Place Objects on Path' extension that was recently added to the list there…).

The same goes for the two most recent extensions you announced in bug #461964 and bug #465571. I am sure all users who followed the topic about creating a sphere in the InkscapeForum <http://www.inkscapeforum.com/viewtopic.php?f=6&t=3684> would be delighted about the Wireframe spheres extension!

Revision history for this message
su_v (suv-lp) wrote :

a) I am not a font expert - Question: this requires adequate fonts installed, and works well for me [1] for all preset alphabets because the default font proposed in the extension (DejaVue Sans) includes the necessary unicode characters? Maybe a note (especially for win32 users) where to get DejaVue (AFAIK it's not among the default fonts installed on win32 - see the discussion in bug #424223) and a link to its website <http://dejavu-fonts.org/wiki/index.php?title=Main_Page> could be helpful.

b) Another very useful enhancement could be a 'reset' button, especially on the 'Decorations' tab, to start all over if one has made a mess of the settings while adjusting and fine-tuning the label and decoration positioning ;-).

c) So far I haven't encountered any glitches while testing with Inkscape 0.46+devel r22547 on OS X 10.5.8, using Python 2.6.2 (installed via MacPorts).

--
[1] OS X was pre-installed as "de_CH.utf-8", user locale/LANG is set to "en_US.utf-8".

Revision history for this message
su_v (suv-lp) wrote :

JFTR - the "DejaVue" font familiy is not part of the default (apple-supplied) system fonts on OS X Leopard either (i.e. requires the user to download and install it to the user font library).

Revision history for this message
Alexandre Prokoudine (alexandre-prokoudine) wrote :

@undictiveload

I'm sorry, but I'm afraid it's too late for Sequential Labels to be in 0.47. Let's merge it when development switches to 0.48, okay? Sorry for not having tried the update again before feature freeze.

Revision history for this message
inductiveload (inductiveload) wrote :

Hi, you are right, it's not a default font on Win32, but it's the one I use. You can replace that with any avaiable font on your system by typing in the name. If there is a font chooser menu for the extension dialogues, obviously that would be better. Feel free to replace with any font that is universally available.

As for the reset button, that's a good idea, but I don't think the extension dialogues have that feature (yet). I would say that it is a good idea for all extensions to have that feature.

Revision history for this message
inductiveload (inductiveload) wrote :

@Alexandre Prokoudine
That's fine, I'm in no hurry! You might want to check I have the Cyrillic alphabet in the right order and so on, as I don't know anything about it except what Google tells me!

ScislaC (scislac)
Changed in inkscape:
milestone: 0.47 → none
su_v (suv-lp)
Changed in inkscape:
milestone: none → 0.49
su_v (suv-lp)
Changed in inkscape:
milestone: 0.91 → none
Changed in inkscape:
status: In Progress → Triaged
Changed in inkscape:
importance: Medium → Wishlist
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.