New Extension: restack z-order

Bug #182002 reported by Rob Antonishen
4
Affects Status Importance Assigned to Milestone
Inkscape
Fix Released
Wishlist
Alexandre Prokoudine

Bug Description

I have developed a new python extension to restack the selected objects' z-order, from left to right, top to bottom (or vice versa), specifying the base point for comparison (top, left, middle, etc.). Examples and files attached.

This extension requires this patch:
https://bugs.launchpad.net/inkscape/+bug/174701
providing the --query-all command line option.

Revision history for this message
Rob Antonishen (rob-antonishen) wrote :
Revision history for this message
Rob Antonishen (rob-antonishen) wrote :
Revision history for this message
Rob Antonishen (rob-antonishen) wrote :
Revision history for this message
Rob Antonishen (rob-antonishen) wrote :
Ryan Lerch (ryanlerch)
Changed in inkscape:
importance: Undecided → Wishlist
status: New → Confirmed
Revision history for this message
Rob Antonishen (rob-antonishen) wrote :

I have updated the extension to provide a fifth option, specifying an arbitrary angle.

Zip of extension files attached.

Revision history for this message
Rob Antonishen (rob-antonishen) wrote :

One more update to include two more options, radial outward and radial inward. These are relative to the geometric center of the selected shapes, not the average center.

Revision history for this message
Rob Antonishen (rob-antonishen) wrote :
Revision history for this message
Alexandre Prokoudine (alexandre-prokoudine) wrote :

Rob, commit 18354 adds your extension to SVN trunk, so Restack will be part of 0.47.

If you have any patches, feel free to send them :-)

I'd like to note though that I'm not keen of using "Modify Path" group. We'll sort it out eventually ;-)

Changed in inkscape:
assignee: nobody → alexandre-prokoudine
milestone: none → 0.47
status: Confirmed → Fix Released
Revision history for this message
Rob Antonishen (rob-antonishen) wrote : Re: [Bug 182002] Re: New Extension: restack z-order

Thanks -

I have tried to clarify the interface by splitting up the GUI from the
code, so I could have 3 INX files all calling the same py file and
manually providing a parameter in the inx so the py code knew which
was calling, but have not been able to get it working. I believe
there is a bugtracker request to have hidden parameters in the gui
form so it might have to wait for that.

When (and if) that is done, I would propose a new effect menu "Change
Z-Order" and have a number of sub-items there:
 - Directional restack (0-360 degrees)
 - Orthagonal restack (4 options, l-r, r-l, t-b and b-t. redundant to
the previous one, but clearer for some people)
 - Radial restack (2 options, inward and outward)
 - Reverse Z-Order (new - no options)
 - Randomize Z-Order (new - no options)
 - Rotate Z-Order (new- integer to specify +/- how many elements to
rotate in the stack)

I have the code finished for all of them, but the GUI was geting
really ugly with that many options, hence the desire to break them
out, and also why I never updated.

Thanks for your time.

-Rob A.

On Thu, Apr 17, 2008 at 11:21 AM, Alexandre Prokoudine
<email address hidden> wrote:
> Rob, commit 18354 adds your extension to SVN trunk, so Restack will be
> part of 0.47.
>
> If you have any patches, feel free to send them :-)
>
> I'd like to note though that I'm not keen of using "Modify Path" group.
> We'll sort it out eventually ;-)
>
> ** Changed in: inkscape
> Assignee: (unassigned) => Alexandre Prokoudine (alexandre-prokoudine)
> Status: Confirmed => Fix Released
> Target: None => 0.47
>
>
>
> --
> New Extension: restack z-order
> https://bugs.launchpad.net/bugs/182002
> You received this bug notification because you are a direct subscriber
> of the bug.
>

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

with respect to the transfer of data from multiple inx files to a single python file, have you tried to use a parameter of the type "description". This is not a hidden parameter but it is essentially read-only, which is close. For an example see measure.py. You would declare it in the different inx files as follows:

