get menu object and display it for editing
13985
def edit
      @menu = Menu.find(params[:id])

      # add breadcrumb and set title
      add_breadcrumb I18n.t("controllers.admin.menus.edit.breadcrumb", menu_name: @menu.name)
      set_title(I18n.t("controllers.admin.menus.edit.title", menu_name: @menu.name))
    end
921466
def menu():
    
    root = MenuItem('')

    for mod in droplet.modules():
        if mod.installed:
            module_path = mod.__class__.__module__.rsplit('.', 1)[0]
            menu = import_module(module_path + '.menu')
            if menu:
                menu.menu(root)

    return root
1056704
def get_menu(self, name):
        
        if self.menubar is None:
            raise ValueError("No menu bar configured")
        return self.menubar.get_menu(name)
696576
def get_context_menu(self):
        
        mnu = QtWidgets.QMenu()
        mnu.addActions(self._actions)
        mnu.addSeparator()
        for menu in self._menus:
            mnu.addMenu(menu)
        return mnu
43187
def on_select_menuitem(self, event, grid, row, col, selection):
        
        if self.grid.changes:  # if user selects a menuitem, that is an edit
            self.grid.changes.add(row)
        else:
            self.grid.changes = {row}

        item_id = event.GetId()
        item = event.EventObject.FindItemById(item_id)
        label = item.Label
        cell_value = grid.GetCellValue(row, col)
        if str(label) == "CLEAR cell of all values":
            label = ""

        col_label = grid.GetColLabelValue(col).strip('\nEDIT ALL').strip('**')
        if col_label in self.colon_delimited_lst and label:
            if not label.lower() in cell_value.lower():
                label += (":" + cell_value).rstrip(':')
            else:
                label = cell_value

        if self.selected_col and self.selected_col == col:
            for row in range(self.grid.GetNumberRows()):
                grid.SetCellValue(row, col, label)
                if self.grid.changes:
                    self.grid.changes.add(row)
                else:
                    self.grid.changes = {row}

                #self.selected_col = None
        else:
            grid.SetCellValue(row, col, label)

        if selection:
            for cell in selection:
                row = cell[0]
                grid.SetCellValue(row, col, label)
            return
286221
def _mk_context_menu(self, thumbkey, chname, info):
        
        menu = Widgets.Menu()
        item = menu.add_name("Display")
        item.add_callback('activated',
                          lambda w: self.load_file(
                              thumbkey, chname, info.name, info.path,
                              info.image_future))
        menu.add_separator()
        item = menu.add_name("Remove")
        item.add_callback('activated',
                          lambda w: self.fv.remove_image_by_name(
                              chname, info.name, impath=info.path))

        return menu
843672
function(title, menu) {
			return utils.find(menu || this.getMenu(), function(val) {
				if (val.type == 'action') {
					if (val.label == title || val.name == title) {
						return val.name;
					}
				} else {
					return this.getActionNameForMenuTitle(title, val.items);
				}
			}, this);
		}
366602
def _append(self, menu):
        ''''''
        menu.AppendCheckItem(self.id(), self.name, self.description)
        menu.Check(self.id(), self.checked)
302065
def showMenu(self, point=None):
        
        menu = self.createMenu(self)
        menu.exec_(QtGui.QCursor.pos())
        menu.deleteLater()
489290
function onMenu( item ) {
    var squire = this.squire;
    var id = item.id;

    switch ( id ) {
    case 'undo':
        squire.undo();
        break;
    case 'redo':
        squire.redo();
        break;
    case 'eraser':
        squire.removeAllFormatting();
        break;
    case 'link':
        makeLink.call( squire );
        break;
    case 'image':
        this.insertImage();
        break;
    case 'format-bold':
        if ( squire.hasFormat( 'b' ) ) {
            squire.removeBold();
        } else {
            squire.bold();
        }
        break;
    case 'format-italic':
        if ( squire.hasFormat( 'i' ) || squire.hasFormat( 'em' ) ) {
            squire.removeItalic();
        } else {
            squire.italic();
        }
        break;
    case 'format-underline':
        if ( squire.hasFormat( 'u' ) ) {
            squire.removeUnderline();
        } else {
            squire.underline();
        }
        break;
    case 'format-align-left':
        squire.setTextAlignment( 'left' );
        break;
    case 'format-align-center':
        squire.setTextAlignment( 'center' );
        break;
    case 'format-align-right':
        squire.setTextAlignment( 'right' );
        break;
    case 'format-align-justify':
        squire.setTextAlignment( 'justify' );
        break;
    case 'font':
        setFontFaceSizeColor.call( squire );
        break;
    case 'format-float-left':
        setFloat.call( squire, 'left' );
        break;
    case 'format-float-center':
        setFloat.call( squire, 'center' );
        break;
    case 'format-float-right':
        setFloat.call( squire, 'right' );
        break;
    case 'format-float-none':
        setFloat.call( squire, 'none' );
        break;
    case 'format-header':
        setHeader.call( squire );
        break;
    default:
        this.processButton( id );
    }
    this.focus = true;
}
832694
def _append(self, menu):
        ''''''
        from wx_loader import wx
        submenu = wx.Menu()
        for i in range(len(self.items)):
            submenu.AppendRadioItem(self.id()+i, self.items[i], self.description)
            if self.items[i] == self.initial:
                submenu.Check(self.id()+i, True)
        menu.AppendMenu(-1, self.name, submenu)
921303
function InlineMenu(editor, menuText) {
        /**
         * The list of items to display
         *
         * @type {Array.<{id: number, name: string>}
         */
        this.items = [];

        /**
         * The selected position in the list; otherwise -1.
         *
         * @type {number}
         */
        this.selectedIndex = -1;


        /**
         * Is the list currently open?
         *
         * @type {boolean}
         */
        this.opened = false;


        /**
         * The editor context
         *
         * @type {Editor}
         */
        this.editor = editor;


        /**
         * The menu selection callback function
         *
         * @type {Function}
         */
        this.handleSelect = null;

        /**
         * The menu closure callback function
         *
         * @type {Function}
         */
        this.handleClose = null;

        /**
         * The menu object
         *
         * @type {jQuery.Object}
         */
        this.$menu =
            $("<li class='dropdown inlinemenu-menu'></li>")
                .append($("<a href='#' class='dropdown-toggle' data-toggle='dropdown'></a>")
                        .hide())
                .append("<ul class='dropdown-menu'>" +
                            "<li class='inlinemenu-header'>" +
                                "<a>" + menuText + "</a>" +
                            "</li>" +
                         "</ul>");

        this._keydownHook = this._keydownHook.bind(this);
    }
643567
def generate_menu():
    """"""
    root_menu = Menu(list(copy.deepcopy(settings.WAFER_MENUS)))
    for dynamic_menu_func in settings.WAFER_DYNAMIC_MENUS:
        dynamic_menu_func = maybe_obj(dynamic_menu_func)
        dynamic_menu_func(root_menu)
    return root_menu
691358
def _menuitem(self, label, icon, onclick, checked=None):
        
        if checked is not None:
            item = Gtk.CheckMenuItem()
            item.set_active(checked)
        elif icon is None:
            item = Gtk.MenuItem()
        else:
            item = Gtk.ImageMenuItem()
            item.set_image(icon)
            # I don't really care for the "show icons only for nouns, not
            # for verbs" policy:
            item.set_always_show_image(True)
        if label is not None:
            item.set_label(label)
        if isinstance(onclick, Gtk.Menu):
            item.set_submenu(onclick)
        elif onclick is not None:
            item.connect('activate', onclick)
        return item
1363590
def setup_menu(self):
        """"""
        self.copy_action = create_action(self, _('Copy'),
                                         shortcut=keybinding('Copy'),
                                         icon=ima.icon('editcopy'),
                                         triggered=self.copy,
                                         context=Qt.WidgetShortcut)
        menu = QMenu(self)
        add_actions(menu, [self.copy_action, ])
        return menu
1137614
def handle_menu_event(self, obj):
        ''''''
        menuitem = obj.menuitem
        if menuitem.returnkey.startswith('# '):
            cmd = menuitem.returnkey[2:]
            if menuitem.handler is not None:
                if menuitem.handler_result is None:
                    return
                cmd += menuitem.handler_result
            self.mpstate.functions.process_stdin(cmd)
        elif menuitem.returnkey == 'popupRallyRemove':
            self.remove_rally(obj.selected[0].objkey)
        elif menuitem.returnkey == 'popupRallyMove':
            self.move_rally(obj.selected[0].objkey)
        elif menuitem.returnkey == 'popupMissionSet':
            self.set_mission(obj.selected[0].objkey, obj.selected[0].extra_info)
        elif menuitem.returnkey == 'popupMissionRemoveNoFly':
            self.remove_mission_nofly(obj.selected[0].objkey, obj.selected[0].extra_info)
        elif menuitem.returnkey == 'popupMissionRemove':
            self.remove_mission(obj.selected[0].objkey, obj.selected[0].extra_info)
        elif menuitem.returnkey == 'popupMissionMove':
            self.move_mission(obj.selected[0].objkey, obj.selected[0].extra_info)
        elif menuitem.returnkey == 'popupFenceRemove':
            self.remove_fencepoint(obj.selected[0].objkey, obj.selected[0].extra_info)
        elif menuitem.returnkey == 'popupFenceMove':
            self.move_fencepoint(obj.selected[0].objkey, obj.selected[0].extra_info)
        elif menuitem.returnkey == 'showPosition':
            self.show_position()
425451
def showMenu(self, point):
        
        menu = QMenu(self)
        acts = {}
        acts['edit'] = menu.addAction('Edit quick filter...')
        
        trigger = menu.exec_(self.mapToGlobal(point))
        
        if trigger == acts['edit']:
            text, accepted = XTextEdit.getText(self.window(),
                                                  'Edit Format',
                                                  'Format:',
                                                  self.filterFormat(),
                                                  wrapped=False)
            
            if accepted:
                self.setFilterFormat(text)