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


Python SmartMenu.get_smart_button_dropdown_wdg方法代码示例

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


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

示例1: get_example_display

# 需要导入模块: from tactic.ui.container import SmartMenu [as 别名]
# 或者: from tactic.ui.container.SmartMenu import get_smart_button_dropdown_wdg [as 别名]
    def get_example_display(self):
        div = DivWdg()

        # ----------------------------- Smart Menu data ----------------------------------------------------------

        menus = [ self.get_smart_menu_main_menu_details(),
                  self.get_smart_menu_submenu_one_details(),
                  self.get_smart_menu_submenu_two_details()
                ]


        # ----------------------------- Smart Context Menu example -----------------------------------------------

        self.setup_next_example( div, "Smart Context Menu example ..." )

        ctx_click_div = DivWdg()
        ctx_click_div.add_styles("background: orange; color: white; border: 1px solid black; " \
                                 "padding: 10px; width: 100px;")
        ctx_click_div.add( "Right Click" )
        SmartMenu.attach_smart_context_menu( ctx_click_div, menus )

        div.add(ctx_click_div)

        # ----------------------------- Smart Drop-down Button Menu example --------------------------------------

        self.setup_next_example( div, "Smart Drop-down Button Menu example ..." )

        btn_dd = SmartMenu.get_smart_button_dropdown_wdg( "Hello", menus, 150 )
        div.add(btn_dd)

        # ----------------------------- Original Context Menu examples -------------------------------------------

        self.setup_next_example( div, "Original Context Menu examples ..." )

        # Create the element to right click on for the given main context menu ...
        activator = DivWdg()

        activator.add_style( "width: 300px" )
        activator.add_style( "height: 50px" )
        activator.add_style( "background: #660000" )
        activator.add_style( "text-align: center" )
        activator.add( "<br/>Right click on me!<br/>(this widget creates the context menus)" )

        s_menu_2 = self.get_ctx_sub_menu_two_details()
        s_menu_3 = {}
        s_menu_3.update( s_menu_2 )
        s_menu_3.update( { 'menu_id': "CtxMenu_Mike_Submenu_Three" } )

        ctx_menu = self.get_ctx_menu_details()
        menus = [ ctx_menu, self.get_ctx_sub_menu_details(), s_menu_2, s_menu_3 ]
        attach_ctx_menu_wdg = AttachContextMenuWdg( activator_wdg=activator, menus=menus )
        div.add( attach_ctx_menu_wdg )

        div.add( activator )
        div.add( "<br/><br/>" )

        # Create second context menu activator, but one that attaches to the already created context menus that
        # were generated above for the first activator. This allows for efficient use of context menus -- e.g.
        # you only need to actually generate one set, but still be able to use that same set of context menus
        # for all, say, edit cells of a DG table ...
        #
        activator2 = DivWdg()

        activator2.add_style( "width: 300px" )
        activator2.add_style( "height: 50px" )
        activator2.add_style( "background: #000066" )
        activator2.add_style( "text-align: center" )
        activator2.add( "<br/>Right click on me!<br/>(this widget attaches to already created context menus)" )

        AttachContextMenuWdg.attach_by_menu_id( activator2, ctx_menu.get('menu_id') )

        div.add( activator2 )

        # -------------------- Drop-down Button Menu example ------------------------------------------------------

        self.setup_next_example( div, "Original Drop-down Menu Button example ..." )

        menus = [ self.get_dd_plain_menu(), self.get_dd_plain_submenu_1() ]
        dd_button = ButtonForDropdownMenuWdg( id="MikeDropDownBtn", title="LMB on Me For Menu", menus=menus,
                                                 width=150, match_width=True)
        div.add( dd_button )

        return div
开发者ID:mincau,项目名称:TACTIC,代码行数:85,代码来源:menu_examples_wdg.py


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