Beispiel #1
0
  def run(self, args, options):
    def setBorder(layer, width, color, colorClass):
      fb.evaluateEffect('[%s setBorderWidth:(CGFloat)%s]' % (layer, width))
      fb.evaluateEffect('[%s setBorderColor:(CGColorRef)[(id)[%s %sColor] CGColor]]' % (layer, colorClass, color))

    obj = fb.evaluateInputExpression(args[0])
    depth = int(options.depth)
    isMac = runtimeHelpers.isMacintoshArch()
    color = options.color
    assert color in self.colors, "Color must be one of the following: {}".format(" ".join(self.colors))
    colorClassName = 'UIColor'
    if isMac:
      colorClassName = 'NSColor'

    if viewHelpers.isView(obj):
      prevLevel = 0
      for view, level in viewHelpers.subviewsOfView(obj):
        if level > depth:
           break
        if prevLevel != level:
          color = self.nextColorAfterColor(color)
          prevLevel = level
        layer = viewHelpers.convertToLayer(view)
        setBorder(layer, options.width, color, colorClassName)
    else:
      # `obj` is not a view, make sure recursive bordering is not requested
      assert depth <= 0, "Recursive bordering is only supported for UIViews or NSViews"
      layer = viewHelpers.convertToLayer(obj)
      setBorder(layer, options.width, color, colorClassName)

    lldb.debugger.HandleCommand('caflush')
    def run(self, arguments, options):
        maxDepth = int(options.depth)
        isMac = runtimeHelpers.isMacintoshArch()

        if arguments[0] == "__keyWindow_dynamic__":
            arguments[0] = "(id)[[UIApplication sharedApplication] keyWindow]"

            if isMac:
                arguments[0] = "(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:0] contentView]"

        if options.upwards:
            view = arguments[0]
            description = viewHelpers.upwardsRecursiveDescription(view, maxDepth)
            if description:
                print description
            else:
                print "Failed to walk view hierarchy. Make sure you pass a view, not any other kind of object or expression."
        else:
            printingMethod = "recursiveDescription"
            if isMac:
                printingMethod = "_subtreeDescription"

            description = fb.evaluateExpressionValue(
                "(id)[" + arguments[0] + " " + printingMethod + "]"
            ).GetObjectDescription()
            if maxDepth > 0:
                separator = re.escape("   | ")
                prefixToRemove = separator * maxDepth + " "
                description += "\n"
                description = re.sub(r"%s.*\n" % (prefixToRemove), r"", description)
            print description
def _recursiveViewControllerDescriptionWithPrefixAndChildPrefix(
        vc, string, prefix, childPrefix):
    isMac = runtimeHelpers.isMacintoshArch()

    s = "%s%s%s\n" % (
        prefix,
        "" if prefix == "" else " ",
        _viewControllerDescription(vc),
    )

    nextPrefix = childPrefix + "   |"

    numChildViewControllers = fb.evaluateIntegerExpression(
        "(int)[(id)[%s childViewControllers] count]" % (vc))

    for i in range(0, numChildViewControllers):
        viewController = fb.evaluateExpression(
            "(id)[(id)[%s childViewControllers] objectAtIndex:%d]" % (vc, i))
        s += _recursiveViewControllerDescriptionWithPrefixAndChildPrefix(
            viewController, string, nextPrefix, nextPrefix)

    if not isMac:
        isModal = fb.evaluateBooleanExpression(
            "%s != nil && ((id)[(id)[(id)%s presentedViewController] presentingViewController]) == %s"  # noqa B950
            % (vc, vc, vc))

        if isModal:
            modalVC = fb.evaluateObjectExpression(
                "(id)[(id)%s presentedViewController]" % (vc))
            s += _recursiveViewControllerDescriptionWithPrefixAndChildPrefix(
                modalVC, string, childPrefix + "  *M", nextPrefix)
            s += "\n// '*M' means the view controller is presented modally."

    return string + s
