# Path: mGui/gui.py
# def _collect_mappings():
# def wrap(control, replace_events=False):
# def derive(control):


import os
from maya import cmds
from mGui import gui
        # initializes all the shelves
        if parent.selectTab:
            current_tab = parent.selectTab
            for child in parent.childArray:
                parent.selectTab = child

            parent.selectTab = current_tab

        for shelf in parent.controls:
            if shelf.key == self.key:
                break
        else:
            with parent.as_parent():
                shelf = self.proxy(self.key)
    
                # Needed so that we don't throw a weird maya error until the next restart.
                # Pulled this from the shelf editor mel script.
                if parent == 'ShelfLayout':
                    cmds.optionVar(stringValue=('shelfName{}'.format(parent.numberOfChildren), self.key))
                    cmds.optionVar(intValue=('shelfLoad{}'.format(parent.numberOfChildren), True))
                    cmds.optionVar(stringValue=('shelfFile{}'.format(parent.numberOfChildren), ''))

        for ctrl in self.controls:
            ctrl.instantiate(shelf)

        cmds.saveAllShelves(parent)



class ShelfButtonProxy(BaseLoader):

# Path: mGui/gui.py
# def _collect_mappings():
# def wrap(control, replace_events=False):
# def derive(control):


# Path: mGui/shelf_loader.py
import os
from maya import cmds
from mGui import gui

        # initializes all the shelves
        if parent.selectTab:
            current_tab = parent.selectTab
            for child in parent.childArray:
                parent.selectTab = child

            parent.selectTab = current_tab

        for shelf in parent.controls:
            if shelf.key == self.key:
                break
        else:
            with parent.as_parent():
                shelf = self.proxy(self.key)
    
                # Needed so that we don't throw a weird maya error until the next restart.
                # Pulled this from the shelf editor mel script.
                if parent == 'ShelfLayout':
                    cmds.optionVar(stringValue=('shelfName{}'.format(parent.numberOfChildren), self.key))
                    cmds.optionVar(intValue=('shelfLoad{}'.format(parent.numberOfChildren), True))
                    cmds.optionVar(stringValue=('shelfFile{}'.format(parent.numberOfChildren), ''))

        for ctrl in self.controls:
            ctrl.instantiate(shelf)

        cmds.saveAllShelves(parent)



class ShelfButtonProxy(BaseLoader):

    proxy = gui.ShelfButton