Poser's Scripts menu as a panel (for Poser 8 and later).
It allows running Python scripts via double click, refreshing of the whole menu or only folders and to copy the path of the script to the clipboard (right click for context menu!)
??
I tried this but I get the attached.
Which is wierd since I haven't a folder with such scripts......
Sorry, the script took the content's root location not that of the application. I updated the script :-)
Thanks for letting me know.
Ah, I see, I had not realized (or perhaps I forgot:-)) that I had placed Python scripts in the external runtime; now it works.
Still, maybe it would be good if it would pick up from both locations?
Quote from: doppelganger on January 11, 2010, 06:19:28 PM
Ah, I see, I had not realized (or perhaps I forgot:-)) that I had placed Python scripts in the external runtime; now it works.
Still, maybe it would be good if it would pick up from both locations?
Well, it'd have to check all libraries then ;-)
You'd probably want just one tree for all scripts?
So "somewhere\Runtime\Python\poserScripts\ScriptsMenu\test\x.py"
and "elsewhere\Runtime\Python\poserScripts\ScriptsMenu\test\y.py" are both displayed in folder "test" in the palette?
Often you will get some package that includes some Python script(s) as part of its runtime and the read me will point out (if you read it) that the python bits need to be moved to the main folder even if you have extracted to an external runtime (most people I would have thought and probably two or more).
Which is sort of a nuisance, you have to remember and to back it up etc.
I agree the tree should be the same (and will be packaged that way usually), I guess you just want a sinple way to specify/add external runtimes to the panel.
Maybe this does it for you. It can check all added Poser libraries for Script menus and add those, too, if the option "Show Lib's Menus" is checked.
I tried it and got this:
Traceback (most recent call last):
File "C:\Program Files\Smith Micro\Poser 8\Runtime\Python\poserScripts\ScriptsMenu\ScriptsMenu\ScriptsMenu.py", line 197, in ?
win = ScriptsWindow(root, name, pane)
File "C:\Program Files\Smith Micro\Poser 8\Runtime\Python\poserScripts\ScriptsMenu\ScriptsMenu\ScriptsMenu.py", line 39, in __init__
self.BuildTree()
File "C:\Program Files\Smith Micro\Poser 8\Runtime\Python\poserScripts\ScriptsMenu\ScriptsMenu\ScriptsMenu.py", line 63, in BuildTree
if self.settings["CheckContentDirs"]:
KeyError: 'CheckContentDirs'
Sorry, there were too tabs too many. Please try the attached version.
That loads up OK and is picking up "P8" external runtime and Poser7/PoserPro runtime ie
F:\Runtimes\P8\Runtime\Python\poserScripts\
or
C:\Program Files\Smith Micro\Poser 7\Runtime\Python\poserScripts\
or
C:\Program Files\Smith Micro\Poser Pro\Runtime\Python\poserScripts
But not eg "F:\Runtimes\Jessi\Runtime\Python\poserScripts" (which contains just 3 scripts that came with a product).
However this doesn't matter as I will now just centralize all my scripts in the P8 external (ie as long as they don't have to be on the C drive).
Quote from: doppelganger on January 14, 2010, 07:11:28 PM
But not eg "F:\Runtimes\Jessi\Runtime\Python\poserScripts" (which contains just 3 scripts that came with a product).
That's because it starts at the Scriptsmenu folder. But you can edit the script to start at poserScripts, if you want.
Just search for "'poserScripts', 'ScriptsMenu'" (without ") and remove the ", 'ScriptsMenu'".
Yes that suits me very well, much cleaner than fiddling with the existing palette or ploughing through the dialog and I can put the scripts where I like now (subject to the tree structure).
Think there are a couple of oddballs like the WardrobeWizard (where you execute a script which then autoloads the existing Python palette) so have to use existing procedure for those.
Nice job, thanks very much.
Love the script but I think I've run into a problem. From reading through the script, it appears that it's supposed to save layout information but no layout is being saved here. I'm on XP-64.
I solved the issue.
On initial run, the directory "acb" doesn't exist in Poser's preferences folder (found via poser.PrefsLocation()) and I get an exception error during the pickle dump. For testing, I set up the script to tell me when there's an exception.
It looks like my OS isn't allowing the script to create the acb folder, so I fixed it by doing this at line 14:
savePath=os.path.join(poser.PrefsLocation(), "acb")
if not os.path.exists(savePath):
os.makedirs(savePath)
Heya, I made some minor modifications to the ScriptsMenu, mostly visual changes. The script does say "Feel free to redistribute" but can I redistribute a modified version? Completely free, of course :)
Visual Modifications:
- Background colour to match that of the standard poser panels
- Folders have light gold text and slightly darker background colour
- Listed scripts have white text and lighter background colour
- Extension of scripts is hidden (.py and .pyc)
- Border is hidden when docked.
I'm toying with some other options but I'm VERY MUCH a learner when it comes to the wxPython system at this moment
As there's really not much magic to the script, feel free to distribute your adjusted version.
I just added the missing save path creation myself.
Quote from: Dizzi on April 04, 2010, 09:40:36 AM
As there's really not much magic to the script, feel free to distribute your adjusted version.
I just added the missing save path creation myself.
Awesome! Thanks so much.
I really appreciate that you've been sharing the wxpython scripts that you've put together. Not only have they been neat ideas, but it gives me a chance to learn some things. I've been wanting to convert my utilities from Tkinter to something like wxpython so that it can be integrated better with poser. There is a LOT of information out there for wxpython but sometimes you really have to dig for it and the python wiki reads like stereo instructions to me. I learn much better from working examples that I can break and curse at. :D
I just added a menu item to the scriptsmenu so that you can right-click and edit the python script if it has a .py extension (I guess more-so for script developers/tweakers). However, right now it is simply using "os.startfile" and would only work properly if you have associated .py with a text editor. This would probably cause problems in general (plus I am not sure if this would work on a mac) so I may just set up a way to define a default text editor and open a script with that (using the poser file dialog to browse to a text editor and then save that path in a separate configuration file).
Okay, I have a download available on my site.
http://netherworks-studios.com/blog1.php/2010/04/05/scriptsmenu-panel (http://netherworks-studios.com/blog1.php/2010/04/05/scriptsmenu-panel)
+ Purpose +
To replicate Poser's Scripts Menu in a floating/dockable panel and to provide some additional functions when working with python scripts.
+ Appearance +
In an attempt at a more seamless integration with Poser's existing panels, there is no docked border and background colour is set to that of other panels. Folder color is darker with yellow text. Script color is lighter with white text. The .py and .pyc extensions are hidden to match the scripts menu.
+ Note +
This script is based on Dizzi's v1.1 work. I did not include the "Show Lib's Menus" function as I feel that the panel should replicate only what is available on the Poser Scripts "Menu". It's simply a consistancy ideal.
+ Usage +
Simply double-click to run a script or open a folder. The plus boxes on the left side can also be used to expand or collapse folders.
A menu is available via right-click.
Copy path to the clipboard (original) - works with files and folders
Refresh Folder and Tree (original) - you can refresh the individual folders or tree if you have made changes outside of Poser.
Browse with Explorer (new) - windows users can browse script folders in Window's Explorer. Similar functionality is implemented for mac users (untested).
Collapse All (new) - Collapses all expanded folders.
Edit Script (new) - scripts with a .py extension can be edited with your file editor of choice. File editor is defined by using "Set Python Editor", which allows you to browse to an .exe or .app installed on your system. The script remembers which editor you have set between poser sessions.
Comments and suggestions are always welcome!