Shows a menu but limits the number of entries shown at a time.
    Functionally equivalent to `show_menu()` with the `limit` parameter set.
353196
def show_limit(entries, **kwargs):
    """"""
    limit = kwargs.pop('limit', 5)
    if limit <= 0:
        return show_menu(entries, **kwargs)
    istart = 0 # Index of group start.
    iend = limit # Index of group end.
    dft = kwargs.pop('dft', None)
    if type(dft) == int:
        dft = str(dft)
    while True:
        if iend > len(entries):
            iend = len(entries)
            istart = iend - limit
        if istart < 0:
            istart = 0
            iend = limit
        unext = len(entries) - iend # Number of next entries.
        uprev = istart # Number of previous entries.
        nnext = "" # Name of 'next' menu entry.
        nprev = "" # Name of 'prev' menu entry.
        dnext = "" # Description of 'next' menu entry.
        dprev = "" # Description of 'prev' menu entry.
        group = copy.deepcopy(entries[istart:iend])
        names = [i.name for i in group]
        if unext > 0:
            for i in ["n", "N", "next", "NEXT", "->", ">>", ">>>"]:
                if i not in names:
                    nnext = i
                    dnext = "Next %u of %u entries" % (unext, len(entries))
                    group.append(MenuEntry(nnext, dnext, None, None, None))
                    names.append("n")
                    break
        if uprev > 0:
            for i in ["p", "P", "prev", "PREV", "<-", "<<", "<<<"]:
                if i not in names:
                    nprev = i
                    dprev = "Previous %u of %u entries" % (uprev, len(entries))
                    group.append(MenuEntry(nprev, dprev, None, None, None))
                    names.append("p")
                    break
        tmpdft = None
        if dft != None:
            if dft not in names:
                if "n" in names:
                    tmpdft = "n"
            else:
                tmpdft = dft
        result = show_menu(group, dft=tmpdft, **kwargs)
        if result == nnext or result == dnext:
            istart += limit
            iend += limit
        elif result == nprev or result == dprev:
            istart -= limit
            iend -= limit
        else:
            return result
1253005
def limit(self, num):
        
        jdf = self._jdf.limit(num)
        return DataFrame(jdf, self.sql_ctx)
1254320
def preview(self, limit=None, width=None):
        
        heading = self.heading
        rel = self.proj(*heading.non_blobs)
        if limit is None:
            limit = config['display.limit']
        if width is None:
            width = config['display.width']
        tuples = rel.fetch(limit=limit+1, format="array")
        has_more = len(tuples) > limit
        tuples = tuples[:limit]
        columns = heading.names
        widths = {f: min(max([len(f)] +
            [len(str(e)) for e in tuples[f]] if f in tuples.dtype.names else [len('=BLOB=')]) + 4, width) for f in columns}
        templates = {f: '%%-%d.%ds' % (widths[f], widths[f]) for f in columns}
        return (
            ' '.join([templates[f] % ('*' + f if f in rel.primary_key else f) for f in columns]) + '\n' +
            ' '.join(['+' + '-' * (widths[column] - 2) + '+' for column in columns]) + '\n' +
            '\n'.join(' '.join(templates[f] % (tup[f] if f in tup.dtype.names else '=BLOB=')
                for f in columns) for tup in tuples) +
            ('\n   ...\n' if has_more else '\n') +
            (' (Total: %d)\n' % len(rel) if config['display.show_tuple_count'] else ''))
600613
def sort_menus(c):
        
        for name in c.items:
            if not c.sorted[name]:
                c.items[name].sort(key=lambda x: x.weight)
                c.sorted[name] = True
1282576
def showOptionsMenu(self):
        
        point        = QPoint(0, self._optionsButton.height())
        global_point = self._optionsButton.mapToGlobal(point)
        
        # prompt the custom context menu
        if self.optionsMenuPolicy() == Qt.CustomContextMenu:
            if not self.signalsBlocked():
                self.optionsMenuRequested.emit(global_point)
            return
        
        # use the default context menu
        menu = XViewProfileManagerMenu(self)
        menu.exec_(global_point)
257978
def _showItemContextMenu(self, item, point, col):
        """"""
        self._startOrStopEditing()
        menu = getattr(item, '_menu', None)
        if menu:
            # self._current_item tells callbacks what item the menu was referring to
            self._current_item = item
            self.clearSelection()
            self.setItemSelected(item, True)
            menu.exec_(point)
        else:
            self._current_item = None
926992
def select_page(self, limit, offset=0, **kwargs):
        
        start = offset
        while True:
            result = self.select(limit=[start, limit], **kwargs)
            start += limit
            if result:
                yield result
            else:
                break
            if self.debug:
                break
404782
def _create_menu(self, items):
        
        menu = Gtk.Menu()
        self._create_menu_items(menu, items)
        return menu
761754
def showMenu( self ):
        
        item = self.uiMenuTREE.currentItem()
        
        menu = QMenu(self)
        act = menu.addAction('Add Menu...')
        act.setIcon(QIcon(projexui.resources.find('img/folder.png')))
        act.triggered.connect(self.createMenu)
        
        if ( item and item.data(0, Qt.UserRole) == 'menu' ):
            act = menu.addAction('Rename Menu...')
            ico = QIcon(projexui.resources.find('img/edit.png'))
            act.setIcon(ico)
            act.triggered.connect(self.renameMenu)
        
        act = menu.addAction('Add Separator')
        act.setIcon(QIcon(projexui.resources.find('img/ui/splitter.png')))
        act.triggered.connect(self.createSeparator)
        
        menu.addSeparator()
        
        act = menu.addAction('Remove Item')
        act.setIcon(QIcon(projexui.resources.find('img/remove.png')))
        act.triggered.connect(self.removeItem)
        act.setEnabled(item is not None)
        
        menu.exec_(QCursor.pos())
1015976
def sub_menu(self):
        
        submenu = gtk.Menu()
        self.start = gtk.ImageMenuItem("Start")
        self.stop = gtk.ImageMenuItem("Stop")
        self.restart = gtk.ImageMenuItem("Restart")
        self.status = gtk.ImageMenuItem("Status")

        self.start.show()
        self.stop.show()
        self.restart.show()
        self.status.show()

        img_Start = gtk.image_new_from_stock(gtk.STOCK_MEDIA_PLAY,
                                             gtk.ICON_SIZE_MENU)
        img_Start.show()
        self.start.set_image(img_Start)

        img_Stop = gtk.image_new_from_stock(gtk.STOCK_STOP,
                                            gtk.ICON_SIZE_MENU)
        img_Stop.show()
        self.stop.set_image(img_Stop)

        img_Restart = gtk.image_new_from_stock(gtk.STOCK_REFRESH,
                                               gtk.ICON_SIZE_MENU)
        img_Restart.show()
        self.restart.set_image(img_Restart)

        img_Status = gtk.image_new_from_stock(gtk.STOCK_DIALOG_QUESTION,
                                              gtk.ICON_SIZE_MENU)
        img_Status.show()
        self.status.set_image(img_Status)

        submenu.append(self.start)
        submenu.append(self.stop)
        submenu.append(self.restart)
        submenu.append(self.status)

        self.daemon = gtk.ImageMenuItem("Daemon")
        self.img_daemon = gtk.image_new_from_stock(self.daemon_STOCK,
                                                   gtk.ICON_SIZE_MENU)
        self.img_daemon.show()
        self.daemon.set_submenu(submenu)
1012139
public function display()
	{
		if (count($this->entries) > 0) {
			$p_tag = new SwatHtmlTag('p');
			$p_tag->id = $this->id;
			$p_tag->class = 'demo-documentation-menu-bar';
			$p_tag->open();

			echo '<span class="menutitle">';
			echo Swat::ngettext('Documentation Link', 'Documentation Links',
				count($this->entries));

			echo '</span>: ';

			$first = true;
			foreach ($this->entries as $class) {
				if (!$first) echo ', ';
				$first = false;
				echo '<a href="http://docs.silverorange.com/swat/'.
					strtolower($class).'.html">'.$class.'</a>';
			}

			$p_tag->close();
		}
	}
628211
def limit(self, limit: int) -> "QuerySet":
        
        queryset = self._clone()
        queryset._limit = limit
        return queryset
1350426
def showHeaderMenu( self, pos):
        
        header = self.header()
        index  = header.logicalIndexAt(pos)
        self._headerIndex = index
        
        # show a pre-set menu
        if self._headerMenu:
            menu = self._headerMenu
        else:
            menu = self.createHeaderMenu(index)
        
        # determine the point to show the menu from
        if pos is not None:
            point = header.mapToGlobal(pos)
        else:
            point = QtGui.QCursor.pos()
        
        self.headerMenuAboutToShow.emit(menu, index)
        menu.exec_(point)
830260
def section_menu(
    context, show_section_root=True, show_multiple_levels=True,
    apply_active_classes=True, allow_repeating_parents=True,
    max_levels=settings.DEFAULT_SECTION_MENU_MAX_LEVELS,
    template='', sub_menu_template='', sub_menu_templates=None,
    use_specific=settings.DEFAULT_SECTION_MENU_USE_SPECIFIC,
    use_absolute_page_urls=False, add_sub_menus_inline=None, **kwargs
):
    """"""
    validate_supplied_values('section_menu', max_levels=max_levels,
                             use_specific=use_specific)

    if not show_multiple_levels:
        max_levels = 1

    menu_class = settings.objects.SECTION_MENU_CLASS
    return menu_class.render_from_tag(
        context=context,
        max_levels=max_levels,
        use_specific=use_specific,
        apply_active_classes=apply_active_classes,
        allow_repeating_parents=allow_repeating_parents,
        use_absolute_page_urls=use_absolute_page_urls,
        add_sub_menus_inline=add_sub_menus_inline,
        template_name=template,
        sub_menu_template_name=sub_menu_template,
        sub_menu_template_names=split_if_string(sub_menu_templates),
        show_section_root=show_section_root,
        **kwargs
    )
1005069
def _append(self, menu):
        ''''''
        menu.Append(self.id(), self.name, self.description)
307861
def set_current_limit(self, value, channel=1):
        
        cmd = "I%d %f" % (channel, value)
        self.write(cmd)
1164740
def persistent_menu(menu):
    
    if len(menu) > 3:
        raise Invalid('menu should not exceed 3 call to actions')

    if any(len(item['call_to_actions']) > 5 for item in menu if item['type'] == 'nested'):
        raise Invalid('call_to_actions is limited to 5 for sub-levels')

    for item in menu:
        if len(item['title']) > 30:
            raise Invalid('menu item title should not exceed 30 characters')

        if item['type'] == 'postback' and len(item['payload']) > 1000:
            raise Invalid('menu item payload should not exceed 1000 characters')