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


Python UndoEntry.set_visibility方法代码示例

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


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

示例1: __init__

# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import set_visibility [as 别名]
    def __init__(self):
        super(Preferences, self).__init__(spacing=12)

        correct_browser = not isinstance(app.browser, AudioFeeds)

        table = Gtk.Table(2, 2)
        table.set_col_spacings(6)
        table.set_row_spacings(6)

        labels = {}
        entries = {}
        for idx, key in enumerate(["gpodder.net/name",
                                   "gpodder.net/password",
                                   "gpodder.net/device"]):
            text, tooltip = _SETTINGS[key][:2]
            label = Gtk.Label(label=text)
            entry = UndoEntry()
            entry.set_text(get_cfg(key))
            if key == "gpodder.net/password":
                entry.set_visibility(False)
            entries[key] = entry
            labels[key] = label
            labels[key].set_mnemonic_widget(entry)
            label.set_tooltip_text(tooltip)
            label.set_alignment(0.0, 0.5)
            label.set_padding(0, 6)
            label.set_use_underline(True)
            table.attach(label, 0, 1, idx, idx+1,
                         xoptions=Gtk.AttachOptions.FILL |
                         Gtk.AttachOptions.SHRINK)
            table.attach(entry, 1, 2, idx, idx+1,
                         xoptions=Gtk.AttachOptions.FILL |
                         Gtk.AttachOptions.SHRINK)
        # value, lower, upper, step_increment, page_increment

        def gpodder_go(button):
            for key in entries:
                value = entries[key].get_text()
                set_cfg(key, value)
            name = get_cfg("gpodder.net/name")
            password = get_cfg("gpodder.net/password")
            device = get_cfg("gpodder.net/device")
            fetch_gpodder(name, password, device)

        button = Gtk.Button(label=_("Fetch!" if correct_browser else "(Fetch) Please switch to a different browser!"), sensitive=correct_browser)
        button.connect("pressed", gpodder_go)
        table.attach(button, 0, 2, idx+1, idx+2)

        self.pack_start(qltk.Frame("Preferences", child=table),
                        True, True, 0)
开发者ID:pschwede,项目名称:quodlibet-plugins,代码行数:52,代码来源:GPodderSync.py

示例2: PluginPreferences

# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import set_visibility [as 别名]
    def PluginPreferences(self, parent):
        def changed(entry, key):
            if entry.get_property('sensitive'):
                plugin_config.set(key, entry.get_text())

        def combo_changed(widget, urlent):
            service = widget.get_active_text()
            plugin_config.set("service", service)
            urlent.set_sensitive((service not in SERVICES))
            urlent.set_text(config_get_url())

        def check_login(*args):
            queue = QLSubmitQueue()
            queue.changed()
            status = queue.send_handshake(show_dialog=True)
            if status:
                queue.quick_dialog(_("Authentication successful."),
                    Gtk.MessageType.INFO)

        box = Gtk.VBox(spacing=12)

        # first frame
        table = Gtk.Table(n_rows=5, n_columns=2)
        table.props.expand = False
        table.set_col_spacings(6)
        table.set_row_spacings(6)

        labels = []
        label_names = [_("_Service:"), _("_URL:"), _("User_name:"),
            _("_Password:")]
        for idx, name in enumerate(label_names):
            label = Gtk.Label(label=name)
            label.set_alignment(0.0, 0.5)
            label.set_use_underline(True)
            table.attach(label, 0, 1, idx, idx + 1,
                         xoptions=Gtk.AttachOptions.FILL |
                         Gtk.AttachOptions.SHRINK)
            labels.append(label)

        row = 0
        service_combo = Gtk.ComboBoxText()
        table.attach(service_combo, 1, 2, row, row + 1)
        cur_service = plugin_config.get('service')

        # Translators: Other service
        other_label = _(u"Other…")
        for idx, serv in enumerate(sorted(SERVICES.keys()) + [other_label]):
            service_combo.append_text(serv)
            if cur_service == serv:
                service_combo.set_active(idx)
        if service_combo.get_active() == -1:
            service_combo.set_active(0)
        labels[row].set_mnemonic_widget(service_combo)
        row += 1

        # url
        entry = UndoEntry()
        entry.set_text(plugin_config.get('url'))
        entry.connect('changed', changed, 'url')
        service_combo.connect('changed', combo_changed, entry)
        service_combo.emit('changed')
        table.attach(entry, 1, 2, row, row + 1)
        labels[row].set_mnemonic_widget(entry)
        row += 1

        # username
        entry = UndoEntry()
        entry.set_text(plugin_config.get('username'))
        entry.connect('changed', changed, 'username')
        table.attach(entry, 1, 2, row, row + 1)
        labels[row].set_mnemonic_widget(entry)
        row += 1

        # password
        entry = UndoEntry()
        entry.set_text(plugin_config.get('password'))
        entry.set_visibility(False)
        entry.connect('changed', changed, 'password')
        table.attach(entry, 1, 2, row, row + 1)
        labels[row].set_mnemonic_widget(entry)
        row += 1

        # verify data
        button = qltk.Button(_("_Verify account data"),
                             Icons.DIALOG_INFORMATION)
        button.connect('clicked', check_login)
        table.attach(button, 0, 2, 4, 5)

        box.pack_start(qltk.Frame(_("Account"), child=table), True, True, 0)

        # second frame
        table = Gtk.Table(n_rows=4, n_columns=2)
        table.props.expand = False
        table.set_col_spacings(6)
        table.set_row_spacings(6)

        label_names = [_("_Artist pattern:"), _("_Title pattern:"),
            _("Exclude _filter:")]

        labels = []
