本文整理汇总了Python中dtk.ui.scrolled_window.ScrolledWindow.add_child方法的典型用法代码示例。如果您正苦于以下问题:Python ScrolledWindow.add_child方法的具体用法?Python ScrolledWindow.add_child怎么用?Python ScrolledWindow.add_child使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类dtk.ui.scrolled_window.ScrolledWindow
的用法示例。
在下文中一共展示了ScrolledWindow.add_child方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [as 别名]
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)
示例2: __init__
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [as 别名]
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])
示例3: get_scrolled_window
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [as 别名]
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
示例4: DeviceIconView
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [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)
示例5: __init__
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [as 别名]
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()
示例6: AlbumSummaryView
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [as 别名]
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)),]
)
示例7: get_icon_view
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [as 别名]
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
示例8: ConvTAskGui
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [as 别名]
class ConvTAskGui(DialogBox):
def __init__(self):
DialogBox.__init__(self,
_("Task Manager for format conversion"),
FORM_WIDTH, FORM_HEIGHT,
mask_type=DIALOG_MASK_SINGLE_PAGE, #DIALOG_MASK_MULTIPLE_PAGE,
close_callback=self.hide_all,
modal=True,
window_hint=gtk.gdk.WINDOW_TYPE_HINT_DIALOG,
window_pos=gtk.WIN_POS_CENTER,
resizable=False,
)
self.init_widgets()
# add widgets.
self.body_box.pack_start(self.scrolled_window, False, False)
def init_widgets(self):
self.scrolled_window = ScrolledWindow()
self.list_view = ListView()
self.list_view.draw_mask = self.get_mask_func(self.list_view)
self.scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC)
self.scrolled_window.add_child(self.list_view)
# self.start_btn = Button(_("Start"))
self.show_time_label = Label("")
self.pause_btn = Button(_("Pause"))
self.close_btn = Button(_("Close"))
self.show_time_label_align = gtk.Alignment()
self.show_time_label_align.set(0.0, 0.5, 1.0, 1.0)
self.show_time_label_align.add(self.show_time_label)
self.left_button_box.set_buttons([self.show_time_label_align])
self.right_button_box.set_buttons([self.pause_btn, self.close_btn])
self.close_btn.connect("clicked", lambda w : self.hide_all())
示例9: RecommendItem
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [as 别名]
class RecommendItem(TreeItem):
'''
class docs
'''
def __init__(self, data_manager, recommend_status):
'''
init docs
'''
TreeItem.__init__(self)
self.name = _("Home")
self.data_manager = data_manager
self.recommend_status = recommend_status
self.page_cache = {}
self.page_name = ['recommend', 'album', 'download_rank']
self.init_recommend_page()
global_event.register_event('download-home-infos-finish', self.update_home_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
@post_gui
def update_home_page(self, data):
if not data:
self.check_network_connection()
return
slide_infos = sort_for_home_page_data(data['slide'])
self.slider_switcher = IndexSlideSwitcher(slide_infos)
self.slider_switcher.connect("motion-notify-index",
lambda w, i: global_event.emit("set-cursor", gtk.gdk.HAND2))
self.slider_switcher.connect("button-press-index",
lambda w, i: global_event.emit("switch-to-detail-page", slide_infos[i][0]))
self.slider_switcher.connect("leave-notify-index", lambda w, i: global_event.emit("set-cursor", None))
self.recommend_infos = sort_for_home_page_data(data['recommend'])
self.tab_switcher = TabSwitcher([_("Recommendations"), _("Topics"), _("Download rank")], CATEGORY_ITEM_NAME_SIZE)
self.tab_switcher_align = gtk.Alignment()
self.tab_switcher_align.set(0.5, 0.5, 1, 1)
self.tab_switcher_align.set_padding(10, 0, 0, 9)
self.tab_switcher_align.add(self.tab_switcher)
self.tab_switcher_pages_callback = [
"get_pkg_icon_view_page",
"get_album_page",
"get_download_rank_page",
]
self.page_box = gtk.VBox()
self.box.pack_start(self.slider_switcher, False, False)
self.box.pack_start(self.tab_switcher_align, False, False)
self.box_align = gtk.Alignment()
self.box_align.set(0.5, 0.5, 1, 1)
self.box_align.set_padding(5, 0, 10, 11)
self.box_align.add(self.box)
self.page_box_align = gtk.Alignment()
self.page_box_align.set(0.5, 0, 1, 1)
self.page_box_align.add(self.page_box)
self.background_box.pack_start(self.box_align, False, False)
self.background_box.pack_start(self.page_box_align)
self.recommend_scrolled_window.add_child(self.background_box)
self.switch_page(0)
self.tab_switcher.connect("tab-switch-start", lambda switcher, page_index: self.switch_page(page_index))
self.tab_switcher.connect("click-current-tab", lambda switcher, page_index: self.click_page())
self.switch_page_view(self.recommend_scrolled_window)
self.recommend_scrolled_window_initial = True
def try_fetch_data(self):
FetchHomeData(LANGUAGE, self.recommend_status).start()
self.timeout_times += 1
def check_network_connection(self):
if is_network_connected():
if self.timeout_times < NETWORK_TRY_TIMES:
self.network_connected_flag = True
self.switch_page_view(self.loading_box)
self.try_fetch_data()
else:
self.network_connected_flag = False
self.switch_page_view(self.network_timeout_box)
self.timeout_times = 0
else:
self.network_connected_flag = False
#.........这里部分代码省略.........
示例10: SecondCategoryItem
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [as 别名]
#.........这里部分代码省略.........
def hover(self, column, offset_x, offset_y):
self.is_hover = True
if self.redraw_request_callback:
self.redraw_request_callback(self)
def unhover(self, column, offset_x, offset_y):
self.is_hover = False
if self.redraw_request_callback:
self.redraw_request_callback(self)
def select(self):
self.is_select = True
if self.redraw_request_callback:
self.redraw_request_callback(self)
def unselect(self):
self.is_select = False
if self.redraw_request_callback:
self.redraw_request_callback(self)
def scrolled_window_vscrollbar_handler(self, widget, state):
if state == "bottom":
current_item_number = len(self.pkg_icon_view.items)
all_pkgs_number = len(self.all_pkg_names)
start = current_item_number
if current_item_number < all_pkgs_number and (current_item_number+LOAD_ITEMS_NUMBER) < all_pkgs_number:
end = current_item_number+LOAD_ITEMS_NUMBER
elif current_item_number < all_pkgs_number and (current_item_number+LOAD_ITEMS_NUMBER) >= all_pkgs_number:
end = all_pkgs_number
else:
return
self.load_new_items(self.all_pkg_names[start:end])
def load_new_items(self, pkg_names):
items = []
for pkg_name in pkg_names:
info = self.data_manager.get_item_pkg_info(pkg_name)
items.append(PkgIconItem(info[0], info[1], info[2], self.data_manager))
self.pkg_icon_view.add_items(items)
global_event.emit("show-pkg-view", self.page_box)
def handle_pkg_install_status_request(self, status, items):
for (index, state) in enumerate(status):
items[index].is_installed = state
items[index].emit_redraw_request()
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)
def draw_row_mask(self, cr, rect, row):
if row % 2 == 1:
cr.set_source_rgba(1, 1, 1, 0.5)
cr.rectangle(rect.x, rect.y, rect.width, rect.height)
cr.fill()
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)),]
)
示例11: CategoryItem
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [as 别名]
#.........这里部分代码省略.........
for pkg_name in pkg_names:
info = self.data_manager.get_item_pkg_info(pkg_name)
items.append(PkgIconItem(info[0], info[1], info[2], self.data_manager))
self.pkg_icon_view.add_items(items)
global_event.emit("show-pkg-view", self.page_box)
def handle_pkg_install_status_request(self, status, items):
for (index, state) in enumerate(status):
items[index].is_installed = state
items[index].emit_redraw_request()
def single_click(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.all_desktop_infos = {}
self.all_pkg_names = self.data_manager.get_first_category_packages(self.first_category_name)
self.message_bar = MessageBar(18)
self.message_bar.set_message(_("%s: %s applications") % (
get_category_name(self.first_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_view.draw_mask = self.draw_mask
self.pkg_icon_view.draw_row_mask = self.draw_row_mask
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.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)
def draw_row_mask(self, cr, rect, row):
if row % 2 == 1:
cr.set_source_rgba(1, 1, 1, 0.5)
cr.rectangle(rect.x, rect.y, rect.width, rect.height)
cr.fill()
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)),]
)
def double_click(self, column, offset_x, offset_y):
if self.is_expand:
self.unexpand()
else:
self.expand()
def add_child_item(self):
items = []
second_category_names = self.data_manager.get_second_category(self.first_category_name)
for second_category_name in second_category_names:
items.append(SecondCategoryItem(self.first_category_name, second_category_name, self.data_manager))
self.child_items = items
self.add_items_callback(self.child_items, self.row_index + 1)
def delete_chlid_item(self):
self.delete_items_callback(self.child_items)
def expand(self):
self.is_expand = True
self.add_child_item()
if self.redraw_request_callback:
self.redraw_request_callback(self)
global_event.emit("category-expand", self)
def unexpand(self):
self.is_expand = False
self.delete_chlid_item()
if self.redraw_request_callback:
self.redraw_request_callback(self)
示例12: GuideBox
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [as 别名]
class GuideBox(gtk.VBox):
def __init__(self):
super(GuideBox, self).__init__()
self.scrolled_window = ScrolledWindow()
self.backgroundbox = BackgroundBox()
self.backgroundbox.draw_mask = self.draw_mask
self.guide_pixbuf = utils.get_common_image_pixbuf('guide.png')
self.top_title = gtk.HBox()
self.top_left_icon = gtk.VBox()
self.top_left_icon.set_size_request(self.guide_pixbuf.get_width(), self.guide_pixbuf.get_height())
self.top_left_icon.connect('expose-event', self.expose_top_left_icon)
top_left_icon_align = gtk.Alignment(0.5, 0.5, 0, 0)
top_left_icon_align.set_padding(15, 3, 13, 3)
top_left_icon_align.add(self.top_left_icon)
self.top_right_text = Label(_("Introduction"), ui_theme.get_color('label_select_background'), 14)
top_right_text_align = gtk.Alignment(0.5, 0.5, 0, 0)
top_right_text_align.set_padding(18, 3, 3, 3)
top_right_text_align.add(self.top_right_text)
self.top_title.pack_start(top_left_icon_align, False, False)
self.top_title.pack_start(top_right_text_align, False, False)
self.content_box = gtk.VBox()
self.guide_label = Label('', enable_select=False, wrap_width=200, text_size=9, text_color=DynamicColor('#808080'))
guide_label_align = gtk.Alignment(0.5, 0.5, 1, 1)
guide_label_align.set_padding(5, 5, 10, 10)
guide_label_align.add(self.guide_label)
self.content_box.pack_start(guide_label_align, False, False)
self.backgroundbox.pack_start(self.top_title, False, False)
self.backgroundbox.pack_start(self.content_box)
self.scrolled_window.add_child(self.backgroundbox)
self.add(self.scrolled_window)
global_event.register_event('download-app-info-finish', self.update_content)
@post_gui
def update_content(self, js):
js = json.loads(js)
self.guide_label.set_text(js['summary'])
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 = "#ffffff"
draw_vlinear(cr, x, y, w, h,
[(0, (sidebar_color, 0.9)),
(1, (sidebar_color, 0.9)),]
)
def expose_top_left_icon(self, widget, event):
# Init.
cr = widget.window.cairo_create()
rect = widget.allocation
# Draw pkg icon.
draw_pixbuf(cr,
self.guide_pixbuf,
rect.x,
rect.y)
示例13: get_scrolled_window
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [as 别名]
def get_scrolled_window(self):
scrolled_window = ScrolledWindow()
scrolled_window.add_child(self)
return scrolled_window
示例14: get_scrolled_window
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [as 别名]
def get_scrolled_window(self):
scrolled_window = ScrolledWindow()
scrolled_window.connect("vscrollbar-state-changed", self.__on_vscrollbar_state_changed)
scrolled_window.add_child(self)
return scrolled_window
示例15: DisplayView
# 需要导入模块: from dtk.ui.scrolled_window import ScrolledWindow [as 别名]
# 或者: from dtk.ui.scrolled_window.ScrolledWindow import add_child [as 别名]
#.........这里部分代码省略.........
left_align pack_start
'''
self.__widget_pack_start(self.left_box,
[self.monitor_display_align,
self.monitor_align,
self.sizes_align,
self.rotation_align,
self.multi_monitors_align,
self.monitor_bright_align,
self.brightness_align,
#self.auto_adjust_align,
#self.close_monitor_align,
self.monitor_lock_align,
self.auto_lock_align,
self.lock_display_align])
self.left_align.add(self.left_box)
'''
right_align pack_start
'''
self.__widget_pack_start(self.right_box,
[self.goto_align])
self.right_box.set_size_request(280, -1)
self.right_align.add(self.right_box)
'''
main && body box
'''
self.main_box.pack_start(self.monitor_resize_align, False, False)
self.body_box.pack_start(self.left_align)
self.body_box.pack_start(self.right_align, False, False)
self.main_box.pack_start(self.body_box)
'''
this->HBox pack_start
'''
self.scrolled_window.add_child(self.main_box)
self.pack_start(self.scrolled_window)
self.__send_message("status", ("display", ""))
def show_again(self):
self.__send_message("status", ("display", ""))
def reset(self):
self.__send_message("status", ("display", _("Reset to default value")))
self.display_manager.reset()
self.close_monitor_combo.set_select_index(self.display_manager.get_close_monitor_index(self.duration_items))
self.lock_display_combo.set_select_index(self.display_manager.get_lock_display_index(self.duration_items))
self.multi_monitors_combo.set_select_index(0)
def __handle_dbus_replay(self, *reply):
pass
def __handle_dbus_error(self, *error):
pass
def __send_message(self, message_type, message_content):
if is_dbus_name_exists(APP_DBUS_NAME):
bus_object = dbus.SessionBus().get_object(APP_DBUS_NAME, APP_OBJECT_NAME)
method = bus_object.get_dbus_method("message_receiver")
method(message_type,
message_content,
reply_handler=self.__handle_dbus_replay,
error_handler=self.__handle_dbus_error)
def __button_press(self, widget, event, module_id):
self.__send_message("goto", (module_id, ""))