Cimbali / pympress

Pympress is a simple yet powerful PDF reader designed for dual-screen presentations
https://cimbali.github.io/pympress/
GNU General Public License v2.0
1.21k stars 89 forks source link

cannot place next slides vertically #260

Closed ousia closed 1 year ago

ousia commented 1 year ago

Describe the bug

Vertical next slides are placed horizontally.

To Reproduce

Steps to reproduce the behavior:

  1. Remove config file.
  2. Go to Starting Configuration and click on Edit layout.
  3. Increase the number of next slides to 2.
  4. Press OK button.

Expected behavior

Next slides should be placed vertically, not horizontally.

Screenshots

vert-may-fs8

Environment (please complete the following information):

Debug information (see below for file locations)

INFO:pympress.app:Pympress: 1.7.2 ; Python: 3.10.8 ; OS: Linux 6.0.12-100.fc35.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 8 16:53:55 UTC 2022 ; Gtk 3.24.34 ; GLib 2.70.0 ; Poppler 21.08.0 cairo ; Cairo 1.17.4 , pycairo 1.20.1
INFO:pympress.extras:Media support: GdkPixbuf gif player, GStreamer 1.20.0, VLC not available
WARNING:pympress.ui:Not starting content or presenter window full screen because there is only one monitor
ERROR:pympress.scribble:Error creating highlight cache
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/pympress/scribble.py", line 412, in reset_scribble_cache
    self.scribble_cache = window.create_similar_image_surface(cairo.Format.ARGB32, ww, wh, scale)
  File "/usr/lib64/python3.10/site-packages/gi/module.py", line 160, in __getattr__
    setattr(wrapper, value_name, wrapper(value_info.get_value()))
ValueError: invalid enum value: 5
Cimbali commented 1 year ago

Ah I see what’s happening I think. The “vertical” orientation is only specifying that the annotations should appear below the next slides, and the next slides are purely laid out on a grid that fills rows first (I think ceil(sqrt(# slides)) columns and ceil(# slides / # columns) rows).

However I see the issue, which is that the space is not used very well. We have a constrained size, so ideally we should be able to pick a sort of inline-block layout (i.e. blocks on a line that wraps).

Alternately we could try and see if 1 less column (i.e. floor(sqrt(# slides))) allows for larger preview slides and reflow ourselves (or try with any number of columns from 1 to # slides).

ousia commented 1 year ago

Many thanks for the fix, @Cimbali.

It works perfectly fine.