TkTerminal icon indicating copy to clipboard operation
TkTerminal copied to clipboard

Bug fix & Improve

Open littlewhitecloud opened this issue 2 years ago • 29 comments

@Moosems This pr is yours now~ I am buckle up :D choose some issues you'd like to fix. (Maybe I will also fix some)

Todo list:

fix #43 fix #35 fix #36 fix #19 fix #27 fix #48 fix #49

Improve

  • [x] #35
  • [ ] #27
  • [ ] #43

Bugfix

  • [ ] #36
  • [ ] #19
  • [x] #48
  • [x] #49
  • [x] #51
  • [x] #52

Test

  • [ ] #19
  • [ ] #22

littlewhitecloud avatar Jun 30 '23 07:06 littlewhitecloud

I'll work on it sometime tomorrow, please don't touch it in the meantime so I can figure out how to do some of these :).

Moosems avatar Jun 30 '23 11:06 Moosems

I'll work on it sometime tomorrow, please don't touch it in the meantime so I can figure out how to do some of these :).

LOL during this period, I will work on my new project: TranslucentTB (Yes a python version TranslucentTB) https://github.com/littlewhitecloud/TranslucentTB/

littlewhitecloud avatar Jun 30 '23 13:06 littlewhitecloud

LOL, its almost a week, do you find out something wrong? @Moosems

littlewhitecloud avatar Jul 06 '23 00:07 littlewhitecloud

LOL, my life has been so freaking crazy 🤣. I had so many plans for this summer and a grand total of 0 are completed.

Moosems avatar Jul 06 '23 00:07 Moosems

@Moosems Will you still work on the pull request?

littlewhitecloud avatar Jul 15 '23 09:07 littlewhitecloud

Traceback (most recent call last):
  File "/Users/Moosems/Desktop/TkTerminal/test.py", line 1, in <module>
    from tktermwidget import Terminal
  File "/Users/Moosems/Desktop/TkTerminal/tktermwidget/__init__.py", line 7, in <module>
    from .style import *  # noqa: F401, F403
    ^^^^^^^^^^^^^^^^^^^^
  File "/Users/Moosems/Desktop/TkTerminal/tktermwidget/style.py", line 271, in <module>
    CUSTOM: dict[str] = load_style()
                        ^^^^^^^^^^^^
  File "/Users/Moosems/Desktop/TkTerminal/tktermwidget/style.py", line 72, in load_style
    with open(JSON_FILE, "r", encoding="utf-8") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/Moosems/Library/Caches/tktermwidget/styles.json'

Moosems avatar Jul 15 '23 16:07 Moosems

Traceback (most recent call last):
  File "/Users/Moosems/Desktop/TkTerminal/test.py", line 1, in <module>
    from tktermwidget import Terminal
  File "/Users/Moosems/Desktop/TkTerminal/tktermwidget/__init__.py", line 7, in <module>
    from .style import *  # noqa: F401, F403
    ^^^^^^^^^^^^^^^^^^^^
  File "/Users/Moosems/Desktop/TkTerminal/tktermwidget/style.py", line 271, in <module>
    CUSTOM: dict[str] = load_style()
                        ^^^^^^^^^^^^
  File "/Users/Moosems/Desktop/TkTerminal/tktermwidget/style.py", line 72, in load_style
    with open(JSON_FILE, "r", encoding="utf-8") as f:
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: '/Users/Moosems/Library/Caches/tktermwidget/styles.json'

Sorry. I forget isort will move them in front of the checks.

littlewhitecloud avatar Jul 16 '23 02:07 littlewhitecloud

@Moosems Could you try to fix #43? I still don’t know how to fix.

littlewhitecloud avatar Jul 17 '23 01:07 littlewhitecloud

I'll give it a shot sometime soon.

Moosems avatar Jul 17 '23 02:07 Moosems

I'll give it a shot sometime soon.

Okay

