Ki-nTree icon indicating copy to clipboard operation
Ki-nTree copied to clipboard

AttributeError: 'Page' object has no attribute 'window'

Open martonmiklos opened this issue 1 year ago • 5 comments

I tried to run the current main branch and I got: kép

I am running KDE Neon (technically it is a 22.04 Ubuntu), all requirements were installed with pip -r Flet version is 0.22.1

Any advice would be recommended!

martonmiklos avatar Sep 26 '24 19:09 martonmiklos

Could you please add which version of Ki-nTree you are using and any output which is generated in the (python) console you are running Ki-nTree from?

T0jan avatar Sep 30 '24 14:09 T0jan

here is the command line output:

[INFO]  TEMPLATE "internal_part_number.yaml" configuration file contains the following keys which are NOT in your user settings: {'IPN_USE_MANUFACTURER_PART_NUMBER'}
[INFO]  TEMPLATE "general.yaml" configuration file contains the following keys which are NOT in your user settings: {'CHECK_EXISTING'}
[INFO]  TEMPLATE "supplier_parameters.yaml" configuration file contains the following keys which are NOT in your user settings: {'Passives', 'Base'}
[INFO]  TEMPLATE "suppliers.yaml" configuration file contains the following keys which are NOT in your user settings: {'Jameco', 'AutomationDirect'}
package:media_kit_libs_linux registered.
Unhandled error processing page session : Traceback (most recent call last):
  File "/home/mm/.local/lib/python3.10/site-packages/flet_runtime/app.py", line 242, in on_session_created
    await asyncio.get_running_loop().run_in_executor(
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/mm/Projektek/inventree2/Ki-nTree/kintree/gui/gui.py", line 46, in kintree_gui
    init_gui(page)
  File "/home/mm/Projektek/inventree2/Ki-nTree/kintree/gui/gui.py", line 29, in init_gui
    page.window.icon = os.path.join(settings.PROJECT_DIR, 'gui', 'logo.ico')
AttributeError: 'Page' object has no attribute 'window'

I am trying it with the code in the main branch. The 1.1.3 loads, however I needed to remove the .config/kintree folder as it failed with:

mm@P15:~/Projektek/inventree2/Ki-nTree$ python kintree_gui.py 
[INFO]  TEMPLATE "internal_part_number.yaml" configuration file contains the following keys which are NOT in your user settings: {'IPN_USE_MANUFACTURER_PART_NUMBER'}
[INFO]  TEMPLATE "general.yaml" configuration file contains the following keys which are NOT in your user settings: {'CHECK_EXISTING'}
[INFO]  TEMPLATE "supplier_parameters.yaml" configuration file contains the following keys which are NOT in your user settings: {'Base', 'Passives'}
[INFO]  TEMPLATE "suppliers.yaml" configuration file contains the following keys which are NOT in your user settings: {'AutomationDirect', 'Jameco'}
package:media_kit_libs_linux registered.
Unhandled error processing page session : Traceback (most recent call last):
  File "/home/mm/.local/lib/python3.10/site-packages/flet_runtime/app.py", line 242, in on_session_created
    await asyncio.get_running_loop().run_in_executor(
  File "/usr/lib/python3.10/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/home/mm/Projektek/inventree2/Ki-nTree/kintree/gui/gui.py", line 48, in kintree_gui
    inventree_settings_view = InvenTreeSettingsView(page)
  File "/home/mm/Projektek/inventree2/Ki-nTree/kintree/gui/views/settings.py", line 922, in __init__
    super().__init__(page)
  File "/home/mm/Projektek/inventree2/Ki-nTree/kintree/gui/views/settings.py", line 358, in __init__
    self.fields[field_name].value = self.settings[field_data[0]]
KeyError: 'IPN_USE_MANUFACTURER_PART_NUMBER'

I would like to do some developments so getting main working would be my goal.

martonmiklos avatar Sep 30 '24 20:09 martonmiklos

@martonmiklos Flet version is incorrect, how do you install Ki-nTree?

Flet version is now at 0.24.1: flet = "^0.24.1"

eeintech avatar Oct 01 '24 18:10 eeintech

@eeintech I installed the reqiurements with pip install -r requirements.txt

In the current main the Flet is set to: Flet>=0.22.0,<0.23.0 https://github.com/sparkmicro/Ki-nTree/blob/main/requirements.txt#L3C1-L3C21

Manually altering the requirements and installing Flet 0.24.1 get the thing working.

Many thanks for the quick support!

Shall I file a PR on the requirements.txt?

martonmiklos avatar Oct 01 '24 18:10 martonmiklos

@martonmiklos Good point, I will just keep this ticket opened until requirements.txt file is fixed, thanks!

eeintech avatar Oct 07 '24 17:10 eeintech