Beispiel #4
0
    def run(self, args, options):
        def setBorder(layer, width, color, colorClass):
            fb.evaluateEffect('[%s setBorderWidth:(CGFloat)%s]' %
                              (layer, width))
            fb.evaluateEffect(
                '[%s setBorderColor:(CGColorRef)[(id)[%s %sColor] CGColor]]' %
                (layer, colorClass, color))

        obj = fb.evaluateInputExpression(args[0])
        depth = int(options.depth)
        isMac = runtimeHelpers.isMacintoshArch()
        color = options.color
        assert color in self.colors, "Color must be one of the following: {}".format(
            " ".join(self.colors))
        colorClassName = 'UIColor'
        if isMac:
            colorClassName = 'NSColor'

        if viewHelpers.isView(obj):
            prevLevel = 0
            for view, level in viewHelpers.subviewsOfView(obj):
                if level > depth:
                    break
                if prevLevel != level:
                    color = self.nextColorAfterColor(color)
                    prevLevel = level
                layer = viewHelpers.convertToLayer(view)
                setBorder(layer, options.width, color, colorClassName)
        else:
            # `obj` is not a view, make sure recursive bordering is not requested
            assert depth <= 0, "Recursive bordering is only supported for UIViews or NSViews"
            layer = viewHelpers.convertToLayer(obj)
            setBorder(layer, options.width, color, colorClassName)

        lldb.debugger.HandleCommand('caflush')
Beispiel #5
0
  def run(self, arguments, options):
    maxDepth = int(options.depth)
    isMac = runtimeHelpers.isMacintoshArch()

    if arguments[0] == '__keyWindow_dynamic__':
      arguments[0] = '(id)[[UIApplication sharedApplication] keyWindow]'

      if isMac:
        arguments[0] = '(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:0] contentView]'

    if options.upwards:
      view = arguments[0]
      description = viewHelpers.upwardsRecursiveDescription(view, maxDepth)
      if description:
        print(description)
      else:
        print('Failed to walk view hierarchy. Make sure you pass a view, not any other kind of object or expression.')
    else:
      printingMethod = 'recursiveDescription'
      if isMac:
        printingMethod = '_subtreeDescription'

      description = fb.evaluateExpressionValue('(id)[' + arguments[0] + ' ' + printingMethod + ']').GetObjectDescription()
      if description:
        description = description.replace('    |', '  |')
        if maxDepth > 0:
          separator = re.escape("   | ")
          prefixToRemove = separator * maxDepth + " "
          description += "\n"
          description = re.sub(r'%s.*\n' % (prefixToRemove), r'', description)
        else:
          description = '\n'.join([l if not l.startswith('   |') else l[4:] for l in description.splitlines()])

      print(description)
Beispiel #6
0
def _recursiveViewControllerDescriptionWithPrefixAndChildPrefix(
        vc, string, prefix, childPrefix):
    isMac = runtimeHelpers.isMacintoshArch()

    s = '%s%s%s\n' % (prefix, '' if prefix == '' else ' ',
                      _viewControllerDescription(vc))

    nextPrefix = childPrefix + '   |'

    numChildViewControllers = fb.evaluateIntegerExpression(
        '(int)[(id)[%s childViewControllers] count]' % (vc))

    for i in range(0, numChildViewControllers):
        viewController = fb.evaluateExpression(
            '(id)[(id)[%s childViewControllers] objectAtIndex:%d]' % (vc, i))
        s += _recursiveViewControllerDescriptionWithPrefixAndChildPrefix(
            viewController, string, nextPrefix, nextPrefix)

    if not isMac:
        isModal = fb.evaluateBooleanExpression(
            '%s != nil && ((id)[(id)[(id)%s presentedViewController] presentingViewController]) == %s'
            % (vc, vc, vc))

        if isModal:
            modalVC = fb.evaluateObjectExpression(
                '(id)[(id)%s presentedViewController]' % (vc))
            s += _recursiveViewControllerDescriptionWithPrefixAndChildPrefix(
                modalVC, string, childPrefix + '  *M', nextPrefix)
            s += '\n// \'*M\' means the view controller is presented modally.'

    return string + s
Beispiel #7
0
    def run(self, arguments, options):
        maxDepth = int(options.depth)
        isMac = runtimeHelpers.isMacintoshArch()

        if arguments[0] == '__keyWindow_dynamic__':
            arguments[0] = '(id)[[UIApplication sharedApplication] keyWindow]'

            if isMac:
                arguments[
                    0] = '(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:0] contentView]'

        if options.upwards:
            view = arguments[0]
            description = viewHelpers.upwardsRecursiveDescription(
                view, maxDepth)
            if description:
                print description
            else:
                print 'Failed to walk view hierarchy. Make sure you pass a view, not any other kind of object or expression.'
        else:
            printingMethod = 'recursiveDescription'
            if isMac:
                printingMethod = '_subtreeDescription'

            description = fb.evaluateExpressionValue(
                '(id)[' + arguments[0] + ' ' + printingMethod +
                ']').GetObjectDescription()
            if maxDepth > 0:
                separator = re.escape("   | ")
                prefixToRemove = separator * maxDepth + " "
                description += "\n"
                description = re.sub(r'%s.*\n' % (prefixToRemove), r'',
                                     description)
            print description
