Create a rectangle showing the current window.
326435
def display_current(self):
        """"""
        if self.idx_current in self.scene.items():
            self.scene.removeItem(self.idx_current)

        item = QGraphicsRectItem(0,
                                 CURR['pos0'],
                                 self.parent.value('window_length'),
                                 CURR['pos1'])
        # it's necessary to create rect first, and then move it
        item.setPos(self.parent.value('window_start'), 0)
        item.setPen(QPen(Qt.lightGray))
        item.setBrush(QBrush(Qt.lightGray))
        item.setZValue(-10)
        self.scene.addItem(item)
        self.idx_current = item
687575
def make_gui(self):
        
        self.option_window = Toplevel()
        self.option_window.protocol("WM_DELETE_WINDOW", self.on_exit)
        self.canvas_frame = tk.Frame(self, height=500)
        self.option_frame = tk.Frame(self.option_window, height=300)
        self.canvas_frame.pack(side=tk.LEFT, fill=tk.BOTH, expand=True)
        self.option_frame.pack(side=tk.RIGHT, fill=None, expand=False)
        self.make_options_frame()
        self.make_canvas_frame()
        self.disable_singlecolor()
414496
def show(self, ):
        
        wins = set(JB_MainWindow.instances())
        widgets = set(self.get_widgets())
        for w in wins - widgets:
            self.add_widget(w)
        super(JB_WindowToolTip, self).show()
22553
def previous_layout(pymux, variables):
    "  "
    pane = pymux.arrangement.get_active_window()
    if pane:
        pane.select_previous_layout()
81733
def render(self, rect, data):
        """"""
        num_elements = len(self.elements)
        col_width = (rect.w-self.margin*(num_elements-1)) / float(num_elements)
        x = rect.x
        for element in self.elements:
            if element is not None:
                element.render(datatypes.Rectangle(
                        x, rect.y, col_width, rect.h
                        ), data)
            x += col_width + self.margin
212938
function(rectangle) {
        return $.Rect.fromSummits(
            this.pointFromPixel(rectangle.getTopLeft(), true),
            this.pointFromPixel(rectangle.getTopRight(), true),
            this.pointFromPixel(rectangle.getBottomLeft(), true)
        );
    }
356311
public void showInfoWindow(){
		if (mInfoWindow == null)
			return;
		final int markerWidth = mIcon.getIntrinsicWidth();
		final int markerHeight = mIcon.getIntrinsicHeight();
		final int offsetX = (int)(markerWidth * (mIWAnchorU - mAnchorU));
		final int offsetY = (int)(markerHeight * (mIWAnchorV - mAnchorV));
		if (mBearing == 0) {
			mInfoWindow.open(this, mPosition, offsetX, offsetY);
			return;
		}
		final int centerX = 0;
		final int centerY = 0;
		final double radians = -mBearing * Math.PI / 180.;
		final double cos = Math.cos(radians);
		final double sin = Math.sin(radians);
		final int rotatedX = (int)RectL.getRotatedX(offsetX, offsetY, centerX, centerY, cos, sin);
		final int rotatedY = (int)RectL.getRotatedY(offsetX, offsetY, centerX, centerY, cos, sin);
		mInfoWindow.open(this, mPosition, rotatedX, rotatedY);
	}
539540
def _select_other_window(history):
    "  "
    current_buffer = history.app.current_buffer
    layout = history.history_layout.layout

    if current_buffer == history.history_buffer:
        layout.current_control = history.history_layout.default_buffer_control

    elif current_buffer == history.default_buffer:
        layout.current_control = history.history_layout.history_buffer_control
1334387
def rectangle(self, x, y, width, height, corner_radius = 0):
        """"""
        if corner_radius <= 0:
            self._add_instruction("rectangle", x, y, width, height)
            return

        # convert into 4 border and  make sure that w + h are larger than 2 * corner_radius
        if isinstance(corner_radius, (int, float)):
            corner_radius = [corner_radius] * 4
        corner_radius = [min(r, min(width, height) / 2) for r in corner_radius]

        x2, y2 = x + width, y + height
        self._rounded_rectangle(x, y, x2, y2, corner_radius)
1336837
def rectangle(self, rect, attr=None, fill=u' '):
        '''
        x0, y0, x1, y1 = rect
        n = DWORD(0)
        if attr is None:
            attr = self.attr
        for y in range(y0, y1):
            pos = self.fixcoord(x0, y)
            self.FillConsoleOutputAttribute(self.hout, attr, x1 - x0, 
                                            pos, byref(n))
            self.FillConsoleOutputCharacterW(self.hout, ord(fill[0]), x1 - x0,
                                             pos, byref(n))
799421
def _create_select_window_handler(self, window):
        "  "
        def handler(mouse_event):
            if mouse_event.event_type == MouseEventType.MOUSE_DOWN:
                self.pymux.arrangement.set_active_window(window)
                self.pymux.invalidate()
            else:
                return NotImplemented  # Event not handled here.
        return handler
865518
function(rect) {
        rect = rect || this._viewportRect();
        var gl = this.context;

        // Set viewport and clear it
        gl.viewport(0, 0, gl.viewportWidth, gl.viewportHeight);
        gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);

        //Set the viewport uniform variables used by each registered program
        var programs = this.programs;
        if (this._dirtyViewport) {
            var view = this._viewportRect();
            for (var comp in programs) {
                programs[comp].setViewportUniforms(view, this.options);
            }
            this._dirtyViewport = false;
        }

        // Search for any entities in the given area (viewport unless otherwise specified)
        var q = Crafty.map.search(rect),
            i = 0,
            l = q.length,
            current;
        //From all potential candidates, build a list of visible entities, then sort by zorder
        var visible_gl = this.visible_gl;
        visible_gl.length = 0;
        for (i = 0; i < l; i++) {
            current = q[i];
            if (
                current._visible &&
                current.program &&
                current._drawLayer === this
            ) {
                visible_gl.push(current);
            }
        }
        visible_gl.sort(this._sort);
        l = visible_gl.length;

        // Now iterate through the z-sorted entities to be rendered
        // Each entity writes it's data into a typed array
        // The entities are rendered in batches, where the entire array is copied to a buffer in one operation
        // A batch is rendered whenever the next element needs to use a different type of program
        // Therefore, you get better performance by grouping programs by z-order if possible.
        // (Each sprite sheet will use a different program, but multiple sprites on the same sheet can be rendered in one batch)
        var shaderProgram = null;
        for (i = 0; i < l; i++) {
            current = visible_gl[i];
            if (shaderProgram !== current.program) {
                if (shaderProgram !== null) {
                    shaderProgram.renderBatch();
                }

                shaderProgram = current.program;
                shaderProgram.index_pointer = 0;
                shaderProgram.switchTo();
            }
            current.draw();
            current._changed = false;
        }

        if (shaderProgram !== null) {
            shaderProgram.renderBatch();
        }
    }
214845
public void rectangle(float x, float y, float w, float h) {
        content.append(x).append(' ').append(y).append(' ').append(w).append(' ').append(h).append(" re").append_i(separator);
    }
977381
def expose_event(self, widget, event):
        
        x, y, width, height = event.area
        self.logger.debug("surface is %s" % self.surface)
        if self.surface is not None:
            win = widget.get_window()
            cr = win.cairo_create()

            # set clip area for exposed region
            cr.rectangle(x, y, width, height)
            cr.clip()

            # Paint from off-screen surface
            cr.set_source_surface(self.surface, 0, 0)
            cr.set_operator(cairo.OPERATOR_SOURCE)
            cr.paint()

        return False
966199
def draw_rectangle(x, y, width, height, attr = {})
            last_content_stream.draw_rectangle(x, y, width, height, attr); self
        end
1026284
function(element) {
    var comp, rects, coords = null;
    comp = window.getComputedStyle(element, null);
    rects=element.getClientRects();
    if('none' !== comp.pointerEvents && rects.length) {
      mainLoop: for(var i=rects.length-1; i>=0; i--) {
        for(var x=rects[i].left, mX=rects[i].right; x<mX; x++) {
          for(var y=rects[i].top, mY=rects[i].bottom; y<mY; y++) {
            if(element === document.elementFromPoint(x,y)) {
              coords = {x: x, y: y};
              break mainLoop;
            }
          }
        }
      }
    }
    return coords;
  }
708024
def fit_to_window(self):
        ''''''
        state = self.state
        self.dragpos = wx.Point(0, 0)
        client_area = state.frame.GetClientSize()
        self.zoom = min(float(client_area.x) / self.img.GetWidth(),
                        float(client_area.y) / self.img.GetHeight())
        self.need_redraw = True