returns collected Leonardo Widgets

    if not declared in settings is used __subclasses__
    which not supports widget subclassing
422408
def get_all_widget_classes():
    
    from leonardo.module.web.models import Widget
    _widgets = getattr(settings,
                       'WIDGETS', Widget.__subclasses__())
    widgets = []
    if isinstance(_widgets, dict):
        for group, widget_cls in six.iteritems(_widgets):
            widgets.extend(widget_cls)
    elif isinstance(_widgets, list):
        widgets = _widgets
    return load_widget_classes(widgets)
851607
def __extract_autoWidgets(self):
        """"""
        if self.__autoWidgets_calculated: return

        if self._builder is not None:
            for wid in self._builder.get_objects():
                # General workaround for issue
                # https://bugzilla.gnome.org/show_bug.cgi?id=607492
                try:
                    name = Gtk.Buildable.get_name(wid)
                except TypeError:
                    continue

                if name in self.autoWidgets and self.autoWidgets[name] != wid:
                    raise ViewError("Widget '%s' in builder also found in "
                        "glade specification" % name)

                self.autoWidgets[name] = wid

        self.__autowidgets_calculated = True
1089899
def _get_list_widget(
        self,
        filters,
        actions=None,
        order_column="",
        order_direction="",
        page=None,
        page_size=None,
        widgets=None,
        **args
    ):

        
        widgets = widgets or {}
        actions = actions or self.actions
        page_size = page_size or self.page_size
        if not order_column and self.base_order:
            order_column, order_direction = self.base_order
        joined_filters = filters.get_joined_filters(self._base_filters)
        count, lst = self.datamodel.query(
            joined_filters,
            order_column,
            order_direction,
            page=page,
            page_size=page_size,
        )
        pks = self.datamodel.get_keys(lst)

        # serialize composite pks
        pks = [self._serialize_pk_if_composite(pk) for pk in pks]

        widgets["list"] = self.list_widget(
            label_columns=self.label_columns,
            include_columns=self.list_columns,
            value_columns=self.datamodel.get_values(lst, self.list_columns),
            order_columns=self.order_columns,
            formatters_columns=self.formatters_columns,
            page=page,
            page_size=page_size,
            count=count,
            pks=pks,
            actions=actions,
            filters=filters,
            modelview_name=self.__class__.__name__,
        )
        return widgets
1244853
def items(self):
        
        output = []
        for i in xrange(self.layout().count()):
            item = self.layout().itemAt(i)
            try:
                widget = item.widget()
            except AttributeError:
                break

            if isinstance(widget, XViewPanelItem):
                output.append(widget)
            else:
                break
        return output
903892
def widget_from_tuple(o):
        """"""
        if _matches(o, (Real, Real)):
            min, max, value = _get_min_max_value(o[0], o[1])
            if all(isinstance(_, Integral) for _ in o):
                cls = IntSlider
            else:
                cls = FloatSlider
            return cls(value=value, min=min, max=max)
        elif _matches(o, (Real, Real, Real)):
            step = o[2]
            if step <= 0:
                raise ValueError("step must be >= 0, not %r" % step)
            min, max, value = _get_min_max_value(o[0], o[1], step=step)
            if all(isinstance(_, Integral) for _ in o):
                cls = IntSlider
            else:
                cls = FloatSlider
            return cls(value=value, min=min, max=max, step=step)
306798
def set_widgets(self):
        """"""
        # First, list available layers in order to check if there are
        # any available layers. Note This will be repeated in
        # set_widgets_step_fc_hazlayer_from_canvas because we need
        # to list them again after coming back from the Keyword Wizard.
        self.parent.step_fc_hazlayer_from_canvas.\
            list_compatible_canvas_layers()
        lst_wdg = self.parent.step_fc_hazlayer_from_canvas.lstCanvasHazLayers
        if lst_wdg.count():
            wizard_name = self.parent.keyword_creation_wizard_name
            self.rbHazLayerFromCanvas.setText(tr(
                'I would like to use a hazard layer already loaded in QGIS\n'
                '(launches the {wizard_name} for hazard if needed)'
            ).format(wizard_name=wizard_name))
            self.rbHazLayerFromCanvas.setEnabled(True)
            self.rbHazLayerFromCanvas.click()
        else:
            self.rbHazLayerFromCanvas.setText(tr(
                'I would like to use a hazard layer already loaded in QGIS\n'
                '(no suitable layers found)'))
            self.rbHazLayerFromCanvas.setEnabled(False)
            self.rbHazLayerFromBrowser.click()

        # Set the memo labels on this and next (hazard) steps
        (hazard, _, hazard_constraints, _) = self.\
            parent.selected_impact_function_constraints()

        layer_geometry = hazard_constraints['name']

        text = (select_hazard_origin_question % (
            layer_geometry, hazard['name']))
        self.lblSelectHazLayerOriginType.setText(text)

        text = (select_hazlayer_from_canvas_question % (
            layer_geometry, hazard['name']))
        self.parent.step_fc_hazlayer_from_canvas.\
            lblSelectHazardLayer.setText(text)

        text = (select_hazlayer_from_browser_question % (
            layer_geometry, hazard['name']))
        self.parent.step_fc_hazlayer_from_browser.\
            lblSelectBrowserHazLayer.setText(text)

        # Set icon
        icon_path = get_image_path(hazard)
        self.lblIconIFCWHazardOrigin.setPixmap(QPixmap(icon_path))
1277334
private String getWidgetName(String settingsWidget) {

        if (WIDGET_MAPPINGS.containsKey(settingsWidget)) {
            return WIDGET_MAPPINGS.get(settingsWidget).getName();
        } else {
            return CmsInputWidget.class.getName();
        }
    }
967824
def get_widget(self, index=None, path=None, tabs=None):
        
        if (index and tabs) or (path and tabs):
            return tabs.widget(index)
        elif self.plugin:
            return self.get_plugin_tabwidget(self.plugin).currentWidget()
        else:
            return self.plugins_tabs[0][0].currentWidget()
475274
def get_widget_css_class(self, attrs):
        """"""
        size_class = 'size-{0}'.format(self.num_inputs)

        if 'class' in attrs:
            attrs['class'] += ' {0}'.format(size_class)
        else:
            attrs['class'] = size_class
159321
def parent_widget(self):
        
        parent = self.parent()
        if parent is not None and isinstance(parent, QtGraphicsItem):
            return parent.widget
557721
def GetClassesByArtifact(cls, artifact_name):
    """"""
    return [
        cls.classes[c]
        for c in cls.classes
        if artifact_name in cls.classes[c].supported_artifacts
    ]
957801
def update_widget_attrs(self, bound_field, attrs):
        
        if bound_field.field.has_subwidgets() is False:
            widget_classes = getattr(self, 'widget_css_classes', None)
            if widget_classes:
                if 'class' in attrs:
                    attrs['class'] += ' ' + widget_classes
                else:
                    attrs.update({'class': widget_classes})
        return attrs
998679
def get_collection_for_cls(self, cls):
        
        if cls not in self.classes:
            if issubclass(cls, Document) and cls not in self.classes and cls not in self.deprecated_classes:
                self.autoregister(cls)
            else:
                raise AttributeError("Unknown object type: %s" % cls.__name__)
        collection = self.classes[cls]['collection']
        return collection
460245
function getWidgets()
    {
        $return = [];
        foreach (array_keys($this->__widgets) as $region)
            $return[$region] = $this->getRegionWidgets($region);

        return $return;
    }
1048571
def widget_attrs(self, widget):
        
        attrs = {}
        if getattr(self, "min_value", None) is not None:
            attrs['min'] = self.min_value
        if getattr(self, "max_value", None) is not None:
            attrs['max'] = self.max_value
        return attrs
504329
def get_widget(self, request):
        
        return self._update_widget_choices(self.field.formfield(widget=RestrictedSelectWidget).widget)
1016275
def propertyWidgetMap(self):
        
        out = {}
        scaffold = self.scaffold()
        
        # initialize the scaffold properties
        for widget in self.findChildren(QtGui.QWidget):
            propname = unwrapVariant(widget.property('propertyName'))
            if not propname: continue
            
            prop = scaffold.property(propname)
            if not prop: continue
            
            out[prop] = widget

        return out