def _recursiveViewControllerDescriptionWithPrefixAndChildPrefix(vc, string, prefix, childPrefix):
    isMac = runtimeHelpers.isMacintoshArch()

    s = "%s%s%s\n" % (prefix, "" if prefix == "" else " ", _viewControllerDescription(vc))

    nextPrefix = childPrefix + "   |"

    numChildViewControllers = fb.evaluateIntegerExpression("(int)[(id)[%s childViewControllers] count]" % (vc))
    childViewControllers = fb.evaluateExpression("(id)[%s childViewControllers]" % (vc))

    for i in range(0, numChildViewControllers):
        viewController = fb.evaluateExpression("(id)[(id)[%s childViewControllers] objectAtIndex:%d]" % (vc, i))
        s += _recursiveViewControllerDescriptionWithPrefixAndChildPrefix(viewController, string, nextPrefix, nextPrefix)

    if not isMac:
        isModal = fb.evaluateBooleanExpression(
            "%s != nil && ((id)[(id)[(id)%s presentedViewController] presentingViewController]) == %s" % (vc, vc, vc)
        )

        if isModal:
            modalVC = fb.evaluateObjectExpression("(id)[(id)%s presentedViewController]" % (vc))
            s += _recursiveViewControllerDescriptionWithPrefixAndChildPrefix(
                modalVC, string, childPrefix + "  *M", nextPrefix
            )
            s += "\n// '*M' means the view controller is presented modally."

    return string + s
  def run(self, arguments, options):
    isMac = runtimeHelpers.isMacintoshArch()

    if arguments[0] == '__keyWindow_rootVC_dynamic__':
      arguments[0] = '(id)[(id)[[UIApplication sharedApplication] keyWindow] rootViewController]'
      if isMac:
        arguments[0] = '(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:0] contentViewController]'

    print vcHelpers.viewControllerRecursiveDescription(arguments[0])
Beispiel #10
0
    def run(self, arguments, options):
        maxDepth = int(options.depth)
        window = int(options.window)
        isMac = runtimeHelpers.isMacintoshArch()

        if window > 0:
            if isMac:
                arguments[0] = (
                    "(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:"
                    + str(window)
                    + "] contentView]"
                )
            else:
                arguments[0] = (
                    "(id)[[[UIApplication sharedApplication] windows] objectAtIndex:"
                    + str(window)
                    + "]"
                )
        elif arguments[0] == "__keyWindow_dynamic__":
            if isMac:
                arguments[
                    0
                ] = "(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:0] contentView]"  # noqa B950
            else:
                arguments[0] = "(id)[[UIApplication sharedApplication] keyWindow]"

        if options.upwards:
            view = arguments[0]
            description = viewHelpers.upwardsRecursiveDescription(view, maxDepth)
            if description:
                print(description)
            else:
                print(
                    "Failed to walk view hierarchy. Make sure you pass a view, not any other kind of object or expression."  # noqa B950
                )
        else:
            printingMethod = "recursiveDescription"
            if isMac:
                printingMethod = "_subtreeDescription"

            description = fb.evaluateExpressionValue(
                "(id)[" + arguments[0] + " " + printingMethod + "]"
            ).GetObjectDescription()
            if maxDepth > 0:
                separator = re.escape("   | ")
                prefixToRemove = separator * maxDepth + " "
                description += "\n"
                description = re.sub(r"%s.*\n" % (prefixToRemove), r"", description)

            if options.short:
                toRemove = ":.*(?:\n|$)"
                description = re.sub(toRemove, r">\n", description)
            elif options.medium:
                toRemove = ";.*(?:\n|$)"
                description = re.sub(toRemove, r">\n", description)

            print(description)
Beispiel #11
0
  def run(self, args, options):
    colorClassName = 'UIColor'
    isMac = runtimeHelpers.isMacintoshArch()

    if isMac:
      colorClassName = 'NSColor'

    layer = viewHelpers.convertToLayer(args[0])
    lldb.debugger.HandleCommand('expr (void)[%s setBorderWidth:(CGFloat)%s]' % (layer, options.width))
    lldb.debugger.HandleCommand('expr (void)[%s setBorderColor:(CGColorRef)[(id)[%s %sColor] CGColor]]' % (layer, colorClassName, options.color))
    lldb.debugger.HandleCommand('caflush')
Beispiel #12
0
  def run(self, arguments, options):
    startResponder = arguments[0]

    isMac = runtimeHelpers.isMacintoshArch()
    responderClass = 'UIResponder'
    if isMac:
      responderClass = 'NSResponder'

    if not fb.evaluateBooleanExpression('(BOOL)[(id)' + startResponder + ' isKindOfClass:[' + responderClass + ' class]]'):
      print('Whoa, ' + startResponder + ' is not a ' + responderClass + '. =(')
      return

    _printIterative(startResponder, _responderChain)
Beispiel #13
0
  def run(self, arguments, options):
    startResponder = fb.evaluateInputExpression(arguments[0])

    isMac = runtimeHelpers.isMacintoshArch()
    responderClass = 'UIResponder'
    if isMac:
      responderClass = 'NSResponder'

    if not fb.evaluateBooleanExpression('(BOOL)[(id)' + startResponder + ' isKindOfClass:[' + responderClass + ' class]]'):
      print 'Whoa, ' + startResponder + ' is not a ' + responderClass + '. =('
      return

    _printIterative(startResponder, _responderChain)
Beispiel #14
0
  def run(self, arguments, options):
    isMac = runtimeHelpers.isMacintoshArch()

    if arguments[0] == '__keyWindow_rootVC_dynamic__':
      if fb.evaluateBooleanExpression('[UIViewController respondsToSelector:@selector(_printHierarchy)]'):
        lldb.debugger.HandleCommand('po [UIViewController _printHierarchy]')
        return

      arguments[0] = '(id)[(id)[[UIApplication sharedApplication] keyWindow] rootViewController]'
      if isMac:
        arguments[0] = '(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:0] contentViewController]'

    print vcHelpers.viewControllerRecursiveDescription(arguments[0])
Beispiel #15
0
  def run(self, arguments, options):
    isMac = runtimeHelpers.isMacintoshArch()

    if arguments[0] == '__keyWindow_rootVC_dynamic__':
      if fb.evaluateBooleanExpression('[UIViewController respondsToSelector:@selector(_printHierarchy)]'):
        print fb.describeObject('[UIViewController _printHierarchy]')
        return

      arguments[0] = '(id)[(id)[[UIApplication sharedApplication] keyWindow] rootViewController]'
      if isMac:
        arguments[0] = '(id)[[[[NSApplication sharedApplication] windows] objectAtIndex:0] contentViewController]'

    print vcHelpers.viewControllerRecursiveDescription(arguments[0])
Beispiel #16
0
    def run(self, args, options):
        colorClassName = 'UIColor'
        isMac = runtimeHelpers.isMacintoshArch()

        if isMac:
            colorClassName = 'NSColor'

        layer = viewHelpers.convertToLayer(args[0])
        lldb.debugger.HandleCommand(
            'expr (void)[%s setBorderWidth:(CGFloat)%s]' %
            (layer, options.width))
        lldb.debugger.HandleCommand(
            'expr (void)[%s setBorderColor:(CGColorRef)[(id)[%s %sColor] CGColor]]'
            % (layer, colorClassName, options.color))
        lldb.debugger.HandleCommand('caflush')
Beispiel #17
0
    def inputCallback(self, input):
        oldView = self.currentView

        if input == "q":
            cmd = 'echo %s | tr -d "\n" | pbcopy' % oldView
            os.system(cmd)

            print(
                "\nI hope " + oldView +
                " was what you were looking for. I put it on your clipboard.")
            viewHelpers.unmaskView(oldView)
            self.keepRunning = False

        elif input == "w":
            v = superviewOfView(self.currentView)
            if not v:
                print("There is no superview. Where are you trying to go?!")
            self.setCurrentView(v, oldView)
        elif input == "s":
            v = firstSubviewOfView(self.currentView)
            if not v:
                print("\nThe view has no subviews.\n")
            self.setCurrentView(v, oldView)
        elif input == "d":
            v = nthSiblingOfView(self.currentView, -1)
            if v == oldView:
                print("\nThere are no sibling views to this view.\n")
            self.setCurrentView(v, oldView)
        elif input == "a":
            v = nthSiblingOfView(self.currentView, 1)
            if v == oldView:
                print("\nThere are no sibling views to this view.\n")
            self.setCurrentView(v, oldView)
        elif input == "p":
            recursionName = "recursiveDescription"
            isMac = runtimeHelpers.isMacintoshArch()

            if isMac:
                recursionName = "_subtreeDescription"

            print(
                fb.describeObject("[(id){} {}]".format(oldView,
                                                       recursionName)))
        else:
            print("\nI really have no idea what you meant by '" + input +
                  "'... =\\\n")
