Skip to content

Commit

Permalink
Fix event callbacks with new signature
Browse files Browse the repository at this point in the history
  • Loading branch information
jsbueno committed May 29, 2021
1 parent ef4f2c7 commit c8de8c5
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions terminedia_paint/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ async def _input(self, label, pos=(0,3), default="", width=30):

text = default
text_picked = False
def _pick_text(entry):
def _pick_text(entry, event=None):
nonlocal text_picked, text
if not entry.value:
return
Expand All @@ -187,7 +187,7 @@ def _pick_text(entry):
widget.kill()
label_w.kill()

def _cancel(entry):
def _cancel(entry, event=None):
nonlocal text_picked, text
text = ""
text_picked = True
Expand Down Expand Up @@ -275,12 +275,12 @@ def pick_character(self, options):
selector = None
extended_selector = None

def _pick_extended(entry):
def _pick_extended(entry, event=None):
self.sc.context.char = entry.value
extended_selector.kill()


def _search_text(entry):
def _search_text(entry, event=None):
nonlocal extended_selector
options = TM.unicode.lookup(entry.value)
if len(options) == 1:
Expand All @@ -298,7 +298,7 @@ def _search_text(entry):
label.kill()
selector.kill()

def _type_text(entry):
def _type_text(entry, event=None):
self.sc.context.char = entry.value[0]
entry.kill()
label.kill()
Expand Down Expand Up @@ -326,7 +326,8 @@ async def pick_color(self, event=None):

async def pick_background(self, event=None):
try:
self.sc.context.background = await self._pick_color(event)
color = await self._pick_color(event)
self.sc.context.background = color if color != TM.DEFAULT_FG else TM.DEFAULT_BG
except TM.widgets.WidgetCancelled:
pass

Expand Down

0 comments on commit c8de8c5

Please sign in to comment.