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

Post audit cleanup #2160

Merged
merged 16 commits into from
Oct 31, 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
2 changes: 1 addition & 1 deletion android/src/toga_android/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ def onOptionsItemSelected(self, menuitem):
# This method also fires when opening submenus
return False
else:
self.menuitem_mapping[itemid].action(None)
self.menuitem_mapping[itemid].action()
return True

def onPrepareOptionsMenu(self, menu):
Expand Down
2 changes: 1 addition & 1 deletion android/src/toga_android/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def __init__(
self.native.show()

def completion_handler(self, return_value: bool) -> None:
self.on_result(self, return_value)
self.on_result(return_value)
self.interface.future.set_result(return_value)


Expand Down
2 changes: 1 addition & 1 deletion android/src/toga_android/widgets/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, button_impl):
self.button_impl = button_impl

def onClick(self, _view):
self.button_impl.interface.on_press(None)
self.button_impl.interface.on_press()


class Button(TextViewWidget):
Expand Down
8 changes: 4 additions & 4 deletions android/src/toga_android/widgets/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ def __init__(self, impl):
def onTouch(self, canvas, event):
x, y = map(self.impl.scale_out, (event.getX(), event.getY()))
if (action := event.getAction()) == MotionEvent.ACTION_DOWN:
self.interface.on_press(None, x, y)
self.interface.on_press(x, y)
elif action == MotionEvent.ACTION_MOVE:
self.interface.on_drag(None, x, y)
self.interface.on_drag(x, y)
elif action == MotionEvent.ACTION_UP:
self.interface.on_release(None, x, y)
self.interface.on_release(x, y)
else: # pragma: no cover
return False
return True
Expand All @@ -58,7 +58,7 @@ def create(self):

def set_bounds(self, x, y, width, height):
super().set_bounds(x, y, width, height)
self.interface.on_resize(None, width=width, height=height)
self.interface.on_resize(width=width, height=height)

def redraw(self):
self.native.invalidate()
Expand Down
2 changes: 1 addition & 1 deletion android/src/toga_android/widgets/dateinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def get_value(self):
def set_value(self, value):
self.native.setText(value.isoformat())
self._dialog.updateDate(value.year, value.month - 1, value.day)
self.interface.on_change(None)
self.interface.on_change()

def get_min_date(self):
return py_date(self._picker.getMinDate())
Expand Down
8 changes: 4 additions & 4 deletions android/src/toga_android/widgets/detailedlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def __init__(self, impl, row_number):

def onClick(self, _view):
self.impl._set_selection(self.row_number)
self.impl.interface.on_select(None)
self.impl.interface.on_select()


@dataclass
Expand All @@ -40,7 +40,7 @@ def __init__(self, impl, row_number):

def onLongClick(self, _view):
self.impl._set_selection(self.row_number)
self.impl.interface.on_select(None)
self.impl.interface.on_select()

actions = [
action
Expand Down Expand Up @@ -76,7 +76,7 @@ def __init__(self, actions, row):
self.row = row

def onClick(self, dialog, which):
self.actions[which].handler(None, row=self.row)
self.actions[which].handler(row=self.row)


class OnRefreshListener(dynamic_proxy(SwipeRefreshLayout.OnRefreshListener)):
Expand All @@ -85,7 +85,7 @@ def __init__(self, interface):
self._interface = interface

def onRefresh(self):
self._interface.on_refresh(None)
self._interface.on_refresh()


class DetailedList(Widget):
Expand Down
2 changes: 1 addition & 1 deletion android/src/toga_android/widgets/multilinetextinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def create(self):
)

def _on_change(self):
self.interface.on_change(None)
self.interface.on_change()

def _on_confirm(self): # pragma: nocover
pass # The interface doesn't support this event.
Expand Down
2 changes: 1 addition & 1 deletion android/src/toga_android/widgets/numberinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def set_min_value(self, value):
pass # This backend doesn't support stepped increments.

def _on_change(self):
self.interface.on_change(None)
self.interface.on_change()

def _on_confirm(self): # pragma: nocover
pass # The interface doesn't support this event.
Expand Down
2 changes: 1 addition & 1 deletion android/src/toga_android/widgets/scrollcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def __init__(self, impl):
self.impl = impl

def onScrollChange(self, view, new_x, new_y, old_x, old_y):
self.impl.interface.on_scroll(None)
self.impl.interface.on_scroll()


class ScrollContainer(Widget, Container):
Expand Down
4 changes: 2 additions & 2 deletions android/src/toga_android/widgets/selection.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ def create(self):
# the change, and use self.last_selection to prevent duplication.
def on_change(self, index):
if index != self.last_selection:
self.interface.on_change(None)
self.interface.on_change()
self.last_selection = index

def insert(self, index, item):
Expand Down Expand Up @@ -68,7 +68,7 @@ def remove(self, index, item=None):
self.select_item(self.last_selection)