#.........这里部分代码省略.........
开发者ID:bernd-wechner,项目名称:quodlibet,代码行数:103,代码来源:qlscrobbler.py

示例3: __init__

# 需要导入模块: from quodlibet.qltk.entry import UndoEntry [as 别名]
# 或者: from quodlibet.qltk.entry.UndoEntry import set_visibility [as 别名]
        def __init__(self):
            super(PreferencesWindow.Connection, self).__init__(spacing=12)
            self.set_border_width(12)
            self.title = _("Connection")
            
            vbox = gtk.VBox(spacing=6)
            hb = gtk.HBox(spacing=6)
            e = UndoEntry()
            e.set_text(config.get("connection", "hostname"))
            e.connect('changed', self.__changed_tb, 'connection', 'hostname')
            e.set_tooltip_text(
                    _("The MPD Host to Connect to"))
            l = gtk.Label(_("Hostname:"))
            l.set_use_underline(True)
            l.set_mnemonic_widget(e)
            hb.pack_start(l, expand=False)
            hb.pack_start(e)
            vbox.pack_start(hb, expand=False)
            
            hb = gtk.HBox(spacing=6)
            e = UndoEntry()
            e.set_text(config.get("connection", "port"))
            e.connect('changed', self.__changed_tb, 'connection', 'port')
            e.set_tooltip_text(
                    _("Port of the MPD Host"))
            l = gtk.Label(_("Port:"))
            l.set_use_underline(True)
            l.set_mnemonic_widget(e)
            hb.pack_start(l, expand=False)
            hb.pack_start(e)
            vbox.pack_start(hb, expand=False)
            
            hb = gtk.HBox(spacing=6)
            e = UndoEntry()
            e.set_text(config.get("connection", "password"))
            e.connect('changed', self.__changed_tb, 'connection', 'password')
            e.set_tooltip_text(
                    _("Password for the MPD Host (if necessary)"))
            e.set_visibility(False)
            l = gtk.Label(_("Password:"))
            l.set_use_underline(True)
            l.set_mnemonic_widget(e)
            hb.pack_start(l, expand=False)
            hb.pack_start(e)
            vbox.pack_start(hb, expand=False)
            
            f = qltk.Frame(_("MPD Server Connection"), child=vbox)
            self.pack_start(f, expand=False)

            # player backend
#            if player.backend and hasattr(player.device, 'PlayerPreferences'):
#                player_prefs = player.device.PlayerPreferences()
#                f = qltk.Frame(_("Output Configuration"), child=player_prefs)
#                self.pack_start(f, expand=False)

            # replaygain
            fallback_gain = config.getfloat("player", "fallback_gain", 0.0)
            adj = gtk.Adjustment(fallback_gain, -12.0, 12.0, 0.5, 0.5, 0.0)
            fb_spin = gtk.SpinButton(adj)
            fb_spin.set_digits(1)
            fb_spin.connect('changed', self.__changed,
                            'player', 'fallback_gain')
            fb_spin.set_tooltip_text(
                _("If no Replay Gain information is available "
                  "for a song, scale the volume by this value"))

            fb_label = gtk.Label(_("_Fall-back gain (dB):"))
            fb_label.set_use_underline(True)
            fb_label.set_mnemonic_widget(fb_spin)

            pre_amp_gain = config.getfloat("player", "pre_amp_gain", 0.0)
            adj = gtk.Adjustment(pre_amp_gain, -6, 6, 0.5, 0.5, 0.0)
            adj.connect('value-changed', self.__changed,
                        'player', 'pre_amp_gain')
            pre_spin = gtk.SpinButton(adj)
            pre_spin.set_digits(1)
            pre_spin.set_tooltip_text(
                _("Scale volume for all songs by this value, "
                  "as long as the result will not clip"))

            pre_label = gtk.Label(_("_Pre-amp gain (dB):"))
            pre_label.set_use_underline(True)
            pre_label.set_mnemonic_widget(pre_spin)

            widgets = [pre_label, pre_spin, fb_label, fb_spin]
            c = ConfigCheckButton(_("_Enable Replay Gain volume adjustment"),
                                    "player", "replaygain", populate=True)
            c.connect('toggled', self.__toggled_gain, widgets)

            # packing
            table = gtk.Table(3, 2)
            table.set_col_spacings(6)
            table.set_row_spacings(6)

            table.attach(c, 0, 2, 0, 1)
            fb_label.set_alignment(0, 0.5)
            table.attach(fb_label, 0, 1, 1, 2,
                         xoptions=0)
            pre_label.set_alignment(0, 0.5)
            table.attach(pre_label, 0, 1, 2, 3,
#.........这里部分代码省略.........
开发者ID:silkecho,项目名称:glowing-silk,代码行数:103,代码来源:prefs.py


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