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

Fix minimum size in gtk backend #1293

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
11c49ee
Draw the structre of how the min_width will update
Jun 29, 2021
4d1f266
Debug the code
Jun 29, 2021
62d6de5
Debug the code
Jun 29, 2021
33079ec
Implement the min_width of gtk backend
Jun 29, 2021
f08a2cc
Implement min_height of the gtk backend
Jun 29, 2021
8f3ccdb
Implement min_height of the gtk backend
Jun 29, 2021
5e0ec09
Fix the style to be flex SpliterContainer in examples_overview example
Jun 29, 2021
8c32850
Showing window after setting layout in gtk backend
Jun 29, 2021
44c3294
flake8 formating
Jun 29, 2021
da0fdf8
flake8 line length formating
Jun 29, 2021
7506d2b
flake8
Jun 29, 2021
2253838
Enhance code by removing redundant cases
Jun 29, 2021
21d7148
Handle edge cases for some widget that does not has interinsic size
Jun 29, 2021
5666de1
Flake8::fix line missing indentation
Jun 29, 2021
ec8c6fc
Flake8::fix do not use bare 'except'
Jun 29, 2021
e33eead
fix typos
Jun 30, 2021
d05711a
Fix if conditions indent
Jun 30, 2021
0a3f4d7
Flake8::fix continuation line under-indented
Jun 30, 2021
b7aa08b
Fix typo
MuhammadMuradG Jul 1, 2021
2585adb
Gtk backend::Fix minimum width of numberinput that used in rehint
Jul 2, 2021
b9ee171
Gtk backend::Fix minimum width of Selection widget that used in rehint
Jul 2, 2021
4deda0d
Gtk backend::Rehint widget before calculate its min width
Jul 2, 2021
67f2719
Gtk backend::Handle some edge cases in Box widget; when Box has speci…
Jul 3, 2021
ad3eb2c
Flake8::fix continuation line under-indented
Jul 3, 2021
0a53bfa
WARNING::Revert to correct platfore
Jul 3, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion examples/examples_overview/examples_overview/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ def startup(self):
),
)

split_container = toga.SplitContainer(content=[left_box, self.info_view])
# make the SplitContainer flex to occupy available Box widget space
split_container = toga.SplitContainer(style=Pack(flex=1), content=[left_box, self.info_view])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not clear why you've made this change. The old layout should be sufficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The structure of the app is as following:
outer_box
|...Label
|...SpliterContainer
|...|...left_box (Box widget)
|...|...|...table (Table widget)
|...|...|...button_box (Box widget has 2 button)
|...|...info_view (MultilineTextInput widget)

Are we need to tell the SpliterContainer to occupy available space of outer_box? Why it will occupy available space without specify flex=1.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not as straightforward as that. outer_box is also the main content of the window, and the layout must conform to the height of the window. The only content in the box is a label and a splitter container, and of those two, label has a fixed height. As a result, the splitter will must absorb all the remaining height. flex=1 should have no effect here - there no ambiguity over where the expansion weight can go.

By way of (weak) proof - macOS and Windows both render this layout the same, and adding flex=1 changes nothing.

There is perhaps a design argument to be made that the interaction between outer_box and window size, and whether it should be possible to specify a window axis size of "None" that causes the window to conform to the minimum possible size; but that's definitely in territory of "feature", rather than "bug".


outer_box = toga.Box(
children=[label, split_container],
Expand Down
Loading