facultyai / faculty-sync

Synchronise a local directory with your Faculty platform workspace
https://pypi.org/project/faculty_sync/
Apache License 2.0
10 stars 1 forks source link

Show potential modifications in Differences screen #5

Closed pbugnion closed 6 years ago

pbugnion commented 6 years ago

Addresses issue #4 .

This aims to make the differences screen safer: we now give a clearer preview of what syncing up and down will actually do the file systems. By allowing scrolling of the list of files to be transferred, it gives the user a clearer idea of everything that's going to be transferred.

The new screen is now split into a menu, on the left-hand side, that allows choosing between Up, Down and Watch. Choosing Up or Down gives a list of all the changes that will be made to your local or SherlockML filesystem respectively. You can then take the action by pressing u or d. Choosing Watch gives you a help message about entering 'Watch' mode. You can then press w to actually start the continuous sync process.

To make testing easier, there is an alpha release corresponding to the current tip of this branch:

pip install https://github.com/ASIDataScience/sml-sync/archive/0.3.0-alpha2.zip --process-dependency-links

sml-sync-diff-demo

pbugnion commented 6 years ago

@janfreyberg This is ready for review, I think.

Because there's a lot of changes, I was thinking of encouraging Tom and other data scientists to try it out for a few days before merging.

janfreyberg commented 6 years ago

If I am in the main screen, select "Up", and am fully synchronised, and then press the right arrow, I get an exception:

Unhandled exception in event loop:
  File "/Users/janfreyberg/anaconda3/envs/smlsync/lib/python3.6/site-packages/prompt_toolkit/eventloop/posix.py", line 154, in _run_task
    t()
  File "/Users/janfreyberg/anaconda3/envs/smlsync/lib/python3.6/site-packages/prompt_toolkit/eventloop/context.py", line 115, in new_func
    return func(*a, **kw)
  File "/Users/janfreyberg/anaconda3/envs/smlsync/lib/python3.6/site-packages/prompt_toolkit/application/application.py", line 532, in read_from_input
    self.key_processor.process_keys()
  File "/Users/janfreyberg/anaconda3/envs/smlsync/lib/python3.6/site-packages/prompt_toolkit/key_binding/key_processor.py", line 272, in process_keys
    self._process_coroutine.send(key_press)
  File "/Users/janfreyberg/anaconda3/envs/smlsync/lib/python3.6/site-packages/prompt_toolkit/key_binding/key_processor.py", line 179, in _process
    self._call_handler(matches[-1], key_sequence=buffer[:])
  File "/Users/janfreyberg/anaconda3/envs/smlsync/lib/python3.6/site-packages/prompt_toolkit/key_binding/key_processor.py", line 321, in _call_handler
    handler.call(event)
  File "/Users/janfreyberg/anaconda3/envs/smlsync/lib/python3.6/site-packages/prompt_toolkit/key_binding/key_bindings.py", line 77, in call
    return self.handler(event)
  File "/Users/janfreyberg/anaconda3/envs/smlsync/lib/python3.6/site-packages/sml_sync/screens/diff.py", line 342, in _
    self._details.gain_focus(event.app)
  File "/Users/janfreyberg/anaconda3/envs/smlsync/lib/python3.6/site-packages/sml_sync/screens/diff.py", line 143, in gain_focus
    app.layout.focus(self._table)
  File "/Users/janfreyberg/anaconda3/envs/smlsync/lib/python3.6/site-packages/prompt_toolkit/layout/layout.py", line 110, in focus
    value = to_container(value)
  File "/Users/janfreyberg/anaconda3/envs/smlsync/lib/python3.6/site-packages/prompt_toolkit/layout/containers.py", line 2078, in to_container
    raise ValueError('Not a container object.')

Exception Not a container object.
Press ENTER to continue...

I can press enter, but can we avoid the exception?

pbugnion commented 6 years ago

Ah, good catch -- it was trying to switch focus to the table of actions, but there is no table in this case.

Now fixed:

pip install https://github.com/ASIDataScience/sml-sync/archive/0.3.0-alpha3.zip
pbugnion commented 6 years ago

Tom raised an issue around behaviour when the terminal is resized. It would be good, if we can, to avoid mangling the output.

pbugnion commented 6 years ago

Opened this issue with Python prompt toolkit to try and understand resize behaviour.

pbugnion commented 6 years ago

I think this is ready for another look.

It should now handle resizes correctly and, in the differences screen, u, d and w will now jump focus to the up, down and watch entry in the menu if that isn't what is currently selected.

pip install https://github.com/ASIDataScience/sml-sync/archive/0.3.0-alpha4.zip