Beispiel #18
0
    def inputCallback(self, input):
        oldView = self.currentView

        if input == 'q':
            cmd = 'echo %s | tr -d "\n" | pbcopy' % oldView
            os.system(cmd)

            print(
                '\nI hope ' + oldView +
                ' was what you were looking for. I put it on your clipboard.')
            viewHelpers.unmaskView(oldView)
            self.keepRunning = False

        elif input == 'w':
            v = superviewOfView(self.currentView)
            if not v:
                print('There is no superview. Where are you trying to go?!')
            self.setCurrentView(v, oldView)
        elif input == 's':
            v = firstSubviewOfView(self.currentView)
            if not v:
                print('\nThe view has no subviews.\n')
            self.setCurrentView(v, oldView)
        elif input == 'd':
            v = nthSiblingOfView(self.currentView, -1)
            if v == oldView:
                print('\nThere are no sibling views to this view.\n')
            self.setCurrentView(v, oldView)
        elif input == 'a':
            v = nthSiblingOfView(self.currentView, 1)
            if v == oldView:
                print('\nThere are no sibling views to this view.\n')
            self.setCurrentView(v, oldView)
        elif input == 'p':
            recursionName = 'recursiveDescription'
            isMac = runtimeHelpers.isMacintoshArch()

            if isMac:
                recursionName = '_subtreeDescription'

            print(
                fb.describeObject('[(id){} {}]'.format(oldView,
                                                       recursionName)))
        else:
            print('\nI really have no idea what you meant by \'' + input +
                  '\'... =\\\n')
Beispiel #19
0
    def inputCallback(self, input):
        oldView = self.currentView

        if input == 'q':
            cmd = 'echo %s | tr -d "\n" | pbcopy' % oldView
            os.system(cmd)

            print '\nI hope ' + oldView + ' was what you were looking for. I put it on your clipboard.'

            self.handler.stop()
        elif input == 'w':
            v = superviewOfView(self.currentView)
            if not v:
                print 'There is no superview. Where are you trying to go?!'
            self.setCurrentView(v)
        elif input == 's':
            v = firstSubviewOfView(self.currentView)
            if not v:
                print '\nThe view has no subviews.\n'
            self.setCurrentView(v)
        elif input == 'd':
            v = nthSiblingOfView(self.currentView, -1)
            if v == oldView:
                print '\nThere are no sibling views to this view.\n'
            self.setCurrentView(v)
        elif input == 'a':
            v = nthSiblingOfView(self.currentView, 1)
            if v == oldView:
                print '\nThere are no sibling views to this view.\n'
            self.setCurrentView(v)
        elif input == 'p':
            recusionName = 'recursiveDescription'
            isMac = runtimeHelpers.isMacintoshArch()

            if isMac:
                recursionName = '_subtreeDescription'

            lldb.debugger.HandleCommand('po [(id)' + oldView + ' ' +
                                        recusionName + ']')
        else:
            print '\nI really have no idea what you meant by \'' + input + '\'... =\\\n'

        viewHelpers.setViewHidden(oldView, False)
Beispiel #20
0
    def run(self, arguments, options):
        startResponder = fb.evaluateInputExpression(arguments[0])

        isMac = runtimeHelpers.isMacintoshArch()
        responderClass = "UIResponder"
        if isMac:
            responderClass = "NSResponder"

        if not fb.evaluateBooleanExpression(
            "(BOOL)[(id)"
            + startResponder
            + " isKindOfClass:["
            + responderClass
            + " class]]"
        ):
            print("Whoa, " + startResponder + " is not a " + responderClass + ". =(")
            return

        _printIterative(startResponder, _responderChain)