if removed_selection:
self.interface.on_change(None)
self.interface.on_change()

def select_item(self, index, item=None):
self.native.setSelection(index)
Expand Down
4 changes: 2 additions & 2 deletions android/src/toga_android/widgets/slider.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ def onProgressChanged(self, _view, _progress, _from_user):
self.impl.on_change()

def onStartTrackingTouch(self, native_seekbar):
self.impl.interface.on_press(None)
self.impl.interface.on_press()

def onStopTrackingTouch(self, native_seekbar):
self.impl.interface.on_release(None)
self.impl.interface.on_release()


class Slider(Widget, toga.widgets.slider.IntSliderImpl):
Expand Down
2 changes: 1 addition & 1 deletion android/src/toga_android/widgets/switch.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ def __init__(self, impl):
self._impl = impl

def onCheckedChanged(self, _button, _checked):
self._impl.interface.on_change(None)
self._impl.interface.on_change()


class Switch(TextViewWidget):
Expand Down
6 changes: 3 additions & 3 deletions android/src/toga_android/widgets/table.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def onClick(self, view):
else:
self.impl.clear_selection()
self.impl.add_selection(tr_id, view)
self.impl.interface.on_select(None)
self.impl.interface.on_select()


class TogaOnLongClickListener(dynamic_proxy(View.OnLongClickListener)):
Expand All @@ -40,8 +40,8 @@ def onLongClick(self, view):
self.impl.clear_selection()
index = view.getId()
self.impl.add_selection(index, view)
self.impl.interface.on_select(None)
self.impl.interface.on_activate(None, row=self.impl.interface.data[index])
self.impl.interface.on_select()
self.impl.interface.on_activate(row=self.impl.interface.data[index])
return True


Expand Down
8 changes: 4 additions & 4 deletions android/src/toga_android/widgets/textinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,17 +110,17 @@ def is_valid(self):
return self.native.getError() is None

def _on_change(self):
self.interface.on_change(None)
self.interface.on_change()
self.interface._validate()

def _on_confirm(self):
self.interface.on_confirm(None)
self.interface.on_confirm()

def _on_gain_focus(self):
self.interface.on_gain_focus(None)
self.interface.on_gain_focus()

def _on_lose_focus(self):
self.interface.on_lose_focus(None)
self.interface.on_lose_focus()

def rehint(self):
self.interface.intrinsic.width = at_least(self.interface._MIN_WIDTH)
Expand Down
2 changes: 1 addition & 1 deletion android/src/toga_android/widgets/timeinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def get_value(self):
def set_value(self, value):
self.native.setText(value.isoformat(timespec="minutes"))
self._dialog.updateTime(value.hour, value.minute)
self.interface.on_change(None)
self.interface.on_change()

def get_min_time(self):
return self._min_time
Expand Down
1 change: 1 addition & 0 deletions changes/2171.misc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The use of ``pytest-freezegun`` was replaced with ``pytest-freezer``, due to lack of maintenance on the freezegun plugin.
6 changes: 3 additions & 3 deletions cocoa/src/toga_cocoa/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def cocoa_windowShouldClose(self):
# As a result of calling that method, the app will either
# exit, or the user will cancel the exit; in which case
# the main window shouldn't close, either.
self.interface.app.on_exit(None)
self.interface.app.on_exit()
return False


Expand Down Expand Up @@ -101,7 +101,7 @@ def application_openFiles_(self, app, filenames) -> None: # pragma: no cover
@objc_method
def selectMenuItem_(self, sender) -> None:
cmd = self.impl._menu_items[sender]
cmd.action(None)
cmd.action()

@objc_method
def validateMenuItem_(self, sender) -> bool:
Expand Down Expand Up @@ -303,7 +303,7 @@ def _menu_about(self, app, **kwargs):
self.interface.about()

def _menu_quit(self, app, **kwargs):
self.interface.on_exit(None)
self.interface.on_exit()

def _menu_close_window(self, app, **kwargs):
if self.interface.current_window:
Expand Down
8 changes: 4 additions & 4 deletions cocoa/src/toga_cocoa/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ def build_dialog(self):
pass

def completion_handler(self, return_value: int) -> None:
self.on_result(None, None)
self.on_result(None)

self.interface.future.set_result(None)

def bool_completion_handler(self, return_value: int) -> None:
result = return_value == NSAlertFirstButtonReturn

self.on_result(None, result)
self.on_result(result)

self.interface.future.set_result(result)

Expand Down Expand Up @@ -216,7 +216,7 @@ def single_path_completion_handler(self, return_value: int) -> None:
else:
result = None

self.on_result(None, result)
self.on_result(result)
self.interface.future.set_result(result)

def multi_path_completion_handler(self, return_value: int) -> None:
Expand All @@ -225,7 +225,7 @@ def multi_path_completion_handler(self, return_value: int) -> None:
else:
result = None

