Connects the inputed dropzone to the given slot at the defined rect.
        
        :param      rect    | <QRectF>
                    slot    | <method> || <function>
        
        :return     <XNodeHotspot>
559938
def connectDropzone( self, 
                         rect, 
                         slot, 
                         color = None,
                         style = None,
                         name  = '',
                         toolTip = '' ):
        
        if not color:
            color = self.hotspotColor()
        if not style:
            style = self.hotspotStyle()
        
        hotspot = XNodeHotspot(rect, 
                               slot, 
                               name,
                               toolTip)
        
        hotspot.setColor(color)
        hotspot.setStyle(style)
        self._dropzones.append(hotspot)
        return hotspot
50543
def dragEnterEvent( self, event ):
        
        filt = self.dragDropFilter()
        if not filt:
            super(XTreeWidget, self).dragEnterEvent(event)
            return
            
        filt(self, event)
624755
private Rectangle getVDropLineRect(JTable.DropLocation loc) {
        if (!loc.isInsertColumn()) {
            return null;
        }

        boolean   ltr  = table.getComponentOrientation().isLeftToRight();
        int       col  = loc.getColumn();
        Rectangle rect = table.getCellRect(loc.getRow(), col, true);

        if (col >= table.getColumnCount()) {
            col--;
            rect = table.getCellRect(loc.getRow(), col, true);
            if (ltr) {
                rect.x = rect.x + rect.width;
            }
        } else if (!ltr) {
            rect.x = rect.x + rect.width;
        }

        if (rect.x == 0) {
            rect.x = -1;
        } else {
            rect.x -= 2;
        }

        rect.width = 3;

        return rect;
    }
431663
def setRect( self, rect ):
        
        mwidth  = self.minimumWidth()
        mheight = self.minimumHeight()
        
        if ( rect.width() < mwidth ):
            rect.setWidth(mwidth)
        if ( rect.height() < mheight ):
            rect.setHeight(mheight)
        
        return super(XNode, self).setRect(rect)
1087453
def connect_after(self, slot, *extra_args):
        
        slot = Slot(slot, *extra_args)
        self._after_functions.add(slot)
1027802
function Rect(options) {

    var self = this;
    this.paper = options.paper;
    this.manager = options.manager;

    if (options.id) {
        this._id = options.id;
    } else {
        this._id = this.manager.getRandomId();
    }
    this._x = options.x;
    this._y = options.y;
    this._width = options.width;
    this._height = options.height;
    this._strokeColor = options.strokeColor;
    this._strokeWidth = options.strokeWidth || 2;
    this._selected = false;
    this._zoomFraction = 1;
    if (options.zoom) {
        this._zoomFraction = options.zoom / 100;
    }
    this.handle_wh = 6;

    this.element = this.paper.rect();
    this.element.attr({'fill-opacity': 0.01,
                       'fill': '#fff',
                       'cursor': 'pointer'});

    if (this.manager.canEdit) {
        // Drag handling of element
        this.element.drag(
            function(dx, dy) {
                // DRAG, update location and redraw
                dx = dx / self._zoomFraction;
                dy = dy / self._zoomFraction;

                var offsetX = dx - this.prevX;
                var offsetY = dy - this.prevY;
                this.prevX = dx;
                this.prevY = dy;

                // Manager handles move and redraw
                self.manager.moveSelectedShapes(offsetX, offsetY, true);
            },
            function() {
                self._handleMousedown();
                this.prevX = 0;
                this.prevY = 0;
                return false;
            },
            function() {
                // STOP
                // notify manager if rectangle has moved
                if (this.prevX !== 0 || this.prevY !== 0) {
                    self.manager.notifySelectedShapesChanged();
                }
                return false;
            }
        );
    }

    this.createHandles();

    this.drawShape();
}
1122410
def region(self, rect):
        
        box = (int(rect[0]), int(rect[1]), int(rect[0]) + int(rect[2]),
               int(rect[1]) + int(rect[3]))
        if box[2] > self.img.size[0] or box[3] > self.img.size[1]:
            raise errors.RectangleError("Region out-of-bounds")
        self.img = self.img.crop(box)
        return self
1164359
function copy(rect) {
         return this.setShape(rect.pos.x, rect.pos.y, rect._width, rect._height);
       }
233607
function getIntersectionRect (rect1, rect2) {
  const intersectRect = {
    topLeft: {},
    bottomRight: {}
  };

  if (!doesIntersect(rect1, rect2)) {
    return;
  }

  const rect1Points = rectToPoints(rect1);
  const rect2Points = rectToPoints(rect2);

  if (rect1.width >= 0) {
    if (rect2.width >= 0) {
      intersectRect.topLeft.x = Math.max(rect1Points.topLeft.x, rect2Points.topLeft.x);
      intersectRect.bottomRight.x = Math.min(rect1Points.bottomRight.x, rect2Points.bottomRight.x);
    } else {
      intersectRect.topLeft.x = Math.max(rect1Points.topLeft.x, rect2Points.bottomRight.x);
      intersectRect.bottomRight.x = Math.min(rect1Points.bottomRight.x, rect2Points.topLeft.x);
    }
  } else if (rect2.width >= 0) {
    intersectRect.topLeft.x = Math.min(rect1Points.topLeft.x, rect2Points.bottomRight.x);
    intersectRect.bottomRight.x = Math.max(rect1Points.bottomRight.x, rect2Points.topLeft.x);
  } else {
    intersectRect.topLeft.x = Math.min(rect1Points.topLeft.x, rect2Points.topLeft.x);
    intersectRect.bottomRight.x = Math.max(rect1Points.bottomRight.x, rect2Points.bottomRight.x);
  }

  if (rect1.height >= 0) {
    if (rect2.height >= 0) {
      intersectRect.topLeft.y = Math.max(rect1Points.topLeft.y, rect2Points.topLeft.y);
      intersectRect.bottomRight.y = Math.min(rect1Points.bottomRight.y, rect2Points.bottomRight.y);
    } else {
      intersectRect.topLeft.y = Math.max(rect1Points.topLeft.y, rect2Points.bottomRight.y);
      intersectRect.bottomRight.y = Math.min(rect1Points.bottomRight.y, rect2Points.topLeft.y);
    }
  } else if (rect2.height >= 0) {
    intersectRect.topLeft.y = Math.min(rect1Points.topLeft.y, rect2Points.bottomRight.y);
    intersectRect.bottomRight.y = Math.max(rect1Points.bottomRight.y, rect2Points.topLeft.y);
  } else {
    intersectRect.topLeft.y = Math.min(rect1Points.topLeft.y, rect2Points.topLeft.y);
    intersectRect.bottomRight.y = Math.max(rect1Points.bottomRight.y, rect2Points.bottomRight.y);
  }

  // Returns top-left and bottom-right points of intersected rectangle
  return intersectRect;

}
730069
def connectdown(np, p, acc, outlet, wtsd=None, workingdir=None, mpiexedir=None,
                    exedir=None, log_file=None, runtime_file=None, hostfile=None):
        """"""
        # If watershed is not specified, use acc to generate a mask layer.
        if wtsd is None or not os.path.isfile(wtsd):
            p, workingdir = TauDEM.check_infile_and_wp(p, workingdir)
            wtsd = workingdir + os.sep + 'wtsd_default.tif'
            RasterUtilClass.get_mask_from_raster(p, wtsd, True)
        fname = TauDEM.func_name('connectdown')
        return TauDEM.run(FileClass.get_executable_fullpath(fname, exedir),
                          {'-p': p, '-ad8': acc, '-w': wtsd},
                          workingdir,
                          None,
                          {'-o': outlet},
                          {'mpipath': mpiexedir, 'hostfile': hostfile, 'n': np},
                          {'logfile': log_file, 'runtimefile': runtime_file})
