hi,
i think with the change from inkex.unittouu to Effect.unittouu in inkex.py (r12722) was a bug introduced (regression).
am i right that a user unit is equivalent to a pixel?
if yes, the actual implementation is converting to *something* but not to user units.
i think the code should look like this (or the method should be renamed to something other than *touu):
if u: try: return retval * self.uuconv[u.string[u.start():u.end()]] except KeyError: pass else: # default take document unit return retval * self.uuconv[self.getDocumentUnit()]
can somebody confirm this?
its also the same with uutounit, it should be:
def uutounit(self, val, unit): return val / self.uuconv[unit]
regards, TimeWaster
On 2013-11-17 17:45 +0100, TimeWaster wrote:
i think with the change from inkex.unittouu to Effect.unittouu in inkex.py (r12722) was a bug introduced (regression).
The context of revision 12722 http://bazaar.launchpad.net/~inkscape.dev/inkscape/trunk/revision/12722
is this regression (still open): - Bug #1240455 “trunk: extensions not compatible with recent unit/viewbox changes (rev >= 12554)” https://bugs.launchpad.net/inkscape/+bug/1240455
am i right that a user unit is equivalent to a pixel?
if yes, the actual implementation is converting to *something* but not to user units.
i think the code should look like this (or the method should be renamed to something other than *touu):
if u: try: return retval * self.uuconv[u.string[u.start():u.end()]] except KeyError: pass else: # default take document unit return retval * self.uuconv[self.getDocumentUnit()]
can somebody confirm this?
its also the same with uutounit, it should be:
def uutounit(self, val, unit): return val / self.uuconv[unit]
On 17-11-2013 17:45, TimeWaster wrote:
hi,
i think with the change from inkex.unittouu to Effect.unittouu in inkex.py (r12722) was a bug introduced (regression).
am i right that a user unit is equivalent to a pixel?
It's a little different. In the trunk version, we set the viewbox according to the user selected document unit, so that the SVG values are expressed in the document unit. The document unit == user unit, or what the extension should output. The uuconv table is really an internal conversion table, and should not be used by extensions. I do not know much about python. Perhaps we can simply make the uuconv table private, so no-one is going to use it outside of inkex.py.
regards, Johan
if yes, the actual implementation is converting to *something* but not to user units.
i think the code should look like this (or the method should be renamed to something other than *touu):
if u: try: return retval * self.uuconv[u.string[u.start():u.end()]] except KeyError: pass else: # default take document unit return retval * self.uuconv[self.getDocumentUnit()]
can somebody confirm this?
its also the same with uutounit, it should be:
def uutounit(self, val, unit): return val / self.uuconv[unit]
regards, TimeWaster
thanx for your explanation, understood and changed in my code.
but i have another problem:
the code of unittouu defaults to px when no uu was directly specified:
else: # default assume 'px' unit return retval / self.__uuconv[self.getDocumentUnit()]
so with a unit (e.g. "200mm") i get mm, without a unit (e.g. "200" when inkscape:document-units="mm") i get px.
this can't be right, can it?
regards, TimeWaster
On 17.11.2013 23:29, Johan Engelen wrote:
On 17-11-2013 17:45, TimeWaster wrote:
hi,
i think with the change from inkex.unittouu to Effect.unittouu in inkex.py (r12722) was a bug introduced (regression).
am i right that a user unit is equivalent to a pixel?
It's a little different. In the trunk version, we set the viewbox according to the user selected document unit, so that the SVG values are expressed in the document unit. The document unit == user unit, or what the extension should output. The uuconv table is really an internal conversion table, and should not be used by extensions. I do not know much about python. Perhaps we can simply make the uuconv table private, so no-one is going to use it outside of inkex.py.
regards, Johan
if yes, the actual implementation is converting to *something* but not to user units.
i think the code should look like this (or the method should be renamed to something other than *touu):
if u: try: return retval *
self.uuconv[u.string[u.start():u.end()]] except KeyError: pass else: # default take document unit return retval * self.uuconv[self.getDocumentUnit()]
can somebody confirm this?
its also the same with uutounit, it should be:
def uutounit(self, val, unit): return val / self.uuconv[unit]
regards, TimeWaster
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access Free app hosting. Or install the open source package on any LAMP server. Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native! http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clk... _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
On 18-11-2013 21:06, TimeWaster wrote:
thanx for your explanation, understood and changed in my code.
but i have another problem:
the code of unittouu defaults to px when no uu was directly specified:
else: # default assume 'px' unit return retval / self.__uuconv[self.getDocumentUnit()]
so with a unit (e.g. "200mm") i get mm, without a unit (e.g. "200" when inkscape:document-units="mm") i get px.
this can't be right, can it?
I find it confusing to say that it is giving back px. Instead, if no unit is specified, it will assume the input is in "px" units, and it will return the value in user units (document units). I made it so, because I thought that is how some extensions use unittouu. But I have not checked at all, and don't feel very strongly about it.
I can see that it makes sense to actually assume document units, if none are given. This enables easier input parsing: if the user does not specify a unit in an input box, it is fair to assume document units, and the same string can be passed to unittouu without special-casing the extension code.
Feel free to change it if you see that it improves the behavior of some effects (and does not deteriorate others).
Regards, Johan
regards, TimeWaster
On 17.11.2013 23:29, Johan Engelen wrote:
On 17-11-2013 17:45, TimeWaster wrote:
hi,
i think with the change from inkex.unittouu to Effect.unittouu in inkex.py (r12722) was a bug introduced (regression).
am i right that a user unit is equivalent to a pixel?
It's a little different. In the trunk version, we set the viewbox according to the user selected document unit, so that the SVG values are expressed in the document unit. The document unit == user unit, or what the extension should output. The uuconv table is really an internal conversion table, and should not be used by extensions. I do not know much about python. Perhaps we can simply make the uuconv table private, so no-one is going to use it outside of inkex.py.
regards, Johan
if yes, the actual implementation is converting to *something* but not to user units.
i think the code should look like this (or the method should be renamed to something other than *touu):
if u: try: return retval *
self.uuconv[u.string[u.start():u.end()]] except KeyError: pass else: # default take document unit return retval * self.uuconv[self.getDocumentUnit()]
can somebody confirm this?
its also the same with uutounit, it should be:
def uutounit(self, val, unit): return val / self.uuconv[unit]
regards, TimeWaster
DreamFactory - Open Source REST & JSON Services for HTML5 & Native Apps OAuth, Users, Roles, SQL, NoSQL, BLOB Storage and External API Access Free app hosting. Or install the open source package on any LAMP server. Sign up and see examples for AngularJS, jQuery, Sencha Touch and Native! http://pubads.g.doubleclick.net/gampad/clk?id=63469471&iu=/4140/ostg.clk... _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clk... _______________________________________________ Inkscape-devel mailing list Inkscape-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/inkscape-devel
participants (3)
-
Johan Engelen
-
su_v
-
TimeWaster