hchauvet / beampy

Beampy is a python tool to create slide-show in svg that can be displayed in web browser or pdf
https://hchauvet.github.io/beampy
GNU General Public License v3.0
58 stars 18 forks source link

A few improvements #28

Closed ffeppon closed 3 years ago

ffeppon commented 3 years ago

Dear Hugo,

Here are the changes I am proposing :

Thanks any way for this library. This is the first thing a bit serious I find to write HTML5 slides without knowing anything from HTML5, but only a bit of beamer knowledge. I find that the writing of the library is rather well-organized and well-understood. I was able to understand and implement these changes after a few hours discovering the package. I might contribute if I need extra things. A thing which also would be nice would be letting the user the possibility to have graphics (images, videos) to be included through relative links and not in a gigantic html. Because the browser might take time to load all the videos at once.

Best Florian

hchauvet commented 3 years ago

Thanks,

I will check why checks failed asap and merge things.

Some quick answers:

But have a way to manage the spacing in "auto" mode could be a great thing, if the empty text does the trick for the moment it's great, but I will think of adding a "spacer" element.

I'm also planning to introduce the same kind of box model like the one of css (with padding, margin and border)

ffeppon commented 3 years ago

Dear Hugo

Your correction does not work because self.width.value is set by default to the document width at lines 155-156


            if self.width is None:
                self.width = document._slides[gcs()].curwidth

That is why I was relying on "self.args" instead of self.width. Maybe this part requires a bit of cleaning then ?

Thanks

hchauvet commented 3 years ago

Ok, maybe we could say that:

When no height and no width are given take the current width for this image (which is the width of the current group where your adding your image), so when self.width and self.height are None.

We could change lines 155 - 156 to:

if self.width is None and self.height is None:
    self.width = document._slides[gcs()].curwidth

Then on the render method keep testing on self.width.value and self.height.value (the .value comes from the register method which re-assign the self.width and self.height variables to a Length object via the the update_size method, not very clever but I will change that in the future to make things a bit less confusing).

Does it works on your side with those changes ?

hchauvet commented 3 years ago

We should also change around line 345

else:
   out_img = resize_raster_image(tmp_img, max_width=self.positionner.width.value)

to

else:
   out_img = resize_raster_image(tmp_img, max_width=figure_width)

Best. Hugo.