Forum: Poser Python Scripting


Subject: wxPython remember dock location

3doutlaw opened this issue on Jun 26, 2013 · 11 posts


semidieu posted Sun, 30 June 2013 at 2:12 PM

With Poser 9+, this is working if you use the new 'addons' system.

If you don't use the addons system, I was able to make it work to something similar to what PhilC did.

 

Saving dock info:

  1. Read the pane settings.

  2. Save it in a .ini file.

 

Restoring dock info:

  1. Read the .ini file.

  2. Create the pane with the settings from the .ini file.

 

 

There are some strange things happening... And the position must be adjusted...

When I load a new pange, I'm using a function that read the ini file, the the position (xp, yp), the size (xs, ys), the dock/float status (DOCK), the various docking information (D - Direction, L - layer, P - position and R - row) and the dockable/floatable status.

Getting the docking information:

pane.dock_direction,pane.dock_layer,pane.dock_pos,pane.dock_rowThen to restore the settings, I read the ini file and get the informations:

(xp,yp,xs,ys,DOCK, D, L, P, R, DOCKABLE) =
SWPC_SizeAndPosInstances()

Finally, I'm loading all using this:

if DOCK:<br></br>
  pane.Dock()<br></br>
else:<br></br>
  pane.Float()<br></br>
pane.Dockable(DOCKABLE)<br></br>
pane.Floatable(DOCKABLE)<br></br>
pane.Caption(name).CaptionVisible()<br></br>
pane.Resizable()<br></br>
pane.Direction(D).Layer(L).Position(P-1).Row(R)<br></br>
pane.FloatingSize(wx.Size(xs-16, ys-34))<br></br>
pane.FloatingPosition(wx.Point(xp+8, yp+26))<br></br>
pane.BestSize(wx.Size(100,100))<br></br>
pane.MinSize(wx.Size(100,100))<br></br>
pane.CloseButton(True)<br></br>
pane.MinimizeButton(True)<br></br>
pane.DestroyOnClose(True)

Notice the Position(P-1) which adjust the docking position - don't know why it's necessary but this was working for me.

 

 

Now... this is an old code and certainly might be better :) Last thing, don't forget the addons if you're developing for the latest version of Poser. It's much better and offers other nice uses :)