示例#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')
示例#2
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')
示例#3
0
 def run(self, args, options):
     layer = viewHelpers.convertToLayer(args[0])
     lldb.debugger.HandleCommand("expr (void)[%s setBorderWidth:%s]" % (layer, options.width))
     lldb.debugger.HandleCommand(
         "expr (void)[%s setBorderColor:(CGColorRef)[(id)[UIColor %sColor] CGColor]]" % (layer, options.color)
     )
     lldb.debugger.HandleCommand("caflush")
示例#4
0
    def run(self, args, options):
        def setUnborder(layer):
            fb.evaluateEffect('[%s setBorderWidth:(CGFloat)%s]' % (layer, 0))

        obj = args[0]
        depth = int(options.depth)
        if viewHelpers.isView(obj):
            for view, level in viewHelpers.subviewsOfView(obj):
                if level > depth:
                    break
                layer = viewHelpers.convertToLayer(view)
                setUnborder(layer)
        else:
            # `obj` is not a view, make sure recursive unbordering is not requested
            assert depth <= 0, "Recursive unbordering is only supported for UIViews or NSViews"
            layer = viewHelpers.convertToLayer(obj)
            setUnborder(layer)

        lldb.debugger.HandleCommand('caflush')
示例#5
0
  def run(self, args, options):
    def setUnborder(layer):
        fb.evaluateEffect('[%s setBorderWidth:(CGFloat)%s]' % (layer, 0))

    obj = args[0]
    depth = int(options.depth)
    if viewHelpers.isView(obj):
      for view, level in viewHelpers.subviewsOfView(obj):
        if level > depth:
           break
        layer = viewHelpers.convertToLayer(view)
        setUnborder(layer)
    else:
      # `obj` is not a view, make sure recursive unbordering is not requested
      assert depth <= 0, "Recursive unbordering is only supported for UIViews or NSViews"
      layer = viewHelpers.convertToLayer(obj)
      setUnborder(layer)

    lldb.debugger.HandleCommand('caflush')
示例#6
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')
示例#7
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')
示例#8
0
def setBorderOnAmbiguousViewRecursive(view, width, color):
  if not fb.evaluateBooleanExpression('[(id)%s isKindOfClass:(Class)[UIView class]]' % view):
    return

  isAmbiguous = fb.evaluateBooleanExpression('(BOOL)[%s hasAmbiguousLayout]' % view)
  if isAmbiguous:
    layer = viewHelpers.convertToLayer(view)
    fb.evaluateEffect('[%s setBorderWidth:(CGFloat)%s]' % (layer, width))
    fb.evaluateEffect('[%s setBorderColor:(CGColorRef)[(id)[UIColor %sColor] CGColor]]' % (layer, color))

  subviews = fb.evaluateExpression('(id)[%s subviews]' % view)
  subviewsCount = int(fb.evaluateExpression('(int)[(id)%s count]' % subviews))
  if subviewsCount > 0:
    for i in range(0, subviewsCount):
      subview = fb.evaluateExpression('(id)[%s objectAtIndex:%i]' % (subviews, i))
      setBorderOnAmbiguousViewRecursive(subview, width, color)
def setBorderOnAmbiguousViewRecursive(view, width, color):
  if not fb.evaluateBooleanExpression('[(id)%s isKindOfClass:(Class)[UIView class]]' % view):
    return

  isAmbiguous = fb.evaluateBooleanExpression('(BOOL)[%s hasAmbiguousLayout]' % view)
  if isAmbiguous:
    layer = viewHelpers.convertToLayer(view)
    fb.evaluateEffect('[%s setBorderWidth:(CGFloat)%s]' % (layer, width))
    fb.evaluateEffect('[%s setBorderColor:(CGColorRef)[(id)[UIColor %sColor] CGColor]]' % (layer, color))

  subviews = fb.evaluateExpression('(id)[%s subviews]' % view)
  subviewsCount = int(fb.evaluateExpression('(int)[(id)%s count]' % subviews))
  if subviewsCount > 0:
    for i in range(0, subviewsCount):
      subview = fb.evaluateExpression('(id)[%s objectAtIndex:%i]' % (subviews, i))
      setBorderOnAmbiguousViewRecursive(subview, width, color)
示例#10
0
 def run(self, args, options):
     layer = viewHelpers.convertToLayer(args[0])
     lldb.debugger.HandleCommand(
         'expr (void)[%s setBorderWidth:(CGFloat)%s]' % (layer, 0))
     lldb.debugger.HandleCommand('caflush')
示例#11
0
 def run(self, args, options):
   layer = viewHelpers.convertToLayer(args[0])
   lldb.debugger.HandleCommand('expr (void)[%s setBorderWidth:(CGFloat)%s]' % (layer, 0))
   lldb.debugger.HandleCommand('caflush')
示例#12
0
 def run(self, args, options):
   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)[UIColor %sColor] CGColor]]' % (layer, options.color))
   lldb.debugger.HandleCommand('caflush')
示例#13
0
 def run(self, args, options):
     layer = viewHelpers.convertToLayer(args[0])
     lldb.debugger.HandleCommand("expr (void)[%s setBorderWidth:%s]" % (layer, 0))
     lldb.debugger.HandleCommand("caflush")