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


Python GSetting.set_value方法代码示例

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


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

示例1: SortOrderButton

# 需要导入模块: from coverart_browser_prefs import GSetting [as 别名]
# 或者: from coverart_browser_prefs.GSetting import set_value [as 别名]
class SortOrderButton(ImageToggleButton):
    __gtype_name__ = 'SortOrderButton'

    def __init__(self, **kargs):
        '''
        Initializes the button.
        '''
        super(SortOrderButton, self).__init__(
            **kargs)

        self.gs = GSetting()

    def initialise(self, plugin, callback, sort_order):
        '''
        set up the images we will use for this widget
        '''
        self.image_display = sort_order
        self.set_tooltip(self.image_display)

        if not self.is_initialised:
            image1 = Gtk.Image.new_from_file(rb.find_plugin_file(plugin,
            'img/arrow_up.png'))
            image2 = Gtk.Image.new_from_file(rb.find_plugin_file(plugin,
            'img/arrow_down.png'))

            super(SortOrderButton, self).initialise(callback,
               image1, image2)

    def do_clicked(self):

        val = not self.image_display
        self.gs.set_value(self.gs.Path.PLUGIN,
                    self.gs.PluginKey.SORT_ORDER, val)
        self.set_tooltip(val)
        self.on_clicked()

    def set_tooltip(self, val):
        cl = CoverLocale()
        cl.switch_locale(cl.Locale.LOCALE_DOMAIN)
        if not val:
            self.set_tooltip_text(_('Sort in descending order'))
        else:
            self.set_tooltip_text(_('Sort in ascending order'))
开发者ID:fossfreedom,项目名称:cb_dev,代码行数:45,代码来源:coverart_widgets.py

示例2: CoverArtBrowserSource

# 需要导入模块: from coverart_browser_prefs import GSetting [as 别名]
# 或者: from coverart_browser_prefs.GSetting import set_value [as 别名]

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

        if self.toolbar_pos == 'right':
            self.toolbar_box.set_visible(False)
            self._toolbar(self.si)
            self.shell.add_widget(self.sidebar,
                        RB.ShellUILocation.RIGHT_SIDEBAR,
                        expand=False,
                        fill=False)

        self.last_toolbar_pos = self.toolbar_pos

        print "CoverArtBrowser DEBUG - end on_notify_toolbar_pos"

    def on_notify_display_bottom_enabled(self, *args):
        '''
        Callback called when the option 'display tracks' is enabled or disabled
        on the plugin's preferences dialog
        '''
        print "CoverArtBrowser DEBUG - on_notify_display_bottom_enabled"

        if self.display_bottom_enabled:
            # make the entry view visible
            self.bottom_box.set_visible(True)

            self.bottom_expander_expanded_callback(
                self.bottom_expander, None)

            # update it with the current selected album
            self.selectionchanged_callback(self.covers_view)

        else:
            if self.bottom_expander.get_expanded():
                y = self.paned.get_position()
                self.gs.set_value(self.gs.Path.PLUGIN,
                                  self.gs.PluginKey.PANED_POSITION,
                                  y)

            self.bottom_box.set_visible(False)

        print "CoverArtBrowser DEBUG - end on_notify_display_bottom_enabled"

    def paned_button_press_callback(self, *args):
        '''
        This callback allows or denies the paned handle to move depending on
        the expanded state of the entry_view
        '''
        print "CoverArtBrowser DEBUG - paned_button_press_callback"
        return not self.bottom_expander.get_expanded()

    def on_paned_button_release_event(self, *args):
        '''
        Callback when the paned handle is released from its mouse click.
        '''

        print "CoverArtBrowser DEBUG - on_paned_button_release_event"

        if self.bottom_expander.get_expanded():
            # save the new position
            new_y = self.paned.get_position()
            self.gs.set_value(self.gs.Path.PLUGIN,
                self.gs.PluginKey.PANED_POSITION, new_y)

        print "CoverArtBrowser DEBUG - end on_paned_button_release_event"

    def on_album_updated(self, model, path, tree_iter):
        '''
开发者ID:fossfreedom,项目名称:cb_dev,代码行数:70,代码来源:coverart_browser_source.py


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