Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Selection does not stay inside window when inside split container #1796

Closed
LunaMeadows opened this issue Feb 25, 2023 · 3 comments · Fixed by #1794
Closed

Selection does not stay inside window when inside split container #1796

LunaMeadows opened this issue Feb 25, 2023 · 3 comments · Fixed by #1794
Labels
bug A crash or error in behavior. linux The issue relates Linux support.

Comments

@LunaMeadows
Copy link
Contributor

LunaMeadows commented Feb 25, 2023

Describe the bug

When adding a selection in a split container, the selection does not set the width properly and goes outside of the container.

import toga
from toga.style.pack import COLUMN, Pack, BOTTOM, ROW, CENTER, JUSTIFY, RIGHT
def build(app):
    right_container = toga.Box(id='OptionsPane', style=Pack(direction=COLUMN, alignment=RIGHT))
    camera_options_box = toga.Box(id='camButtons', style=Pack(direction=ROW, alignment=CENTER))
    button_previous_cam = toga.Button('Previous', style=Pack(width=100, padding=20, padding_top=0))
    label_cam = toga.Label('next', style=Pack(width=100, padding=20, padding_top=10, text_align=CENTER))
    button_next_cam = toga.Button('next', style=Pack(width=100, padding=20, padding_top=0))
    camera_options_box.add(button_previous_cam, label_cam, button_next_cam)
    image_camera_viewer = toga.ImageView(image=toga.Image('0_0.jpg'), style=Pack(width=420, height=420))
    selection_image_dropdown = toga.Selection(items=['Test'])

    right_container.add(camera_options_box, image_camera_viewer, selection_image_dropdown)

    box2 = toga.Box(style=Pack(direction=COLUMN, alignment=CENTER))

    box2.add(
        toga.Selection('Preset Selection', items=[''], style=Pack(width=200)),
        toga.Button('Load Preset', style=Pack(width=200)),
        toga.Button('Edit Preset', style=Pack(width=200)),
        toga.Button('Delete Preset', style=Pack(width=200)),
        toga.Button('New Preset', style=Pack(width=200)),
        toga.Box(style=Pack(direction=COLUMN, flex=1)),
        toga.Button('Map Cameras', style=Pack(width=200)),
    )

    split = toga.SplitContainer()
    split.content = [(box2, .3), (right_container, .7)]

    return split

    return box


def main():
    return toga.App("Testing", "org.test.test", startup=build)


if __name__ == "__main__":
    main().main_loop()

Steps to reproduce

Add selection to splitcontainer

Expected behavior

Selection should stay within the split container

Screenshots

No response

Environment

  • Operating System: Ubuntu 20.04
  • Python version: 3.8
  • Software versions:
    • Briefcase:
    • Toga: 0.3.0
    • ...

Logs


Additional context

No response

@LunaMeadows LunaMeadows added the bug A crash or error in behavior. label Feb 25, 2023
@mhsmith
Copy link
Member

mhsmith commented Mar 1, 2023

Can you add some screenshots showing the problem?

@LunaMeadows
Copy link
Contributor Author

Apologizes, I thought I did. As you can see the end of the selection box is going outside of the screen.
image

@mhsmith
Copy link
Member

mhsmith commented Mar 4, 2023

Thanks: I've tested your example and confirmed that this issue will be fixed by #1794.

@mhsmith mhsmith added the linux The issue relates Linux support. label Mar 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A crash or error in behavior. linux The issue relates Linux support.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants