can-lehmann / owlkettle

A declarative user interface framework based on GTK 4
https://can-lehmann.github.io/owlkettle/README
MIT License
367 stars 14 forks source link

Error: undeclared identifier: 'DropDown' #71

Closed dlesnoff closed 9 months ago

dlesnoff commented 9 months ago

I tried to run the drop down example in the widgets directory.

I got an undeclared identifier error. /home/kolmogorov/Documents/dev/owlkettle/examples/widgets/drop_down.nim(49, 20) Error: undeclared identifier: 'DropDown' candidates (edit distance, scope distance); see '--spellSuggest': (1, 7): 'drop_down'

Has the widget been removed? I have tried to rename the module to drop_down_example.nim to avoid any conflict and I got the same error!

can-lehmann commented 9 months ago

I am currently unable to reproduce this error. Are you sure that you are using a current (= development) version of owlkettle? What is the nim and owlkettle version you use?

The DropDown widget still exists https://github.com/can-lehmann/owlkettle/blob/main/owlkettle/widgets.nim#L2467 and the example should compile.

dlesnoff commented 9 months ago
$nimble list -i --ver
owlkettle  [(version: 2.2.0, checksum: 8320a06fe96fe44d623c970b6420ec485d1aa990)]
$nim
Nim Compiler Version 1.9.3 [Linux: amd64]
Compiled at 2023-06-10
Copyright (c) 2006-2023 by Andreas Rumpf

I apparently forgot to update to the release of Nim 2.0. I update and check if it works.

dlesnoff commented 9 months ago

I updated and it still provides the same error. The source code comes from the git version, main branch, and is at latest commit.

$git show-branch
[main] Fix Switch.state field

I use Xfwm4 (Xfce's WM) but that should not intervene in the compilation, am I right?

can-lehmann commented 9 months ago

Could you try uninstalling and reinstalling owlkettle using nimble install owlkettle@#head? Do any of the other examples work? (e.g. counter.nim)

Your window manager should not affect the compilation process.

dlesnoff commented 9 months ago

I uninstalled and reinstalled using nimble install owlkettle@#head.

I removed the owlkettle directory and re-download it from the git. None of the examples counter.nim nor drop_down work.

counter.nim: /home/kolmogorov/.nimble/pkgs/owlkettle-2.1.0/owlkettle/widgets.nim(598, 59) Warning: 'Lock levels' are deprecated, now a noop [Deprecated] /home/kolmogorov/.nimble/pkgs/owlkettle-2.1.0/owlkettle/widgets.nim(796, 62) Warning: 'Lock levels' are deprecated, now a noop [Deprecated] /home/kolmogorov/.nimble/pkgs/owlkettle-2.1.0/owlkettle/widgets.nim(797, 68) Warning: 'Lock levels' are deprecated, now a noop [Deprecated] /home/kolmogorov/.nimble/pkgs/owlkettle-2.1.0/owlkettle/widgets.nim(798, 68) Warning: 'Lock levels' are deprecated, now a noop [Deprecated] /home/kolmogorov/.nimble/pkgs/owlkettle-2.1.0/owlkettle/widgets.nim(1495, 6) Warning: A custom '=destroy' hook which takes a 'var T' parameter is deprecated; it should take a 'T' parameter [Deprecated] ... /home/kolmogorov/Documents/dev/owlkettle/examples/counter.nim(29, 12) template/generic instantiation of gui from here /home/kolmogorov/Documents/dev/owlkettle/examples/counter.nim(41, 19) Error: type mismatch: got 'array[0..0, ButtonStyle]' for '[ButtonSuggested]' but expected 'set[ButtonStyle]'

dlesnoff commented 9 months ago

counter.nim is easily fixed, I just had to replace the [] by {}.

can-lehmann commented 9 months ago

It seems like nimble is somehow not installing the correct version. The error that occurs in counter.nim is quite typical for using an older version (<= 2.2.0) of owlkettle (see https://github.com/can-lehmann/owlkettle/issues/52). We changed the syntax for the style field since.

dlesnoff commented 9 months ago

Indeed. I asked in the #nimble Discord/Matrix channel and I have done the following: – remove the package in .nimble/pkgs and/or .nimble/pkgs2 – remove the nim cache. for me its at ~/.cache/nim I restored [] in counter.nim, recompiled, it works. I installed libadwaita-1 for drop_down.nim, it works too. Thanks!