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


Python Secret.password_lookup方法代码示例

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


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

示例1: connect

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup [as 别名]
 def connect(self, password):
     """
         Connect lastfm
         @param password as str/None
     """
     if self._goa:
         t = Thread(target=self._connect, args=('', '', True))
         t.daemon = True
         t.start()
     # Get username/password from GSettings/Secret
     elif Secret is not None and\
             Gio.NetworkMonitor.get_default().get_network_available():
         self._username = Lp().settings.get_value(
                                                'lastfm-login').get_string()
         if password is None:
             schema = Secret.Schema.new("org.gnome.Lollypop",
                                        Secret.SchemaFlags.NONE,
                                        SecretSchema)
             Secret.password_lookup(schema, SecretAttributes, None,
                                    self._on_password_lookup)
         else:
             t = Thread(target=self._connect, args=(self._username,
                                                    password, True))
             t.daemon = True
             t.start()
开发者ID:ferranroig,项目名称:lollypop,代码行数:27,代码来源:lastfm.py

示例2: testAsyncNotFound

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup [as 别名]
	def testAsyncNotFound(self):
		loop = GLib.MainLoop(None, False)

		def on_result_ready(source, result, unused):
			loop.quit()
			password = Secret.password_lookup_finish(result)
			self.assertEquals(None, password)

		Secret.password_lookup (STORE_SCHEMA, { "number": "7", "string": "five" },
		                        None, on_result_ready, None)

		loop.run()
开发者ID:Pusenka,项目名称:libsecret,代码行数:14,代码来源:test-lookup-password.py

示例3: testAsynchronous

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup [as 别名]
	def testAsynchronous(self):
		loop = GLib.MainLoop(None)

		def on_result_ready(source, result, unused):
			loop.quit()
			password = Secret.password_lookup_finish(result)
			self.assertEquals("222", password)

		Secret.password_lookup (STORE_SCHEMA, { "number": "2", "string": "two" },
		                        None, on_result_ready, None)

		loop.run()
开发者ID:Distrotech,项目名称:libsecret,代码行数:14,代码来源:test-lookup-password.py

示例4: get_account_password

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup [as 别名]
    def get_account_password(self, email, callback):
        def on_password_lookup_finish(source, result, data):
            try:
                password = Secret.password_lookup_finish(result) or ''
            except GLib.Error as e:
                password = ''
                logging.error('Failed to lookup password, Error: {}'.format(e))
            callback(password)

        Secret.password_lookup(
            self._account_schema,
            {'email': email},
            None,
            on_password_lookup_finish,
            None,
        )
开发者ID:JasonLG1979,项目名称:pithos,代码行数:18,代码来源:util.py

示例5: connect

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup [as 别名]
 def connect(self, password):
     """
         Connect lastfm
         @param password as str/None
     """
     if Secret is None or\
             not Gio.NetworkMonitor.get_default().get_network_available():
         return
     self._username = Lp.settings.get_value('lastfm-login').get_string()
     if password is None:
         schema = Secret.Schema.new("org.gnome.Lollypop",
                                    Secret.SchemaFlags.NONE,
                                    SecretSchema)
         Secret.password_lookup(schema, SecretAttributes, None,
                                self._on_password_lookup)
     else:
         start_new_thread(self._connect, (self._username, password))
开发者ID:ktosiu,项目名称:lollypop,代码行数:19,代码来源:lastfm.py

示例6: __init__

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup [as 别名]

