# python import import logging # gtk import import gtk # html simple viewer from lib.htmltextview import HtmlTextView # atoidejouer import from atoidejouer.tools import storage # get application logger logger = logging.getLogger('atoidejouer') class ScreenHelp(gtk.ScrolledWindow): def __init__(self, activity_): gtk.ScrolledWindow.__init__(self) self.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC) # init main box self.__v_box = gtk.VBox(spacing=2) self.__v_box.show() self.add_with_viewport(self.__v_box) # keep activity self.activity = activity_ # load html content with open(storage.get_html_path('help')) as f: for content in f.read().split('----'): content = content.strip() c_widget = None if '\n' in content: c_widget = HtmlTextView() c_widget.display_html(content) c_widget.show() else: i_path = storage.get_html_img_path(content) logger.debug(i_path) c_widget = gtk.Image() c_widget.set_from_file(i_path) c_widget.show() self.__v_box.pack_start(c_widget, expand=False, fill=True) def _show(self): # show all self.show() # update activity self.activity.set_canvas(self)