Python win32con.MF_SEPARATOR Examples
The following are 10
code examples of win32con.MF_SEPARATOR().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
win32con
, or try the search function
.
Example #1
Source File: mdi_pychecker.py From ironpython2 with Apache License 2.0 | 6 votes |
def OnRClick(self, params): menu = win32ui.CreatePopupMenu() flags=win32con.MF_STRING|win32con.MF_ENABLED lineno = self._obj_.LineFromChar(-1) #selection or current line line = self._obj_.GetLine(lineno) regexGrepResult = regexGrep.match(line) charstart, charend = self._obj_.GetSel() if regexGrepResult: self.fnm = regexGrepResult.group(1) self.lnnum = int(regexGrepResult.group(2)) menu.AppendMenu(flags, ID_OPEN_FILE, "&Open "+self.fnm) menu.AppendMenu(flags, ID_ADDCOMMENT, "&Add to source: Comment Tag/#$pycheck_no ..") menu.AppendMenu(flags, ID_ADDPYCHECKNO2, "&Add to source: Specific #$pycheck_no=%(errtext)s ..") menu.AppendMenu(win32con.MF_SEPARATOR) menu.AppendMenu(flags, ID_TRYAGAIN, "&Try Again") menu.AppendMenu(flags, win32ui.ID_EDIT_CUT, 'Cu&t') menu.AppendMenu(flags, win32ui.ID_EDIT_COPY, '&Copy') menu.AppendMenu(flags, win32ui.ID_EDIT_PASTE, '&Paste') menu.AppendMenu(flags, win32con.MF_SEPARATOR); menu.AppendMenu(flags, win32ui.ID_EDIT_SELECT_ALL, '&Select all') menu.AppendMenu(flags, win32con.MF_SEPARATOR); menu.AppendMenu(flags, ID_SAVERESULTS, 'Sa&ve results') menu.TrackPopupMenu(params[5]) return 0
Example #2
Source File: interact.py From ironpython2 with Apache License 2.0 | 6 votes |
def GetRightMenuItems(self): # Just override parents ret = [] flags = 0 ret.append((flags, win32ui.ID_EDIT_UNDO, '&Undo')) ret.append(win32con.MF_SEPARATOR) ret.append((flags, win32ui.ID_EDIT_CUT, 'Cu&t')) ret.append((flags, win32ui.ID_EDIT_COPY, '&Copy')) start, end=self.GetSel() if start!=end: ret.append((flags, ID_EDIT_COPY_CODE, 'Copy code without prompts')) if win32clipboard.IsClipboardFormatAvailable(win32clipboard.CF_UNICODETEXT): ret.append((flags, ID_EDIT_EXEC_CLIPBOARD, 'Execute python code from clipboard')) ret.append((flags, win32ui.ID_EDIT_PASTE, '&Paste')) ret.append(win32con.MF_SEPARATOR) ret.append((flags, win32ui.ID_EDIT_SELECT_ALL, '&Select all')) ret.append((flags, win32ui.ID_EDIT_SELECT_BLOCK, 'Select &block')) ret.append((flags, win32ui.ID_VIEW_WHITESPACE, "View &Whitespace")) return ret
Example #3
Source File: editor.py From ironpython2 with Apache License 2.0 | 6 votes |
def OnRClick(self,params): menu = win32ui.CreatePopupMenu() # look for a module name line=self._obj_.GetLine().strip() flags=win32con.MF_STRING|win32con.MF_ENABLED if patImport.match(line)==len(line): menu.AppendMenu(flags, ID_LOCATE_FILE, "&Locate %s.py"%patImport.group('name')) menu.AppendMenu(win32con.MF_SEPARATOR); menu.AppendMenu(flags, win32ui.ID_EDIT_UNDO, '&Undo') menu.AppendMenu(win32con.MF_SEPARATOR); menu.AppendMenu(flags, win32ui.ID_EDIT_CUT, 'Cu&t') menu.AppendMenu(flags, win32ui.ID_EDIT_COPY, '&Copy') menu.AppendMenu(flags, win32ui.ID_EDIT_PASTE, '&Paste') menu.AppendMenu(flags, win32con.MF_SEPARATOR); menu.AppendMenu(flags, win32ui.ID_EDIT_SELECT_ALL, '&Select all') menu.AppendMenu(flags, win32con.MF_SEPARATOR); menu.AppendMenu(flags, ID_GOTO_LINE, '&Goto line...') menu.TrackPopupMenu(params[5]) return 0
Example #4
Source File: winapi.py From gui-o-matic with GNU Lesser General Public License v3.0 | 6 votes |
def _show_menu( self ): menu = win32gui.CreatePopupMenu() for action in self.menu_actions: if action: flags = win32con.MF_STRING if not action.sensitive: flags |= win32con.MF_GRAYED win32gui.AppendMenu( menu, flags, action.get_id(), action.label ) else: win32gui.AppendMenu( menu, win32con.MF_SEPARATOR, 0, '' ) pos = win32gui.GetCursorPos() win32gui.SetForegroundWindow( self.window_handle ) win32gui.TrackPopupMenu( menu, win32con.TPM_LEFTALIGN | win32con.TPM_BOTTOMALIGN, pos[ 0 ], pos[ 1 ], 0, self.window_handle, None ) win32gui.PostMessage( self.window_handle, win32con.WM_NULL, 0, 0 )
Example #5
Source File: sgrepmdi.py From ironpython2 with Apache License 2.0 | 5 votes |
def OnRClick(self, params): menu = win32ui.CreatePopupMenu() flags=win32con.MF_STRING|win32con.MF_ENABLED lineno = self._obj_.LineFromChar(-1) #selection or current line line = self._obj_.GetLine(lineno) regexGrepResult = regexGrep.match(line) if regexGrepResult: self.fnm = regexGrepResult.group(1) self.lnnum = int(regexGrepResult.group(2)) menu.AppendMenu(flags, ID_OPEN_FILE, "&Open "+self.fnm) menu.AppendMenu(win32con.MF_SEPARATOR) menu.AppendMenu(flags, ID_TRYAGAIN, "&Try Again") charstart, charend = self._obj_.GetSel() if charstart != charend: linestart = self._obj_.LineIndex(lineno) self.sel = line[charstart-linestart:charend-linestart] menu.AppendMenu(flags, ID_GREP, "&Grep for "+self.sel) menu.AppendMenu(win32con.MF_SEPARATOR) menu.AppendMenu(flags, win32ui.ID_EDIT_CUT, 'Cu&t') menu.AppendMenu(flags, win32ui.ID_EDIT_COPY, '&Copy') menu.AppendMenu(flags, win32ui.ID_EDIT_PASTE, '&Paste') menu.AppendMenu(flags, win32con.MF_SEPARATOR); menu.AppendMenu(flags, win32ui.ID_EDIT_SELECT_ALL, '&Select all') menu.AppendMenu(flags, win32con.MF_SEPARATOR); menu.AppendMenu(flags, ID_SAVERESULTS, 'Sa&ve results') menu.TrackPopupMenu(params[5]) return 0
Example #6
Source File: coloreditor.py From ironpython2 with Apache License 2.0 | 5 votes |
def OnRClick(self,params): menu = win32ui.CreatePopupMenu() self.AppendMenu(menu, "&Locate module", "LocateModule") self.AppendMenu(menu, flags=win32con.MF_SEPARATOR) self.AppendMenu(menu, "&Undo", "EditUndo") self.AppendMenu(menu, '&Redo', 'EditRedo') self.AppendMenu(menu, flags=win32con.MF_SEPARATOR) self.AppendMenu(menu, 'Cu&t', 'EditCut') self.AppendMenu(menu, '&Copy', 'EditCopy') self.AppendMenu(menu, '&Paste', 'EditPaste') self.AppendMenu(menu, flags=win32con.MF_SEPARATOR) self.AppendMenu(menu, '&Select all', 'EditSelectAll') self.AppendMenu(menu, 'View &Whitespace', 'ViewWhitespace', checked=self.SCIGetViewWS()) self.AppendMenu(menu, "&Fixed Font", "ViewFixedFont", checked = self._GetColorizer().bUseFixed) self.AppendMenu(menu, flags=win32con.MF_SEPARATOR) self.AppendMenu(menu, "&Goto line...", "GotoLine") submenu = win32ui.CreatePopupMenu() newitems = self.idle.GetMenuItems("edit") for text, event in newitems: self.AppendMenu(submenu, text, event) flags=win32con.MF_STRING|win32con.MF_ENABLED|win32con.MF_POPUP menu.AppendMenu(flags, submenu.GetHandle(), "&Source code") flags = win32con.TPM_LEFTALIGN|win32con.TPM_LEFTBUTTON|win32con.TPM_RIGHTBUTTON menu.TrackPopupMenu(params[5], flags, self) return 0
Example #7
Source File: context_menu.py From ironpython2 with Apache License 2.0 | 4 votes |
def QueryContextMenu(self, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags): print "QCM", hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags # Query the items clicked on format_etc = win32con.CF_HDROP, None, 1, -1, pythoncom.TYMED_HGLOBAL sm = self.dataobj.GetData(format_etc) num_files = shell.DragQueryFile(sm.data_handle, -1) if num_files>1: msg = "&Hello from Python (with %d files selected)" % num_files else: fname = shell.DragQueryFile(sm.data_handle, 0) msg = "&Hello from Python (with '%s' selected)" % fname idCmd = idCmdFirst items = [] if (uFlags & 0x000F) == shellcon.CMF_NORMAL: # Check == here, since CMF_NORMAL=0 print "CMF_NORMAL..." items.append(msg) elif uFlags & shellcon.CMF_VERBSONLY: print "CMF_VERBSONLY..." items.append(msg + " - shortcut") elif uFlags & shellcon.CMF_EXPLORE: print "CMF_EXPLORE..." items.append(msg + " - normal file, right-click in Explorer") elif uFlags & CMF_DEFAULTONLY: print "CMF_DEFAULTONLY...\r\n" else: print "** unknown flags", uFlags win32gui.InsertMenu(hMenu, indexMenu, win32con.MF_SEPARATOR|win32con.MF_BYPOSITION, 0, None) indexMenu += 1 for item in items: win32gui.InsertMenu(hMenu, indexMenu, win32con.MF_STRING|win32con.MF_BYPOSITION, idCmd, item) indexMenu += 1 idCmd += 1 win32gui.InsertMenu(hMenu, indexMenu, win32con.MF_SEPARATOR|win32con.MF_BYPOSITION, 0, None) indexMenu += 1 return idCmd-idCmdFirst # Must return number of menu items we added.
Example #8
Source File: shell.py From eavatar-me with Apache License 2.0 | 4 votes |
def create_menu(self, menu): # option_icon = self.prep_menu_icon(option_icon) item, extras = win32gui_struct.PackMENUITEMINFO( text=base.STR_EXIT, hbmpItem=None, wID=_ID_QUIT) win32gui.InsertMenuItem(menu, 0, 1, item) win32gui.InsertMenu(menu, 0, win32con.MF_BYPOSITION, win32con.MF_SEPARATOR, None) win32gui.InsertMenu(menu, 0, (win32con.MF_POPUP | win32con.MF_BYPOSITION), self.notices_menu, base.STR_NOTICES_MENU) win32gui.InsertMenu(menu, 0, win32con.MF_BYPOSITION, win32con.MF_SEPARATOR, None) win32gui.InsertMenu(menu, 0, win32con.MF_POPUP | win32con.MF_BYPOSITION, self.status_menu, base.STR_STATUS_MENU) win32gui.InsertMenu(menu, 0, win32con.MF_BYPOSITION, win32con.MF_SEPARATOR, None) # item, extras = win32gui_struct.PackMENUITEMINFO( # text=STR_OPEN_CONSOLE, # hbmpItem=None, # wID=_ID_OPEN_CONSOLE) # win32gui.InsertMenuItem(menu, 0, 1, item) item, extras = win32gui_struct.PackMENUITEMINFO( text=base.STR_OPEN_FOLDER, hbmpItem=None, wID=_ID_OPEN_FOLDER) win32gui.InsertMenuItem(menu, 0, 1, item) item, extras = win32gui_struct.PackMENUITEMINFO( text=base.STR_OPEN_WEBFRONT, hbmpItem=None, wID=_ID_OPEN_WEBFRONT) win32gui.InsertMenuItem(menu, 0, 1, item)
Example #9
Source File: taskbar_widget.py From termite-visualizations with BSD 3-Clause "New" or "Revised" License | 4 votes |
def OnTaskbarNotify( self, hwnd, msg, wparam, lparam, ): if lparam == win32con.WM_LBUTTONUP: pass elif lparam == win32con.WM_LBUTTONDBLCLK: pass elif lparam == win32con.WM_RBUTTONUP: menu = win32gui.CreatePopupMenu() win32gui.AppendMenu(menu, win32con.MF_STRING, 1023, 'Toggle Display') win32gui.AppendMenu(menu, win32con.MF_SEPARATOR, 0, '') if self.serverState == self.EnumServerState.STOPPED: win32gui.AppendMenu(menu, win32con.MF_STRING, 1024, 'Start Server') win32gui.AppendMenu(menu, win32con.MF_STRING | win32con.MF_GRAYED, 1025, 'Restart Server') win32gui.AppendMenu(menu, win32con.MF_STRING | win32con.MF_GRAYED, 1026, 'Stop Server') else: win32gui.AppendMenu(menu, win32con.MF_STRING | win32con.MF_GRAYED, 1024, 'Start Server') win32gui.AppendMenu(menu, win32con.MF_STRING, 1025, 'Restart Server') win32gui.AppendMenu(menu, win32con.MF_STRING, 1026, 'Stop Server') win32gui.AppendMenu(menu, win32con.MF_SEPARATOR, 0, '') win32gui.AppendMenu(menu, win32con.MF_STRING, 1027, 'Quit (pid:%i)' % os.getpid()) pos = win32gui.GetCursorPos() # See http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/menus_0hdi.asp win32gui.SetForegroundWindow(self.hwnd) win32gui.TrackPopupMenu( menu, win32con.TPM_LEFTALIGN, pos[0], pos[1], 0, self.hwnd, None, ) win32api.PostMessage(self.hwnd, win32con.WM_NULL, 0, 0) return 1
Example #10
Source File: context_menu.py From Email_My_PC with MIT License | 4 votes |
def QueryContextMenu(self, hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags): print "QCM", hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags # Query the items clicked on format_etc = win32con.CF_HDROP, None, 1, -1, pythoncom.TYMED_HGLOBAL sm = self.dataobj.GetData(format_etc) num_files = shell.DragQueryFile(sm.data_handle, -1) if num_files>1: msg = "&Hello from Python (with %d files selected)" % num_files else: fname = shell.DragQueryFile(sm.data_handle, 0) msg = "&Hello from Python (with '%s' selected)" % fname idCmd = idCmdFirst items = ['First Python content menu item'] if (uFlags & 0x000F) == shellcon.CMF_NORMAL: # Check == here, since CMF_NORMAL=0 print "CMF_NORMAL..." items.append(msg) elif uFlags & shellcon.CMF_VERBSONLY: print "CMF_VERBSONLY..." items.append(msg + " - shortcut") elif uFlags & shellcon.CMF_EXPLORE: print "CMF_EXPLORE..." items.append(msg + " - normal file, right-click in Explorer") elif uFlags & CMF_DEFAULTONLY: print "CMF_DEFAULTONLY...\r\n" else: print "** unknown flags", uFlags win32gui.InsertMenu(hMenu, indexMenu, win32con.MF_SEPARATOR|win32con.MF_BYPOSITION, 0, None) indexMenu += 1 for item in items: win32gui.InsertMenu(hMenu, indexMenu, win32con.MF_STRING|win32con.MF_BYPOSITION, idCmd, item) indexMenu += 1 idCmd += 1 win32gui.InsertMenu(hMenu, indexMenu, win32con.MF_SEPARATOR|win32con.MF_BYPOSITION, 0, None) indexMenu += 1 return idCmd-idCmdFirst # Must return number of menu items we added.