当前位置: 首页>>代码示例>>Python>>正文


Python menu.Menu方法代码示例

本文整理汇总了Python中menu.Menu方法的典型用法代码示例。如果您正苦于以下问题:Python menu.Menu方法的具体用法?Python menu.Menu怎么用?Python menu.Menu使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在menu的用法示例。


在下文中一共展示了menu.Menu方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: process_arguments

# 需要导入模块: import menu [as 别名]
# 或者: from menu import Menu [as 别名]
def process_arguments(parser):
    args = populate_parser(parser)
    args = Menu(args).self_args
    global debug
    global err_msgs
    global log_file

    debug = args.debug
    err_msgs = []

    if args.debug and args.log_file:
        try:
            log_file = open(args.log_file, "wb")
        except IOError as e:
            debug_log("Could not open given log file [" + args.log_file + "] for writing : " + str(e) + ". "
                                                                                                        "Sending debug information to stdout.",
                      True)
    else:
        log_file = None

    return args 
开发者ID:CheckPointSW,项目名称:ExportImportPolicyPackage,代码行数:23,代码来源:utils.py

示例2: __init__

# 需要导入模块: import menu [as 别名]
# 或者: from menu import Menu [as 别名]
def __init__(self, title, choices, **kw):
        Button.__init__(self, title, **kw)
        self.choices = choices
#         self.menu = Menu(title, ((c, c) for c in choices))
        self.menu = Menu(title, ((c, None) for c in choices)) 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:7,代码来源:extended_widgets.py

示例3: choices

# 需要导入模块: import menu [as 别名]
# 或者: from menu import Menu [as 别名]
def choices(self, ch):
        self._choices = ch
        self.menu = Menu("", [(name, "pickMenu") for name in self._choices],
                         self.scrolling, self.scroll_items, doNotTranslate=self.doNotTranslate) 
开发者ID:mcgreentn,项目名称:GDMC,代码行数:6,代码来源:extended_widgets.py

示例4: createMenu

# 需要导入模块: import menu [as 别名]
# 或者: from menu import Menu [as 别名]
def createMenu(self, title = '', icon = ''):
		return Menu(self.window, title, self.normUrl(icon))

	# 菜单项 
开发者ID:Lanfei,项目名称:hae,代码行数:6,代码来源:api.py

示例5: __init__

# 需要导入模块: import menu [as 别名]
# 或者: from menu import Menu [as 别名]
def __init__(self, path, i, o, callback = None, display_hidden = False, current_dot = False, prev_dot = True, scrolling=True):
        """Initialises the Menu object.
        
        Args:

            * ``path``: a path to start from.
            * ``i``, ``o``: input&output device objects.

        Kwargs:

            * ``callback``: if set, FilePickerMenu will call the callback with path as first argument upon selecting path, instead of exiting.
            * ``current_dot``: if set, FilePickerMenu will show '.' path.
            * ``prev_dot``: if set, FilePickerMenu will show '..' path.
            * ``display_hidden``: if set, FilePickerMenu displays hidden files.

        """
        self.i = i
        self.o = o
        if not os.path.isdir(path):
             raise ValueError("PathPicker path has to be a directory!")
        self.path = os.path.normpath(path)
        self.name = "PathPickerMenu-{}".format(self.path)
        self.display_hidden = display_hidden
        self.callback = callback
        self.current_dot = current_dot
        self.prev_dot = prev_dot
        self._in_background = Event()
        self.set_contents([]) #Method inherited from Menu and needs an argument, but context is not right
        self.generate_keymap()
        self.scrolling={"enabled":scrolling,       
                        "current_finished":False,  
                        "current_scrollable":False,
                        "counter":0,               
                        "pointer":0} 
开发者ID:CRImier,项目名称:pyLCI,代码行数:36,代码来源:path_picker.py

示例6: options_menu

# 需要导入模块: import menu [as 别名]
# 或者: from menu import Menu [as 别名]
def options_menu(self):
        self.to_background()
        current_item = self._contents[self.pointer][0]
        full_path = os.path.join(self.path, current_item)
        contents = [["Select path",lambda x=full_path: self.option_select(x)],
                    ["See full name",lambda x=full_path: Printer(current_item, self.i, self.o)],
                    ["See full path",lambda x=full_path: Printer(x, self.i, self.o)],
                    ["Exit PathPicker", self.option_exit]]
        Menu(contents, self.i, self.o).activate()
        if self.in_background:
            self.to_foreground() 
开发者ID:CRImier,项目名称:pyLCI,代码行数:13,代码来源:path_picker.py

示例7: option_exit

# 需要导入模块: import menu [as 别名]
# 或者: from menu import Menu [as 别名]
def option_exit(self):
        self.deactivate()
        raise MenuExitException #Menu needs to exit when PathPicker exits. It doesn't, of course, as it's in the main loop, so the app's left hanging. 
        #One of the reasons MenuExitExceptions are there. 
开发者ID:CRImier,项目名称:pyLCI,代码行数:6,代码来源:path_picker.py


注:本文中的menu.Menu方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。