Return an Item (e.g. StateView) for each model (e.g. StateModel) in the current selection
970072
def _get_selected_items(self):
        
        return set(self.canvas.get_view_for_model(model) for model in self._selection)
1314300
def get_visible_items(self):
        """"""
        items = []
        iterator = QTreeWidgetItemIterator(self)
        while iterator.value():
            item = iterator.value()
            if not item.isHidden():
                if item.parent():
                    if item.parent().isExpanded():
                        items.append(item)
                else:
                    items.append(item)
            iterator += 1
        return items
52786
def item_for widget
      each do |e|
        if e.is_a? Item
          if e.widget == widget
            return e
          end
        end
      end
      return nil
    end
1060498
def viewitems(obj, **kwargs):
    
    func = getattr(obj, "viewitems", None)
    if not func:
        func = obj.items
    return func(**kwargs)
400383
function() {
        var model = scope.modelArray;
        if (!model) {
          var selection = sfPath.parse(attrs.sfNewArray);
          model = [];
          sel(selection, scope, model);
          scope.modelArray = model;
        }
        return model;
      }
87010
def choices(self, changelist):
        
        show_all = self.used_parameters.get(self.parameter_name) == "1"
        return (
            {
                'display': _('Current Configuration'),
                'selected': not show_all,
                'query_string': changelist.get_query_string({}, [self.parameter_name]),
            },
            {
                'display': _('All (Show History)'),
                'selected': show_all,
                'query_string': changelist.get_query_string({self.parameter_name: "1"}, []),
            }
        )
298845
def items(self):
        """"""
        if self.scraper.current_item is not self:
            self._move_here()

        if self._items is None:
            self._items = ItemList()
            self._items.scraper = self.scraper
            self._items.collection = self
            for i in self.scraper._fetch_itemslist(self):
                i.parent = self
                if i.type == TYPE_DATASET and i.dialect is None:
                    i.dialect = self.scraper.dialect
                self._items.append(i)
        return self._items
1080958
def findItemsByState( self, state ):
        
        out = []
        if ( self.hasRecordState(state) ):
            out.append(self)
        
        for c in range(self.childCount()):
            out += self.child(c).findItemsByState(state)
        
        return out
909508
def get_model(app, model):
    """"""
    if 'get_model' not in _LAZY_LOADS:
        _lazy_load_get_model()

    _get_model = _LAZY_LOADS['get_model']
    return _get_model(app, model)
208665
function(current, $scope) {
            var $selfRef = this;

            var selectables = $selfRef._tabItems($scope);
            var nextIndex = 0;
            if ($(current).length === 1){
                var currentIndex = selectables.index(current);
                if (currentIndex + 1 < selectables.length) {
                    nextIndex = currentIndex + 1;
                }
            }
            return selectables.eq(nextIndex);
        }
364283
def get_selected_object(self):
        
        model, paths = self.tree_view.get_selection().get_selected_rows()
        if len(paths) == 1:
            return self.tree_store.get_iter(paths[0]), paths[0]
        else:
            return None, paths
1297239
def toggleModelIndex(self, modelIndex):
        
        if not self.isCheckable():
            return
            
        item = self.model().item(modelIndex.row())
        if item.checkState() == Qt.Checked:
            state = Qt.Unchecked
        else:
            state = Qt.Checked
        
        item.setCheckState(state)
585788
def currentItem( self ):
        
        model = self.navigationModel()
        if ( not model ):
            return None
        
        return model.itemByPath(self.text())
1326827
def as_select(self, _items=None, **kwargs):
        
        attrs = self.extra.copy()
        attrs.update(kwargs)
        attrs['name'] = self.name
        if not self.optional:
            attrs['required'] = True
        html = [u'<select %s>' % get_html_attrs(attrs)]
        values = [self.to_string(**attrs)] or []
        items = _items or self.items

        for item in items:
            if isinstance(item, list):
                html.extend(self._render_optgroup(item, values))
            else:
                html.append(self._render_option(item, values))
        html.append(u'</select>')

        return Markup('\n'.join(html))
1267673
def getCurrentItem(self): # TODO: rename? getCurrentItemAndIndex? getCurrentTuple? getCurrent?
        
        currentIndex = self.getRowCurrentIndex()
        currentItem = self.model().getItem(currentIndex)
        return currentItem, currentIndex
511329
def get_state_machine_selection(self):
        
        if self._selected_sm_model:
            return self._selected_sm_model.selection, self._selected_sm_model.selection.states
        else:
            return None, set()
384896
def current_set(self):
        
        assert self.model.KEY_FIELDS != (), "Just use model.current() if there are no KEY_FIELDS"
        return self.get_queryset().filter(
            pk__in=self._current_ids_subquery()
        ).annotate(
            is_active=models.Value(1, output_field=models.IntegerField())
        )