本文整理汇总了Python中win32con.MF_SEPARATOR属性的典型用法代码示例。如果您正苦于以下问题:Python win32con.MF_SEPARATOR属性的具体用法?Python win32con.MF_SEPARATOR怎么用?Python win32con.MF_SEPARATOR使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类win32con
的用法示例。
在下文中一共展示了win32con.MF_SEPARATOR属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: OnRClick
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import MF_SEPARATOR [as 别名]
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
示例2: GetRightMenuItems
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import MF_SEPARATOR [as 别名]
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
示例3: OnRClick
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import MF_SEPARATOR [as 别名]
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
示例4: _show_menu
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import MF_SEPARATOR [as 别名]
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 )
示例5: OnRClick
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import MF_SEPARATOR [as 别名]
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
示例6: OnRClick
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import MF_SEPARATOR [as 别名]
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
示例7: QueryContextMenu
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import MF_SEPARATOR [as 别名]
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.
示例8: create_menu
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import MF_SEPARATOR [as 别名]
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)
示例9: OnTaskbarNotify
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import MF_SEPARATOR [as 别名]
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
示例10: QueryContextMenu
# 需要导入模块: import win32con [as 别名]
# 或者: from win32con import MF_SEPARATOR [as 别名]
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.