chef/cookbooks/cpe_nudge/files/nudge-python/resources/nibbler.py [89:131]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            d = buffer(f.read())
        n_obj = NSNib.alloc().initWithNibData_bundle_(d, None)
        placeholder_obj = NSObject.alloc().init()
        result, n = n_obj.instantiateWithOwner_topLevelObjects_(
            placeholder_obj, None)
        self.hidden = True
        self.nib_contents = n
        self.win = [
            x for x in self.nib_contents if x.className() == 'NSWindow'][0]
        self.views = views_dict(self.nib_contents)
        self._attached = []

    def attach(self, func, identifier_label):
        # look up the object with the identifer provided
        o = self.views[identifier_label]
        # get the classname of the object and handle appropriately
        o_class = o.className()
        if o_class == 'NSButton':
            # Wow, we actually know how to do this one
            temp = func_to_controller_selector(func)
            # hold onto it
            self._attached.append(temp)
            o.setTarget_(temp)
            # button.setAction_(objc.selector(controller.buttonClicked_,
            # signature='v@:'))
            o.setAction_(temp.doTheThing_)

    def run(self):
        if self.hidden:
            psn = ProcessSerialNumber(0, kCurrentProcess)
            ApplicationServices.TransformProcessType(
                psn, kProcessTransformToUIElementAppication)
        else:
            psn = ProcessSerialNumber(0, kCurrentProcess)
            ApplicationServices.TransformProcessType(
                psn, kProcessTransformToForegroundApplication)
        self.win.makeKeyAndOrderFront_(None)
        self.win.display()
        NSApp.activateIgnoringOtherApps_(True)
        NSApp.run()

    def quit(self):
        NSApplication.sharedApplication().terminate_(None)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



chef/cookbooks/cpe_umad/files/resources/py2_nibbler.py [114:156]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
            d = buffer(f.read())
        n_obj = NSNib.alloc().initWithNibData_bundle_(d, None)
        placeholder_obj = NSObject.alloc().init()
        result, n = n_obj.instantiateWithOwner_topLevelObjects_(
            placeholder_obj, None)
        self.hidden = True
        self.nib_contents = n
        self.win = [
            x for x in self.nib_contents if x.className() == 'NSWindow'][0]
        self.views = views_dict(self.nib_contents)
        self._attached = []

    def attach(self, func, identifier_label):
        # look up the object with the identifer provided
        o = self.views[identifier_label]
        # get the classname of the object and handle appropriately
        o_class = o.className()
        if o_class == 'NSButton':
            # Wow, we actually know how to do this one
            temp = func_to_controller_selector(func)
            # hold onto it
            self._attached.append(temp)
            o.setTarget_(temp)
            # button.setAction_(objc.selector(controller.buttonClicked_,
            # signature='v@:'))
            o.setAction_(temp.doTheThing_)

    def run(self):
        if self.hidden:
            psn = ProcessSerialNumber(0, kCurrentProcess)
            ApplicationServices.TransformProcessType(
                psn, kProcessTransformToUIElementAppication)
        else:
            psn = ProcessSerialNumber(0, kCurrentProcess)
            ApplicationServices.TransformProcessType(
                psn, kProcessTransformToForegroundApplication)
        self.win.makeKeyAndOrderFront_(None)
        self.win.display()
        NSApp.activateIgnoringOtherApps_(True)
        NSApp.run()

    def quit(self):
        NSApplication.sharedApplication().terminate_(None)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



