application.py 文件源码

python
阅读 28 收藏 0 点赞 0 评论 0

项目:Icon-Requests 作者: bil-elmoussaoui 项目源码 文件源码
def generate_menu(self):
        # Help section
        help_content = Gio.Menu.new()
        help_content.append_item(Gio.MenuItem.new(_("Night Mode"), "app.night_mode"))
        help_content.append_item(Gio.MenuItem.new(_("About"), "app.about"))
        help_content.append_item(Gio.MenuItem.new(_("Quit"), "app.quit"))
        help_section = Gio.MenuItem.new_section(None, help_content)
        self.menu.append_item(help_section)

        action = Gio.SimpleAction.new_stateful("night_mode", None, GLib.Variant.new_boolean(settings.get_is_night_mode()))
        action.connect("change-state", self.on_night_mode)
        self.add_action(action)

        action = Gio.SimpleAction.new("about", None)
        action.connect("activate", self.on_about)
        self.add_action(action)

        action = Gio.SimpleAction.new("quit", None)
        action.connect("activate", self.on_quit)
        self.add_action(action)

        if is_gnome() and not is_app_menu():
            self.set_app_menu(self.menu)
            logging.debug("Adding gnome shell menu")
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号