Conversation
src/views/collection.rs
Outdated
| // 1) Set up an in-memory database | ||
| let conn = Connection::open_in_memory().unwrap(); | ||
|
|
||
| // Minimal schema for the required tables, adapted from migrations |
There was a problem hiding this comment.
why not use the test harness for an in memory db?
There was a problem hiding this comment.
Are you referring to test_helpers.rs? I'm not familiar really with how to chain those together, but if get_connection() is sufficient to make Collection::create etc work robustly then I'll swap it in here.
There was a problem hiding this comment.
it is, we need to condense it, but put this at the top:
setup_gen_dir();
let conn = &mut get_connection(None);
let db_uuid = get_db_uuid(conn);
let operation_conn = &get_operation_connection(None);
setup_db(operation_conn, &db_uuid);
| let mut focus_zone = "canvas"; | ||
|
|
||
| // Create explorer and its state that persists across frames | ||
| let mut explorer = CollectionExplorer::new(conn, collection_name); |
There was a problem hiding this comment.
can you explain more why we need this other thing for state management?
There was a problem hiding this comment.
I consider the Explorer sidebar as its own widget that lives independently from the Viewer. That way, I don't force it on the operations UI, for example. I also need to keep the state on the listview third-party widget, so I refer to that state from inside of the explorer state.
src/views/block_group.rs
Outdated
| KeyCode::Esc => { | ||
| show_panel = false; | ||
| if key.modifiers == KeyModifiers::SHIFT { | ||
| // Shift+Tab - cycle backwards |
There was a problem hiding this comment.
we need some better focus thing to handle these. mine is also a bit of a mess.
There was a problem hiding this comment.
Yeah I saw the index based focus cycler you had in operations but it didn't fit well here. I actually made the sidebar permanent because of the focus cycling. Fyi: I didn't use ctrl+arrows because the window manager on macOS uses that.
| let sibling_candidates = Collection::query( | ||
| conn, | ||
| "SELECT * FROM collections | ||
| WHERE name GLOB ?1", |
There was a problem hiding this comment.
We're emulating file paths, so it seemed appropriate. (not a strong opinion though)
| state.list_state.selected = self.find_prev_selectable(state, current_idx); | ||
| } | ||
|
|
||
| pub fn handle_input(&self, state: &mut CollectionExplorerState, key: KeyEvent) { |
There was a problem hiding this comment.
why isn't this using the stateful widget vs. the custom state?
There was a problem hiding this comment.
I wanted to be able to skip the headers when scrolling down the sidebar, that's not a part of tui-widget-list currently.
No description provided.