Couple of housekeeping questions ....

92 views
Skip to first unread message

md

unread,
Jul 28, 2014, 4:51:04 PM7/28/14
to python_in...@googlegroups.com
I have a couple general housekeeping questions for you guys ...

1. Where do you store your persistent application settings ?
2. How/Where do you check to see if a dialog you have wrapped in the Maya application exists so it does not create multiple instances ?

Thanks

M

Marcus Ottosson

unread,
Jul 28, 2014, 4:56:36 PM7/28/14
to python_in...@googlegroups.com


--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/7bb471e0-016e-45cf-a495-3af04d45a72d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Tony Barbieri

unread,
Jul 28, 2014, 5:07:18 PM7/28/14
to python_in...@googlegroups.com
I have been using QSettings but I don't think I'll continue to use them for all cases.  First off on Windows they are stored in the Registry which I'm not super pleased about.  I know there is an option to store them in an .ini file as well but I haven't investigated it.

The other issue is then the settings are tied to the Workstation, I'd prefer the settings are tied to the Show + Tool or if more granularity is required the Context + Tool.  I'd store them somewhere in the Show's file system hierarchy. 



For more options, visit https://groups.google.com/d/optout.



--
Tony

md

unread,
Jul 28, 2014, 5:50:25 PM7/28/14
to python_in...@googlegroups.com
omg


On Monday, July 28, 2014 4:56:36 PM UTC-4, Marcus Ottosson wrote:
On 28 July 2014 21:51, md <acco...@mdonovan.com> wrote:
I have a couple general housekeeping questions for you guys ...

1. Where do you store your persistent application settings ?
2. How/Where do you check to see if a dialog you have wrapped in the Maya application exists so it does not create multiple instances ?

Thanks

M

--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_maya+unsub...@googlegroups.com.



--
Marcus Ottosson
konstr...@gmail.com

Justin Israel

unread,
Jul 28, 2014, 6:05:13 PM7/28/14
to python_in...@googlegroups.com
Busted on cross-posting? :-)

@Tony, I also like QSettings since it handles a few things for you like platform-specific storage locations that can resolve from User -> System. You can actually pass a Format flag to the constructor to tell it to use INI (I do that do keep it consistent on OSX/Linux), and can pass names or even pre-constructed absolute paths, to control which config it sources. QSettings is nice because it is already thread safe and handles syncing for you. 

Some annoying downsides of QSettings is how it seemingly handles booleans and some other types when it stores. I've noticed it will store (at least in my version of PySide) a bool as a string, so I have to convert it to an int before storing it. In some cases I have found it easier to just use a normal yaml config. QSettings can at least tell you the target storage location of where it would store a conf on the given platform.




To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/c0c101c9-d9c0-4043-a824-b48ba2f769b7%40googlegroups.com.

Tony Barbieri

unread,
Jul 28, 2014, 6:08:02 PM7/28/14
to python_in...@googlegroups.com
Ah, thanks for the additional info, Justin!



For more options, visit https://groups.google.com/d/optout.



--
Tony

Marcus Ottosson

unread,
Jul 30, 2014, 2:14:58 AM7/30/14
to python_in...@googlegroups.com
Busted on cross-posting? :-)

Was this for me?



For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Justin Israel

unread,
Jul 30, 2014, 2:37:38 AM7/30/14
to python_in...@googlegroups.com
LOL, I totally misread that whole link. It looked so similar, that at a glance I thought it was a cross post! :-) 
Now I properly recognize it for what it is. Ignore me on that comment. 


Marcus Ottosson

unread,
Jul 30, 2014, 2:51:27 AM7/30/14
to python_in...@googlegroups.com
Ah! Got it, no it was just quite the coincidence. :)



For more options, visit https://groups.google.com/d/optout.



--
Marcus Ottosson
konstr...@gmail.com

Michael Donovan

unread,
Jul 30, 2014, 10:54:54 AM7/30/14
to python_in...@googlegroups.com
how about some answers ?? =) !


You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/z0cZGsK5X8g/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOA-BXOr6aYQxFGD1spXGZ0bY05AXCU3M8LkRbZ6LUOL_Q%40mail.gmail.com.

Justin Israel

unread,
Jul 30, 2014, 3:49:13 PM7/30/14
to python_in...@googlegroups.com

1. I either use QSettings which picks the proper place to store, or if the app is platform specific I just store a yaml file in the standard user config area of that platform.

2. You can save your application reference as an APP global var in your module, or as a private instance member of your class, so that you can check and reshow it. This will probably get reset if you use reload() on the module for any reason. So an alternative is to set a useful objectName on the window, and check the children of the Maya QMainWindow for an existing match of name and type.

Reply all
Reply to author
Forward
0 new messages