Skip to content

Commit

Permalink
Merge pull request #2200 from mhsmith/rehint-updates
Browse files Browse the repository at this point in the history
Android and WinForms rehint updates
  • Loading branch information
freakboy3742 committed Nov 6, 2023
2 parents cda9754 + 9d2af8a commit bd042ae
Show file tree
Hide file tree
Showing 7 changed files with 1 addition and 23 deletions.
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
)

0 comments on commit bd042ae

Please sign in to comment.