本文整理汇总了Python中dtk.ui.treeview.TreeView类的典型用法代码示例。如果您正苦于以下问题:Python TreeView类的具体用法?Python TreeView怎么用?Python TreeView使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TreeView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, data=None, view_type=1):
TreeView.__init__(self, enable_drag_drop=False,
enable_multiple_select=True)
# view_type 为list类型
self.connect("double-click-item", self.on_music_view_double_click)
self.connect("press-return", self.on_music_view_press_return)
self.connect("right-press-items", self.on_music_view_right_press_items)
#self.connect("delete-select-items",
#self.on_music_view_delete_select_items)
self.db_file = get_cache_file("neteasecloudmusic/neteasecloudmusic.db")
self.view_type = view_type
self.view_data = data
self.request_thread_id = 0
self.collect_thread_id = 0
self.onlinelist_thread_id = 0
self.collect_page = 0
#self.load_online_playlists()
#if self.view_type == self.DEFAULT_TYPE:
#self.load()
#elif self.view_type == self.COLLECT_TYPE:
#self.load_collect_songs()
#elif self.view_type == self.PLAYLIST_TYPE:
self.load_onlinelist_songs()
示例2: AlbumDetailPage
class AlbumDetailPage(gtk.VBox):
'''
class docs
'''
def __init__(self, data_manager, album_info):
'''
init docs
'''
gtk.VBox.__init__(self)
self.treeview = TreeView(enable_drag_drop=False, expand_column=1)
items = []
for software_info in album_info['softwares']:
items.append(AlbumDetailItem(software_info, data_manager))
self.treeview.add_items(items)
self.treeview.draw_mask = self.draw_mask
self.pack_start(self.treeview, True, True)
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.
'''
draw_vlinear(cr, x, y, w, h,
[(0, ("#FFFFFF", 0.9)),
(1, ("#FFFFFF", 0.9)),]
)
示例3: __init__
def __init__(self):
TreeView.__init__(self, enable_drag_drop=False, enable_multiple_select=False)
# Player.connect("instant-new-song", self.on_new_song)
Dispatcher.connect("download-songs", self.on_dispatcher_download_songs)
self.set_expand_column(1)
示例4: __init__
def __init__(self, *args, **kwargs):
TreeView.__init__(self, *args, **kwargs)
targets = [
("text/deepin-radios", gtk.TARGET_SAME_APP, 1),
]
self.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_DROP,
targets, gtk.gdk.ACTION_COPY)
self.connect_after("drag-data-received", self.on_drag_data_received)
self.connect("double-click-item", self.on_double_click_item)
self.connect("button-press-event", self.on_button_press_event)
self.connect("delete-select-items", self.try_emit_empty_signal)
self.connect("right-press-items", self.on_right_press_items)
Dispatcher.connect("play-radio", self.on_dispatcher_play_radio)
Player.connect("play-end", self.on_play_end)
self.lock = threading.Lock()
self.current_index = 0
self.playlist = []
self.limit_number = 25
self.preview_db_file = get_config_file("preview_radios.db")
self.status_db_file = get_cache_file("musicfm/status.db")
self.load_status()
示例5: __init__
def __init__(self):
TreeView.__init__(self, enable_drag_drop=False, enable_multiple_select=True)
targets = [("text/deepin-songs", gtk.TARGET_SAME_APP, 1), ("text/uri-list", 0, 2), ("text/plain", 0, 3)]
self.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_DROP,
targets, gtk.gdk.ACTION_COPY)
self.pl = None
self.add_song_cache = []
sort_key = ["file", "album", "genre", "#track", "artist", "title", "#playcount", "#added"]
self.sort_reverse = {key : False for key in sort_key }
self.connect_after("drag-data-received", self.on_drag_data_received)
self.connect("double-click-item", self.double_click_item_cb)
self.connect("button-press-event", self.button_press_cb)
self.connect("delete-select-items", self.try_emit_empty_signal)
self.connect("motion-notify-item", self.on_motion_notify_item)
self.connect("press-return", self.on_press_return)
self.draw_area.connect("leave-notify-event", self.on_leave_notify_event)
self.set_hide_columns([1])
self.set_expand_column(None)
MediaDB.connect("removed", self.__remove_songs)
MediaDB.connect("simple-changed", self.__songs_changed)
self.song_notify = SongNotify()
self.notify_timeout_id = None
self.notify_timeout = 400 # ms
self.delay_notify_item = None
self.notify_offset_x = 5
self.invaild_items = set()
示例6: __init__
def __init__(self, data=None, view_type=1):
TreeView.__init__(self, enable_drag_drop=False,
enable_multiple_select=True)
# view_type 为list类型
self.connect("double-click-item", self.on_music_view_double_click)
self.connect("press-return", self.on_music_view_press_return)
self.connect("right-press-items", self.on_music_view_right_press_items)
#self.connect("delete-select-items",
#self.on_music_view_delete_select_items)
self.db_file = get_cache_file("neteasecloudmusic/neteasecloudmusic.db")
self.view_type = view_type
self.view_data = data
self.request_thread_id = 0
self.collect_thread_id = 0
self.onlinelist_thread_id = 0
self.collect_page = 0
if self.view_type not in [self.PLAYING_LIST_TYPE, self.LOGIN_LIST_TYPE,
self.PERSONAL_FM_ITEM]:
self.load_onlinelist_songs()
if self.view_type == self.PERSONAL_FM_ITEM:
self.enable_multiple_select=False
示例7: __init__
def __init__(self, enable_multiple_select=True):
TreeView.__init__(self, enable_drag_drop=False,
enable_multiple_select=enable_multiple_select)
#self.connect("double-click-item", self.on_music_view_double_click)
#self.connect("press-return", self.on_music_view_press_return)
self.connect("right-press-items", self.right_press_items)
示例8: __init__
def __init__(self):
TreeView.__init__(self, enable_drag_drop=False,
enable_multiple_select=True)
# view_type 为list类型
self.connect("double-click-item", self.on_music_view_double_click)
self.connect("press-return", self.on_music_view_press_return)
self.connect("right-press-items", self.on_music_view_right_press_items)
self.onlinelist_thread_id = 0
示例9: __init__
def __init__(self):
TreeView.__init__(self, enable_drag_drop=False, enable_multiple_select=True)
self.connect("double-click-item", self.on_music_view_double_click)
self.connect("press-return", self.on_music_view_press_return)
event_manager.connect("add-songs", self.on_event_add_songs)
event_manager.connect("play-songs", self.on_event_play_songs)
self.db_file = get_config_file("baidumusic.db")
self.load()
self.request_thread_id = 0
示例10: __init_widget
def __init_widget(self):
self.buttonbox = gtk.VBox()
self.pack_start(self.buttonbox, False, False)
style.add_separator(self)
#self.connection_tree = EntryTreeView()
self.add_button = AddSettingItem(_("New Connection") ,self.add_new_connection)
add_setting_tree = TreeView([self.add_button])
add_setting_tree.set_expand_column(1)
self.pack_start(add_setting_tree, False, False)
self.set_size_request(160, -1)
self.show_all()
self.__init_signals()
示例11: plugin_widget
def plugin_widget(self):
self.__get_devices()
plugin_box = gtk.VBox()
adapter_box = gtk.HBox(spacing = 5)
adapter_image = ImageBox(app_theme.get_pixbuf("bluetooth/enable_open.png"))
adapter_label = self.__setup_label(_("Adapter"))
adapter_toggle = self.__setup_toggle()
if self.my_bluetooth.adapter:
adapter_toggle.set_active(self.my_bluetooth.adapter.get_powered())
if self.my_bluetooth.adapter.get_powered():
self.tray_icon.set_icon_theme("enable")
else:
self.tray_icon.set_icon_theme("enable_disconnect")
adapter_toggle.connect("toggled", self.__adapter_toggled)
separator_align = self.__setup_align(padding_bottom = 0)
separator = self.__setup_separator()
separator_align.add(separator)
'''
devices treeview
'''
device_treeview = TreeView()
device_separator_align = self.__setup_align()
device_separator = self.__setup_separator()
device_separator_align.add(device_separator)
device_count = len(self.device_items)
if device_count:
device_treeview.delete_all_items()
device_treeview.add_items(self.device_items)
device_treeview.set_size_request(self.width, device_count * DeviceItem.ITEM_HEIGHT)
else:
device_treeview.set_child_visible(False)
device_separator_align.set_size_request(-1, 0)
device_separator_align.set_child_visible(False)
'''
select button
'''
select_button_align = self.__setup_align()
select_button = SelectButton(_("Advanced options..."),
font_size = 10,
ali_padding = 5)
select_button.set_size_request(self.width, 25)
select_button.connect("clicked", self.__bluetooth_selected) # I don't know why, but replacing "button-press-event" with
select_button_align.add(select_button) # clicked really works...
adapter_box.pack_start(adapter_image, False, False)
adapter_box.pack_start(adapter_label, False, False)
adapter_box.pack_start(adapter_toggle, False, False)
plugin_box.pack_start(adapter_box, False, False)
plugin_box.pack_start(separator_align, False, False)
plugin_box.pack_start(device_treeview, False, False)
plugin_box.pack_start(device_separator_align, False, False)
plugin_box.pack_start(select_button_align, False, False)
return plugin_box
示例12: create_mirror_select_table
def create_mirror_select_table(self):
main_table = gtk.Table(3, 2)
main_table.set_row_spacings(CONTENT_ROW_SPACING)
mirror_select_title = Label(_("Select mirror"))
self.select_best_mirror_button = Button(self.select_best_mirror_button_texts["normal"])
self.select_best_mirror_button.connect("clicked", self.select_best_mirror)
self.mirrors_dir = os.path.join(get_parent_dir(__file__, 2), 'mirrors')
self.current_mirror_hostname = utils.get_current_mirror_hostname()
self.mirror_items = self.get_mirror_items()
self.mirror_view = TreeView(self.mirror_items,
enable_drag_drop=False,
enable_multiple_select=False,
mask_bound_height=0,
)
self.mirror_view.set_expand_column(1)
self.mirror_view.set_size_request(-1, 280)
self.mirror_view.draw_mask = self.mirror_treeview_draw_mask
main_table.attach(mirror_select_title, 0, 1, 0, 1, yoptions=gtk.FILL)
main_table.attach(self.select_best_mirror_button, 1, 2, 0, 1, xoptions=gtk.FILL)
main_table.attach(create_separator_box(), 0, 2, 1, 2, xoptions=gtk.FILL)
main_table.attach(self.mirror_view, 0, 2, 2, 3, xoptions=gtk.FILL)
return main_table
示例13: __init__
def __init__(self, bus_interface, data_manager):
'''
init docs
'''
# Init.
gtk.VBox.__init__(self)
self.bus_interface = bus_interface
self.data_manager = data_manager
self.search_flag = False
self.uninstall_change_items = {"add": [], "delete": []}
self.message_bar = MessageBar(32)
self.message_bar.search_entry.entry.connect("changed", self.search_cb)
self.message_bar.search_button.connect("clicked", self.search_cb)
self.treeview = TreeView(enable_drag_drop=False)
self.treeview.set_expand_column(0)
top_hbox = gtk.HBox()
top_hbox.pack_start(self.message_bar)
self.pack_start(top_hbox, False, False)
self.pack_start(self.treeview, True, True)
self.treeview.connect("items-change", self.update_message_bar)
self.fetch_uninstall_info()
self.treeview.draw_mask = self.draw_mask
示例14: __init_navigatebar
def __init_navigatebar(self):
self.navigatebar = TreeView(enable_drag_drop=False, enable_multiple_select=False)
self.navigatebar.connect("single-click-item", self.on_navigatebar_single_click)
self.navigatebar.set_size_request(132, -1)
self.navigatebar.draw_mask = self.on_navigatebar_draw_mask
local_expand_item = ExpandItem(_("Library"))
network_expand_item = ExpandItem(_("Internet"))
self.navigatebar.add_items([local_expand_item,
network_expand_item,
])
local_expand_item.add_childs([
(FavoritesTitle, self.favorites_page),
(LocalWallpapersTitle, self.pictures_page),
],
expand=True)
network_expand_item.add_childs([(_("360 Wallpaper"), self.bizhi360_cache_page),
(_("LoveWallpaper"), self.aibizhi_cache_page),
], expand=True)
if get_favorite_number() == 0:
self.navigatebar.set_highlight_item(self.navigatebar.get_items()[2])
self.switch_page.add(self.pictures_page)
else:
self.navigatebar.set_highlight_item(self.navigatebar.get_items()[1])
self.switch_page.add(self.favorites_page)
示例15: add_switcher
def add_switcher(self):
if self.device_tree == None:
self.device_tree = TreeView([DeviceToggleItem(self.wireless_devices, 0)])
self.device_tree.set_expand_column(1)
self.content_box.pack_start(self.device_tree, False, True)
self.content_box.reorder_child(self.device_tree, 0)
net_manager.emit_wifi_switch(0)