本文整理汇总了Python中dtk.ui.scrolled_window.ScrolledWindow类的典型用法代码示例。如果您正苦于以下问题:Python ScrolledWindow类的具体用法?Python ScrolledWindow怎么用?Python ScrolledWindow使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ScrolledWindow类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self):
self.tree_view_open = app_theme.get_pixbuf("treeview/open.png")
self.tree_view_close = app_theme.get_pixbuf("treeview/close.png")
self.tree_view_right = app_theme.get_pixbuf("treeview/right.png")
self.tree_view_bottom = app_theme.get_pixbuf("treeview/bottom.png")
#
self.listview_color = ui_theme.get_color("scrolledbar")
self.play_list_vbox = gtk.VBox()
#
self.list_scroll_win = ScrolledWindow(0, 0)
self.list_scroll_win.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
self.list_view = ListView()
#
self.tree_scroll_win = ScrolledWindow(0, 0)
self.tree_scroll_win.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
self.tree_view = TreeViewBase()
self.note_book = NoteBook()
#
self.list_view.on_draw_sub_item = self.__listview_on_draw_sub_item
self.list_view.columns.add_range(["filename", "time"])
self.list_view.columns[0].width = 120
self.list_view.columns[1].width = 95
#
self.note_book.hide_title()
self.tree_view.paint_nodes_event = self.__treeview_paint_nodes_event
#
self.list_scroll_win.add_with_viewport(self.list_view)
self.tree_scroll_win.add_with_viewport(self.tree_view)
self.note_book.add_layout1(self.list_scroll_win)
self.note_book.add_layout2(self.tree_scroll_win)
#self.play_list_vbox.pack_start(self.scroll_win, True, True)
self.play_list_vbox.pack_start(self.note_book, True, True)
示例2: __init__
def __init__(self):
DialogBox.__init__(self, _("Task Manager"), 350, 450, DIALOG_MASK_SINGLE_PAGE,
modal=False, close_callback=self.hide_all)
self.is_changed = False
scrolled_window = ScrolledWindow(0, 0)
scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
scrolled_align = gtk.Alignment()
scrolled_align.set(1, 1, 1, 1)
scrolled_align.set_padding(10, 0, 0, 0)
scrolled_align.add(scrolled_window)
self.jobs_view = JobsView()
self.jobs_view.draw_mask = self.get_mask_func(self.jobs_view)
scrolled_window.add_child(self.jobs_view)
pause_button = Button(_("Pause"))
pause_button.connect("clicked", self.pause_job)
stop_button = Button(_("Close"))
stop_button.connect("clicked", lambda w: self.hide_all())
self.body_box.add(scrolled_align)
self.right_button_box.set_buttons([pause_button, stop_button])
Dispatcher.connect("transfor-job", self.add_new_job)
示例3: __init__
def __init__(self):
DialogBox.__init__(self, _("Search"), 460, 300, DIALOG_MASK_SINGLE_PAGE,
modal=False, window_hint=None, close_callback=self.hide_all)
title_label = Label(_("Title:"))
self.title_entry = TextEntry("")
self.title_entry.set_size(300, 25)
self.search_button = Button(_("Search"))
self.search_button.connect("clicked", self.search_song)
control_box = gtk.HBox(spacing=5)
control_box.pack_start(title_label, False, False)
control_box.pack_start(self.title_entry, False, False)
control_box.pack_start(self.search_button, False, False)
scrolled_window = ScrolledWindow(0, 0)
scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
self.result_view = ListView()
self.result_view.connect("double-click-item", self.double_click_cb)
self.result_view.draw_mask = self.get_mask_func(self.result_view)
self.result_view.add_titles([_("Title"), _("Artist"), _("Album"), _("Type"), _("Size")])
scrolled_window.add_child(self.result_view)
self.prompt_label = Label("")
download_button = Button(_("Download"))
download_button.connect("clicked", self.download_song)
cancel_button = Button(_("Close"))
cancel_button.connect("clicked", lambda w: self.hide_all())
self.body_box.set_spacing(5)
self.body_box.pack_start(control_box, False, False)
self.body_box.pack_start(scrolled_window, True, True)
self.left_button_box.set_buttons([self.prompt_label])
self.right_button_box.set_buttons([download_button, cancel_button])
示例4: __init__
def __init__(self, data_manager):
# Init.
gtk.VBox.__init__(self)
self.data_manager = data_manager
self.tab_box = gtk.HBox()
self.tab_box.set_size_request(-1, RANK_TAB_HEIGHT)
self.tab_box.set_spacing(1)
self.tab_box_align = gtk.Alignment()
self.tab_box_align.set(1, 0, 0, 0)
self.tab_box_align.set_padding(3, 9, 25, 48)
for (tab_index, tab_name) in enumerate([_("Top 25 weekly"), _("Top 25 monthly"), _("Top 25 totally")]):
self.tab_box.pack_start(RankTab(tab_index, tab_name, tab_index == 0), False, False)
self.page_box = gtk.VBox()
self.page_align = gtk.Alignment()
self.page_align.set(0.5, 0.5, 1, 1)
self.page_align.set_padding(0, 0, 15, 15)
self.week_rank_icon_view = IconView()
self.week_rank_icon_view_scrlledwindow = ScrolledWindow()
self.week_rank_icon_view.draw_mask = self.draw_mask
self.month_rank_icon_view = IconView()
self.month_rank_icon_view_scrlledwindow = ScrolledWindow()
self.month_rank_icon_view.draw_mask = self.draw_mask
self.all_rank_icon_view = IconView()
self.all_rank_icon_view_scrlledwindow = ScrolledWindow()
self.all_rank_icon_view.draw_mask = self.draw_mask
self.week_rank_icon_view_scrlledwindow.add_child(self.week_rank_icon_view)
self.month_rank_icon_view_scrlledwindow.add_child(self.month_rank_icon_view)
self.all_rank_icon_view_scrlledwindow.add_child(self.all_rank_icon_view)
self.tab_box_align.add(self.tab_box)
self.page_box.pack_start(self.page_align)
self.pack_start(self.tab_box_align, False, False)
self.pack_start(self.page_box, True, True)
self.loading = LoadingBox()
self.view_list = [
('week', self.week_rank_icon_view, self.week_rank_icon_view_scrlledwindow),
('month', self.month_rank_icon_view, self.month_rank_icon_view_scrlledwindow),
('all', self.all_rank_icon_view, self.all_rank_icon_view_scrlledwindow)]
self.pkg_names = []
self.show_flag = None
self.all_show_flag = ['week', 'month', 'all']
global_event.register_event("update-rank-page", self.update_rank_page)
gtk.timeout_add(300, self.get_pkgs_status)
global_event.emit("update-rank-page", 0)
示例5: DeviceIconView
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)
示例6: __init__
def __init__(self):
DialogBox.__init__(
self, _("Lyrics search"), 460, 300, DIALOG_MASK_MULTIPLE_PAGE, close_callback=self.hide_all,
modal=False, window_hint=None, skip_taskbar_hint=False)
self.artist_entry = InputEntry()
self.artist_entry.set_size(130, 23)
self.title_entry = InputEntry()
self.title_entry.set_size(130, 23)
artist_label = Label(_("Artist:"))
title_label = Label(_("Title:"))
right_align = gtk.Alignment()
right_align.set(0, 0, 0, 1)
search_button = Button(_("Search"))
search_button.connect("clicked", self.search_lyric_cb)
info_box = gtk.HBox(spacing=25)
control_box = gtk.HBox(spacing=5)
title_box = gtk.HBox(spacing=5)
title_box.pack_start(title_label, False, False)
title_box.pack_start(self.title_entry)
artist_box = gtk.HBox(spacing=5)
artist_box.pack_start(artist_label, False, False)
artist_box.pack_start(self.artist_entry)
control_box.pack_start(title_box, False, False)
control_box.pack_start(artist_box, False, False)
info_box.pack_start(control_box, False, False)
info_box.pack_start(search_button, False, False)
scrolled_window = ScrolledWindow(0, 0)
scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
sort_items = [(lambda item: item.title, cmp), (lambda item: item.artist, cmp)]
self.result_view = ListView(sort_items)
self.result_view.connect("double-click-item", self.double_click_cb)
self.result_view.add_titles([_("Title"), _("Artist")])
self.result_view.draw_mask = self.get_mask_func(self.result_view)
scrolled_window.add_child(self.result_view)
self.prompt_label = Label("")
download_button = Button(_("Download"))
download_button.connect("clicked", self.download_lyric_cb)
cancel_button = Button(_("Close"))
cancel_button.connect("clicked", lambda w: self.hide_all())
info_box_align = gtk.Alignment()
info_box_align.set_padding(5, 0, 5, 0)
info_box_align.add(info_box)
self.body_box.set_spacing(5)
self.body_box.pack_start(info_box_align, False, False)
self.body_box.pack_start(scrolled_window, True, True)
self.left_button_box.set_buttons([self.prompt_label])
self.right_button_box.set_buttons([download_button, cancel_button])
self.lrc_manager = LrcManager()
示例7: __init__
def __init__(self):
self.one_close = app_theme.get_pixbuf("treeview/1-close.png")
self.one_open = app_theme.get_pixbuf("treeview/1-open.png")
self.two_close = app_theme.get_pixbuf("treeview/2-close.png")
self.two_open = app_theme.get_pixbuf("treeview/2-open.png")
self.three_close = app_theme.get_pixbuf("treeview/3-close.png")
self.three_open = app_theme.get_pixbuf("treeview/3-open.png")
#
self.tree_view_open = app_theme.get_pixbuf("treeview/open.png")
self.tree_view_close = app_theme.get_pixbuf("treeview/close.png")
self.tree_view_right = app_theme.get_pixbuf("treeview/right.png")
self.tree_view_bottom = app_theme.get_pixbuf("treeview/bottom.png")
#
self.listview_color = ui_theme.get_color("scrolledbar")
self.play_list_vbox = gtk.VBox()
#
self.list_view_vbox = gtk.VBox()
self.list_scroll_win = ScrolledWindow(0, 0)
self.list_scroll_win.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
self.list_view = ListView()
#
self.play_list_con = PlayListControl()
#
self.list_view_vbox.pack_start(self.list_scroll_win, True, True)
self.list_view_vbox.pack_start(self.play_list_con, False, False)
# 网络列表,搜索框.
self.tree_scroll_win = ScrolledWindow(0, 0)
self.tree_scroll_win.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
self.tree_view_vbox = gtk.VBox()
self.tree_view = TreeViewBase()
self.search_ali = gtk.Alignment(0, 0, 1, 1)
self.search = Search()
self.search_ali.add(self.search)
#
self.search_ali.set_padding(7, 5, 12, 12)
self.tree_view_vbox.pack_start(self.search_ali, False, False)
self.tree_view_vbox.pack_start(self.tree_scroll_win, True, True)
self.search_ali.connect("expose-event", self.search_ali_expose_event)
#
self.note_book = NoteBook()
#
self.list_view.on_draw_sub_item = self.__listview_on_draw_sub_item
self.list_view.columns.add_range(["filename", "time"])
self.list_view.columns[0].width = 120
self.list_view.columns[1].width = 95
#
self.note_book.hide_title()
self.tree_view.paint_nodes_event = self.__treeview_paint_nodes_event
#
self.list_scroll_win.add_with_viewport(self.list_view)
self.tree_scroll_win.add_with_viewport(self.tree_view)
#self.note_book.add_layout1(self.list_scroll_win)
self.note_book.add_layout1(self.list_view_vbox)
self.note_book.add_layout2(self.tree_view_vbox)
#self.play_list_vbox.pack_start(self.scroll_win, True, True)
self.play_list_vbox.pack_start(self.note_book, True, True)
示例8: AlbumSummaryView
class AlbumSummaryView(gtk.VBox):
'''
class docs
'''
def __init__(self):
'''
init docs
'''
gtk.VBox.__init__(self)
self.scrolled_window = ScrolledWindow()
self.iconview = IconView()
self.iconview.draw_mask = self.draw_mask
self.scrolled_window.add_child(self.iconview)
self.pack_start(self.scrolled_window, True, True)
global_event.register_event('download-album-infos-finish', self.update_item)
def try_fetch_data(self):
FetchAlbumData(LANGUAGE).start()
@post_gui
def update_item(self, data):
items = []
if data:
for album_info in data:
items.append(AlbumSummaryItem(album_info))
items.sort(key=attrgetter('album_order'), reverse=True)
self.iconview.add_items(items)
global_event.emit('switch-to-album-summary-view')
else:
global_event.emit('switch-to-network-problem-view')
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)),]
)
示例9: get_icon_view
def get_icon_view(self, padding_x=0, padding_y=10):
''' Draggable IconView '''
icon_view = IconView(padding_x, padding_y)
targets = [("text/deepin-songs", gtk.TARGET_SAME_APP, 1), ("text/uri-list", 0, 2)]
icon_view.drag_source_set(gtk.gdk.BUTTON1_MASK, targets, gtk.gdk.ACTION_COPY)
icon_view.connect("drag-data-get", self.__on_drag_data_get)
icon_view.connect("double-click-item", self.__on_double_click_item)
icon_view.connect("single-click-item", self.__on_single_click_item)
icon_view.connect("right-click-item", self.__on_right_click_item)
icon_view.draw_mask = self.on_iconview_draw_mask
scrolled_window = ScrolledWindow()
scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
scrolled_window.add_child(icon_view)
return icon_view, scrolled_window
示例10: SearchPage
class SearchPage(gtk.VBox):
'''
class docs
'''
def __init__(self, module_infos):
'''
init docs
'''
gtk.VBox.__init__(self)
self.scrolled_window = ScrolledWindow()
self.scrolled_window.set_size_request(800, 425)
self.result_align = self.__setup_align(padding_top = TEXT_WINDOW_TOP_PADDING,
padding_left = TEXT_WINDOW_LEFT_PADDING)
self.result_box = gtk.VBox()
self.result_box.connect("expose-event", self.__expose)
self.result_align.add(self.result_box)
'''
struct keywords {
module_id,
module_name,
module_keywords {
uid,
keyword
}
}
'''
self.__keywords = []
self.__module_infos = module_infos
'''
TODO: from EACH MODULE import keywords
'''
for module_info_list in self.__module_infos:
for module_info in module_info_list:
if module_info.search_keyword != "None":
try:
module = __import__("%s.%s" % (module_info.id, module_info.search_keyword), fromlist=["keywords"])
self.__keywords.append((module_info.id, module_info.name, module.keywords, module_info.menu_icon_pixbuf))
except Exception, e:
print "Error %s %s" % (module_info.id, e)
continue
self.__keyword_search = KeywordSearch(self.__keywords)
self.scrolled_window.add_child(self.result_align)
self.pack_start(self.scrolled_window)
示例11: button_press
def button_press(self, column, offset_x, offset_y):
# init Loading widget
loading_box = LoadingBox()
global_event.emit("show-pkg-view", loading_box)
self.page_box = gtk.VBox()
self.all_pkg_names = self.data_manager.get_second_category_packages(self.second_category_name)
self.message_bar = MessageBar(18)
self.message_bar.set_message(_("%s > %s : %s applications") % (
get_category_name(self.first_category_name),
get_category_name(self.second_category_name),
len(self.all_pkg_names),
))
self.pkg_icon_view = IconView()
self.pkg_icon_view.connect("motion-notify-item", tooltip_aciton)
if len(self.all_pkg_names) > LOAD_ITEMS_NUMBER:
self.load_new_items(self.all_pkg_names[:LOAD_ITEMS_NUMBER])
else:
self.load_new_items(self.all_pkg_names)
self.pkg_icon_scrolled_window = ScrolledWindow()
self.pkg_icon_scrolled_window.connect("vscrollbar-state-changed", self.scrolled_window_vscrollbar_handler)
self.pkg_icon_scrolled_window.add_child(self.pkg_icon_view)
self.pkg_icon_view.draw_mask = self.draw_mask
self.pkg_icon_view.draw_row_mask = self.draw_row_mask
self.page_box.pack_start(self.message_bar, False, False)
self.page_box.pack_start(self.pkg_icon_scrolled_window, True, True)
global_event.emit("update-current-status-pkg-page", self.pkg_icon_view)
示例12: __init__
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)
示例13: get_scrolled_window
def get_scrolled_window(self):
scrolled_window = ScrolledWindow(0, 0)
scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
scrolled_window.connect("vscrollbar-state-changed",
self.__on_vscrollbar_state_changed)
scrolled_window.add_child(self)
return scrolled_window
示例14: update
def update(self, playlist):
'''update'''
self.playlist = playlist
songs = self.playlist.get_songs()
self.song_view = SongView()
self.song_view.add_songs(songs)
self.song_view.connect("begin-add-items", lambda w: self.switch_it())
self.song_view.connect("empty-items", lambda w: self.switch_it(False))
self.scrolled_window = ScrolledWindow(0, 0)
self.scrolled_window.add_child(self.song_view)
self.scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
self.scrolled_window.set_size_request(220, -1)
self.title = playlist.get_name()
示例15: init_recommend_page
def init_recommend_page(self):
self.recommend_scrolled_window = ScrolledWindow()
self.background_box = BackgroundBox()
self.background_box.draw_mask = self.draw_mask
self.box = gtk.VBox()
self.loading_box = LoadingBox()
self.network_failed_box = NetworkConnectFailed(self.check_network_connection)
self.network_timeout_box = NetworkConnectTimeout(self.check_network_connection)
self.timeout_times = 0
self.recommend_scrolled_window_initial = False