Beispiel #21
0
  def inputCallback(self, input):
    oldView = self.currentView

    if input == 'q':
      cmd = 'echo %s | tr -d "\n" | pbcopy' % oldView
      os.system(cmd)

      print '\nI hope ' + oldView + ' was what you were looking for. I put it on your clipboard.'

      self.handler.stop()
    elif input == 'w':
      v = superviewOfView(self.currentView)
      if not v:
        print 'There is no superview. Where are you trying to go?!'
      self.setCurrentView(v)
    elif input == 's':
      v = firstSubviewOfView(self.currentView)
      if not v:
        print '\nThe view has no subviews.\n'
      self.setCurrentView(v)
    elif input == 'd':
      v = nthSiblingOfView(self.currentView, -1)
      if v == oldView:
        print '\nThere are no sibling views to this view.\n'
      self.setCurrentView(v)
    elif input == 'a':
      v = nthSiblingOfView(self.currentView, 1)
      if v == oldView:
        print '\nThere are no sibling views to this view.\n'
      self.setCurrentView(v)
    elif input == 'p':
      recusionName = 'recursiveDescription'
      isMac = runtimeHelpers.isMacintoshArch()

      if isMac:
        recursionName = '_subtreeDescription'

      lldb.debugger.HandleCommand('po [(id)' + oldView + ' ' + recusionName + ']')
    else:
      print '\nI really have no idea what you meant by \'' + input + '\'... =\\\n'

    viewHelpers.setViewHidden(oldView, False)
Beispiel #22
0
  def inputCallback(self, input):
    oldView = self.currentView

    if input == 'q':
      cmd = 'echo %s | tr -d "\n" | pbcopy' % oldView
      os.system(cmd)

      print '\nI hope ' + oldView + ' was what you were looking for. I put it on your clipboard.'
      viewHelpers.unmaskView(oldView)
      self.keepRunning = False

    elif input == 'w':
      v = superviewOfView(self.currentView)
      if not v:
        print 'There is no superview. Where are you trying to go?!'
      self.setCurrentView(v, oldView)
    elif input == 's':
      v = firstSubviewOfView(self.currentView)
      if not v:
        print '\nThe view has no subviews.\n'
      self.setCurrentView(v, oldView)
    elif input == 'd':
      v = nthSiblingOfView(self.currentView, -1)
      if v == oldView:
        print '\nThere are no sibling views to this view.\n'
      self.setCurrentView(v, oldView)
    elif input == 'a':
      v = nthSiblingOfView(self.currentView, 1)
      if v == oldView:
        print '\nThere are no sibling views to this view.\n'
      self.setCurrentView(v, oldView)
    elif input == 'p':
      recursionName = 'recursiveDescription'
      isMac = runtimeHelpers.isMacintoshArch()

      if isMac:
        recursionName = '_subtreeDescription'

      print fb.describeObject('[(id){} {}]'.format(oldView, recursionName))
    else:
      print '\nI really have no idea what you meant by \'' + input + '\'... =\\\n'
def _recursiveViewControllerDescriptionWithPrefixAndChildPrefix(vc, string, prefix, childPrefix):
  isMac = runtimeHelpers.isMacintoshArch()

  s = '%s%s%s\n' % (prefix, '' if prefix == '' else ' ', _viewControllerDescription(vc))

  nextPrefix = childPrefix + '   |'

  numChildViewControllers = fb.evaluateIntegerExpression('(int)[(id)[%s childViewControllers] count]' % (vc))

  for i in range(0, numChildViewControllers):
    viewController = fb.evaluateExpression('(id)[(id)[%s childViewControllers] objectAtIndex:%d]' % (vc, i))
    s += _recursiveViewControllerDescriptionWithPrefixAndChildPrefix(viewController, string, nextPrefix, nextPrefix)

  if not isMac:
    isModal = fb.evaluateBooleanExpression('%s != nil && ((id)[(id)[(id)%s presentedViewController] presentingViewController]) == %s' % (vc, vc, vc))

    if isModal:
      modalVC = fb.evaluateObjectExpression('(id)[(id)%s presentedViewController]' % (vc))
      s += _recursiveViewControllerDescriptionWithPrefixAndChildPrefix(modalVC, string, childPrefix + '  *M', nextPrefix)
      s += '\n// \'*M\' means the view controller is presented modally.'

  return string + s
Beispiel #24
0
def isNSView(obj):
    return runtimeHelpers.isMacintoshArch() and fb.evaluateBooleanExpression('[(id)%s isKindOfClass:(Class)[NSView class]]' % obj)
Beispiel #25
0
def isNSView(obj):
    return runtimeHelpers.isMacintoshArch() and fb.evaluateBooleanExpression(
        '[(id)%s isKindOfClass:(Class)[NSView class]]' % obj)