def __init__(self, image_name, *args, **kwargs): # if no corners were specified, assumed all corners should be rounded corners = kwargs.pop("corners", []) if len(corners) == 0: corners = (u"tl", u"tr", u"bl", u"br") div = Div(*args, **kwargs) for corner in corners: div = Div( div, class_=u"%s_%s" % (image_name, corner), ) Div.__init__( self, div, id=u"%s_wrapper" % (kwargs.get(u"id") or image_name), class_=u"%s_color" % image_name, )
def __init__( self, image_name, *args, **kwargs ): # if no corners were specified, assumed all corners should be rounded corners = kwargs.pop( "corners", [] ) if len( corners ) == 0: corners = ( u"tl", u"tr", u"bl", u"br" ) div = Div( *args, **kwargs ) for corner in corners: div = Div( div, class_ = u"%s_%s" % ( image_name, corner ), ) Div.__init__( self, div, id = u"%s_wrapper" % ( kwargs.get( u"id" ) or image_name ), class_ = u"%s_color" % image_name, )
def __init__(self, toolbar, notebooks, notebook, parent_id, notebook_path, updates_path, user, rate_plan): linked_notebooks = [ nb for nb in notebooks if ( nb.read_write == Notebook.READ_WRITE or (nb.read_write == Notebook.READ_ONLY and not nb.name.startswith(u"Luminotes")) ) and nb.name not in (u"trash") and nb.deleted is False ] if [tag for tag in notebook.tags if tag.name == u"forum"]: forum_tag = True forum_name = tag.value notebook_word = u"discussion" note_word = u"post" else: forum_tag = False forum_name = None notebook_word = u"notebook" note_word = u"note" Div.__init__( self, toolbar, (user.username == u"anonymous") and self.forum_link(forum_tag, forum_name) or None, (user.username != u"anonymous") and Div( (notebook_path != u"/") and Div( H4(u"this %s" % notebook_word, id=u"this_notebook_area_title"), self.forum_link(forum_tag, forum_name), (rate_plan.get(u"notebook_sharing") and notebook.name == u"Luminotes blog") and Div( A( u"follow", href=u"%s?rss" % notebook_path, id=u"blog_rss_link", title=u"Subscribe to the RSS feed for the Luminotes blog.", ), A( Img( src=u"/static/images/rss.png", width=u"14", height=u"14", class_=u"middle_image padding_left", ), href=u"%s?rss" % notebook_path, title=u"Subscribe to the RSS feed for the Luminotes blog.", ), class_=u"link_area_item", ) or ( updates_path and rate_plan.get(u"notebook_sharing") and (not forum_tag) and Div( A( u"follow", href=updates_path, id=u"notebook_rss_link", title=u"Subscribe to the RSS feed for this %s." % notebook_word, ), A( Img( src=u"/static/images/rss.png", width=u"14", height=u"14", class_=u"middle_image padding_left", ), href=updates_path, title=u"Subscribe to the RSS feed for this %s." % notebook_word, ), class_=u"link_area_item", ) or None ), (notebook.read_write != Notebook.READ_ONLY) and Div( A( u"nothing but %ss" % note_word, href=u"#", id=u"declutter_link", title=u"Focus on just your %ss without any distractions." % note_word, ), class_=u"link_area_item", ) or None, (notebook.read_write != Notebook.READ_WRITE and notebook.name != u"Luminotes") and Div( A( u"export", href=u"#", id=u"export_link", title=u"Download a stand-alone copy of the entire %s." % notebook_word, ), class_=u"link_area_item", ) or None, (notebook.read_write != Notebook.READ_WRITE) and Div( A( u"print", href=u"/notebooks/export?notebook_id=%s&format=print" % notebook.object_id, id=u"print_notebook_link", target=u"_new", title=u"Print this %s." % notebook_word, ), class_=u"link_area_item", ) or None, (notebook.read_write == Notebook.READ_WRITE) and Span( Div( (notebook.name != u"trash") and A( u"import", href=u"#", id=u"import_link", title=u"Import %ss from other software into Luminotes." % note_word, ) or None, (notebook.name != u"trash") and u"|" or None, A( u"export", href=u"#", id=u"export_link", title=u"Download a stand-alone copy of the entire %s." % notebook_word, ), class_=u"link_area_item", ) or None, (notebook.name != u"trash") and Div( notebook.trash_id and A( u"trash", href=u"/notebooks/%s?parent_id=%s" % (notebook.trash_id, notebook.object_id), id=u"trash_link", title=u"Look here for %ss you've deleted." % note_word, ) or None, (notebook.owner and notebook.name != u"trash" and notebook.trash_id) and u"|" or None, (notebook.owner and notebook.name != u"trash") and A( u"delete", href=u"#", id=u"delete_notebook_link", title=u"Move this %s to the trash." % notebook_word, ) or None, class_=u"link_area_item", ) or None, (notebook.owner and notebook.name != u"trash") and Div( A( u"rename", href=u"#", id=u"rename_notebook_link", title=u"Change the name of this %s." % notebook_word, ), class_=u"link_area_item", ) or None, ( notebook.owner and notebook.name != u"trash" and user.username and rate_plan.get(u"notebook_sharing") ) and Div( A( u"share", href=u"#", id=u"share_notebook_link", title=u"Share this %s with others." % notebook_word, ), class_=u"link_area_item", ) or None, Div( A( u"print", href=u"/notebooks/export?notebook_id=%s&format=print" % notebook.object_id, id=u"print_notebook_link", target=u"_new", title=u"Print this %s." % notebook_word, ), class_=u"link_area_item", ) or None, (notebook.name == u"trash") and Rounded_div( u"trash_notebook", A( u"trash", href=u"#", id=u"trash_link", title=u"Look here for %ss you've deleted." % note_word, ), class_=u"link_area_item", ) or None, ) or None, id=u"this_notebook_area", ) or None, (not forum_tag) and Div( (len(linked_notebooks) > 0) and H4(u"notebooks", id=u"notebooks_area_title") or None, [ (nb.object_id == notebook.object_id) and Rounded_div( u"current_notebook", A(nb.name, href=u"/notebooks/%s" % nb.object_id, id=u"notebook_%s" % nb.object_id), (len(linked_notebooks) > 1) and Span( Img( src=u"/static/images/up_arrow.png", width=u"20", height=u"17", id=u"current_notebook_up", ), Img( src=u"/static/images/down_arrow.png", width=u"20", height=u"17", id=u"current_notebook_down", ), Span(id="current_notebook_up_hover_preload"), Span(id="current_notebook_down_hover_preload"), ) or None, class_=u"link_area_item", ) or Div( A(nb.name, href=u"/notebooks/%s" % nb.object_id, id=u"notebook_%s" % nb.object_id), class_=u"link_area_item", ) for nb in linked_notebooks ], id=u"notebooks_area", ) or None, (not forum_tag) and Div( Input( type=u"button", class_=u"note_button", id=u"new_notebook_button", value=u"+ notebook", title=u"Create a new wiki notebook.", ), class_=u"link_area_item", ) or None, Div(id=u"storage_usage_area"), id=u"link_area_holder", ) or None, id=u"link_area", )
def __init__(self, notebook, root_notes, recent_notes, total_notes_count, user): tags = [tag for tag in notebook.tags if tag.name == u"forum"] if tags: forum_name = tags[0].value forum_tag = True else: forum_name = None forum_tag = False Div.__init__( self, Div( Div( Search_form(), class_=u"link_area_item", ), H4( forum_tag and u"posts" or u"notes", Span( Span(total_notes_count, id=u"total_notes_count"), u"total", class_=u"small_text link_area_item", ), notebook.read_write != Notebook.READ_ONLY and Input( type=u"button", class_=u"note_button small_text", id=u"save_button", value=u"saved", disabled=u"true", title=u"save your work", ) or None, id=u"note_tree_area_title", ) or None, (not forum_tag) and self.make_tree( [ self.make_item( title=note.title, link_attributes=u'href="/notebooks/%s?note_id=%s"' % (notebook.object_id, note.object_id), link_class=u"note_tree_link", has_children=(notebook.name != u"trash") and self.LINK_PATTERN.search(note.contents) or False, root_note_id=note.object_id, ) for note in root_notes ], Tr( Td(), (notebook.name != u"trash" and notebook.read_write == Notebook.READ_WRITE) and Td( Input( type=u"button", class_=u"note_button", id=u"new_note_tree_link_button", value=u"+ note link", title=u"Add one of your notes to this list.", ), Span(id=u"new_note_tree_link_area"), ) or None, id=u"new_note_tree_link_row", ) or None, tree_id="note_tree_root_table", ) or None, (not forum_tag and recent_notes is not None and notebook.name != u"trash") and Span( H4( u"recent updates", id=u"recent_notes_area_title", ), self.make_tree( Tr(id="recent_notes_top"), [ self.make_item( title=note.title, link_attributes= u'href="/notebooks/%s?note_id=%s"' % (notebook.object_id, note.object_id), link_class=u"recent_note_link", has_children=False, root_note_id=note.object_id, base_name=u"recent_note", ) for note in recent_notes ], navigation=Tbody( Tr(id="recent_notes_spacer"), Tr( Td(), Td( A(u"more", href=u"#", id=u"recent_notes_more_link", class_=u"undisplayed"), A(u"less", href=u"#", id=u"recent_notes_less_link", class_=u"undisplayed"), ), ), id=u"recent_notes_navigation"), tree_id="recent_notes_table", ), ) or None, (user.username is None) and P( A(u"Download", href=u"/download", class_=u"hook_action"), Span(u" or ", class_=u"hook_action_or"), A(u"Sign up", href=u"/pricing", class_=u"hook_action"), Br(), Span("Get started in seconds.", class_=u"hook_action_detail"), class_=u"hook_action_area", separator=u"", ) or None, id=u"note_tree_area_holder", ), Span(id="tree_arrow_hover_preload"), Span(id="tree_arrow_down_preload"), Span(id="tree_arrow_down_hover_preload"), id=u"note_tree_area", )
def __init__( self, notebook, hide_toolbar = False, note_word = None ): Div.__init__( self, Div( P( Div( Input( type = u"button", id = u"newNote", title = u"make a new %s [ctrl-M]" % ( note_word or u"note" ), class_ = "image_button newNote_large", ), class_ = u"button_background" ), Div( Input( type = u"button", id = u"createLink", title = u"link [ctrl-L]", class_ = "image_button createLink_large", ), class_ = u"button_background" ), # Notebook.READ_WRITE_FOR_OWN_NOTES should not have a file upload button ( notebook.read_write == Notebook.READ_WRITE ) and Div( Input( type = u"button", id = u"attachFile", title = u"attach file or image", class_ = "image_button attachFile_large", ), class_ = u"button_background" ) or None, ), P( Div( Input( type = u"button", id = u"bold", title = u"bold [ctrl-B]", class_ = "image_button bold_large", ), class_ = u"button_background" ), Div( Input( type = u"button", id = u"italic", title = u"italic [ctrl-I]", class_ = "image_button italic_large", ), class_ = u"button_background" ), Div( Input( type = u"button", id = u"underline", title = u"underline [ctrl-U]", class_ = "image_button underline_large", ), class_ = u"button_background" ), Div( Input( type = u"button", id = u"strikethrough", title = u"strikethrough [ctrl-S]", class_ = "image_button strikethrough_large", ), class_ = u"button_background" ), Div( Input( type = u"button", id = u"color", title = u"text color", class_ = "image_button color_large", ), class_ = u"button_background" ), Div( Input( type = u"button", id = u"font", title = u"font", class_ = "image_button font_large", ), class_ = u"button_background" ), Div( Input( type = u"button", id = u"title", title = u"title", class_ = "image_button title_large", ), class_ = u"button_background" ), ), P( Div( Input( type = u"button", id = u"insertUnorderedList", title = u"bullet list [ctrl-period]", class_ = "image_button insertUnorderedList_large", ), class_ = u"button_background" ), Div( Input( type = u"button", id = u"insertOrderedList", title = u"numbered list [ctrl-1]", class_ = "image_button insertOrderedList_large", ), class_ = u"button_background" ), ), class_ = u"button_wrapper", ), id = u"toolbar", class_ = hide_toolbar and u"undisplayed" or None, )
def __init__( self, user, first_notebook, login_url, logout_url, note_title, rate_plan = None ): title_image = Img( src ="/static/images/luminotes_title.png", class_ = u"luminotes_title", width = u"193", height = u"60", alt = u"Luminotes", ) trial_expired = False if TRIAL: from pytz import utc from datetime import datetime, timedelta trial_age = datetime.now( tz = utc ) - first_notebook.revision if trial_age > timedelta( days = 30 ): trial_expired = True if rate_plan and rate_plan.get( u"name" ) == u"desktop": Div.__init__( self, Div( ( note_title == u"home" ) and title_image or A( title_image, href = u"http://luminotes.com/", target = "_new" ), Div( ( TRIAL and u"trial" or u"" ), u"version", VERSION, u" | ", A( u"upgrade", href = u"http://luminotes.com/download", target = "_new", class_ = trial_expired and "trial_upgrade_link" or u"" ), u" | ", A( u"community", href = u"http://luminotes.com/community", target = "_new" ), u" | ", A( u"blog", href = u"http://luminotes.com/blog/", target = "_new" ), u" | ", A( u"close", href = u"/close" ), class_ = u"header_links", ), class_ = u"wide_center_area", ), id = u"header", class_ = u"header", ) return Div.__init__( self, Div( ( note_title == u"home" ) and title_image or A( title_image, href = u"/" ), ( login_url and user.username == u"anonymous" ) and Div( A( u"login", href = login_url, id = u"login_link", class_ = u"bold_link", ), class_ = u"header_user_links", ) or Div( u"logged in as %s" % ( user.username or u"a guest" ), u" | ", ( note_title != u"wiki" ) and first_notebook and Span( A( u"my wiki", href = u"/notebooks/%s" % first_notebook.object_id, ), u" | ", ) or None, user.username and note_title == u"wiki" and Span( A( u"settings", href = u"#", title = u"Update your account settings.", id = u"settings_link", ), " | ", ) or None, A( u"logout", href = logout_url, id = u"logout_link", title = u"Sign out of your account.", ), class_ = u"header_user_links", ), Div( ( note_title == u"home" ) and Span( u"home", class_ = u"bold_link" ) or A( u"home", href = u"/" ), u" | ", ( note_title == u"tour" ) and Span( u"tour", class_ = u"bold_link" ) or A( u"tour", href = u"/tour" ), u" | ", ( user.username in ( None, u"anonymous" ) ) and Span( ( note_title == u"wiki" ) and Span( u"demo", class_ = u"bold_link" ) or A( u"demo", href = u"/users/demo" ), u" | " ) or None, ( note_title == u"community" ) and Span( u"community", class_ = u"bold_link" ) or A( u"community", href = u"/community" ), u" | ", ( note_title == u"download" ) and Span( u"download", class_ = u"bold_link" ) or \ A( u"download", href = u"/download", title = u"Download Luminotes to run on your own computer.", class_ = u"bold_link", ), " | ", ( user.username and user.username != u"anonymous" ) and Span( A( u"upgrade", href = u"/pricing", title = u"Upgrade your Luminotes account.", class_ = u"bold_link", ), ) or Span( ( note_title == u"pricing" ) and Span( u"sign up", class_ = u"bold_link" ) or \ A( u"sign up", href = u"/pricing", title = u"Sign up for an online Luminotes account.", class_ = u"bold_link", ), ) or None, #( note_title == u"support" ) and Span( u"support", class_ = u"bold_link" ) or A( u"support", href = u"/support" ), u" | ", #( note_title == u"team" ) and Span( u"team", class_ = u"bold_link" ) or A( u"team", href = u"/meet_the_team" ), u" | ", #( note_title == u"blog" ) and Span( u"blog", class_ = u"bold_link" ) or A( u"blog", href = u"/blog" ), u" | ", #( note_title == u"privacy" ) and Span( u"privacy", class_ = u"bold_link" ) or A( u"privacy", href = u"/privacy" ), class_ = u"header_links", ), class_ = u"wide_center_area", ), id = u"header", class_ = u"header", )
def __init__(self, toolbar, notebooks, notebook, parent_id, notebook_path, updates_path, user, rate_plan): linked_notebooks = [ nb for nb in notebooks if (nb.read_write == Notebook.READ_WRITE or (nb.read_write == Notebook.READ_ONLY and not nb.name.startswith(u"Luminotes"))) and nb.name not in (u"trash") and nb.deleted is False ] if [tag for tag in notebook.tags if tag.name == u"forum"]: forum_tag = True forum_name = tag.value notebook_word = u"discussion" note_word = u"post" else: forum_tag = False forum_name = None notebook_word = u"notebook" note_word = u"note" Div.__init__( self, toolbar, (user.username == u"anonymous") and self.forum_link(forum_tag, forum_name) or None, (user.username != u"anonymous") and Div( (notebook_path != u"/") and Div( H4( u"this %s" % notebook_word, id=u"this_notebook_area_title", ), self.forum_link(forum_tag, forum_name), (rate_plan.get(u"notebook_sharing") and notebook.name == u"Luminotes blog") and Div( A( u"follow", href=u"%s?rss" % notebook_path, id=u"blog_rss_link", title= u"Subscribe to the RSS feed for the Luminotes blog.", ), A( Img(src=u"/static/images/rss.png", width=u"14", height=u"14", class_=u"middle_image padding_left"), href=u"%s?rss" % notebook_path, title= u"Subscribe to the RSS feed for the Luminotes blog.", ), class_=u"link_area_item", ) or (updates_path and rate_plan.get(u"notebook_sharing") and (not forum_tag) and Div( A( u"follow", href=updates_path, id=u"notebook_rss_link", title=u"Subscribe to the RSS feed for this %s." % notebook_word, ), A( Img(src=u"/static/images/rss.png", width=u"14", height=u"14", class_=u"middle_image padding_left"), href=updates_path, title=u"Subscribe to the RSS feed for this %s." % notebook_word, ), class_=u"link_area_item", ) or None), (notebook.read_write != Notebook.READ_ONLY) and Div( A( u"nothing but %ss" % note_word, href=u"#", id=u"declutter_link", title= u"Focus on just your %ss without any distractions." % note_word, ), class_=u"link_area_item", ) or None, (notebook.read_write != Notebook.READ_WRITE and notebook.name != u"Luminotes") and Div( A( u"export", href=u"#", id=u"export_link", title= u"Download a stand-alone copy of the entire %s." % notebook_word, ), class_=u"link_area_item", ) or None, (notebook.read_write != Notebook.READ_WRITE) and Div( A( u"print", href=u"/notebooks/export?notebook_id=%s&format=print" % notebook.object_id, id=u"print_notebook_link", target=u"_new", title=u"Print this %s." % notebook_word, ), class_=u"link_area_item", ) or None, (notebook.read_write == Notebook.READ_WRITE) and Span( Div( (notebook.name != u"trash") and A( u"import", href=u"#", id=u"import_link", title= u"Import %ss from other software into Luminotes." % note_word, ) or None, (notebook.name != u"trash") and u"|" or None, A( u"export", href=u"#", id=u"export_link", title= u"Download a stand-alone copy of the entire %s." % notebook_word, ), class_=u"link_area_item", ) or None, (notebook.name != u"trash") and Div( notebook.trash_id and A( u"trash", href=u"/notebooks/%s?parent_id=%s" % (notebook.trash_id, notebook.object_id), id=u"trash_link", title=u"Look here for %ss you've deleted." % note_word, ) or None, (notebook.owner and notebook.name != u"trash" and notebook.trash_id) and u"|" or None, (notebook.owner and notebook.name != u"trash") and A( u"delete", href=u"#", id=u"delete_notebook_link", title=u"Move this %s to the trash." % notebook_word, ) or None, class_=u"link_area_item", ) or None, (notebook.owner and notebook.name != u"trash") and Div( A( u"rename", href=u"#", id=u"rename_notebook_link", title=u"Change the name of this %s." % notebook_word, ), class_=u"link_area_item", ) or None, (notebook.owner and notebook.name != u"trash" and user.username and rate_plan.get(u"notebook_sharing")) and Div( A( u"share", href=u"#", id=u"share_notebook_link", title=u"Share this %s with others." % notebook_word, ), class_=u"link_area_item", ) or None, Div( A( u"print", href= u"/notebooks/export?notebook_id=%s&format=print" % notebook.object_id, id=u"print_notebook_link", target=u"_new", title=u"Print this %s." % notebook_word, ), class_=u"link_area_item", ) or None, (notebook.name == u"trash") and Rounded_div( u"trash_notebook", A( u"trash", href=u"#", id=u"trash_link", title=u"Look here for %ss you've deleted." % note_word, ), class_=u"link_area_item", ) or None, ) or None, id=u"this_notebook_area", ) or None, (not forum_tag) and Div((len(linked_notebooks) > 0) and H4( u"notebooks", id=u"notebooks_area_title", ) or None, [ (nb.object_id == notebook.object_id) and Rounded_div( u"current_notebook", A( nb.name, href=u"/notebooks/%s" % nb.object_id, id=u"notebook_%s" % nb.object_id, ), (len(linked_notebooks) > 1) and Span( Img(src=u"/static/images/up_arrow.png", width=u"20", height=u"17", id=u"current_notebook_up"), Img(src=u"/static/images/down_arrow.png", width=u"20", height=u"17", id=u"current_notebook_down"), Span(id="current_notebook_up_hover_preload"), Span(id="current_notebook_down_hover_preload"), ) or None, class_=u"link_area_item", ) or Div( A( nb.name, href=u"/notebooks/%s" % nb.object_id, id=u"notebook_%s" % nb.object_id, ), class_=u"link_area_item", ) for nb in linked_notebooks ], id=u"notebooks_area") or None, (not forum_tag) and Div( Input( type=u"button", class_=u"note_button", id=u"new_notebook_button", value=u"+ notebook", title=u"Create a new wiki notebook.", ), class_=u"link_area_item", ) or None, Div(id=u"storage_usage_area", ), id=u"link_area_holder", ) or None, id=u"link_area", )