-
-
Notifications
You must be signed in to change notification settings - Fork 98
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
[BUG] Pasting workspaces causes program to crash and pasted workspace to be removed #174
Comments
Hmm... Not sure If I'm replicating the same bug. Can you paste the error? Thanks! |
Hey, I did some more testing to figure out why replicating the bug wasn't working, I have updated my original comment to include everything necessary to replicate the bug, but I will also include the error. ╭──────────────────────────────────────────────────────────────────────── Traceback (most recent call last) ─────────────────────────────────────────────────────────────────────────╮
│ /Users/austingause/.pyenv/versions/3.12.0/lib/python3.12/site-packages/dooit/ui/screens/index.py:59 in on_key │
│ │
│ 56 │ │ event.stop() ╭───────────────────────────── locals ─────────────────────────────╮ │
│ 57 │ │ │ event = Key(key='k', character='k', name='k', is_printable=True) │ │
│ 58 │ │ key = self.resolve_key(event) │ key = 'k' │ │
│ ❱ 59 │ │ await self.send_keypress(key) │ self = MainScreen(name='main') │ │
│ 60 │ ╰──────────────────────────────────────────────────────────────────╯ │
│ 61 │ async def send_keypress(self, key: str): │
│ 62 │ │ if self.bar.status == "SEARCH": │
│ │
│ /Users/austingause/.pyenv/versions/3.12.0/lib/python3.12/site-packages/dooit/ui/screens/index.py:66 in send_keypress │
│ │
│ 63 │ │ │ return await self.query_one(Searcher).keypress(key) │
│ 64 │ │ │
│ 65 │ │ visible_focused = [i for i in self.query(".focus") if i.display][0] │
│ ❱ 66 │ │ await visible_focused.keypress(key) │
│ 67 │ │
│ 68 │ async def clear_right(self) -> None: │
│ 69 │ │ try: │
│ │
│ ╭──────────────────────────────────────── locals ─────────────────────────────────────────╮ │
│ │ key = 'k' │ │
│ │ self = MainScreen(name='main') │ │
│ │ visible_focused = WorkspaceTree(id='Tree-manager_4a33b675-3694-404b-9d37-975a8cdf3ea3') │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /Users/austingause/.pyenv/versions/3.12.0/lib/python3.12/site-packages/dooit/ui/widgets/tree.py:521 in keypress │
│ │
│ 518 │ │ if self.current and self.current._is_editing(): ╭─────────────────────────────────── locals ───────────────────────────────────╮ │
│ 519 │ │ │ return await self.current.keypress(key) │ key = 'k' │ │
│ 520 │ │ │ self = WorkspaceTree(id='Tree-manager_4a33b675-3694-404b-9d37-975a8cdf3ea3') │ │
│ ❱ 521 │ │ await super().keypress(key) ╰──────────────────────────────────────────────────────────────────────────────╯ │
│ 522 │
│ │
│ /Users/austingause/.pyenv/versions/3.12.0/lib/python3.12/site-packages/dooit/ui/widgets/base.py:42 in keypress │
│ │
│ 39 │ │ │ │ if bind.check_for_cursor and not self.is_cursor_available: │
│ 40 │ │ │ │ │ return │
│ 41 │ │ │ │ │
│ ❱ 42 │ │ │ │ res = await func(*bind.params) │
│ 43 │ │ │ │ if isinstance(res, Result) and res.message: │
│ 44 │ │ │ │ │ self.post_message(Notify(res.text())) │
│ 45 │
│ │
│ ╭────────────────────────────────────────────────── locals ───────────────────────────────────────────────────╮ │
│ │ bind = <dooit.utils.keybinder.Bind object at 0x106898800> │ │
│ │ func = <bound method Tree.move_up of WorkspaceTree(id='Tree-manager_4a33b675-3694-404b-9d37-975a8cdf3ea3')> │ │
│ │ key = 'k' │ │
│ │ self = WorkspaceTree(id='Tree-manager_4a33b675-3694-404b-9d37-975a8cdf3ea3') │ │
│ ╰─────────────────────────────────────────────────────────────────────────────────────────────────────────────╯ │
│ │
│ /Users/austingause/.pyenv/versions/3.12.0/lib/python3.12/site-packages/dooit/ui/widgets/tree.py:365 in move_up │
│ │
│ 362 │ │ │ self.current = node ╭─────────────────────────────────── locals ───────────────────────────────────╮ │
│ 363 │ │ self = WorkspaceTree(id='Tree-manager_4a33b675-3694-404b-9d37-975a8cdf3ea3') │ │
│ 364 │ async def move_up(self) -> None: ╰──────────────────────────────────────────────────────────────────────────────╯ │
│ ❱ 365 │ │ if node := self.prev_node(): │
│ 366 │ │ │ self.current = node │
│ 367 │ │
│ 368 │ async def move_to_top(self) -> None: │
│ │
│ /Users/austingause/.pyenv/versions/3.12.0/lib/python3.12/site-packages/dooit/ui/widgets/tree.py:248 in prev_node │
│ │
│ 245 │ │ if not self.current: │
│ 246 │ │ │ return │
│ 247 │ │ │
│ ❱ 248 │ │ idx = nodes.index(self.current) │
│ 249 │ │ if not idx: │
│ 250 │ │ │ return │
│ 251 │
│ │
│ ╭───────────────────────────────────── locals ──────────────────────────────────────╮ │
│ │ nodes = [ │ │
│ │ │ WorkspaceWidget( │ │
│ │ │ │ id='workspace_f079751c-ece2-4ab1-86d6-73833484eabf' │ │
│ │ │ ), │ │
│ │ │ WorkspaceWidget( │ │
│ │ │ │ id='workspace_93a44e4b-4a11-4bdd-9c75-0804106ee901' │ │
│ │ │ ), │ │
│ │ │ WorkspaceWidget( │ │
│ │ │ │ id='workspace_159155c6-019f-45bf-a01d-60f060dbe249' │ │
│ │ │ ), │ │
│ │ │ WorkspaceWidget( │ │
│ │ │ │ id='workspace_474c34d8-8aba-4a13-8384-bccb9fcf8fe5' │ │
│ │ │ ) │ │
│ │ ] │ │
│ │ self = WorkspaceTree(id='Tree-manager_4a33b675-3694-404b-9d37-975a8cdf3ea3') │ │
│ ╰───────────────────────────────────────────────────────────────────────────────────╯ │
╰────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────╯
ValueError: WorkspaceWidget(id='workspace_c43fcc53-d086-4c38-941a-154ef145e852') is not in list |
Thanks for the details! I think I may have found a fix but not sure since for some weird reason, I can't replicate the bug most of the time (It works sometimes) |
If I'm not mistaken, I used pip to install it both on my MacBook and my Linux desktop, and am also able to get the error to appear on both, with a roughly 70%~ rate of the bug appearing. It is certainly an interesting issue. |
Can you try pip installing using this: pip install git+https://github.com/kraanzu/dooit.git@develop and let me know if it fixes it. |
Yeah no problem, will give it a shot when I get a chance and update the thread when I am able to test it. |
Describe the bug 🐛
Upon copying and pasting workspaces, using the directional keys 'j' or 'k' causes the program to crash and the recently pasted workspace to be removed.
To Reproduce 🐣
Steps to reproduce the behavior:
-- START OF EDIT
-- END OF EDIT
Expected behavior 🤔
The workspace should be able to be pasted without the program crashing and the workspace being removed.
Screenshots 🧐
If applicable, add screenshots to help explain your problem.
Desktop (please complete the following information): 🤖
Additional context 📝
A "fix/bypass" I found was that, upon pasting the workspace, if you press 'tab' to enter the workspace, and press 'a' to create a task, followed by adding the description of the task, when you press 'tab' again to return to the workspace selection pane, upon using 'j' or 'k' the program will still crash, but the workspace will still be there with the newly added task.
The text was updated successfully, but these errors were encountered: