Returns the mime data for dragging for this instance.
        
        :param      items | [<QtGui.QTreeWidgetItem>, ..]
517006
def mimeData(self, items):
        
        func = self.dataCollector()
        if func:
            return func(self, items)
        
        data = super(XTreeWidget, self).mimeData(items)
        
        # return defined custom data
        if len(items) == 1:
            try:
                dragdata = items[0].dragData()
            except AttributeError:
                return data
            
            if not data:
                data = QtCore.QMimeData()
            
            urls = []
            for format, value in dragdata.items():
                if format == 'url':
                    urls.append(QtCore.QUrl(value))
                else:
                    data.setData(format, QtCore.QByteArray(value))
            
            data.setUrls(urls)
            return data
        
        return data
999530
def itemize(data):
    
    if isinstance(data, dict):
        ret = {}
        for key in data:
            ret[key] = itemize(data[key])
        return ret
    elif isinstance(data, list):
        return {'item': [itemize(value) for value in data]}
    else:
        return data
1304278
function(items) {
            items = $.makeArray(items);

            for (var i = 0; i < items.length; i++) {
                var item = items[i];

                // Make sure this element doesn't belong to another dragger
                if ($.data(item, 'drag')) {
                    Garnish.log('Element was added to more than one dragger');
                    $.data(item, 'drag').removeItems(item);
                }

                // Add the item
                $.data(item, 'drag', this);

                // Add the listener
                this.addListener(item, 'mousedown', '_handleMouseDown');
            }

            this.$items = this.$items.add(items);
        }
1269128
def get(self, item_name):
		
		if self.prefix:
			item_name = self.prefix + self.seperator + item_name
		item_names = item_name.split(self.seperator)
		node = self._storage
		for item_name in item_names:
			node = node[item_name]
		return node
1251775
def OnMeasureItem(self, item):
        """"""

        item_name = self.GetItems()[item]
        return icons[item_name].GetHeight()
513872
def _getitem(item, i):
    
    if not isinstance(i, (tuple, list)):
        return item.get(i, _none)
    type_ = list if isinstance(item, list) else tuple
    return type_(item.get(j, _none) for j in i)
383240
def data(self, index, role):
        
        item = self.itemAt(index)
        if not item:
            return None
        d = item.declaration
        if role == Qt.DisplayRole:
            return d.text
        elif role == Qt.ToolTipRole:
            return d.tool_tip
        elif role == Qt.CheckStateRole and d.checkable:
            return d.checked and Qt.Checked or Qt.Unchecked
        elif role == Qt.DecorationRole and d.icon:
            return get_cached_qicon(d.icon)
        elif role == Qt.EditRole and d.editable:
            return d.text
        elif role == Qt.StatusTipRole:
            return d.status_tip
        elif role == Qt.TextAlignmentRole:
            h, v = d.text_alignment
            return TEXT_H_ALIGNMENTS[h] | TEXT_V_ALIGNMENTS[v]
        elif role == Qt.ForegroundRole and d.foreground:
            return get_cached_qcolor(d.foreground)
        elif role == Qt.BackgroundRole and d.background:
            return get_cached_qcolor(d.background)
        #elif role == Qt.SizeHintRole and d.minimum_size:
        #    return d.minimum_size

        return None
907695
def _ItemsToUrns(self, items):
    """"""
    for item in items:
      try:
        yield flow_export.CollectionItemToAff4Path(item, self.client_id)
      except flow_export.ItemNotExportableError:
        pass
1086213
def dragData(self, x=None, y=None):
        
        # look for specific drag information for this item
        first  = (x, y)
        second = (x, None)
        third  = (None, y)
        fourth = (None, None)
        
        for key in (first, second, third, fourth):
            data = self._dragData.get(key)
            if data:
                return data
        
        return None
1247065
def _listitemify(self, item):
        '''
        '''
        info_type = self.info_type if hasattr(self, 'info_type') else 'video'

        # Create ListItems for anything that is not already an instance of
        # ListItem
        if not hasattr(item, 'as_tuple'):
            if 'info_type' not in item.keys():
                item['info_type'] = info_type
            item = xbmcswift2.ListItem.from_dict(**item)
        return item
94691
def get_actions_from_items(self, items):
        """"""
        fromcursor_act = create_action(self, text=_('Go to cursor position'),
                                       icon=ima.icon('fromcursor'),
                                       triggered=self.go_to_cursor_position)
        fullpath_act = create_action(self, text=_('Show absolute path'),
                                     toggled=self.toggle_fullpath_mode)
        fullpath_act.setChecked(self.show_fullpath)
        allfiles_act = create_action(self, text=_('Show all files'),
                                     toggled=self.toggle_show_all_files)
        allfiles_act.setChecked(self.show_all_files)
        comment_act = create_action(self, text=_('Show special comments'),
                                    toggled=self.toggle_show_comments)
        comment_act.setChecked(self.show_comments)
        group_cells_act = create_action(self, text=_('Group code cells'),
                                        toggled=self.toggle_group_cells)
        group_cells_act.setChecked(self.group_cells)
        sort_files_alphabetically_act = create_action(
            self, text=_('Sort files alphabetically'),
            toggled=self.toggle_sort_files_alphabetically)
        sort_files_alphabetically_act.setChecked(
            self.sort_files_alphabetically)
        actions = [fullpath_act, allfiles_act, group_cells_act, comment_act,
                   sort_files_alphabetically_act, fromcursor_act]
        return actions
1366016
def exportTreeItem(self, sheet, cols, item):
        
        # export item information
        for c, col in enumerate(cols):
            data = unwrapVariant(item.data(Qt.EditRole, col))
            if data:
                sheet.write(self._currrow, c, nativestring(data))
            else:
                sheet.write(self._currrow, c, nativestring(item.text(col)))
        
        self._currrow += 1
        
        # export children as rows
        for c in range(item.childCount()):
            self.exportTreeItem(sheet, cols, item.child(c))
193100
def get_source_data_items(self, data_item: DataItem) -> typing.List[DataItem]:
        
        return [DataItem(data_item) for data_item in self._document_model.get_source_data_items(data_item._data_item)] if data_item else None
799406
def startDrag(self, dragData):
        
        # create the mime data
        mimeData = QMimeData()
        for key, value in dragData.items():
            mimeData.setData('application/x-%s' % key, wrapVariant(value))
        
        # create the drag instance
        drag = QDrag(self.scene().chart())
        drag.setMimeData(mimeData)
        drag.exec_()
590931
def get_item_data(self, item):
        """"""
        filename, line_number_str = get_item_user_text(item).split(self.SEP)
        return filename, int(line_number_str)
337531
def __item_data(self, model, index):
        """"""
        item = model.items[index]

        data = {
            "name": item.name,
            "data": item.data,
            "doc": getattr(item, "doc", None),
            "path": getattr(item, "path", None),
        }

        return data
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