Start Page Redesign

A forum for research and development of the user interface of FreeCAD
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
openfablab
Posts: 62
Joined: Wed Nov 02, 2016 4:42 pm
Contact:

Re: Start Page Redesign

Post by openfablab »

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 2485 times
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Start Page Redesign

Post by yorik »

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
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Start Page Redesign

Post by Kunda1 »

#documentation
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Start Page Redesign

Post by yorik »

The start center documentation actually needs some heavy work... Adding that to my todo list...
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: Start Page Redesign

Post by pablogil »

yorik wrote: Thu May 09, 2019 6:22 pm ping
Hi @yorik,

I'm wondering if you think it would be nice to add a filter to the list of Recent files of the Start WB.

It's pretty annoying (for me, of course) to see other file types in the Recent files list than the only ones I would like to have: the FCstd ones, so I was thinking about a Preferences option that let you choose which files types you want to have listed in this list.
May be the perfect solution would be to have this filter in the list itself and have the option to "live" filter it and to save (or remember) the last filtered file types you have when starting up FreeCAD again.

What do you think about it?
Thank
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
User avatar
Kunda1
Veteran
Posts: 13434
Joined: Thu Jan 05, 2017 9:03 pm

Re: Start Page Redesign

Post by Kunda1 »

pablogil wrote: Mon Aug 19, 2019 8:40 am I'm wondering if you think it would be nice to add a filter to the list of Recent files of the Start WB.
:+1:
Alone you go faster. Together we go farther
Please mark thread [Solved]
Want to contribute back to FC? Checkout:
'good first issues' | Open TODOs and FIXMEs | How to Help FreeCAD | How to report Bugs
User avatar
yorik
Founder
Posts: 13640
Joined: Tue Feb 17, 2009 9:16 pm
Location: Brussels
Contact:

Re: Start Page Redesign

Post by yorik »

Good idea! I suggest you implement it as a preference option first, then if you go forward with it it will be easier to implement a system directly on the start page, that sets/unset the preference...
User avatar
pablogil
Posts: 881
Joined: Wed Nov 26, 2014 3:19 pm
Location: Badajoz (Spain)
Contact:

Re: Start Page Redesign

Post by pablogil »

yorik wrote: Mon Aug 19, 2019 4:39 pm Good idea! I suggest you implement it as a preference option first, then if you go forward with it it will be easier to implement a system directly on the start page, that sets/unset the preference...
Sadly I don’t have the skills to implement it... I just got the idea (or need) and felt like making the suggestion to anyone with enough skills to implement it :oops:

BTW, I could help with the html/CSS styles under the Start page
Dark and Light stylesheets v2.0 to theme your FreeCAD UI, more information here
User avatar
openfablab
Posts: 62
Joined: Wed Nov 02, 2016 4:42 pm
Contact:

Re: Start Page Redesign

Post by openfablab »

yorik wrote: 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...
I made some successful experimenting with FreeCADGui.webView.webPage.browser.setHtml and now want to try javascript approach. But how can I correctly call python functions from javascript and get response?
User avatar
bitacovir
Veteran
Posts: 1570
Joined: Sat Apr 19, 2014 6:23 am
Contact:

Re: Start Page Redesign

Post by bitacovir »

I forgot I had this mock-up of a Start Page. Maybe it gives some additional inspiration...
image823.jpg
image823.jpg (251.84 KiB) Viewed 1582 times
::bitacovir::
==================
One must be absolutely modern.
Arthur Rimbaud (A Season in Hell -1873)

Canal Youtube Grupo Telegram de FreeCAD Español

My personal web site
My GitHub repository
Mini Airflow Tunnel Project
Post Reply