theodox / mGui

Python module for cleaner maya GUI layout syntax
MIT License
123 stars 23 forks source link

Duplicate functions? #73

Closed theodox closed 7 years ago

theodox commented 7 years ago

so,,, which of these is the right one? Looks like a merge issue creating two versions of the same idea

    @classmethod
    def wrap(cls, control_name, key=None):

        def _spoof_create(*_, **__):
            return control_name

        try:
            cache_CMD = cls.CMD
            cls.CMD = _spoof_create
            return cls(key=control_name)

        finally:
            cls.CMD = cache_CMD

    @classmethod
    def from_existing(cls, key, widget):
        """
        Create an instance of <cls> from an existing widgets
        """

        def fake_init(self, *_, **__):
            return widget

        _cmd = cls.CMD

        try:
            cls.CMD = fake_init
            return cls(key)

        finally:
            cls.CMD = _cmd
bob-white commented 7 years ago

I've been meaning to ask that as well.

It looks like the only place that from_existing is being used is in the PanelFactory class. Otherwise wrap is being used all over the place.

theodox commented 7 years ago

That makes it easy, anyway :)

theodox commented 7 years ago

Adios