Skip to content

Commit

Permalink
Update GTK hinting methods.
Browse files Browse the repository at this point in the history
  • Loading branch information
freakboy3742 committed Feb 16, 2023
1 parent f381494 commit 55fde14
Show file tree
Hide file tree
Showing 21 changed files with 13 additions and 37 deletions.
2 changes: 1 addition & 1 deletion core/tests/widgets/test_divider.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@ def test_update_direction(self):
self.divider.direction = new_direction
self.assertEqual(self.divider.direction, new_direction)
self.assertValueSet(self.divider, "direction", new_direction)
self.assertActionPerformed(self.divider, "rehint Divider")
self.assertActionPerformed(self.divider, "rehint")
2 changes: 1 addition & 1 deletion core/tests/widgets/test_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def test_update_label_text(self):
self.label.text = new_text
self.assertEqual(self.label.text, new_text)
self.assertValueSet(self.label, "text", new_text)
self.assertActionPerformed(self.label, "rehint Label")
self.assertActionPerformed(self.label, "rehint")

self.label.text = None
self.assertEqual(self.label.text, "")
Expand Down
3 changes: 0 additions & 3 deletions dummy/src/toga_dummy/widgets/datepicker.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,5 @@ def set_min_date(self, value):
def set_max_date(self, value):
return self._set_value("max date", value)

def rehint(self):
self._action("rehint DatePicker")

def set_on_change(self, handler):
self._set_value("on_change", handler)
3 changes: 0 additions & 3 deletions dummy/src/toga_dummy/widgets/divider.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@ class Divider(Widget):
def create(self):
self._action("create Divider")

def rehint(self):
self._action("rehint Divider")

def set_direction(self, value):
self._set_value("direction", value)
3 changes: 0 additions & 3 deletions dummy/src/toga_dummy/widgets/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,3 @@ def set_alignment(self, value):

def set_text(self, value):
self._set_value("text", self.interface._text)

def rehint(self):
self._action("rehint Label")
3 changes: 0 additions & 3 deletions dummy/src/toga_dummy/widgets/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,3 @@ def get_selected_item(self):

def set_on_select(self, handler):
self._set_value("on_select", handler)

def rehint(self):
self._action("rehint Selection")
3 changes: 0 additions & 3 deletions dummy/src/toga_dummy/widgets/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ def set_range(self, range):
def set_tick_count(self, tick_count):
self._set_value("tick_count", tick_count)

def rehint(self):
self._action("rehint Slider")

def set_on_change(self, handler):
self._set_value("on_change", handler)

Expand Down
3 changes: 0 additions & 3 deletions dummy/src/toga_dummy/widgets/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,5 @@ def set_value(self, value):
def get_value(self):
return self._get_value("value")

def rehint(self):
self._action("rehint Switch")

def set_on_change(self, handler):
self._set_value("on_change", handler)
3 changes: 0 additions & 3 deletions dummy/src/toga_dummy/widgets/textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,6 @@ def set_font(self, font):
def set_alignment(self, value):
self._set_value("alignment", value)

def rehint(self):
self._action("rehint TextInput")

def set_on_change(self, handler):
self._set_value("on_change", handler)

Expand Down
3 changes: 0 additions & 3 deletions dummy/src/toga_dummy/widgets/timepicker.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,5 @@ def set_min_time(self, value):
def set_max_time(self, value):
return self._set_value("max time", value)

def rehint(self):
self._action("rehint TimePicker")

def set_on_change(self, handler):
self._set_value("on_change", handler)
2 changes: 1 addition & 1 deletion gtk/src/toga_gtk/widgets/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ def get_image_data(self):

# Rehint

def rehint(self):
def gtk_rehint(self):
# print("REHINT", self, self.native.get_preferred_width(), self.native.get_preferred_height())
# width = self.native.get_preferred_width()
# height = self.native.get_preferred_height()
Expand Down
2 changes: 1 addition & 1 deletion gtk/src/toga_gtk/widgets/divider.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def create(self):
self.native = Gtk.Separator()
self.native.interface = self.interface

def rehint(self):
def gtk_rehint(self):
width = self.native.get_preferred_width()
height = self.native.get_preferred_height()

Expand Down
2 changes: 1 addition & 1 deletion gtk/src/toga_gtk/widgets/imageview.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def set_bounds(self, x, y, width, height):
# rehint to update scaling of pixbuf
self.rehint()

def rehint(self):
def gtk_rehint(self):
if self._pixbuf:
height, width = self._resize_max(
original_height=self._pixbuf.get_height(),
Expand Down
2 changes: 1 addition & 1 deletion gtk/src/toga_gtk/widgets/label.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def set_text(self, value):
# corner and only jumps back at its place after resizing the window.
self.native.set_text(self.interface._text)

def rehint(self):
def gtk_rehint(self):
# print("REHINT", self,
# self.native.get_preferred_width(), self.native.get_preferred_height(),
# getattr(self, '_fixed_height', False), getattr(self, '_fixed_width', False)
Expand Down
2 changes: 1 addition & 1 deletion gtk/src/toga_gtk/widgets/multilinetextinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def gtk_on_focus_out(self, *args):
) # make the placeholder text gray.
return False

def rehint(self):
def gtk_rehint(self):
self.interface.intrinsic.width = at_least(self.interface.MIN_WIDTH)
self.interface.intrinsic.height = at_least(self.interface.MIN_HEIGHT)

Expand Down
2 changes: 1 addition & 1 deletion gtk/src/toga_gtk/widgets/numberinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def set_alignment(self, value):
def set_font(self, font):
self.interface.factory.not_implemented("NumberInput.set_font()")

def rehint(self):
def gtk_rehint(self):
width = self.native.get_preferred_width()
height = self.native.get_preferred_height()
if width and height:
Expand Down
2 changes: 1 addition & 1 deletion gtk/src/toga_gtk/widgets/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def select_item(self, item):
def get_selected_item(self):
return self.native.get_active_text()

def rehint(self):
def gtk_rehint(self):
# width = self.native.get_preferred_width()
height = self.native.get_preferred_height()

Expand Down
2 changes: 1 addition & 1 deletion gtk/src/toga_gtk/widgets/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def set_range(self, range):
def set_tick_count(self, tick_count):
self.interface.factory.not_implemented("Slider.tick_count()")

def rehint(self):
def gtk_rehint(self):
# print("REHINT", self, self.native.get_preferred_width(), self.native.get_preferred_height())
height = self.native.get_preferred_height()

Expand Down
2 changes: 1 addition & 1 deletion gtk/src/toga_gtk/widgets/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def get_value(self):
def set_value(self, value):
self.switch.set_active(value)

def rehint(self):
def gtk_rehint(self):
# print("REHINT", self, self.native.get_preferred_width(), self.native.get_preferred_height())
width = self.native.get_preferred_width()
height = self.native.get_preferred_height()
Expand Down
2 changes: 1 addition & 1 deletion gtk/src/toga_gtk/widgets/textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ def get_value(self):
def set_value(self, value):
self.native.set_text(value)

def rehint(self):
def gtk_rehint(self):
# print("REHINT", self,
# self._impl.get_preferred_width(), self._impl.get_preferred_height(),
# getattr(self, '_fixed_height', False), getattr(self, '_fixed_width', False)
Expand Down
2 changes: 1 addition & 1 deletion gtk/src/toga_gtk/widgets/webview.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,6 @@ def invoke_javascript(self, javascript):
# Invoke the javascript without a callback.
self.native.run_javascript(javascript, None, None)

def rehint(self):
def gtk_rehint(self):
self.interface.intrinsic.width = at_least(self.interface.MIN_WIDTH)
self.interface.intrinsic.height = at_least(self.interface.MIN_HEIGHT)

0 comments on commit 55fde14

Please sign in to comment.