Start Page Redesign

A forum for research and development of the user interface of FreeCAD

Moderator: agryson

RogerK
Posts: 27
Joined: Thu Oct 04, 2018 6:25 pm
Location: Elsau

Re: Start Page Redesign

Postby RogerK » Fri Jan 04, 2019 11:06 am

Hi looo
looo wrote:
Fri Jan 04, 2019 10:41 am
For debugging please post the output of:
This is the output:

Code: Select all

Python 3.6.6 | packaged by conda-forge | (default, Jul 26 2018, 11:48:23) [MSC v.1900 64 bit (AMD64)] on win32
Type 'help', 'copyright', 'credits' or 'license' for more information.
>>> 
>>> import FreeCAD as App
>>> print(App.getHomePath())
D:/FreeCAD_0.18.15521_Conda_Py3QT5-WinVS2015_x64/
>>> print(App.getResourceDir())
D:/FreeCAD_0.18.15521_Conda_Py3QT5-WinVS2015_x64/data/
>>> print(App.getUserAppDataDir())
C:\Users\Roger Kuster\AppData\Roaming\FreeCAD\

The Paths are looking correct, besides that two of them using backslash's instead of the slash's normaly used in Windows. I'm using the conda package downloaded from the Github Releases page. Normaly everything works fine only the startpage fails to get the path to python scripts. They are always searched in C: .

Is there anotherway to install FreeCAD conda build other than downloading the bundle from Github?


Kind regards

Roger
User avatar
hammax
Posts: 839
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee

Re: Start Page Redesign

Postby hammax » Fri Jan 04, 2019 11:30 am

… here is what I can find out:
The called py-macro is missing .

Start_Gallery_3.png
Start_Gallery_3.png (31.96 KiB) Viewed 569 times
Syres
Posts: 348
Joined: Thu Aug 09, 2018 11:14 am

Re: Start Page Redesign

Postby Syres » Fri Jan 04, 2019 11:46 am

@hammax, you accidently navigated to the incorrect path, note the 'data' folder should be between 'FreeCAD_0.18.15536_x86_dev_win' and 'Mod'. The file must be there as it's the one that's creating the error message.

@RogerK and @looo, I don't think the incorrect C: drive lookup is a widespread Windows issue as I've never had that error message when using Create New on the Py3Qt5 downloads.

Using:

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15518 (Git)
Build type: Release
Branch: master
Hash: e83c44200ab428b753a1e08a2e4d95e03236e481
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)

the Python Console output is as expected:

Code: Select all

Python 3.6.6 | packaged by conda-forge | (default, Jul 26 2018, 11:48:23) [MSC v.1900 64 bit (AMD64)] on win32
Type 'help', 'copyright', 'credits' or 'license' for more information.
>>> exec(open('E:/Data/My Downloads/FreeCAD_0.18.15518_Conda_Py3QT5-WinVS2015_x64/FreeCAD_0.18.15518_Conda_Py3QT5-WinVS2015_x64/data/Mod/Start/StartPage/LoadNew.py').read())
>>> App.setActiveDocument("Unnamed")
>>> App.ActiveDocument=App.getDocument("Unnamed")
>>> Gui.ActiveDocument=Gui.getDocument("Unnamed")
User avatar
hammax
Posts: 839
Joined: Thu Jan 19, 2017 5:03 pm
Location: Ammersee

Re: Start Page Redesign

Postby hammax » Fri Jan 04, 2019 12:16 pm

… OK I found the other StartPage folder and corrected the typo "urllib"
Now it works!!!
Thanks
User avatar
yorik
Site Admin
Posts: 11510
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Start Page Redesign

Postby yorik » Fri Jan 04, 2019 1:19 pm

regarding the C:/D: issue, there are apparently two issues:

1) the relative links in the HTML code, ex: <a href="LoadNew.py"> which expects to find the LoadNew.py script at the same place of the host HTML file. Of course, here, that HTML page doesn't exist physically, it is created at runtime by FreeCAD. But FreeCAD sets a "fake" page location like this when starting the start page:

