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

Android and WinForms rehint updates #2200

Merged
merged 2 commits into from
Nov 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
4 changes: 0 additions & 4 deletions android/src/toga_android/widgets/progressbar.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from android import R
from android.view import View
from android.widget import ProgressBar as A_ProgressBar
from travertino.size import at_least

from .base import Widget

Expand Down Expand Up @@ -94,9 +93,6 @@ def rehint(self):
View.MeasureSpec.UNSPECIFIED,
View.MeasureSpec.UNSPECIFIED,
)
self.interface.intrinsic.width = self.scale_out(
at_least(self.native.getMeasuredWidth()), ROUND_UP
)
self.interface.intrinsic.height = self.scale_out(
self.native.getMeasuredHeight(), ROUND_UP
)
4 changes: 0 additions & 4 deletions android/src/toga_android/widgets/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from android.view import View
from android.widget import AdapterView, ArrayAdapter, Spinner
from java import dynamic_proxy
from travertino.size import at_least

from .base import Widget

Expand Down Expand Up @@ -86,9 +85,6 @@ def clear(self):

def rehint(self):
self.native.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
self.interface.intrinsic.width = self.scale_out(
at_least(self.native.getMeasuredWidth()), ROUND_UP
)
self.interface.intrinsic.height = self.scale_out(
self.native.getMeasuredHeight(), ROUND_UP
)
4 changes: 0 additions & 4 deletions android/src/toga_android/widgets/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
from android.view import View
from android.widget import SeekBar
from java import dynamic_proxy
from travertino.size import at_least

import toga

Expand Down Expand Up @@ -69,9 +68,6 @@ def _load_tick_drawable(self):

def rehint(self):
self.native.measure(View.MeasureSpec.UNSPECIFIED, View.MeasureSpec.UNSPECIFIED)
self.interface.intrinsic.width = self.scale_out(
at_least(self.native.getMeasuredWidth()), ROUND_UP
)
self.interface.intrinsic.height = self.scale_out(
self.native.getMeasuredHeight(), ROUND_UP
)
1 change: 1 addition & 0 deletions changes/2200.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Most widgets with flexible sizes now default to a minimum size of 100 CSS pixels. An explicit size will still override this value.
3 changes: 0 additions & 3 deletions core/src/toga/widgets/scrollcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@


class ScrollContainer(Widget):
_MIN_WIDTH = 0
_MIN_HEIGHT = 0

def __init__(
self,
id=None,
Expand Down
4 changes: 0 additions & 4 deletions winforms/src/toga_winforms/widgets/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from decimal import ROUND_UP

import System.Windows.Forms as WinForms
from travertino.size import at_least

from ..libs.wrapper import WeakrefCallable
from .base import Widget
Expand Down Expand Up @@ -78,9 +77,6 @@ def get_selected_index(self):
return None if index == -1 else index

def rehint(self):
self.interface.intrinsic.width = self.scale_out(
at_least(self.native.PreferredSize.Width), ROUND_UP
)
self.interface.intrinsic.height = self.scale_out(
self.native.PreferredSize.Height, ROUND_UP
)
4 changes: 0 additions & 4 deletions winforms/src/toga_winforms/widgets/slider.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from decimal import ROUND_UP

import System.Windows.Forms as WinForms
from travertino.size import at_least

from toga.widgets.slider import IntSliderImpl

Expand Down Expand Up @@ -57,9 +56,6 @@ def set_ticks_visible(self, visible):
self.native.TickStyle = BOTTOM_RIGHT_TICK_STYLE if visible else NONE_TICK_STYLE

def rehint(self):
self.interface.intrinsic.width = self.scale_out(
at_least(self.native.PreferredSize.Width), ROUND_UP
)
self.interface.intrinsic.height = self.scale_out(
self.native.PreferredSize.Height, ROUND_UP
)