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


Python TreeView.unhover_row方法代码示例

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


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

示例1: WebcastsBrowser

# 需要导入模块: from dtk.ui.treeview import TreeView [as 别名]
# 或者: from dtk.ui.treeview.TreeView import unhover_row [as 别名]
class WebcastsBrowser(gtk.VBox):
    
    def __init__(self):
        gtk.VBox.__init__(self)
        
        # Init data.
        self.source_data = OrderedDict()
        self.source_data["internal"] = "国内广播"
        self.source_data["foreign"]  = "国外广播"
        self.source_data["network"] = "网络广播"
        self.source_data["genres"] = "流派广播"
        self.source_data["music"]  = "音乐广播"
        self.source_data["finance"] = "财经广播"
        self.source_data["sports"] = "体育广播"
        
        # Init sourcebar
        self.__init_sourcebar()
        
        # Init webcasts view.
        self.source_view, self.source_sw = self.get_webcasts_view()
        self.collect_view, self.collect_sw = self.get_webcasts_view()
        # self.custom_view, custom_view_sw = self.get_webcasts_view()
        
        self.source_view.connect("single-click-item", self.on_source_view_single_click_item)
        
        if WebcastsDB.isloaded():
            self.on_webcastsdb_loaded()
        else:    
            self.connect_to_webcastsdb()
            
        # Dispatcher
        Dispatcher.connect("webcast-info", self.on_dispatcher_webcast_info)    
        Dispatcher.connect("clear-sourcebar-status", lambda obj: self.clear_sourcebar_status())
        
        # Used to switch categroy view.
        self.switch_view_box = gtk.VBox()
        self.switch_view_box.add(self.source_sw)
        
        body_paned = HPaned(handle_color=app_theme.get_color("panedHandler"), enable_drag=True)
        body_paned.add1(self.sourcebar)
        body_paned.add2(self.switch_view_box)
        
        self.add(body_paned)
        self.show_all()
        
    def on_dispatcher_webcast_info(self, obj, parent, key):    
        items = WebcastsDB.get_items(parent, key)
        self.source_view.clear()
        if items:
            self.source_view.add_items([WebcastListItem(tag) for tag in items])        
            switch_tab(self.switch_view_box, self.source_sw)
        
    def connect_to_webcastsdb(self):    
        WebcastsDB.connect("loaded", self.on_webcastsdb_loaded)
        
    def on_webcastsdb_loaded(self, *args):    
        items = WebcastsDB.get_items("internal", "中央电台")
        self.source_view.add_items([WebcastListItem(tag) for tag in items])        
        
        # load collect webcasts.
        collect_taglist = WebcastsDB.get_favorite_items()
        if collect_taglist:
            self.collect_view.add_items([WebcastListItem(tag) for tag in collect_taglist])
        
    def __init_sourcebar(self):
        self.sourcebar = TreeView(enable_drag_drop=False, enable_multiple_select=False)
        items = []
        for index, (key, value) in enumerate(self.source_data.items()):
            if index == 0: show_icon = True
            else: show_icon = False
            items.append(CategroyItem(value, key, self.sourcebar, index, show_icon))
        items.append(CustomItem("我的收藏", lambda : switch_tab(self.switch_view_box, self.collect_sw)))    
                
        self.sourcebar.add_items(items)
        self.sourcebar.set_size_request(121, -1)
        self.sourcebar.draw_mask = self.on_sourcebar_draw_mask        
        self.sourcebar.draw_area.tag_by_poup_panel_grab_window = True
        popup_grab_window.focus_out_callback = self.handle_focus_out
        
    def handle_focus_out(self):
        self.sourcebar.unhover_row()
        self.sourcebar.left_button_press = False
        
    def get_webcasts_view(self):    
        webcast_view = MultiDragWebcastView()
        scrolled_window = ScrolledWindow(0, 0)
        scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
        scrolled_window.add_child(webcast_view)
        return webcast_view, scrolled_window
    
    def on_sourcebar_draw_mask(self, cr, x, y, w, h):    
        draw_alpha_mask(cr, x, y, w, h ,"layoutRight")

        return False
    
    def on_source_view_single_click_item(self, widget, item, column, x, y):
        if column == 2:
            item.toggle_is_collected()
            if item.is_collected:
                tags = item.webcast.get_dict()
#.........这里部分代码省略.........
开发者ID:WilliamRen,项目名称:deepin-music-player,代码行数:103,代码来源:discard_browser.py


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