Example #1
0
def prepare_about_me_view(app, window, script, data):
    """
    View preparator.

    :param app: reference to the application, :see: :module:`pisak.application`.
    :param window: application main window, :class:`pisak.window.Window` instance.
    :param script: ClutterScript with the view description.
    :param data: some specific data.
    """
    try:
        about = wordpress.blog.get_about_me_page()
    except socket.timeout:
        window.load_popup(MESSAGES['too-slow-connection'], 'main_panel/main')
    else:
        about_info = script.get_object("about")
        plain = html_parsers.extract_text(about.content)
        if plain:
            about_info.set_text(plain)

        handlers.button_to_view(window, script, "button_edit_desc",
                                "blog/speller_about_me")
        handlers.button_to_view(window, script, "button_edit_photo",
                                "blog/viewer_about_me_library")
        handlers.button_to_view(window, script, "button_exit")
        handlers.button_to_view(window, script, "button_back", "blog/main")
Example #2
0
 def _produce_item(self, post_item):
     post = post_item.content
     tile = Tile()
     self._prepare_item(tile)
     frame = widgets.Frame()
     frame.set_style_class("PisakBlogPostTile")
     tile.add_child(frame)
     tile.connect("clicked", self.item_handler, post_item)
     tile.hilite_tool = widgets.Aperture()
     if isinstance(post, dict):
         post_title = post["title"]
         post_date = post["date"]
     else:
         post_title = post.title
         post_date = post.date
     tile.title.set_text(
         html_parsers.extract_text(post_title) or _NO_POST_TITLE)
     if isinstance(post_date, str):
         parsed = post_date.split("+")[0].replace("T", " ")
         try:
             parsed = parsed.split('-')[0]
             post_date = datetime.strptime(parsed, "%Y-%m-%d %H:%M:%S")
         except ValueError as err:
             _LOG.warning(err)
             post_date = None
     if post_date:
         tile.date.set_text(utils.date_to_when(post_date))
     return tile
Example #3
0
def prepare_about_me_view(app, window, script, data):
    """
    View preparator.

    :param app: reference to the application, :see: :module:`pisak.application`.
    :param window: application main window, :class:`pisak.window.Window` instance.
    :param script: ClutterScript with the view description.
    :param data: some specific data.
    """
    try:
        about = wordpress.blog.get_about_me_page()
    except socket.timeout:
        window.load_popup(MESSAGES['too-slow-connection'], 'main_panel/main')
    else:
        about_info = script.get_object("about")
        plain = html_parsers.extract_text(about.content)
        if plain:
            about_info.set_text(plain)

        handlers.button_to_view(window, script, "button_edit_desc",
                                "blog/speller_about_me")
        handlers.button_to_view(window, script, "button_edit_photo",
                                "blog/viewer_about_me_library")
        handlers.button_to_view(window, script, "button_exit")
        handlers.button_to_view(window, script, "button_back", "blog/main")
Example #4
0
 def _produce_item(self, post_item):
     post = post_item.content
     tile = Tile()
     self._prepare_item(tile)
     frame = widgets.Frame()
     frame.set_style_class("PisakBlogPostTile")
     tile.add_child(frame)
     tile.connect("clicked", self.item_handler, post_item)
     tile.hilite_tool = widgets.Aperture()
     if isinstance(post, dict):
         post_title = post["title"]
         post_date = post["date"]
     else:
         post_title = post.title
         post_date = post.date
     tile.title.set_text(html_parsers.extract_text(post_title) or
                         _NO_POST_TITLE)
     if isinstance(post_date, str):
         parsed = post_date.split("+")[0].replace("T", " ")
         try:
             parsed = parsed.split('-')[0]
             post_date = datetime.strptime(
                 parsed, "%Y-%m-%d %H:%M:%S")
         except ValueError as err:
             _LOG.warning(err)
             post_date = None
     if post_date:
         tile.date.set_text(utils.date_to_when(post_date))
     return tile
Example #5
0
def prepare_speller_about_me_view(app, window, script, data):
    text_widget = script.get_object("text_box")
    plain_bio = html_parsers.extract_text(
        wordpress.blog.get_about_me_page().content)
    if plain_bio:
        text_widget.type_text(plain_bio)
    handlers.button_to_view(window, script, "button_proceed", "blog/about_me")
    handlers.button_to_view(window, script, "button_exit")
Example #6
0
def prepare_speller_about_me_view(app, window, script, data):
    text_widget = script.get_object("text_box")
    plain_bio = html_parsers.extract_text(
        wordpress.blog.get_about_me_page().content)
    if plain_bio:
        text_widget.type_text(plain_bio)
    handlers.button_to_view(window, script, "button_proceed", "blog/about_me")
    handlers.button_to_view(window, script, "button_exit")
