parazeeknova / nyxtext

an AI-powered tool (soon!) that provides a feature-rich text editor for developers, students, and creatives alike, eliminating the need for them to use any other app for text-related tasks.
https://harshsahu-portfolio.vercel.app/pages/project
MIT License
64 stars 4 forks source link

[BUG] can not open file from GUI #15

Open clach04 opened 5 months ago

clach04 commented 5 months ago

Nyx Text Bug Report

Description

Similar to https://github.com/parazeeknova/nyxtext/issues/14 but with errors.

Attempting to open a file from the GUI results in errors:

  1. window appears then hidden behind main window
  2. stack trace

    (py3venv) C:\code\py\nyxtext>python editor/scripts/main.py Exception in Tkinter callback Traceback (most recent call last): File "C:\Pythons\Python312\Lib\tkinter__init.py", line 1962, in call return self.func(*args) ^^^^^^^^^^^^^^^^ File "C:\code\py\nyxtext\py3venv\Lib\site-packages\customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked self._command() File "C:\code\py\nyxtext\editor\scripts\framework\welcome_Screen.py", line 55, in welcome_open_button = customtkinter.CTkButton(self.welcome_tab,text=" Open file... ", command=lambda: open_window(self.welcome_tab), ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\code\py\nyxtext\editor\scripts\framework\welcome_Screen.py", line 54, in open_window open = openfile_window(master) ^^^^^^^^^^^^^^^^^^^^^^^ File "C:\code\py\nyxtext\editor\scripts\framework\open_file.py", line 12, in init self.wm_attributes('-type', 'splash') File "C:\Pythons\Python312\Lib\tkinter\init__.py", line 2046, in wm_attributes return self.tk.call(args) ^^^^^^^^^^^^^^^^^^ _tkinter.TclError: bad attribute "-type": must be -alpha, -transparentcolor, -disabled, -fullscreen, -toolwindow, or -topmost

Steps to Reproduce

  1. start editor
  2. Click "open file"

Expected Behavior

No crash and from code scan file chooser dialog

Actual Behavior

See above

Screenshots

[If applicable, add screenshots to help explain the problem. You can drag and drop images here.]

Environment

Additional Context

[Add any other context about the problem here. For example, any recent changes made to the project, or any workaround attempted.]

Possible Solution

[If you have any ideas on how to fix the bug, or where the problem might be located, please provide them here.]

Related Issues

[If there are any related issues or pull requests, please link them here.]

Your GitHub Username

[Please provide your GitHub username if you would like to be notified about updates or if further clarification is needed.]

Labels

[Choose appropriate labels to categorize the bug report, such as "bug", "needs investigation", etc.]

clach04 commented 5 months ago

Modifying to:

self.wm_attributes('-topmost', 'true')

Gets past this error but then fails to load.

    (py3venv) C:\code\py\nyxtext>python  editor/scripts/main.py
    Exception in Tkinter callback
    Traceback (most recent call last):
      File "C:\Pythons\Python312\Lib\tkinter\__init__.py", line 1962, in __call__
        return self.func(*args)
               ^^^^^^^^^^^^^^^^
      File "C:\code\py\nyxtext\py3venv\Lib\site-packages\customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked
        self._command()
      File "C:\code\py\nyxtext\editor\scripts\framework\open_file.py", line 56, in open_file
        self.text_Area.text_area.delete(1.0, tk.END)  # Clear the text area
        ^^^^^^^^^^^^^^
    AttributeError: 'openfile_window' object has no attribute 'text_Area'
parazeeknova commented 5 months ago

Hmm , yeh seems like the attributes we are using for new_file.py and open_file.py on the welcome tab are linux specific. I guess @noviciusss will be fixing the same and adding a exception handling or if/else for the attributes for the window which is creating the issue, ALSO, any function to open file in the workspace and codespace do not work after the recent change in file structure so will implement the correct functionality to open file in few days...

noviciusss commented 5 months ago

Fixed bug as i was using Linux so it was compatible with mine but corrected it to work for both

clach04 commented 5 months ago

This is not fixed for me. Still seeing the exact same problem as described in https://github.com/parazeeknova/nyxtext/issues/15#issuecomment-2002112198 which is why I did not open a PR with the fix I previously identifed.

@noviciusss If this is working for you can you explain how to open the file as maybe I'm doing something wrong?

With the current code:

commit c224811da6732189d05912312379366eaedcbbaa (HEAD -> main, origin/main, origin/HEAD)
Author: Samarth Pratap Singh <samarthsin2006@gmail.com>
Date:   Sun Mar 17 18:46:34 2024 +0530

    fixed bug

After clicking Open file on the main window, the pop-up window actually pops-under and is hidden, have to bring it to front. Once at front and use the "Open ..." button get a file chooser, which then crashes with the same stack trace (only difference is the moved line numbers):

(py3venv) C:\code\py\nyxtext_clach04>python  editor/scripts/main.py
Exception in Tkinter callback
Traceback (most recent call last):
  File "C:\Pythons\Python312\Lib\tkinter\__init__.py", line 1962, in __call__
    return self.func(*args)
           ^^^^^^^^^^^^^^^^
  File "C:\code\py\nyxtext\py3venv\Lib\site-packages\customtkinter\windows\widgets\ctk_button.py", line 554, in _clicked
    self._command()
  File "C:\code\py\nyxtext_clach04\editor\scripts\framework\open_file.py", line 59, in open_file
    self.text_Area.text_area.delete(1.0, tk.END)  # Clear the text area
    ^^^^^^^^^^^^^^
AttributeError: 'openfile_window' object has no attribute 'text_Area'

None of the other clickables in the front window seem to do anything.

Anything else you need from me for this bug report?

parazeeknova commented 5 months ago

Currently the functionality behind any buttons do not work after the rebase, we are currently in process of changing the pervious code that is why your are getting this error,

AttributeError: 'openfile_window' object has no attribute 'text_Area'

As we need to implement code such that the file opens the text into the tab in which the user is currently working, I'll be coding this today so wait for commits that fixes this.

And btw, is nyxtext running on your device and showing the welcome screen ?

parazeeknova commented 5 months ago

Currently the functionality behind any buttons do not work after the rebase, we are currently in process of changing the pervious code that is why your are getting this error,

AttributeError: 'openfile_window' object has no attribute 'text_Area'

As we need to implement code such that the file opens the text into the tab in which the user is currently working, I'll be coding this today so wait for commits that fixes this.

And btw, is nyxtext running on your device and showing the welcome screen ?

Can't implement open file today, will see tomorrow