Code: Select all

self.browser.setHtml(StartPage.handle(), App.getResourceDir() + 'Mod/Start/StartPage/')
So for who has the problem, it would be interesting to know what App.getResourceDir() + 'Mod/Start/StartPage/' says, and verify if the other scripts (LoadNew.py, LoadMRU.py, etc..) are found at that location.

If everything is correct, maybe we need to use an absolute path instead of a relative...

2) The icons that don't appear are all created by python's tempfile.mkstemp() function. We can test where it creates its temp files foe example by doing this:

Code: Select all

import tempfile
dummyfile = tempfile.mkstemp(dir=tempfolder,suffix='.png')
print(dummyfile)
Syres
Posts: 348
Joined: Thu Aug 09, 2018 11:14 am

Re: Start Page Redesign

Postby Syres » Fri Jan 04, 2019 2:34 pm

With regard to 2) Icons location, I just added the lines to both my Py2Qt3 and Py3Qt5 (both build 018.15536) recent files section only as I've only two icons to detect, here are the results:

OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15536 (Git)
Build type: Release
Branch: master
Hash: 98ebeaa198df945ba666c15912c6caf95920f0ef
Python version: 2.7.14
Qt version: 4.8.7
Coin version: 4.0.0a
OCC version: 7.2.0
Locale: English/UnitedKingdom (en_GB)

Code: Select all

c:\users\jps\appdata\local\temp\FreeCADStartThumbnailsjdtbzn\tmpyvkcrz.png
c:\users\jps\appdata\local\temp\FreeCADStartThumbnailsjdtbzn\tmprnpazl.png
OS: Windows 7
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.18.15536 (Git)
Build type: Release
Branch: master
Hash: 98ebeaa198df945ba666c15912c6caf95920f0ef
Python version: 3.6.6
Qt version: 5.6.2
Coin version: 4.0.0a
OCC version: 7.3.0
Locale: English/UnitedKingdom (en_GB)

Code: Select all

C:\Users\JPS\AppData\Local\Temp\FreeCADStartThumbnailsrka8fvky\tmpkpiqttp8.png
C:\Users\JPS\AppData\Local\Temp\FreeCADStartThumbnailsrka8fvky\tmpv0rfke0e.png
Assumption: The case of the folder names isn't an issue.
I've looked in both folders and there's the same number of files (31 including my Examples folder) in each and the correct icons appear in each folder, so it looks as though the saving icons side of things is OK.
RogerK
Posts: 27
Joined: Thu Oct 04, 2018 6:25 pm
Location: Elsau

Re: Start Page Redesign

Postby RogerK » Fri Jan 04, 2019 3:58 pm

yorik wrote:
Fri Jan 04, 2019 1:19 pm
1) ...
So for who has the problem, it would be interesting to know what App.getResourceDir() + 'Mod/Start/StartPage/' says, and verify if the other scripts (LoadNew.py, LoadMRU.py, etc..) are found at that location.

If everything is correct, maybe we need to use an absolute path instead of a relative...
This is the output:

Code: Select all

App.getResourceDir() + 'Mod/Start/StartPage/'
'D:/FreeCAD_0.18.15536_Conda_Py3QT5-WinVS2015_x64/data/Mod/Start/StartPage/'
When Browsing to this directory the modules are all in place.

Now Syres inspired me a bit. I placed the conda package into the subfolder "D:\My FreeCAD". Can you guess now what happend? Yes it works!
If there is a space in the path the libraries are found, even in another than the C drive. If there isn't a space, the libraries are always searched on the C drive.

@Syres: Can you verify this if you place the conda package in a path without a space, if you then get the error that the phyton scripts cannot be found in C drive?


Yorik, to your second Question:
yorik wrote:
Fri Jan 04, 2019 1:19 pm
2) The icons that don't appear are all created by python's tempfile.mkstemp() function. We can test where it creates its temp files foe example by doing this:

Code: Select all

import tempfile
dummyfile = tempfile.mkstemp(dir=tempfolder,suffix='.png')
print(dummyfile)
The file is created:

Code: Select all

import tempfile
dummyfile = tempfile.mkstemp(dir='C:\\Users\\Roger Kuster\\AppData\\Local\\Temp',suffix='.png')
print(dummyfile)
(11, 'C:\\Users\\Roger Kuster\\AppData\\Local\\Temp\\tmp6juwflyv.png')
I have also checked the temp folder. There are subfolders called FreeCADStartThumbnails... which contains the thumbnails that should be displayed on the start page. They are created at the first time the start page is displayed and displayed correctly in an imageviewer, so they aren't corrupt.
FreeCAD_Thumbnails_temp_folder.PNG
FreeCAD_Thumbnails_temp_folder.PNG (43.66 KiB) Viewed 533 times

During testing I struggeled with the encoding of the temp string. Normally coded with windows standard syntax I got always an error that
the '\' couldn't be encoded, so I had to use the escape char ('\\'):

Code: Select all

dummyfile = tempfile.mkstemp(dir='C:\Users\Roger Kuster\AppData\Local\Temp',suffix='.png')
  File "<input>", line 1
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape
Could the thumbnail access code be failing because of this? When I use the normal build (PY2/QT4) the thumbnails are displayed.


Roger
Syres
Posts: 348
Joined: Thu Aug 09, 2018 11:14 am

Re: Start Page Redesign

Postby Syres » Fri Jan 04, 2019 4:50 pm

@RogerK, unfortunately I cannot reproduce the fault when moving the conda package to either E:\Data or C:\TestFC, it all still works as expected, sorry.
RogerK
Posts: 27
Joined: Thu Oct 04, 2018 6:25 pm
Location: Elsau

Re: Start Page Redesign

Postby RogerK » Fri Jan 04, 2019 7:37 pm

Hi all

Thanks @Syres. I know now what causes the problem, although it's not clear for me why this happend. I created a link on my desktop to launch FreeCAD 0.18 Dev Package. For easely updating I have removed the Entry in the property "Ausführen in"/ "Run In", so I have just to change the Path in the target field.
FreeCAD_Shortcut_Execute.PNG
FreeCAD_Shortcut_Execute.PNG (76.83 KiB) Viewed 508 times

When "Run in" is blank the scripts are searched in the C drive. If I enter the Path to the binary as in the example above, then there is no Problem.

When I check the working directory of the Process in Powershell, then this is set correctly to the binary path:

Code: Select all

Please provide a PID number to get its ExecutablePath : 11568
ExecutablePath ==> "D:\FreeCAD_0.18.15536_Conda_Py3QT5-WinVS2015_x64\bin\FreeCAD.exe"
Current Working Directory ==> "D:\FreeCAD_0.18.15536_Conda_Py3QT5-WinVS2015_x64\bin\"

It's a strange behavier, I suspect that originally FreeCAD is execute somewhere in the C drive, maybe the user temp directory and then changes to the Path of the executable. But somewhere the original execution path is ghosting around and make the lookup of the scripts failing.

But "Run in" parameter doesn't affect the imags on the startpage, they are still not displayed with the conda image.


Kind regards

Roger
Syres
Posts: 348
Joined: Thu Aug 09, 2018 11:14 am

Re: Start Page Redesign

Postby Syres » Sat Jan 12, 2019 11:52 am

@yorik please see https://forum.freecadweb.org/viewtopic. ... 94#p279594 , it's not a clean method for getting the icons working on the Start Page. I'll see if I can find appropriate hardware to do a vanilla install of Windows 7 and I have access to a Windows 10 box of a family member to generate a repeatable fix of registry keys.
yorik wrote:
Fri Jan 04, 2019 1:19 pm