851643
def inputRect(self):
        
        try:
            return self._inputNode.sceneRect()
        except AttributeError:
            point = self.inputPoint()
            return QRectF(point.x(), point.y(), 0, 0)
154166
def connect(self, slot):
        
        if not callable(slot):
            raise ValueError("Connection to non-callable '%s' object failed" % slot.__class__.__name__)

        if (isinstance(slot, partial) or '<' in slot.__name__):
            # If it's a partial or a lambda. The '<' check is the only py2 and py3 compatible way I could find
            if slot not in self._slots:
                self._slots.append(slot)
        elif inspect.ismethod(slot):
            # Check if it's an instance method and store it with the instance as the key
            slotSelf = slot.__self__
            slotDict = weakref.WeakKeyDictionary()
            slotDict[slotSelf] = slot.__func__
            if slotDict not in self._slots:
                self._slots.append(slotDict)
        else:
            # If it's just a function then just store it as a weakref.
            newSlotRef = weakref.ref(slot)
            if newSlotRef not in self._slots:
                self._slots.append(newSlotRef)
1326258
def connect_input(self, wire):
        """"""
        self._input = wire
        wire.sinks.append(self)
526532
function setupDropzone (el, accept) {
  interact(el)
    .on('dropactivate', e => { console.log(e.type); e.reject(); })
    .dropzone({
      accept: accept,
      ondropactivate: function (event) {
        addClass(event.relatedTarget, '-drop-possible');
      },
      ondropdeactivate: function (event) {
        removeClass(event.relatedTarget, '-drop-possible');
      },
    })
    .on('dropactivate', function (event) {
      const active = event.target.getAttribute('active')|0;

      // change style if it was previously not active
      if (active === 0) {
        addClass(event.target, '-drop-possible');
        event.target.textContent = 'Drop me here!';
      }

      event.target.setAttribute('active', active + 1);
    })
    .on('dropdeactivate', function (event) {
      const active = event.target.getAttribute('active')|0;

      // change style if it was previously active
      // but will no longer be active
      if (active === 1) {
        removeClass(event.target, '-drop-possible');
        event.target.textContent = 'Dropzone';
      }

      event.target.setAttribute('active', active - 1);
    })
    .on('dragenter', function (event) {
      addClass(event.target, '-drop-over');
      event.relatedTarget.textContent = 'I\'m in';
    })
    .on('dragleave', function (event) {
      removeClass(event.target, '-drop-over');
      event.relatedTarget.textContent = 'Drag me…';
    })
    .on('drop', function (event) {
      removeClass(event.target, '-drop-over');
      event.relatedTarget.textContent = 'Dropped';
    });
}
232413
def draw_rect(self, bbox, cell_val):
        
        new_x0 = int(bbox[x0])
        new_y0 = int(bbox[y0])
        new_x1 = max(new_x0 + 1, int(bbox[x1]))
        new_y1 = max(new_y0 + 1, int(bbox[y1]))

        self.grid[new_x0:new_x1, new_y0:new_y1] = cell_val
1202428
def add_rect(self, width, height, rid=None):
        
        assert(width > 0 and height > 0)
        if width > max(self.width, self.height) or\
            height > max(self.height, self.width):
            return None

        rect = None
        # If Waste managment is enabled, first try to place the rectangle there
        if self._waste_management:
            rect = self._waste.add_rect(width, height, rid)

        # Get best possible rectangle position
        if not rect:
            rect, _ = self._select_position(width, height)
            if rect:
                self._add_skyline(rect)

        if rect is None:
            return None
        
        # Store rectangle, and recalculate skyline
        rect.rid = rid
        self.rectangles.append(rect)
        return rect
723157
def fill_rect(self, x, y, width, height, color):
        """"""
        # pylint: disable=too-many-arguments, too-many-boolean-expressions
        self.rect(x, y, width, height, color, fill=True)