Exemplo n.º 1
0
def dump_slides() -> None:
    for filename in get_free_args():
        print(f"filename {filename}")
        presentation = Presentation(filename)
        for number, slide in enumerate(presentation.slides):
            print(f"slide {number}")
            dump_print(slide)
Exemplo n.º 2
0
def extract_text() -> None:
    for filename in get_free_args():
        presentation = Presentation(filename)
        for slide_number, slide in enumerate(presentation.slides):
            print(f"slide number {slide_number}")
            if slide.name != "":
                print(f"slide.name {slide.name}")
            # This block extracts hyperlinks
            for v in slide.part.rels.values():
                target: str = v.target_ref
                if target.startswith(".."):
                    continue
                print(v.target_ref)
            for shape in slide.shapes:
                # pylint: disable=no-member
                if shape.shape_type == MSO_SHAPE_TYPE.PLACEHOLDER:
                    print(shape.shape_type)
                    print(shape.text)
                if shape.shape_type == MSO_SHAPE_TYPE.TEXT_BOX:
                    print(shape.shape_type)
                    print(shape.text)
                if shape.shape_type == MSO_SHAPE_TYPE.TABLE:
                    print(shape.shape_type)
                    for row in shape.table.rows:
                        for cell in row.cells:
                            print(cell.text)
Exemplo n.º 3
0
 def test_free_args(self):
     register_function(
         name="foo",
         description="foobar",
         function=raise_value_error,
         allow_free_args=True,
     )
     config_arg_parse_and_launch(
         args=["foo", "--num=30", "zoo"],
         launch=False,
         do_exit=False,
     )
     self.assertListEqual(get_free_args(), ["zoo"])
Exemplo n.º 4
0
def view() -> None:
    view_svgs(get_free_args())
Exemplo n.º 5
0
def print_pickle() -> None:
    for filename in get_free_args():
        with open(filename, "rb") as file_handle:
            print(f"{filename}")
            for x, y in pickle.load(file_handle).items():
                print(x, y)
Exemplo n.º 6
0
def download_links() -> None:
    refs = get_sorted_refs(get_free_args())
    for ref in refs:
        download(ref)
Exemplo n.º 7
0
def extract_links() -> None:
    refs = get_sorted_refs(get_free_args())
    for ref in refs:
        print(ref)
Exemplo n.º 8
0
def remove_folders() -> None:
    result = []
    for f in get_free_args():
        r = os.path.splitext(os.sep.join(f.split(os.sep)[1:]))[0]
        result.append(r)
    print(' '.join(result), end='')