Example #7
0
def prepare_about_me_view(app, window, script, data):
    handlers.button_to_view(window, script, "button_edit_desc",
                            "blog/speller_about_me")
    handlers.button_to_view(window, script, "button_edit_photo",
                            "blog/viewer_about_me_library")
    handlers.button_to_view(window, script, "button_exit")
    handlers.button_to_view(window, script, "button_back", "blog/main")
    about_info = script.get_object("about")
    about = wordpress.blog.get_about_me_page()
    plain = html_parsers.extract_text(about.content)
    if plain:
        about_info.set_text(plain)
Example #8
0
def prepare_speller_post_view(app, window, script, data):
    if wordpress.blog.pending_post is not None:
        text_field = script.get_object("text_box")
        plain_text = html_parsers.extract_text(
            wordpress.blog.pending_post.content)
        if plain_text:
            text_field.type_text(plain_text)
    else:
        wordpress.blog.prepare_empty_post()
    handlers.button_to_view(
        window, script, "button_proceed", "blog/speller_title")
    handlers.button_to_view(window, script, "button_exit")
Example #9
0
def prepare_about_me_view(app, window, script, data):
    handlers.button_to_view(window, script, "button_edit_desc",
                            "blog/speller_about_me")
    handlers.button_to_view(window, script, "button_edit_photo",
                            "blog/viewer_about_me_library")
    handlers.button_to_view(window, script, "button_exit")
    handlers.button_to_view(window, script, "button_back", "blog/main")
    about_info = script.get_object("about")
    about = wordpress.blog.get_about_me_page()
    plain = html_parsers.extract_text(about.content)
    if plain:
        about_info.set_text(plain)
Example #10
0
def prepare_speller_post_view(app, window, script, data):
    if wordpress.blog.pending_post is not None:
        text_field = script.get_object("text_box")
        plain_text = html_parsers.extract_text(
            wordpress.blog.pending_post.content)
        if plain_text:
            text_field.type_text(plain_text)
    else:
        wordpress.blog.prepare_empty_post()
    handlers.button_to_view(window, script, "button_proceed",
                            "blog/speller_title")
    handlers.button_to_view(window, script, "button_exit")
Example #11
0
def prepare_speller_post_view(app, window, script, data):
    """
    View preparator.

    :param app: reference to the application, :see: :module:`pisak.application`.
    :param window: application main window, :class:`pisak.window.Window` instance.
    :param script: ClutterScript with the view description.
    :param data: some specific data.
    """
    if wordpress.blog.pending_post is not None:
        text_field = script.get_object("text_box")
        plain_text = html_parsers.extract_text(
            wordpress.blog.pending_post.content)
        if plain_text:
            text_field.type_text(plain_text)
    else:
        wordpress.blog.prepare_empty_post()
    handlers.button_to_view(window, script, "button_proceed",
                            "blog/speller_title")
    handlers.button_to_view(window, script, "button_exit")
Example #12
0
def prepare_speller_about_me_view(app, window, script, data):
    """
    View preparator.

    :param app: reference to the application, :see: :module:`pisak.application`.
    :param window: application main window, :class:`pisak.window.Window` instance.
    :param script: ClutterScript with the view description.
    :param data: some specific data.
    """
    try:
        bio = wordpress.blog.get_about_me_page()
    except socket.timeout:
        window.load_popup(MESSAGES['too-slow-connection'], 'main_panel/main')
    else:
        plain_bio = html_parsers.extract_text(bio.content)
        if plain_bio:
            text_widget = script.get_object("text_box")
            text_widget.type_text(plain_bio)
        handlers.button_to_view(window, script, "button_proceed", "blog/about_me")
        handlers.button_to_view(window, script, "button_exit")
Example #13
0
def prepare_speller_post_view(app, window, script, data):
    """
    View preparator.

    :param app: reference to the application, :see: :module:`pisak.application`.
    :param window: application main window, :class:`pisak.window.Window` instance.
    :param script: ClutterScript with the view description.
    :param data: some specific data.
    """
    if wordpress.blog.pending_post is not None:
        text_field = script.get_object("text_box")
        plain_text = html_parsers.extract_text(
            wordpress.blog.pending_post.content)
        if plain_text:
            text_field.type_text(plain_text)
    else:
        wordpress.blog.prepare_empty_post()
    handlers.button_to_view(
        window, script, "button_proceed", "blog/speller_title")
    handlers.button_to_view(window, script, "button_exit")
Example #14
0
def prepare_speller_about_me_view(app, window, script, data):
    """
    View preparator.

    :param app: reference to the application, :see: :module:`pisak.application`.
    :param window: application main window, :class:`pisak.window.Window` instance.
    :param script: ClutterScript with the view description.
    :param data: some specific data.
    """
    try:
        bio = wordpress.blog.get_about_me_page()
    except socket.timeout:
        window.load_popup(MESSAGES['too-slow-connection'], 'main_panel/main')
    else:
        plain_bio = html_parsers.extract_text(bio.content)
        if plain_bio:
            text_widget = script.get_object("text_box")
            text_widget.type_text(plain_bio)
        handlers.button_to_view(window, script, "button_proceed",
                                "blog/about_me")
        handlers.button_to_view(window, script, "button_exit")