#.........这里部分代码省略.........
            label.show()
            grid.attach(label, l, t, w, h)
        else:
            switch_artwork_tags.set_state(
                                      Lp().settings.get_value('save-to-tags'))

        if GLib.find_program_in_path("youtube-dl") is None:
            builder.get_object('charts_grid').hide()
        else:
            switch_charts = builder.get_object('switch_charts')
            switch_charts.set_state(Lp().settings.get_value('show-charts'))

        switch_genres = builder.get_object('switch_genres')
        switch_genres.set_state(Lp().settings.get_value('show-genres'))

        switch_compilations = builder.get_object('switch_compilations')
        switch_compilations.set_state(
            Lp().settings.get_value('show-compilations'))

        switch_artwork = builder.get_object('switch_artwork')
        switch_artwork.set_state(Lp().settings.get_value('artist-artwork'))

        switch_spotify = builder.get_object('switch_spotify')
        switch_spotify.set_state(Lp().settings.get_value('search-spotify'))

        switch_itunes = builder.get_object('switch_itunes')
        switch_itunes.set_state(Lp().settings.get_value('search-itunes'))

        if GLib.find_program_in_path("youtube-dl") is None:
            builder.get_object('yt-dl').show()

        combo_orderby = builder.get_object('combo_orderby')
        combo_orderby.set_active(Lp().settings.get_enum(('orderby')))

        combo_preview = builder.get_object('combo_preview')

        scale_coversize = builder.get_object('scale_coversize')
        scale_coversize.set_range(150, 300)
        scale_coversize.set_value(
                            Lp().settings.get_value('cover-size').get_int32())
        self.__settings_dialog.connect('destroy', self.__edit_settings_close)

        builder.connect_signals(self)

        main_chooser_box = builder.get_object('main_chooser_box')
        self.__chooser_box = builder.get_object('chooser_box')

        self.__set_outputs(combo_preview)

        #
        # Music tab
        #
        dirs = []
        for directory in Lp().settings.get_value('music-uris'):
            dirs.append(directory)

        # Main chooser
        self.__main_chooser = ChooserWidget()
        image = Gtk.Image.new_from_icon_name("list-add-symbolic",
                                             Gtk.IconSize.MENU)
        self.__main_chooser.set_icon(image)
        self.__main_chooser.set_action(self.__add_chooser)
        main_chooser_box.pack_start(self.__main_chooser, False, True, 0)
        if len(dirs) > 0:
            uri = dirs.pop(0)
        else:
            filename = GLib.get_user_special_dir(
                                            GLib.UserDirectory.DIRECTORY_MUSIC)
            if filename:
                uri = GLib.filename_to_uri(filename)
            else:
                uri = ""

        self.__main_chooser.set_dir(uri)

        # Others choosers
        for directory in dirs:
            self.__add_chooser(directory)

        #
        # Google tab
        #
        builder.get_object('cs-entry').set_text(
                            Lp().settings.get_value('cs-api-key').get_string())
        #
        # Last.fm tab
        #
        if Lp().lastfm is not None and Secret is not None:
            self.__test_img = builder.get_object('test_img')
            self.__login = builder.get_object('login')
            self.__password = builder.get_object('password')
            schema = Secret.Schema.new("org.gnome.Lollypop",
                                       Secret.SchemaFlags.NONE,
                                       SecretSchema)
            Secret.password_lookup(schema, SecretAttributes, None,
                                   self.__on_password_lookup)
            builder.get_object('lastfm_grid').set_sensitive(True)
            builder.get_object('lastfm_error').hide()
            self.__login.set_text(
                Lp().settings.get_value('lastfm-login').get_string())
开发者ID:TainakaDrums,项目名称:lollypop,代码行数:104,代码来源:settings.py

示例7: __init__

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup [as 别名]

#.........这里部分代码省略.........

        switch_view = builder.get_object('switch_dark')
        switch_view.set_state(Lp.settings.get_value('dark-ui'))

        switch_background = builder.get_object('switch_background')
        switch_background.set_state(Lp.settings.get_value('background-mode'))

        switch_state = builder.get_object('switch_state')
        switch_state.set_state(Lp.settings.get_value('save-state'))

        switch_autoplay = builder.get_object('switch_autoplay')
        switch_autoplay.set_state(Lp.settings.get_value('auto-play'))

        switch_genres = builder.get_object('switch_genres')
        switch_genres.set_state(Lp.settings.get_value('show-genres'))

        switch_compilations = builder.get_object('switch_compilations')
        switch_compilations.set_state(
            Lp.settings.get_value('show-compilations'))

        self._settings_dialog.connect('destroy', self._edit_settings_close)

        builder.connect_signals(self)

        main_chooser_box = builder.get_object('main_chooser_box')
        self._chooser_box = builder.get_object('chooser_box')
        party_grid = builder.get_object('party_grid')

        #
        # Music tab
        #
        dirs = []
        for directory in Lp.settings.get_value('music-path'):
            dirs.append(directory)

        # Main chooser
        self._main_chooser = ChooserWidget()
        image = Gtk.Image.new_from_icon_name("list-add-symbolic",
                                             Gtk.IconSize.MENU)
        self._main_chooser.set_icon(image)
        self._main_chooser.set_action(self._add_chooser)
        main_chooser_box.pack_start(self._main_chooser, False, True, 0)
        if len(dirs) > 0:
            path = dirs.pop(0)
        else:
            path = GLib.get_user_special_dir(
                GLib.UserDirectory.DIRECTORY_MUSIC)
        self._main_chooser.set_dir(path)

        # Others choosers
        for directory in dirs:
            self._add_chooser(directory)

        #
        # Party mode tab
        #
        genres = Lp.genres.get()
        genres.insert(0, (Type.POPULARS, _("Populars")))
        genres.insert(1, (Type.RECENTS, _("Recently added")))
        ids = Lp.player.get_party_ids()
        i = 0
        x = 0
        for genre_id, genre in genres:
            label = Gtk.Label()
            label.set_property('margin-start', 10)
            label.set_property('halign', Gtk.Align.START)
            label.set_property('hexpand', True)
            label.set_ellipsize(Pango.EllipsizeMode.END)
            label.set_text(genre)
            label.set_tooltip_text(genre)
            label.show()
            switch = Gtk.Switch()
            if genre_id in ids:
                switch.set_state(True)
            switch.connect("state-set", self._party_switch_state, genre_id)
            switch.set_property('margin-end', 50)
            switch.show()
            party_grid.attach(label, x, i, 1, 1)
            party_grid.attach(switch, x+1, i, 1, 1)
            if x == 0:
                x += 2
            else:
                i += 1
                x = 0
        #
        # Last.fm tab
        #
        if Lp.lastfm is not None and Secret is not None:
            self._test_img = builder.get_object('test_img')
            self._login = builder.get_object('login')
            self._password = builder.get_object('password')
            schema = Secret.Schema.new("org.gnome.Lollypop",
                                       Secret.SchemaFlags.NONE,
                                       SecretSchema)
            Secret.password_lookup(schema, SecretAttributes, None,
                                   self._on_password_lookup)
            builder.get_object('lastfm_grid').set_sensitive(True)
            builder.get_object('lastfm_error').hide()
            self._login.set_text(
                Lp.settings.get_value('lastfm-login').get_string())
开发者ID:lesthack,项目名称:lollypop,代码行数:104,代码来源:settings.py

示例8: __init__

# 需要导入模块: from gi.repository import Secret [as 别名]
# 或者: from gi.repository.Secret import password_lookup [as 别名]

#.........这里部分代码省略.........

        switch_scan = builder.get_object('switch_scan')
        switch_scan.set_state(Lp().settings.get_value('auto-update'))

        switch_view = builder.get_object('switch_dark')
        switch_view.set_state(Lp().settings.get_value('dark-ui'))

        switch_background = builder.get_object('switch_background')
        switch_background.set_state(Lp().settings.get_value('background-mode'))

        switch_state = builder.get_object('switch_state')
        switch_state.set_state(Lp().settings.get_value('save-state'))

        switch_mix = builder.get_object('switch_mix')
        switch_mix.set_state(Lp().settings.get_value('mix'))

        switch_mix_party = builder.get_object('switch_mix_party')
        switch_mix_party.set_state(Lp().settings.get_value('party-mix'))

        switch_artwork_tags = builder.get_object('switch_artwork_tags')
        if which("kid3-cli") is None:
            switch_artwork_tags.set_sensitive(False)
            switch_artwork_tags.set_tooltip_text(
                                            _("You need to install kid3-cli"))
        else:
            switch_artwork_tags.set_state(
                                      Lp().settings.get_value('artwork-tags'))

        switch_genres = builder.get_object('switch_genres')
        switch_genres.set_state(Lp().settings.get_value('show-genres'))

        switch_compilations = builder.get_object('switch_compilations')
        switch_compilations.set_state(
            Lp().settings.get_value('show-compilations'))

        switch_artwork = builder.get_object('switch_artwork')
        switch_artwork.set_state(Lp().settings.get_value('artist-artwork'))

        switch_repeat = builder.get_object('switch_repeat')
        switch_repeat.set_state(not Lp().settings.get_value('repeat'))

        combo_orderby = builder.get_object('combo_orderby')
        combo_orderby.set_active(Lp().settings.get_enum(('orderby')))

        combo_preview = builder.get_object('combo_preview')

        scale_coversize = builder.get_object('scale_coversize')
        scale_coversize.set_range(150, 300)
        scale_coversize.set_value(
                            Lp().settings.get_value('cover-size').get_int32())
        self._settings_dialog.connect('destroy', self._edit_settings_close)

        builder.connect_signals(self)

        main_chooser_box = builder.get_object('main_chooser_box')
        self._chooser_box = builder.get_object('chooser_box')

        self._set_outputs(combo_preview)

        #
        # Music tab
        #
        dirs = []
        for directory in Lp().settings.get_value('music-path'):
            dirs.append(directory)

        # Main chooser
        self._main_chooser = ChooserWidget()
        image = Gtk.Image.new_from_icon_name("list-add-symbolic",
                                             Gtk.IconSize.MENU)
        self._main_chooser.set_icon(image)
        self._main_chooser.set_action(self._add_chooser)
        main_chooser_box.pack_start(self._main_chooser, False, True, 0)
        if len(dirs) > 0:
            path = dirs.pop(0)
        else:
            path = GLib.get_user_special_dir(
                GLib.UserDirectory.DIRECTORY_MUSIC)
        self._main_chooser.set_dir(path)

        # Others choosers
        for directory in dirs:
            self._add_chooser(directory)

        #
        # Last.fm tab
        #
        if Lp().lastfm is not None and Secret is not None:
            self._test_img = builder.get_object('test_img')
            self._login = builder.get_object('login')
            self._password = builder.get_object('password')
            schema = Secret.Schema.new("org.gnome.Lollypop",
                                       Secret.SchemaFlags.NONE,
                                       SecretSchema)
            Secret.password_lookup(schema, SecretAttributes, None,
                                   self._on_password_lookup)
            builder.get_object('lastfm_grid').set_sensitive(True)
            builder.get_object('lastfm_error').hide()
            self._login.set_text(
                Lp().settings.get_value('lastfm-login').get_string())
开发者ID:Nikhil-z,项目名称:lollypop,代码行数:104,代码来源:settings.py


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