Start Page Redesign

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

Moderator: agryson

User avatar
openfablab
Posts: 20
Joined: Wed Nov 02, 2016 4:42 pm

Re: Start Page Redesign

Postby openfablab » Tue May 07, 2019 9:09 pm

Hello!

New start page is great and it inspired me to experiment there with an issue tracker (simplified kind of PLM).

But I did not found how to update HTML content of start page programmatically. Can it be done at all?

tracker.png
tracker.png (25.55 KiB) Viewed 179 times
User avatar
yorik
Site Admin
Posts: 11263
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Start Page Redesign

Postby yorik » Wed May 08, 2019 2:06 pm

Yes and no...

Basically it works like this: When the Start workbench starts, a web view is automatically created, and then the StartPage.handle() function is called to produce the html code that is inserted in the webview (all happens in Start/Gui/Workbench.cpp, line78 onwards).

After this is done, the reference to the created webview is lost so there is no way to fill it with the contents of StartPage.handle() again.

There are several ways to work around this. One, which I think is the best way, would be to work only with HTML/JS, inside the existing page. That is, with javascript you are able to alter contents of the html page, basically replace the contents of a <div> element with javascript's innerHtml function. You can add timers inside javascript, or have buttons trigger a reload, etc.

If you absolutely need to reload the whole start page, then the best way is probably replace Start/Gui/Workbench.cpp line 105, instead of webView=..., make it something like FreeCADGui.webView =... So after the start WB is started, you can do something like this:

FreeCADGui.webView.webPage.browser.setHtml(StartPage.handle())

But it's less elegant and more complicated. I would try the JS way. Have a look at the StartPage.js, it has several functions that update the contents of divs to use as examples...
User avatar
Kunda1
Posts: 4581
Joined: Thu Jan 05, 2017 9:03 pm

Re: Start Page Redesign

Postby Kunda1 » Wed May 08, 2019 4:13 pm

#documentation
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
User avatar
yorik
Site Admin
Posts: 11263
Joined: Tue Feb 17, 2009 9:16 pm
Location: São Paulo, Brazil
Contact:

Re: Start Page Redesign

Postby yorik » Thu May 09, 2019 6:22 pm

The start center documentation actually needs some heavy work... Adding that to my todo list...