Create pen width combo box
335963
def _create_penwidth_combo(self):
        """"""

        choices = map(unicode, xrange(12))
        self.pen_width_combo = \
            _widgets.PenWidthComboBox(self, choices=choices,
                                      style=wx.CB_READONLY, size=(50, -1))

        self.pen_width_combo.SetToolTipString(_(u"Border width"))
        self.AddControl(self.pen_width_combo)
        self.Bind(wx.EVT_COMBOBOX, self.OnLineWidth, self.pen_width_combo)
511034
def hint_width(self):
        """"""
        return sum((len(self.style.delimiter),
                    self.wide,
                    len(self.style.delimiter),
                    len(u' '),
                    UCS_PRINTLEN + 2,
                    len(u' '),
                    self.style.name_len,))
1350103
function create(controller, boxes) {
  var doc = controller.window.document;
  var maxWidth = doc.documentElement.boxObject.width;
  var maxHeight = doc.documentElement.boxObject.height;
  var rect = [];
  for (var i = 0, j = boxes.length; i < j; ++i) {
    rect = boxes[i];
    if (rect[0] + rect[2] > maxWidth) maxWidth = rect[0] + rect[2];
    if (rect[1] + rect[3] > maxHeight) maxHeight = rect[1] + rect[3];
  }
  var canvas = doc.createElementNS("http://www.w3.org/1999/xhtml", "canvas");
  var width = doc.documentElement.boxObject.width;
  var height = doc.documentElement.boxObject.height;
  canvas.width = maxWidth;
  canvas.height = maxHeight;
  var ctx = canvas.getContext("2d");
  ctx.clearRect(0,0, canvas.width, canvas.height);
  ctx.save();
  ctx.drawWindow(controller.window, 0, 0, width, height, "rgb(0,0,0)");
  ctx.restore();
  ctx.save();
  ctx.fillStyle = "rgba(255,0,0,0.4)";
  for (var i = 0, j = boxes.length; i < j; ++i) {
    rect = boxes[i];
    ctx.fillRect(rect[0], rect[1], rect[2], rect[3]);
  }
  ctx.restore();

  _saveCanvas(canvas);
}
753620
def make_vertical_box(cls, children, layout=Layout(), duplicates=False):
        ""
        if not duplicates: return widgets.VBox(children, layout=layout)
        else: return widgets.VBox([children[0], children[2]], layout=layout)
702397
function pad(text, width) {
  var space = (width - text.length) + 5;
  return text + Array(space).join(" ");
}
802637
def format(self, text, width=78, indent=4):
        """"""
        return textwrap.fill(
            text,
            width=width,
            initial_indent=' ' * indent,
            subsequent_indent=' ' * indent,
        )
271912
def setCursorSize(self, p):
        ''
        self.cursorBox = BoundingBox(self.cursorBox.xmin, self.cursorBox.ymin, p.x, p.y)
        self.cursorBox.w = max(self.cursorBox.w, self.canvasCharWidth)
        self.cursorBox.h = max(self.cursorBox.h, self.canvasCharHeight)
717601
def get_pen_from_data(pendata):
    """"""

    pen_color = wx.Colour()
    pen_color.SetRGB(pendata[0])
    pen = wx.Pen(pen_color, *pendata[1:])
    pen.SetJoin(wx.JOIN_MITER)

    return pen
1302560
def create_combobox(self, text, choices, option, default=NoDefault,
                        tip=None, restart=False):
        """"""
        label = QLabel(text)
        combobox = QComboBox()
        if tip is not None:
            combobox.setToolTip(tip)
        for name, key in choices:
            if not (name is None and key is None):
                combobox.addItem(name, to_qvariant(key))
        # Insert separators
        count = 0
        for index, item in enumerate(choices):
            name, key = item
            if name is None and key is None:
                combobox.insertSeparator(index + count)
                count += 1
        self.comboboxes[combobox] = (option, default)
        layout = QHBoxLayout()
        layout.addWidget(label)
        layout.addWidget(combobox)
        layout.addStretch(1)
        layout.setContentsMargins(0, 0, 0, 0)
        widget = QWidget(self)
        widget.label = label
        widget.combobox = combobox
        widget.setLayout(layout)
        combobox.restart_required = restart
        combobox.label_text = text
        return widget
1033972
function widgetCell({
  col,
  row,
  width,
  height,
}) {
  return css({
    gridColumnStart: col + 1,
    gridColumnEnd: col + width + 1,
    gridRowStart: row + 1,
    gridRowEnd: row + height + 1,
  }).toString();
}
1166904
def OnInsertCols(self, event):
        """"""

        bbox = self.grid.selection.get_bbox()

        if bbox is None or bbox[1][1] is None:
            # Insert rows at cursor
            ins_point = self.grid.actions.cursor[1] - 1
            no_cols = 1
        else:
            # Insert at right edge of bounding box
            ins_point = bbox[0][1] - 1
            no_cols = self._get_no_rowscols(bbox)[1]

        with undo.group(_("Insert columns")):
            self.grid.actions.insert_cols(ins_point, no_cols)

        self.grid.GetTable().ResetView()

        # Update the default sized cell sizes
        self.grid.actions.zoom()

        event.Skip()
22609
def add_bigger_box(self):
        
        start1 = "width='"+str(int(self.molecule.molsize1))+"px' height='"+str(int(self.molecule.molsize2))+"px' >"
        start2 = "<rect style='opacity:1.0;fill:#FFFFFF;stroke:none' width='"+str(int(self.molecule.molsize1))+"' height='"+str(int(self.molecule.molsize2))+"' x='0' y='0'> </rect>"
        bigger_box ="width='100%' height='100%' viewbox='0 0 "+str(int(self.molecule.x_dim))+" "+str(int(self.molecule.y_dim))+"' > "
        big_box2= "<rect style='opacity:1.0;fill:white;stroke:none' width='"+str(int(self.molecule.x_dim))+"px' height='"+str(int(self.molecule.y_dim))+"px' x='0' y='0'> </rect> <g id='molecularDrawing' transform='translate("+str((self.molecule.x_dim-self.molecule.molsize1)/2)+","+str((self.molecule.y_dim-self.molecule.molsize2)/2)+")'>'<rect style='opacity:1.0;fill:#ffffff;stroke:none' width='"+str(self.molecule.molsize1)+"' height='"+str(self.molecule.molsize2)+"' x='0' y='0' /> "
        self.end_symbol = "</svg>"
        no_end_symbol = "</g>"
        #Make the lines in molecule drawing thicker to look better with the large plots
        linewidth1 = "stroke-width:2px"
        linewidth2 = "stroke-width:5px"
        self.change_lines_in_svg("molecule.svg", linewidth1,linewidth2)

        self.change_lines_in_svg("molecule.svg", start1, bigger_box)
        self.change_lines_in_svg("molecule.svg", start2, big_box2)
        self.change_lines_in_svg("molecule.svg", self.end_symbol, no_end_symbol)
        with open("molecule.svg","r") as f:
            lines = f.readlines()
            self.filestart = " ".join(map(str,lines[0:8]))
            self.draw_molecule ="".join(map(str,lines[8:]))
            f.close()
49340
def createPen(self, altStyle=None, altWidth=None):
        
        pen = self.configValue
        if pen is not None:

            style = self.findByNodePath('style').configValue
            if style is None and altStyle is not None:
                pen.setStyle(altStyle)

            width = self.findByNodePath('width').configValue
            if width == 0.0 and altWidth is not None:
                #logger.debug("Setting altWidth = {!r}".format(altWidth))
                pen.setWidthF(altWidth)

        return pen
58578
private void jComboBoxLineWidthActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBoxLineWidthActionPerformed
        float lineWidth;
        try {
            lineWidth = Float.parseFloat(jComboBoxLineWidth.getSelectedItem().toString());
        } catch (NumberFormatException ex) {
            lineWidth = 1.0f;
        }
        parent.getGraphPanelChart().getChartSettings().setLineWidth(lineWidth);
        refreshGraphPreview();
    }
115675
def _makeIndentFromWidth(self, width):
        
        if self._indenter.useTabs:
            tabCount, spaceCount = divmod(width, self._indenter.width)
            return ('\t' * tabCount) + (' ' * spaceCount)
        else:
            return ' ' * width
278088
def _createComboBoxes(self, row):
        
        tree = self.tree
        model = self.tree.model()
        self._setColumnCountForContents()

        for col, _ in enumerate(self._axisNames, self.COL_FIRST_COMBO):
            logger.debug("Adding combobox at ({}, {})".format(row, col))
            comboBox = QtWidgets.QComboBox()
            comboBox.setSizeAdjustPolicy(QtWidgets.QComboBox.AdjustToContents)
            comboBox.activated.connect(self._comboBoxActivated)
            self._comboBoxes.append(comboBox)

            #editor = LabeledWidget(QtWidgets.QLabel(comboLabel), comboBox)
            tree.setIndexWidget(model.index(row, col), comboBox)
1204088
def opt_width(self, width):
        
        if width != "auto":
            width = int(width)
        self.conf["width"] = width