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


Python TreeView.unselect_all方法代码示例

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


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

示例1: HomePage

# 需要导入模块: from dtk.ui.treeview import TreeView [as 别名]
# 或者: from dtk.ui.treeview.TreeView import unselect_all [as 别名]

#.........这里部分代码省略.........
                item.button_press(0, 0, 0)
                break
        
    def draw_mask(self, cr, x, y, w, h):
        '''
        Draw mask interface.
        
        @param cr: Cairo context.
        @param x: X coordiante of draw area.
        @param y: Y coordiante of draw area.
        @param w: Width of draw area.
        @param h: Height of draw area.
        '''
        sidebar_color = app_theme.get_color("sidebar_background").get_color()
        draw_vlinear(cr, x, y, w, h,
                     [(0, (sidebar_color, 0.9)),
                      (1, (sidebar_color, 0.9)),]
                     )
        
    def expose_canopy(self, widget, event):
        # Init.
        cr = widget.window.cairo_create()
        rect = widget.allocation
        canopy_color = app_theme.get_color("sidebar_select").get_color()
        
        canopy_img_blue_path = os.path.join(get_parent_dir(__file__, 2), "image", "canopy", "canopy-blue.png")
        canopy_img_yellow_path = os.path.join(get_parent_dir(__file__, 2), "image", "canopy", "canopy-yellow.png")

        draw_pixbuf(
            cr,
            gtk.gdk.pixbuf_new_from_file(canopy_img_yellow_path),
            rect.x,
            rect.y)
        
        surface = cairo.ImageSurface.create_from_png(canopy_img_blue_path)
        cr.set_source_rgb(*color_hex_to_cairo(canopy_color))
        cr.mask_surface(surface, rect.x, rect.y)

    def expose_split_line(self, widget, event):
        # Init.
        cr = widget.window.cairo_create()
        rect = widget.allocation

        cr.set_source_rgb(*color_hex_to_cairo("#e5e5e5"))
        cr.rectangle(rect.x, rect.y, 1, rect.height)
        cr.fill()
        
        return True
        
    def search_entry_changed(self, entry, entry_string):
        self.press_id += 1
        self.press_return = False
        self.entry_changed = True
        
    def search_entry_key_press(self, widget, event):
        self.in_press = True
        self.press_id += 1
        
        remove_timeout_id(self.show_timeout_id)
        
    def search_entry_key_release(self, widget, event):
        self.in_press = False
        press_id = copy.deepcopy(self.press_id)
        remove_timeout_id(self.show_timeout_id)
        self.show_timeout_id = gobject.timeout_add(200, lambda : self.popup_completion(press_id))
        
    def popup_completion(self, press_id):
        if (not self.in_press) and (not self.press_return) and press_id == self.press_id and self.entry_changed:
            search_string = search_entry.get_text()
            if len(search_string.strip()) >= 3:
                match_pkgs = self.data_manager.get_pkgs_match_input(search_string)
                if len(match_pkgs) > 0:
                    completion_window.show(search_string, match_pkgs)
                else:
                    completion_grab_window.popup_grab_window_focus_out()
            else:
                completion_grab_window.popup_grab_window_focus_out()
                
            self.entry_changed = False
        
    def show_search_page(self, search_string, press_return=False):
        if search_string.strip() != "":
            self.category_view.unselect_all()
            
            self.press_return = press_return
            
            if self.press_return:
                completion_grab_window.popup_grab_window_focus_out()
            
            search_page = SearchPage(self.data_manager)
            self.show_pkg_view(search_page)
            search_page.update(map(lambda word: word.encode("utf8"), search_string.split(" ")))
        else:
            logger.warning("empty string in search text input")
        
    def show_pkg_view(self, widget):
        container_remove_all(self.page_box)
        self.page_box.pack_start(widget, True, True)
        
        self.page_box.show_all()
开发者ID:electricface,项目名称:deepin-software-center,代码行数:104,代码来源:home_page.py


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