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

Talon v0.4 support: port from resource.open to resource.watch & initial talon-list conversions #1239

Closed
wants to merge 8 commits into from

Conversation

knausj85
Copy link
Member

@knausj85 knausj85 commented Jul 24, 2023

Splitting #1234 into a few pull requests for convenience. This is not fully vetted yet, opening a draft for convenience and initial discussion.

  • port from resource.open to resource.watch (Talon v0.4) (merge in port from resource.open to resource.watch (Talon v0.4) #1199)
  • Convert many lists to .talon-list to jumpstart the process / discussion. I did not attempt to convert them all, just the highest priority targets and a few interesting ones for discussion. We need some sort of migration plan, as I would like to move away from CSVs wherever possible.
  • Also adds support for keypad keys, as it wasn't worth the effort to separate into a separate pull request

todo:

  • Fix unit tests for create spoken forms
  • Create a CSV to .talon-list converter for targeted conversions
  • Verify emacs functionality

Questions:

  1. Should CSVs migrated to talon-lists migrated continue to live in Settings?
  2. do we want to auto regenerate a talon list if it's deleted as was done for the CSVs?
  3. is there a 'good' way to migrate targeted lists that exist only in python without breaking every customization?

Comment on lines +2 to +3
-
`: `
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This can be moved to a dragon specific punctuation list.

Comment on lines +5 to +8
default_digits = "zero one two three four five six seven eight nine".split(" ")
numbers = [str(i) for i in range(10)]
default_f_digits = (
"one two three four five six seven eight nine ten eleven twelve".split(" ")
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merge error, can be removed.

Comment on lines +1 to +5
#todo: if we wanted to convert this
# we'd probably want to rework the list to have hard-coded strings
# like e.g. BRACES on the right side.
# list: user.navigation_target_name
# -
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm leaving a note here for discussion purposes. I don't think this should be converted as is.

down: down
left: left
right: right
up: up
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can just do up instead of up: up in all of these identity mapped lists. With up: up it's actually kind of confusing which side to edit too.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's arguably a bit more convenient for those that may customize to keep up: up though.

This is a similar problem to eg https://github.com/talonhub/community/blob/7b09a4a789ed1dc380865d2840a5abda9f65af25/core/windows_and_tabs/window_snap_positions.talon-list

where we may be better off with something more obviously not a spoken form on the right side.

Copy link
Collaborator

@lunixbochs lunixbochs Jul 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think up: up is not more convenient at all, because it's not obvious which side to edit when the sides are symmetrical. I think using a non spoken form on the right hand side is also bad (in the case of key mappings), because the right hand side is a key name. You shouldn't map those to something else.

up on a line by itself should be fine. It's easy enough to teach people how to work with these files I think. We're still much better off than the "simple key names" in Python where you had to move the key to a different list if you wanted to remap it.

If the file contains:

list: user.arrow_key
-
up
down
left
right

I want to remove "up" and add "shoop" mapped to up. I need to know what the existing lines in the .talon-list mean, and I need to know how to add a line. I need to know this regardless of whether the file contains up: up or just up.

-up
+shoop: up

Anyway. Don't do up: up. Not worth bike shedding.

@@ -36,6 +37,7 @@ talon dump context:
user.talon_action_find("{user.talon_actions}")
^talon debug list {user.talon_lists}$: user.talon_debug_list(talon_lists)
^talon copy list {user.talon_lists}$: user.talon_copy_list(talon_lists)
^talon convert list {user.talon_lists}$: user.talon_convert_list(user.talon_lists)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably remove this

core/text/prose_snippets.talon-list Outdated Show resolved Hide resolved
return decorator


# NOTE: this is deprecated, use @track_csv_list instead.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TODO: raise a Deprecation/FutureWarning?

@@ -184,6 +184,9 @@ class Resource:
def open(self, path: str, mode: str = "r"):
return open(path, mode, encoding="utf-8")

def watch(self, path: str):
pass
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't this return an identity function?

Suggested change
pass
return lambda f: f

Co-authored-by: David Vo <auscompgeek@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants