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

Windows compatibility (WAS: 0.20.2 Support) #16

Open
offbyfour opened this issue Mar 5, 2023 · 11 comments
Open

Windows compatibility (WAS: 0.20.2 Support) #16

offbyfour opened this issue Mar 5, 2023 · 11 comments

Comments

@offbyfour
Copy link

Hello, is this addon supported on 0.20.2? I have installed it, but I cant seem to find the searchbar anywhere.

@pstarkebaum
Copy link

I can' find it with 0.20.1. Installed it by git clone, and with addon manager.

@SuzanneSoy
Copy link
Owner

Downloading the latest release now, I'll have a look. @paulstarkebaum @offbyfour pretty please ping me in a couple of days if I don't get back to you, I tend to get distracted easily.

@SuzanneSoy
Copy link
Owner

Okay that was easy, seems like in 20.x the package.xml is taken into account and forces the code to be in a subfolder.

This fix has broken compatibility with 19.x unfortunately 🤷‍♀️, not sure how to have a version that works on both. Closing for now.

@SuzanneSoy
Copy link
Owner

SuzanneSoy commented Apr 12, 2023

Compatibility issue fixed (had to move everything in a subfolder, now works with 0.20.x and using a bunch of symlinks we have an approximate compatibility with 19.x, happy to make it work with both properly if there's a nicer workaround).

Edit: merged #14 which was the correct fix and the PR was right under my nose all the time…

@pstarkebaum
Copy link

There it is! Thank you so much!

@offbyfour
Copy link
Author

Ooo yes the update worked and I can see it now. However I'm getting an error saying the cache file cannot be found:

16:02:49 File "C:\Users\offbyfour\AppData\Roaming\FreeCAD\Mod\SearchBar.\RefreshTools.py", line 53, in readCacheTools
16:02:49 with open(cachePath(), 'r') as cache:
16:02:49 FileNotFoundError: [Errno 2] No such file or directory: 'C:\Users\offbyfour\AppData\Roaming\FreeCAD\Cache_SearchBarMod'
16:02:49

@SuzanneSoy
Copy link
Owner

@offbyfour I can't reproduce, even if I remove that file. That function is only called in one place, wrapped in a try/except to initialize the cache if it can't read it.

  1. Does the directory C:\Users\offbyfour\AppData\Roaming\FreeCAD\ exist? I haven't tested this on Windows, might be a path problem
  2. Are you sure you copied the error message correctly? The . on the first line of the error SearchBar.\RefreshTools.py seems really odd.
  3. Can you send a screenshot with the Python console opened?

Thanks a lot for helping me debug this.

@SuzanneSoy SuzanneSoy reopened this May 6, 2023
@SuzanneSoy SuzanneSoy changed the title 0.20.2 Support Can't open cache [Windows] (WAS: 0.20.2 Support) May 6, 2023
@offbyfour
Copy link
Author

offbyfour commented May 10, 2023

I think the file path did exist but there was no file "Cache_SearchBarMod" in it (I did accidentally take out a slash). I dug through the code and it looks like the cache file was not being written because the lxml library was not found on my pc.

I had to fight it a little bit but entering this into the python console (windows specific) fixed my issue:

'''
import os

pipModule = "lxml"

pip_cmd = 'python'
try:
out = os.popen(pip_cmd + ' -m pip install --upgrade '+pipModule,'r')
except:
FreeCAD.Console.PrintWarning("Something went wrong with the PC pip install/upgrade of "+pipModule+"\n")
'''

@offbyfour
Copy link
Author

offbyfour commented May 10, 2023

Ok, now I'm running into another issue, it seems that its loading the data from the workbench but the selection dont seem to work. Every time I click an item it takes me to the top of the search bar and nothing else happens. I tried searching for cylinder but nothing comes up.Also I think the icons are not being pulled in (see picture).

image

SuzanneSoy added a commit that referenced this issue Jun 1, 2023
@SuzanneSoy
Copy link
Owner

Thanks a lot for taking the time to help debug this, @offbyfour ! Sorry about the late reply, I've been unwell lately.

In a6668a6 I've added lxml as a dependency (since we can now have Python dependencies in FreeCAD 20.x), and I added a try/except so that if it can't load lxml then it just ignores that section of the search bar. In commit 0371610 I added a couple of debug messages. Now when you click on a toolbar/tool popup/tool/document/object/parameter group/parameter in the search results, it should print one of these:

switch to document…
select object …
Refresh list of tools
Popup submenu of tool … available in workbenches …
Run action of tool … available in workbenches …
Activating workbench … to access tool …
show toolbar … from workbenches …
Open Parameter Editor (parameter group)
Open Parameter Editor (single parameter)

The screenshot looks okay, the part of the results you are showing lists FreeCAD parameters, they don't have an icon (they're just the parameters you can see in |FC Menu BarToolsParameter Editor`) so the hammer and wrench icon is used for them. At the top of the results, you should have one entry "Refresh list of tools" which loads all the toolbars and icons etc. into the cache, and it should be followed by these toolbars. This is what it should look like:

20230601_21h55m12s_grim

@SuzanneSoy SuzanneSoy changed the title Can't open cache [Windows] (WAS: 0.20.2 Support) Windows compatibility (WAS: 0.20.2 Support) Jun 1, 2023
@offbyfour
Copy link
Author

Ah no worries, thanks for looking into this.

When I open up freecad, I get the drop down however there is very little in the console window. Clicking on the items does not seem to trigger any extra debug output:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants