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


Python Gtk.MAJOR_VERSION属性代码示例

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


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

示例1: show_context_menu

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import MAJOR_VERSION [as 别名]
def show_context_menu(self):
        """
        Show popup menu using different functions according to Gtk version.
        'Gtk.Menu.popup' is deprecated since version 3.22, see:
        https://lazka.github.io/pgi-docs/index.html#Gtk-3.0/classes/Menu.html#Gtk.Menu.popup
        """
        self.prepare_context_menu()
        self.context_menu.show_all()
        if (Gtk.MAJOR_VERSION >= 3) and (Gtk.MINOR_VERSION >= 22):
            self.context_menu.popup_at_pointer(None)
        else:
            self.context_menu.popup(None, None, None, None, 0, 0)

    # ======================================================
    # selection event handlers
    # ====================================================== 
开发者ID:gramps-project,项目名称:addons-source,代码行数:18,代码来源:PhotoTaggingGramplet.py

示例2: on_local_option

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import MAJOR_VERSION [as 别名]
def on_local_option(self, app, option):
        self.calc_sa = False
        if option.contains("version"):
            print("GPT:    {}".format(__version__))
            print("Python: {}".format(sys.version[:5]))
            print("GTK+:   {}.{}.{}".format(Gtk.MAJOR_VERSION,
                                            Gtk.MINOR_VERSION,
                                            Gtk.MICRO_VERSION,
                                            ))
            print(_("Application executed from {}".format(cli.install_dir)))
            return 0    # quit
        elif option.contains("cli"):
            cli.help()
            cli.shell()
            return 0
        elif option.contains("default"):
            self.load_stack_application_window()
        elif option.contains("alt-gui-compact"):
            self.load_application_window()
        elif option.contains("alt-gui-ext"):
            self.load_player_window()
        elif option.contains("tl-calc"):
            tlc.standalone()
            return 0
        else:
            # insert key do option GLibVariantDict
            option.insert_value("default", GLib.Variant("u", True))
            self.on_local_option(app, option)

        # contiunue with loading the app
        return -1 
开发者ID:encarsia,项目名称:gpt,代码行数:33,代码来源:modules.py

示例3: show_menu

# 需要导入模块: from gi.repository import Gtk [as 别名]
# 或者: from gi.repository.Gtk import MAJOR_VERSION [as 别名]
def show_menu(self, event=None):
        """
        Show popup menu.
        """
        if (Gtk.MAJOR_VERSION >= 3) and (Gtk.MINOR_VERSION >= 22):
            # new from gtk 3.22:
            self.popup_at_pointer(event)
        else:
            if event:
                self.popup(None, None, None, None,
                           event.get_button()[1], event.time)
            else:
                self.popup(None, None, None, None,
                           0, Gtk.get_current_event_time())
                #self.popup(None, None, None, None, 0, 0) 
开发者ID:gramps-project,项目名称:addons-source,代码行数:17,代码来源:graphview.py


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