Skip to content
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] can not open file from GUI #15

Open
clach04 opened this issue Mar 16, 2024 · 6 comments
Open

[BUG] can not open file from GUI #15

clach04 opened this issue Mar 16, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@clach04
Copy link
Contributor

clach04 commented Mar 16, 2024

Nyx Text Bug Report

Description

Similar to #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

  • OS: Windows 10

  • Nyx Text Version: ❗ this information is not available from the GUI - 3cfb7d7 see [BUG] can't open files from command line #14

  • Other relevant information:

    Python 3.12.1 (tags/v3.12.1:2305ca5, Dec 7 2023, 22:03:25) [MSC v.1937 64 bit (AMD64)] on win32

    • Pillow-10.2.0
    • chlorophyll-0.4.1
    • customtkinter-5.2.2
    • darkdetect-0.8.0
    • packaging-24.0
    • pygments-2.17.2
    • pyperclip-1.8.2
    • tklinenums-1.7.1
    • toml-0.10.2

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 clach04 added the bug Something isn't working label Mar 16, 2024
@clach04
Copy link
Contributor Author

clach04 commented Mar 16, 2024

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
Copy link
Owner

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
Copy link
Contributor

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

@clach04
Copy link
Contributor Author

clach04 commented Mar 17, 2024

This is not fixed for me. Still seeing the exact same problem as described in #15 (comment) 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 <[email protected]>
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
Copy link
Owner

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 parazeeknova reopened this Mar 17, 2024
@parazeeknova parazeeknova pinned this issue Mar 17, 2024
@parazeeknova
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants