Render widget tools button.
331865
protected function renderButtons()
    {
        // Box tools
        if ($this->buttonsTemplate !== null && !empty($this->boxTools)) {
            // Begin box tools
            echo Html::beginTag('div', ['class' => 'box-tools pull-right']);
            echo preg_replace_callback('/\\{([\w\-\/]+)\\}/', function ($matches) {
                $name = $matches[1];
                if (isset($this->boxTools[$name])) {
                    $label = isset($this->boxTools[$name]['label']) ? $this->boxTools[$name]['label'] : '';

                    $icon = isset($this->boxTools[$name]['icon']) ? Html::tag('i', '', ['class' => 'fa ' . $this->boxTools[$name]['icon']]) : '';
                    $label = $icon . ' ' . $label;
                    $this->boxTools[$name]['options']['class'] = isset($this->boxTools[$name]['options']['class']) ? 'btn btn-sm ' . $this->boxTools[$name]['options']['class'] : 'btn btn-sm';

                    return Html::button($label, $this->boxTools[$name]['options']);
                } else {
                    return '';
                }
            }, $this->buttonsTemplate);
            // End box tools
            echo Html::endTag('div');
        }
    }
1221335
def render(self, **kwargs):
        """"""
        for item in self._parent._children.values():
            if not isinstance(item, Layer) or not item.control:
                continue
            key = item.layer_name
            if not item.overlay:
                self.base_layers[key] = item.get_name()
                if len(self.base_layers) > 1:
                    self.layers_untoggle[key] = item.get_name()
            else:
                self.overlays[key] = item.get_name()
                if not item.show:
                    self.layers_untoggle[key] = item.get_name()
        super(LayerControl, self).render()
938257
protected function renderTools()
    {
        $tools = '';
        if($this->collapseButton !== false){
            $tools .= '<a class="collapse-link"><i class="fa fa-chevron-up"></i></a>';
        }
        if ($this->closeButton !== false) {
            $tools .= '<a class="close-link"><i class="fa fa-times"></i></a>';
        }
        if (!empty($tools)) {
            return Html::tag('div', $tools, ['class' => 'ibox-tools']);
        } else {
            return null;
        }
    }
439274
def on_directory_button_tool_clicked(self):
        """"""
        # noinspection PyCallByClass,PyTypeChecker
        # set up parameter from dialog
        input_path = self.layer.currentLayer().source()
        input_directory, self.output_filename = os.path.split(input_path)
        file_extension = os.path.splitext(self.output_filename)[1]
        self.output_filename = os.path.splitext(self.output_filename)[0]
        # show Qt file directory dialog
        output_path, __ = QtWidgets.QFileDialog.getSaveFileName(
            self,
            self.tr('Output file'),
            '%s_multi_buffer%s' % (
                os.path.join(input_directory, self.output_filename),
                file_extension),
            'GeoJSON (*.geojson);;Shapefile (*.shp)')
        # set selected path to the dialog
        self.output_form.setText(output_path)
1032881
def render(self):
		
		self.widget.attrs = {
			k: v for k, v in self.attrs.items() if k[0] != "_"
		}
		self.set_input()

		if not self.attrs.get("_no_wrapper"):
			self.set_label()
			self.set_help()
			self.set_errors()
			self.set_classes()
			self.set_icon()  # Must be the bottom-most setter

		self.values["class"] = pad(" ".join(self.values["class"])).lstrip()
		result = mark_safe(FIELD_WRAPPER % self.values)
		self.widget.attrs = self.attrs  # Re-assign variables
		return result
111112
def render_widgets(kb_app: kb,
                   sphinx_app: Sphinx,
                   doctree: doctree,
                   fromdocname: str,
                   ):
    

    builder: StandaloneHTMLBuilder = sphinx_app.builder

    for node in doctree.traverse(widget):
        # Render the output
        w = sphinx_app.env.widgets.get(node.name)
        context = builder.globalcontext.copy()

        # Add in certain globals
        context['resources'] = sphinx_app.env.resources
        context['references'] = sphinx_app.env.references
        output = w.render(sphinx_app, context)

        # Put the output into the node contents
        listing = [nodes.raw('', output, format='html')]
        node.replace_self(listing)
861009
def rebuild( self ):
        
        self.setUpdatesEnabled(False)
        
        # sync up the toolbuttons with our actions
        actions = self._actionGroup.actions()
        btns    = self.findChildren(QToolButton)
        horiz   = self.direction() in (QBoxLayout.LeftToRight, 
                                       QBoxLayout.RightToLeft)
        
        # remove unnecessary buttons
        if len(actions) < len(btns):
            rem_btns = btns[len(actions)-1:]
            btns = btns[:len(actions)]
            
            for btn in rem_btns:
                btn.close()
                btn.setParent(None)
                btn.deleteLater()
        
        # create new buttons
        elif len(btns) < len(actions):
            for i in range(len(btns), len(actions)):
                btn = QToolButton(self)
                btn.setAutoFillBackground(True)
                btns.append(btn)
                self.layout().addWidget(btn)
                
                btn.clicked.connect(self.emitClicked)
        
        # determine coloring options
        palette      = self.palette()
        checked      = palette.color(palette.Highlight)
        checked_fg   = palette.color(palette.HighlightedText)
        unchecked    = palette.color(palette.Button)
        unchecked_fg = palette.color(palette.ButtonText)
        border       = palette.color(palette.Mid)
        
        # define the stylesheet options
        options = {}
        options['top_left_radius']      = 0
        options['top_right_radius']     = 0
        options['bot_left_radius']      = 0
        options['bot_right_radius']     = 0
        options['border_color']         = border.name()
        options['checked_fg']           = checked_fg.name()
        options['checked_bg']           = checked.name()
        options['checked_bg_alt']       = checked.darker(120).name()
        options['unchecked_fg']         = unchecked_fg.name()
        options['unchecked_bg']         = unchecked.name()
        options['unchecked_bg_alt']     = unchecked.darker(120).name()
        options['padding_top']          = 1
        options['padding_bottom']       = 1
        options['padding_left']         = 1
        options['padding_right']        = 1
        
        if horiz:
            options['x1'] = 0
            options['y1'] = 0
            options['x2'] = 0
            options['y2'] = 1
        else:
            options['x1'] = 0
            options['y1'] = 0
            options['x2'] = 1
            options['y2'] = 1
        
        # sync up the actions and buttons
        count = len(actions)
        palette = self.palette()
        font = self.font()
        for i, action in enumerate(actions):
            btn = btns[i]
            
            # assign the action for this button
            if btn.defaultAction() != action:
                # clear out any existing actions
                for act in btn.actions():
                    btn.removeAction(act)
                
                # assign the given action
                btn.setDefaultAction(action)
            
            options['top_left_radius']  = 1
            options['bot_left_radius']  = 1
            options['top_right_radius'] = 1
            options['bot_right_radius'] = 1
            
            if horiz:
                options['padding_left']     = self._padding
                options['padding_right']    = self._padding
            else:
                options['padding_top']      = self._padding
                options['padding_bottom']   = self._padding
            
            if not i:
                if horiz:
                    options['top_left_radius'] = self.cornerRadius()
                    options['bot_left_radius'] = self.cornerRadius()
                    options['padding_left']    += self.cornerRadius() / 3.0
                else:
                    options['top_left_radius'] = self.cornerRadius()
                    options['top_right_radius'] = self.cornerRadius()
                    options['padding_top']     += self.cornerRadius() / 3.0
                    
            if i == count - 1:
                if horiz:
                    options['top_right_radius'] = self.cornerRadius()
                    options['bot_right_radius'] = self.cornerRadius()
                    options['padding_right']    += self.cornerRadius() / 3.0
                else:
                    options['bot_left_radius']  = self.cornerRadius()
                    options['bot_right_radius'] = self.cornerRadius()
                    options['padding_bottom']   += self.cornerRadius() / 3.0
            
            btn.setFont(font)
            btn.setPalette(palette)
            btn.setStyleSheet(TOOLBUTTON_STYLE % options)
            if horiz:
                btn.setSizePolicy(QSizePolicy.Expanding, QSizePolicy.Preferred)
            else:
                btn.setSizePolicy(QSizePolicy.Preferred, QSizePolicy.Expanding)
        
        self.setUpdatesEnabled(True)
1229232
public function renderWidget()
    {
        $items = [];
        foreach ($this->items as $item) {
            $appkey = $this->getShareKey($item);
            $name = self::t(ArrayHelper::getValue($this->shareMapping, $item));
            $icon = Html::tag('i', '', ['class' => "fa fa-{$this->icon_size} fa-{$item} share-{$item}", 'aria-hidden' => 'true']);
            $link = Html::a($icon, 'javascript:void(0);', [
                'data' => ['toggle' => 'tooltip', 'placement' => 'top', 'original-title' => self::t('Share to {name}', ['name' => $name])]
            ]);
            $items[] = Html::tag('li', $link, ['data' => ['network' => $item, 'appkey' => $appkey]]);
        }
        return Html::tag('ul', implode("\n", $items), $this->itemOptions);
    }
852046
private function renderButton()
    {
        $this->params = Json::encode([
            'btnName' => $this->options['id'],
            'cookieName' => $this->cookie['name'],
            'cookieValue' => addslashes($this->getHashedCookieValue($this->cookie['value'])),
            'cookieOptions' => isset($this->cookie['options']) ? $this->cookie['options'] : null,
        ]);

        if($this->cookie($this->cookie['name'])) {
            Html::addCssClass($this->options, 'active');
        }

        echo Button::widget([
            'label' => $this->encodeLabel ? Html::encode($this->label) : $this->label,
            'encodeLabel' => $this->encodeLabel,
            'options' => ArrayHelper::merge(['data-toggle' => 'button'], $this->options),
        ]);
    }
1161840
protected function renderCustomTools($tools)
    {
        if ($this->form->isCreating()) {
            $this->disableView();
            $this->disableDelete();
        }

        if (empty($tools)) {
            return '';
        }

        return $tools->map(function ($tool) {
            if ($tool instanceof Renderable) {
                return $tool->render();
            }

            if ($tool instanceof Htmlable) {
                return $tool->toHtml();
            }

            return (string) $tool;
        })->implode(' ');
    }
136236
protected function renderButtons()
    {
        $buttons = [];
        foreach ($this->buttons as $button) {
            if (is_array($button)) {
                $visible = ArrayHelper::remove($button, 'visible', true);
                if ($visible === false) {
                    continue;
                }

                $button['view'] = $this->getView();
                if (!isset($button['encodeLabel'])) {
                    $button['encodeLabel'] = $this->encodeLabels;
                }
                if (!isset($button['options'], $button['options']['type'])) {
                    ArrayHelper::setValue($button, 'options.type', 'button');
                }
                $buttons[] = Button::widget($button);
            } else {
                $buttons[] = $button;
            }
        }

        return implode("\n", $buttons);
    }
1255979
def before_render(self):
        
        # Render the Add button if the user has the AddClient permission
        if check_permission(AddClient, self.context):
            self.context_actions[_("Add")] = {
                "url": "createObject?type_name=Client",
                "icon": "++resource++bika.lims.images/add.png"
            }

        # Display a checkbox next to each client in the list if the user has
        # rights for ModifyPortalContent
        self.show_select_column = check_permission(ModifyPortalContent,
                                                   self.context)
318168
def OnWidgetToolbarToggle(self, event):
        """"""

        self.main_window.widget_toolbar.SetGripperVisible(True)
        widget_toolbar_info = self.main_window._mgr.GetPane("widget_toolbar")

        self._toggle_pane(widget_toolbar_info)

        event.Skip()
464354
def action2button(action, autoraise=True, text_beside_icon=False, parent=None):
    """"""
    if parent is None:
        parent = action.parent()
    button = QToolButton(parent)
    button.setDefaultAction(action)
    button.setAutoRaise(autoraise)
    if text_beside_icon:
        button.setToolButtonStyle(Qt.ToolButtonTextBesideIcon)
    return button
782335
def display(self, tool):
        
        self._tools.append(tool)
        self._justDisplay(tool)
297922
def create_button(self, widget):
        
        btn = QtGui.QToolButton(self)
        btn.setIconSize(QtCore.QSize(self._iconw, self._iconh))
        self.update_button(btn, widget)
        return btn
751578
def RenderWidget(self):
        """"""
        t = self.type
        if t == int:
            ret = QSpinBox()
            ret.setMaximum(999999999)
            ret.setValue(self.value)
        elif t == float:
            ret = QLineEdit()
            ret.setText(str(self.value))
        elif t == bool:
            ret = QCheckBox()
            ret.setChecked(self.value)
        else:  # str, list left
            ret = QLineEdit()
            ret.setText(str(self.value))

        if self.toolTip is not None:
            ret.setToolTip(self.toolTip)

        self.widget = ret
        return ret