예제 #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)
예제 #9
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)
예제 #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")