littlewhitecloud avatar Jul 17 '23 02:07 littlewhitecloud

After I test #22, it doesn't freeze after input a bunch. (On Windows) result image args image https://github.com/littlewhitecloud/TkTerminal/issues/22#issuecomment-1603696271 Or can you ask someone who you know to test it on another platform? @Moosems

littlewhitecloud avatar Jul 17 '23 02:07 littlewhitecloud

LOL, @Moosems are you still on the car?

littlewhitecloud avatar Jul 18 '23 11:07 littlewhitecloud

Been traveling all month :). Two more weeks.

Moosems avatar Jul 18 '23 12:07 Moosems

Been traveling all month :). Two more weeks.

Sounds great!

littlewhitecloud avatar Jul 18 '23 12:07 littlewhitecloud

How's that other project of yours going?

Moosems avatar Jul 18 '23 14:07 Moosems

How's that other project of yours going?

Which project? ā€œCustomTkinterTitlebarā€ or ā€œTranslucenttbā€?

littlewhitecloud avatar Jul 18 '23 22:07 littlewhitecloud

The newest one :).

Moosems avatar Jul 18 '23 23:07 Moosems

The newest one :).

@Moosems You mean Translucenttb? Oh, I think it is almost finished. But still has some issues to fix. image image image image I also make something fun based on it:

https://github.com/littlewhitecloud/TkTerminal/assets/71159641/578f0b38-2a2e-400c-bb69-1df19e22f544

(LOL, just for fun)

littlewhitecloud avatar Jul 19 '23 00:07 littlewhitecloud

@Moosems I find out that why the program freeze. Maybe we can use threading (I am not good at it lol, but I will try to learn it)~

littlewhitecloud avatar Jul 20 '23 01:07 littlewhitecloud

Use an event_generate for "threads" as tkinter isn't thread safe.

Moosems avatar Jul 20 '23 01:07 Moosems

Use an event_generate for "threads" as tkinter isn't thread safe.

Can you give an example to show how to use event_generate()?

littlewhitecloud avatar Jul 20 '23 01:07 littlewhitecloud

It seems that tkinter is thread safe now...? (In the new version) I also find a closed issues talks about tkinter thread safe: https://github.com/python/cpython/issues/55286

littlewhitecloud avatar Jul 20 '23 01:07 littlewhitecloud

Can you give an example to show how to use event_generate()?

from tkinter import Tk, Button

root = Tk()

def threaded(_) -> None:
    print("Running in tandem with the main process")

root.bind("<<Thread>>", threaded)

Button(root, text="Thread", command=lambda: root.event_generate("<<Thread>>"))

root.mainloop()

Moosems avatar Jul 20 '23 04:07 Moosems

It seems that tkinter is thread safe now...? (In the new version)

I also find a closed issues talks about tkinter thread safe:

https://github.com/python/cpython/issues/55286

Read through it, it's not ;).

"all Tkinter access must be from the main thread (or more precisely, from the thread that calls the mainloop). Violating this is likely to cause nasty and mysterious symptoms such as freezes and core dumps."

Moosems avatar Jul 20 '23 04:07 Moosems

https://github.com/billyeatcookies/Biscuit/blob/main/biscuit/core/components/views/panel/terminal/terminal.py

Moosems avatar Jul 21 '23 20:07 Moosems

Biscuit does it anyway though :).

Moosems avatar Jul 21 '23 20:07 Moosems

https://github.com/billyeatcookies/Biscuit/blob/main/biscuit/core/components/views/panel/terminal/terminal.py

I actually looked at this document as well, and I was thinking what is superfluous with ours

littlewhitecloud avatar Jul 22 '23 00:07 littlewhitecloud

I might just "copy" parts ;).

Moosems avatar Jul 22 '23 00:07 Moosems

Bruh, It seems that I almost forget there is a pr.

littlewhitecloud avatar Oct 20 '23 12:10 littlewhitecloud