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

PR for #3472: use flat json for cut/copy/paste nodes #3473

Draft
wants to merge 226 commits into
base: devel
Choose a base branch
from

Conversation

edreamleo
Copy link
Member

@edreamleo edreamleo commented Jul 31, 2023

This PR will remain a draft until Leo 6.7.6.

#3472 describes the json format.
#3485 describes possible problems with paste-retaining-clones.

  • Rewrite copy-node, paste-node, and paste-retaining-clones so they use json dicts.
  • Add unit tests for all new/changed code.
  • (Maybe) paste-retaining-clones should give priority to pasted nodes.
  • (Maybe) Restore the legacy operation of server.copy_node and server.copy_node_as_json.
    The new version of fc.outline_to_clipboard_string uses c.archive
Details

Here is the old version of fc.outline_to_clipboard_string:

# Save
tua = self.descendentTnodeUaDictList
vua = self.descendentVnodeUaDictList
gnxDict = self.gnxDict
vnodesDict = self.vnodesDict
try:
    self.usingClipboard = True
    d = self.leojs_outline_dict(p or self.c.p)  # Checks for illegal ua's
    s = json.dumps(d, indent=2, cls=SetJSONEncoder)
finally:  # Restore
    self.descendentTnodeUaDictList = tua
    self.descendentVnodeUaDictList = vua
    self.gnxDict = gnxDict
    self.vnodesDict = vnodesDict
    self.usingClipboard = False

Command-line arguments and commands

  • Add check-uas command, with two aliases.
  • Add support for --trace=uas.

Commander methods

  • Add c.archive, c.unarchive, and c.validate_archive.
  • Remove c.recreateGnxDict. This method had no chance of being correct.
  • Add c.was_cloned_in_archive and c.recompute_all_parents.
  • Rewrite c.all_unique_nodes using v.alt_self_and_subtree.
  • Change c.all_nodes to c.all_unique_nodes everywhere, retaining all_nodes as an alias.
  • Add c.alt_all_positions and c.alt_unique_nodes.

Position methods

  • Add p.alt_self_and_subtree and p.alt_subtree.

VNode methods

  • Add v.alt_self_and_subtree and v.alt_self_and_parents.
  • Rewrite v.setAllAncestorAtFileNodesDirty using v.alt_self_and_parents.

leoGlobals classes and functions

  • Define SetJSONEncoder class in leoGlobals.py, not leoFileCommands.py.
  • Add g.dump_archive, g.dump_clone_info, g.dump_gnx,
  • Add g.archive_uas. It validates all uas. Switches in g.app.debug enable traces in this method.
  • Improve g.objToString and g.internalError`.

Testing

  • Improve various testing helpers in leoTest2.py.

@edreamleo edreamleo added this to the 6.7.5 milestone Jul 31, 2023
@edreamleo edreamleo marked this pull request as draft July 31, 2023 21:44
@edreamleo edreamleo mentioned this pull request Aug 7, 2023
@edreamleo edreamleo added the leoJS Issues & PRs that affect leoJS label Oct 23, 2023
@edreamleo edreamleo modified the milestones: 6.7.6, 6.7.7 Nov 7, 2023
@edreamleo edreamleo modified the milestones: 6.7.7, 6.7.8 Dec 31, 2023
@edreamleo edreamleo modified the milestones: 6.7.8, 6.7.9 Jan 13, 2024
@edreamleo edreamleo modified the milestones: 6.7.9, 6.7.10 Mar 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Code Re Leo's code FileFormat leoJS Issues & PRs that affect leoJS Waiting
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants