本文整理汇总了Python中dtk.ui.iconview.IconView.clear方法的典型用法代码示例。如果您正苦于以下问题:Python IconView.clear方法的具体用法?Python IconView.clear怎么用?Python IconView.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dtk.ui.iconview.IconView
的用法示例。
在下文中一共展示了IconView.clear方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DeviceIconView
# 需要导入模块: from dtk.ui.iconview import IconView [as 别名]
# 或者: from dtk.ui.iconview.IconView import clear [as 别名]
class DeviceIconView(ScrolledWindow):
def __init__(self, items=None):
ScrolledWindow.__init__(self, 0, 0)
self.device_iconview = IconView()
self.device_iconview.connect("right-click-item", self.__on_right_click_item)
self.device_iconview.draw_mask = self.draw_mask
if items:
self.device_iconview.add_items(items)
self.device_scrolledwindow = ScrolledWindow()
self.device_scrolledwindow.add_child(self.device_iconview)
self.add_child(self.device_scrolledwindow)
event_manager.add_callback("text", self.__on_text)
event_manager.add_callback("hide-text", self.__on_hide_text)
def __on_text(self, name, obj, argv):
disable(self, False)
text(self, argv)
def __on_hide_text(self, name, obj, argv):
disable(self, True)
def __do_remove_item(self, item):
item.do_remove()
self.device_iconview.delete_items([item])
def __on_right_click_item(self, widget, item, x, y):
menu_items = [(None, _("Pair"), lambda : item.do_pair())]
if item.is_paired:
menu_items = []
menu_items.extend(item.menu_items)
menu_items.append(None)
menu_items.append((None, _("Remove Device"), lambda : self.__do_remove_item(item)))
Menu(menu_items, True).show((int(x), int(y)))
def clear(self):
self.device_iconview.clear()
def draw_mask(self, cr, x, y, w, h):
cr.set_source_rgb(*color_hex_to_cairo("#FFFFFF"))
cr.rectangle(x, y, w, h)
cr.fill()
cr.set_source_rgb(*color_hex_to_cairo("#AEAEAE"))
cr.rectangle(x, y, w, h)
cr.stroke()
def add_items(self, items, clear=False):
if clear:
self.device_iconview.clear()
self.device_iconview.add_items(items)
示例2: Browser
# 需要导入模块: from dtk.ui.iconview import IconView [as 别名]
# 或者: from dtk.ui.iconview.IconView import clear [as 别名]
#.........这里部分代码省略.........
def expose_left_box_mask(self, widget, event):
cr = widget.window.cairo_create()
rect = widget.allocation
draw_alpha_mask(cr, rect.x, rect.y, rect.width, rect.height, "layoutRight")
return False
def expose_upper_box_mask(self, widget, event):
cr = widget.window.cairo_create()
rect = widget.allocation
draw_alpha_mask(cr, rect.x, rect.y, rect.width - 2, rect.height, "layoutLast")
return False
def draw_filter_view_mask(self, cr, x, y, width, height):
draw_alpha_mask(cr, x, y, width, height, "layoutLast")
def create_separator_box(self, padding_x=0, padding_y=0):
separator_box = HSeparator(
app_theme.get_shadow_color("hSeparator").get_color_info(),
padding_x, padding_y)
return separator_box
def __switch_to_filter_view(self, widget):
self.back_button.set_no_show_all(True)
self.back_button.hide()
self.switch_box(self.right_box, self.filter_scrolled_window)
self.view_mode = ICON_VIEW_MODE
def reload_filter_view(self, tag="artist", switch=False, use_path=False):
self.entry_box.entry.set_text("")
self.back_button.set_no_show_all(True)
self.back_button.hide()
self.categorybar_status = tag
self.filter_view.clear()
if not use_path:
self.path_categorybar.set_index(-1)
_dict = self.get_infos_from_db(tag)
keys = _dict.keys()
keys.sort()
items = []
all_nb = len(self.__db_query.get_all_songs())
items.append(IconItem(("deepin-all-songs", "deepin-all-songs", all_nb, tag)))
for key in keys:
value, nb = _dict[key]
items.append(IconItem((key, value, nb, tag)))
self.filter_view.add_items(items)
if switch:
self.switch_box(self.right_box, self.filter_scrolled_window)
self.view_mode = ICON_VIEW_MODE
if not use_path:
self.change_combo_box_status(True)
def get_infos_from_db(self, tag, values=None):
genres = []
artists = []
extened = False
return self.__db_query.get_info(tag, genres, artists, values, extened)
def get_attr_infos_from_db(self, info_type="###ALL###", song_dir=None):
return self.__db_query.get_attr_infos(info_type, song_dir)
def change_combo_box_status(self, hide=False):