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


Python Button.set_child_visible方法代码示例

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


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

示例1: DetailPage

# 需要导入模块: from dtk.ui.button import Button [as 别名]
# 或者: from dtk.ui.button.Button import set_child_visible [as 别名]
class DetailPage(gtk.VBox):
    """
    class docs
    """

    def __init__(self):
        """
        init docs
        """
        gtk.VBox.__init__(self)

        self.__background_settings = deepin_gsettings.new("com.deepin.dde.background")

        self.draw_title_background = self.draw_tab_title_background
        self.theme = None

        self.wallpaper_box = gtk.VBox()
        self.window_theme_box = gtk.VBox()
        self.wallpaper_view = WallpaperView(padding_x=30, padding_y=ITEM_PADDING_Y)
        self.wallpaper_view_sw = self.wallpaper_view.get_scrolled_window()
        self.wallpaper_view_sw.set_size_request(-1, 426)

        position_group, self.position_combobox = get_combo_group(
            _("Position"), DRAW_COMBO_ITEM, self.on_position_combox_selected
        )
        time_group, self.time_combobox = get_combo_group(_("Duration"), TIME_COMBO_ITEM, self.on_time_combox_selected)

        self.__is_random = True
        if self.__background_settings.get_int("background-duration") == 0:
            self.__is_random = False
        self.unorder_play, self.random_toggle = get_toggle_group(
            _("Random"), self.__on_random_toggled, self.__is_random
        )
        self.button_align = gtk.Alignment()
        self.button_box = gtk.HBox(spacing=5)
        self.select_all_button = Button(_("Select all"))
        self.select_all_button.set_size_request(80, WIDGET_HEIGHT)
        self.select_all_button.connect("clicked", self.__on_select_all)
        self.delete_button = Button(_("Delete"))
        self.delete_button.set_size_request(80, WIDGET_HEIGHT)
        self.delete_button.connect("clicked", self.__on_delete)
        self.button_box.pack_start(self.select_all_button, False, False)
        self.button_box.pack_start(self.delete_button, False, False)
        self.button_align.add(self.button_box)

        self.action_bar = gtk.HBox(spacing=26)
        self.action_bar.pack_start(position_group, False, False)
        self.action_bar.pack_start(time_group, False, False)
        self.action_bar.pack_start(self.unorder_play, False, False)
        self.action_bar.pack_end(self.button_align, False, False)
        action_bar_align = gtk.Alignment()
        action_bar_align.set_size_request(-1, STATUS_HEIGHT)
        action_bar_align.set_padding(5, 5, 50, 20)
        action_bar_align.add(self.action_bar)

        self.wallpaper_box.pack_start(self.wallpaper_view_sw, True, True)
        self.wallpaper_box.pack_start(action_bar_align, False, False)

        self.pack_start(self.wallpaper_box, False, False)

        event_manager.add_callback("select-wallpaper", self.on_wallpaper_select)
        event_manager.add_callback("apply-wallpaper", self.__on_wallpaper_apply)
        event_manager.add_callback("add-wallpapers", self.__on_add_wallpapers)

    def __random_enable(self):
        self.time_combobox.set_sensitive(True)
        self.unorder_play.set_child_visible(True)
        self.random_toggle.set_child_visible(True)
        self.random_toggle.set_active(self.theme.get_background_random_mode())

    def __random_disable(self):
        self.time_combobox.set_sensitive(False)
        self.unorder_play.set_child_visible(False)
        self.random_toggle.set_child_visible(False)
        self.random_toggle.set_active(self.theme.get_background_random_mode())

    def on_wallpaper_select(self, name, obj, select_item):
        if self.wallpaper_view.is_randomable():
            self.__random_enable()
        else:
            self.__random_disable()

        if self.wallpaper_view.is_select_all():
            self.select_all_button.set_label(_("Clear all"))
        else:
            self.select_all_button.set_label(_("Select all"))
        self.select_all_button.set_size_request(80, WIDGET_HEIGHT)

    def __on_wallpaper_apply(self, name, obj, select_item):
        self.__random_disable()

        if self.wallpaper_view.is_select_all():
            self.select_all_button.set_label(_("Clear all"))
        else:
            self.select_all_button.set_label(_("Select all"))
        self.select_all_button.set_size_request(80, WIDGET_HEIGHT)

    def __on_select_all(self, widget):
        self.wallpaper_view.select_all()
        if self.wallpaper_view.is_select_all():
#.........这里部分代码省略.........
开发者ID:martyr-deepin,项目名称:deepin-system-settings,代码行数:103,代码来源:detail_page.py

示例2: FootBox

# 需要导入模块: from dtk.ui.button import Button [as 别名]
# 或者: from dtk.ui.button.Button import set_child_visible [as 别名]
class FootBox(gtk.HBox):
    '''
    class docs
    '''
	
    def __init__(self):
        '''
        init docs
        '''
        gtk.HBox.__init__(self)

        self.button_width = 80

        self.module_id = None

        self.buttons_list = []
        self.__setup_reset_button()
        self.buttons_list.append(self.reset_button)

        self.__is_init_ui = False
   
    def __setup_reset_button(self):
        self.reset_button = Button(_("Reset"))
        #self.reset_button.set_size_request(self.button_width, WIDGET_HEIGHT)
        self.reset_button.connect("clicked", self.__reset_button_clicked)

    def __setup_buttons_align(self, list):
        buttons_align = self.__setup_align(padding_top = 7,
            padding_left = 80 - (len(list) - 1) * 10,
            padding_right = TEXT_WINDOW_RIGHT_WIDGET_PADDING)
        buttons_box = gtk.HBox(spacing = 5)
        i = 0
        while i < len(list):
            buttons_box.pack_start(list[i], False, False)
            i += 1

        buttons_align.add(buttons_box)

        return buttons_align

    def __init_ui(self):
        self.status_label = self.__setup_label("")
        self.right_box = gtk.VBox()
        self.buttons_align = self.__setup_buttons_align(self.buttons_list)
        self.right_box.pack_start(self.buttons_align)
        
        self.pack_start(self.status_label)
        self.pack_end(self.right_box, False, False)
        self.set_size_request(-1, STATUS_HEIGHT)
        
        self.connect("expose-event", self.__expose)
        
        self.__is_init_ui = True

    def __handle_dbus_reply(*reply):                                                  
        pass

    def __handle_dbus_error(*error):                                                  
        pass

    def __add_button_clicked(self, widget, argv):                                      
        bus = dbus.SessionBus()                                                              
        module_dbus_name = "com.deepin.%s_settings" % (self.module_id)                  
        module_object_name = "/com/deepin/%s_settings" % (self.module_id)                  
        if is_dbus_name_exists(module_dbus_name):                                       
            bus_object = bus.get_object(module_dbus_name, module_object_name)       
            method = bus_object.get_dbus_method("message_receiver")                 
            method("add_button_cb",                                                        
                   argv,                                                             
                   reply_handler=self.__handle_dbus_reply,                          
                   error_handler=self.__handle_dbus_error                          
                  )                    

    def __reset_button_clicked(self, widget):
        bus = dbus.SessionBus()                                                     
        module_dbus_name = "com.deepin.%s_settings" % (self.module_id)                   
        module_object_name = "/com/deepin/%s_settings" % (self.module_id)                
        if is_dbus_name_exists(module_dbus_name):                                   
            bus_object = bus.get_object(module_dbus_name, module_object_name)          
            method = bus_object.get_dbus_method("message_receiver")                 
            method("reset",                                                    
                   "",                      
                   reply_handler=self.__handle_dbus_reply,                                 
                   error_handler=self.__handle_dbus_error                  
                  )         
    
    def hide(self):
        self.hide_all()

    def show(self, module_id):
        self.module_id = module_id

        if not self.__is_init_ui:
            self.__init_ui()
       
        self.show_all()

    def hide_reset(self):
        self.reset_button.set_child_visible(False)
   
#.........这里部分代码省略.........
开发者ID:electricface,项目名称:deepin-system-settings,代码行数:103,代码来源:foot_box.py


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