def __init__(self): gtk.HBox.__init__(self) self.aibizhi_cache_page = CachePage(Aibizhi()) self.bizhi360_cache_page = CachePage(Bizhi360()) self.aibizhi_cache_page.cache_view.try_to_fetch() self.bizhi360_cache_page.cache_view.try_to_fetch() self.system_wallpapers_page = SystemPage( get_system_wallpaper_dirs()[0]) self.picture_wallpapers_page = PicturePage(get_images_dir()) self.download_wallpapaers_page = UserPage(get_download_wallpaper_dir()) self.task_page = TaskPage() self.__init_navigatebar() self.switch_page = gtk.VBox() self.pack_start(self.navigatebar, False, True) self.pack_start(self.switch_page, True, True) self.switch_page.add(self.system_wallpapers_page) event_manager.add_callback("downloading-tasks-number", self.on_download_item_changed) self.connect("expose-event", self.on_addpage_expose_event)
def __init__(self): gtk.HBox.__init__(self) self.connect("expose-event", self.on_page_expose_event) self.aibizhi_cache_page = CachePage(Aibizhi()) self.bizhi360_cache_page = CachePage(Bizhi360()) self.aibizhi_cache_page.cache_view.try_to_fetch() self.bizhi360_cache_page.cache_view.try_to_fetch() self.favorites_page = FavoritePage(get_favorite_dir()) self.pictures_page = LocalPicturePage(get_download_wallpaper_dir()) self.add_item = AddItem() self.pictures_page.select_view.add_items([self.add_item]) self.task_page = TaskPage() self.switch_page = gtk.VBox() self.__init_navigatebar() self.pack_start(self.navigatebar, False, True) self.pack_start(self.switch_page, True, True) event_manager.add_callback("switch-to-local-pictures", self.switch_to_local_pictures)
def __init__(self): gtk.HBox.__init__(self) self.aibizhi_cache_page = CachePage(Aibizhi()) self.bizhi360_cache_page = CachePage(Bizhi360()) self.aibizhi_cache_page.cache_view.try_to_fetch() self.bizhi360_cache_page.cache_view.try_to_fetch() self.system_wallpapers_page = SystemPage(get_system_wallpaper_dirs()[0]) self.picture_wallpapers_page = PicturePage(get_images_dir()) self.download_wallpapaers_page = UserPage(get_download_wallpaper_dir()) self.task_page = TaskPage() self.__init_navigatebar() self.switch_page = gtk.VBox() self.pack_start(self.navigatebar, False, True) self.pack_start(self.switch_page, True, True) self.switch_page.add(self.system_wallpapers_page) event_manager.add_callback("downloading-tasks-number", self.on_download_item_changed) self.connect("expose-event", self.on_addpage_expose_event)
class AddPage(gtk.HBox): def __init__(self): gtk.HBox.__init__(self) self.aibizhi_cache_page = CachePage(Aibizhi()) self.bizhi360_cache_page = CachePage(Bizhi360()) self.aibizhi_cache_page.cache_view.try_to_fetch() self.bizhi360_cache_page.cache_view.try_to_fetch() self.system_wallpapers_page = SystemPage( get_system_wallpaper_dirs()[0]) self.picture_wallpapers_page = PicturePage(get_images_dir()) self.download_wallpapaers_page = UserPage(get_download_wallpaper_dir()) self.task_page = TaskPage() self.__init_navigatebar() self.switch_page = gtk.VBox() self.pack_start(self.navigatebar, False, True) self.pack_start(self.switch_page, True, True) self.switch_page.add(self.system_wallpapers_page) event_manager.add_callback("downloading-tasks-number", self.on_download_item_changed) self.connect("expose-event", self.on_addpage_expose_event) def set_theme(self, theme): self.system_wallpapers_page.set_theme(theme) self.picture_wallpapers_page.set_theme(theme) self.download_wallpapaers_page.set_theme(theme) self.aibizhi_cache_page.set_theme(theme) self.bizhi360_cache_page.set_theme(theme) def on_download_item_changed(self, name, obj, data): pass 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( [(_("System"), self.system_wallpapers_page), (_("Pictures"), self.picture_wallpapers_page), (_("Favorites"), self.download_wallpapaers_page)], expand=True) network_expand_item.add_childs([ (_("360 Wallpaper"), self.bizhi360_cache_page), (_("LoveWallpaper"), self.aibizhi_cache_page), ], expand=True) self.navigatebar.set_highlight_item(self.navigatebar.get_items()[1]) def on_addpage_expose_event(self, widget, event): cr = widget.window.cairo_create() rect = widget.allocation self.draw_mask(cr, *rect) def on_navigatebar_draw_mask(self, cr, x, y, w, h): self.draw_mask(cr, x, y, w, h) draw_line(cr, (x + w, y), (0, h), "#d6d6d6") 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. ''' cr.set_source_rgb(1, 1, 1) cr.rectangle(x, y, w, h) cr.fill() def on_navigatebar_single_click(self, widget, item, column, x, y): if item.widget: widget.set_highlight_item(item) switch_box(self.switch_page, item.widget)
class AddPage(gtk.HBox): def __init__(self): gtk.HBox.__init__(self) self.aibizhi_cache_page = CachePage(Aibizhi()) self.bizhi360_cache_page = CachePage(Bizhi360()) self.aibizhi_cache_page.cache_view.try_to_fetch() self.bizhi360_cache_page.cache_view.try_to_fetch() self.system_wallpapers_page = SystemPage(get_system_wallpaper_dirs()[0]) self.picture_wallpapers_page = PicturePage(get_images_dir()) self.download_wallpapaers_page = UserPage(get_download_wallpaper_dir()) self.task_page = TaskPage() self.__init_navigatebar() self.switch_page = gtk.VBox() self.pack_start(self.navigatebar, False, True) self.pack_start(self.switch_page, True, True) self.switch_page.add(self.system_wallpapers_page) event_manager.add_callback("downloading-tasks-number", self.on_download_item_changed) self.connect("expose-event", self.on_addpage_expose_event) def set_theme(self, theme): self.system_wallpapers_page.set_theme(theme) self.picture_wallpapers_page.set_theme(theme) self.download_wallpapaers_page.set_theme(theme) self.aibizhi_cache_page.set_theme(theme) self.bizhi360_cache_page.set_theme(theme) def on_download_item_changed(self, name, obj, data): pass 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([(_("System"), self.system_wallpapers_page), (_("Pictures"), self.picture_wallpapers_page), (_("Favorites"), self.download_wallpapaers_page)], expand=True) network_expand_item.add_childs([(_("360 Wallpaper"), self.bizhi360_cache_page), (_("LoveWallpaper"), self.aibizhi_cache_page), ], expand=True) self.navigatebar.set_highlight_item(self.navigatebar.get_items()[1]) def on_addpage_expose_event(self, widget, event): cr = widget.window.cairo_create() rect = widget.allocation self.draw_mask(cr, *rect) def on_navigatebar_draw_mask(self, cr, x, y, w, h): self.draw_mask(cr, x, y, w, h) draw_line(cr, (x + w, y), (0, h), "#d6d6d6") 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. ''' cr.set_source_rgb(1, 1, 1) cr.rectangle(x, y, w, h) cr.fill() def on_navigatebar_single_click(self, widget, item, column, x, y): if item.widget: widget.set_highlight_item(item) switch_box(self.switch_page, item.widget)