On Fri, Mar 17, 2017 at 5:57 AM yann19 <[email protected]> wrote:
...

> At times, I will create a script called utils file if there are functions
> that are either used in the UI file/ shared across with other scripts for
> easy maintenance
>
> 1. In such cases, should the signals functions and the ui initialization
> be separated into 2 different files?
>

My opinion is that the consumer of the widget should wire up any signals it
cares about on those widgets, to slots it knows about. So if your UI is
composed of a bunch of internal widgets which are not part of the public
interface then it should connect those up itself. Then the UI can expose
its own top level signals for things that a consume of that UI class should
have access to.

In another class consuming the UI, it would make use of the top level
signals or signals of any of the documented public child widgets of the
class.



>
> 2. If there are several classes within a script file in which it can make
> debugging un-manageable, while I think it will be better to break up these
> classes
> into separate files, is it wise to do so? If so, what are some of the
> procedures to take note of?
>

A module should consist of logic that shares the same purpose. If all of
the content in that file, which shares the same purpose, makes the file
larger than you feel is manageable, then an option is to turn the single
file module into a package, and split the content into modules of that
package.

So if you have something like:

database.py

And the User and Project content within that module become too large. You
can split it into something like this:

database/
    __init__.py
    user.py
    project.py

And you could even import those two modules into your __init__.py so that
the database package behaves like it did before.

Justin

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0Dh0%2BSh79gmg_vHK0dVHzwUWJEzEonjshiQrB3hmVMcw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to