self.on_result(None, result)
self.on_result(result)

self.interface.future.set_result(result)

Expand Down
2 changes: 1 addition & 1 deletion cocoa/src/toga_cocoa/widgets/button.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TogaButton(NSButton):

@objc_method
def onPress_(self, obj) -> None:
self.interface.on_press(None)
self.interface.on_press()


class Button(Widget):
Expand Down
16 changes: 8 additions & 8 deletions cocoa/src/toga_cocoa/widgets/canvas.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,34 +50,34 @@ def isFlipped(self) -> bool:
def mouseDown_(self, event) -> None:
position = self.convertPoint(event.locationInWindow, fromView=None)
if event.clickCount == 1:
self.interface.on_press(None, position.x, position.y)
self.interface.on_press(position.x, position.y)
else:
self.interface.on_activate(None, position.x, position.y)
self.interface.on_activate(position.x, position.y)

@objc_method
def rightMouseDown_(self, event) -> None:
position = self.convertPoint(event.locationInWindow, fromView=None)
self.interface.on_alt_press(None, position.x, position.y)
self.interface.on_alt_press(position.x, position.y)

@objc_method
def mouseUp_(self, event) -> None:
position = self.convertPoint(event.locationInWindow, fromView=None)
self.interface.on_release(None, position.x, position.y)
self.interface.on_release(position.x, position.y)

@objc_method
def rightMouseUp_(self, event) -> None:
position = self.convertPoint(event.locationInWindow, fromView=None)
self.interface.on_alt_release(None, position.x, position.y)
self.interface.on_alt_release(position.x, position.y)

@objc_method
def mouseDragged_(self, event) -> None:
position = self.convertPoint(event.locationInWindow, fromView=None)
self.interface.on_drag(None, position.x, position.y)
self.interface.on_drag(position.x, position.y)

@objc_method
def rightMouseDragged_(self, event) -> None:
position = self.convertPoint(event.locationInWindow, fromView=None)
self.interface.on_alt_drag(None, position.x, position.y)
self.interface.on_alt_drag(position.x, position.y)


class Canvas(Widget):
Expand All @@ -94,7 +94,7 @@ def redraw(self):

def set_bounds(self, x, y, width, height):
super().set_bounds(x, y, width, height)
self.interface.on_resize(None, width=width, height=height)
self.interface.on_resize(width=width, height=height)

def set_background_color(self, color):
if color is TRANSPARENT or color is None:
Expand Down
8 changes: 4 additions & 4 deletions cocoa/src/toga_cocoa/widgets/detailedlist.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ def menuForEvent_(self, event):
@objc_method
def primaryActionOnRow_(self, menuitem):
row = self.interface.data[menuitem.tag]
self.interface.on_primary_action(self.interface, row=row)
self.interface.on_primary_action(row=row)

@objc_method
def secondaryActionOnRow_(self, menuitem):
row = self.interface.data[menuitem.tag]
self.interface.on_secondary_action(self.interface, row=row)
self.interface.on_secondary_action(row=row)

# TableDataSource methods
@objc_method
Expand Down Expand Up @@ -122,7 +122,7 @@ def selectionShouldChangeInTableView_(self, table) -> bool:

@objc_method
def tableViewSelectionDidChange_(self, notification) -> None:
self.interface.on_select(self.interface)
self.interface.on_select()


class DetailedList(Widget):
Expand Down Expand Up @@ -180,7 +180,7 @@ def remove(self, index, item):

# After deletion, the selection changes, but Cocoa doesn't send
# a tableViewSelectionDidChange: message.
self.interface.on_select(self.interface)
self.interface.on_select()

def clear(self):
self.native_detailedlist.reloadData()
Expand Down
2 changes: 1 addition & 1 deletion cocoa/src/toga_cocoa/widgets/internal/refresh.py
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ def scrollWheel_(self, event) -> None:
NSMakePoint(self.contentView.bounds.origin.x, -HEADER_HEIGHT)
)
self.refresh_indicator.startAnimation(self)
self.interface.on_refresh(self.interface)
self.interface.on_refresh()

send_super(__class__, self, "scrollWheel:", event, argtypes=[c_void_p])

Expand Down
4 changes: 2 additions & 2 deletions cocoa/src/toga_cocoa/widgets/multilinetextinput.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ class TogaTextView(NSTextView):

@objc_method
def textDidChange_(self, notification) -> None:
self.interface.on_change(None)
self.interface.on_change()


class MultilineTextInput(Widget):
Expand Down Expand Up @@ -78,7 +78,7 @@ def get_value(self):

def set_value(self, value):
self.native_text.string = value
self.interface.on_change(None)
self.interface.on_change()

def set_color(self, value):
self.native_text.textColor = native_color(value)
Expand Down
Loading