<param name="txthelp" type="description">label data here</param>

it would show up in the gui as a read-only label, and then you would need to transfer it to the python file using something like

    self.OptionParser.add_option("-x", "--txthelp", action="store", type="string", dest="Txthelp")

and then in python you would have access to it using the name "Txthelp".
It's been a while since I looked at this, but I could try to develop a working example if this looks interesting...

APP

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

Well, for now I change submenu to "Reorder". Feel free to submit new versions here or, if you already provided 2+ patches like that, we could give you SVN commit access (let us know what's your SourceForge username then). Thanks you for your contribution and have a nice day ;-)

Revision history for this message
Rob Antonishen (rob-antonishen) wrote :

Well - I tried it and it doesn't not appear to function. If I define
a default value in the option parser line, the value is the default.
If I do not provide a default, it has a value of None.

Reading the wiki is says:
For the sake of the UI there are also the following two parameters
that do not provide data to the extension but alter the user input
GUI.

    * description
    * notebook

so it might not work.

This wishlist item: https://bugs.launchpad.net/inkscape/+bug/171870
might fix the issue.

I guess I could write 4 completely separate extensions, but there
would be a fair bit of duplication in the python code.

Alternately, I could make all of the options in one interface, but it
got real ugly, real fast. I also considered using tabs, but the
active tab does not get passed either.

I do have a sourceforge account, but don't currently have svn access
(changed computers and not installed).

-Rob A>

On Thu, Apr 17, 2008 at 9:49 PM, Alvin Penner <email address hidden> wrote:
> with respect to the transfer of data from multiple inx files to a single
> python file, have you tried to use a parameter of the type
> "description". This is not a hidden parameter but it is essentially
> read-only, which is close. For an example see measure.py. You would
> declare it in the different inx files as follows:
>
> <param name="txthelp" type="description">label data here</param>
>
> it would show up in the gui as a read-only label, and then you would
> need to transfer it to the python file using something like
>
> self.OptionParser.add_option("-x", "--txthelp", action="store",
> type="string", dest="Txthelp")
>
> and then in python you would have access to it using the name "Txthelp".
> It's been a while since I looked at this, but I could try to develop a working example if this looks interesting...
>
> APP
>
>
>
> --
> New Extension: restack z-order
> https://bugs.launchpad.net/bugs/182002
> You received this bug notification because you are a direct subscriber
> of the bug.
>

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

Well, this is very embarrassing, but the description parameter didn't work for me either, I apologize for the confusion.
    I believe I got it confused with the notebook parameter. If you use a notebook parameter then each page has a title or name, and that name gets transmitted to the python file. Unfortunately that's not what you need.
   Anyways, sorry for the misdirection, I look forward to experimenting with the z-order.

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

   Decided to try to get some communication going using a notebook parameter, so here is an experimental version. This will show up on the Modify Path menu as two new items, Run Parent 1 & 2. The python file will just report an error message indicating its parent.
  Not very elegant, but thought I would send it anyways...

Revision history for this message
Rob Antonishen (rob-antonishen) wrote :

That works well. I'm incorporating it into this extension.

The only trick I found was having to add a
   self.options.tab = self.options.tab.strip('\'"')
at the start, as the name parameter cones through wrapped in double quotes.

-Rob A>

On Sat, Apr 19, 2008 at 9:04 AM, Alvin Penner wrote:
> Decided to try to get some communication going using a notebook parameter, so here is an experimental version. This will show up on the Modify Path menu as two new items, Run Parent 1 & 2. The python file will just report an error message indicating its parent.
> Not very elegant, but thought I would send it anyways...
>
> ** Attachment added: "C:\WINDOWS\Temp\parent.zip"
> http://launchpadlibrarian.net/13577148/C%3A%5CWINDOWS%5CTemp%5Cparent.zip
>
>
>
> --
> New Extension: restack z-order
> https://bugs.launchpad.net/bugs/182002
> You received this bug notification because you are a direct subscriber
> of the bug.
>

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.