Recent

Author Topic: Example projects window  (Read 54934 times)

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
Re: Example projects window
« Reply #105 on: February 27, 2022, 12:22:07 pm »
Juha, I have a forked Lazarus gitlab repo, it now contains my worked over ~/examples directory.  How do you suggest I submit that 'stage one' to Lazarus, as a pull request or an old school diff file ? 
I will look at it tomorrow. Today I have other things going on...

Quote
But maybe a policy matter ?  Its currently called Online Examples (in, eg, the menu item).  As its not exclusively OnLine and may never be, is a different name appropriate ?  I don't want to call it "New Examples" and at some stage it will be old, any suggestions ?
"Example projects" is still very descriptive.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

dbannon

  • Hero Member
  • *****
  • Posts: 2802
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Example projects window
« Reply #106 on: February 27, 2022, 11:38:17 pm »
No rush Juha, we are traveling at present so my time is limited too.

"Example projects" is still very descriptive.

OK, from that I assume that "Stage Two" will have to include removal of the existing Example Window, it already owns "Example projects".  I was planning on being a bit more incremental than that, but quite happy to go boots and all.

My fork with the worked over examples is at https://gitlab.com/dbannon/lazarus/-/tree/newexamples, its a branch of my main fork that can track the official one.

I'll bring up another branch to accept the Example Window changes.

Davo 
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
Re: Example projects window
« Reply #107 on: March 02, 2022, 04:02:50 pm »
OK, from that I assume that "Stage Two" will have to include removal of the existing Example Window, it already owns "Example projects".  I was planning on being a bit more incremental than that, but quite happy to go boots and all.
IMO the old Example Window can be removed at the same time the new one is added. Two competing Example Windows will only confuse users.
The idea is that people test the new one in trunk. The old one can be found in revision history any time.

Quote
My fork with the worked over examples is at https://gitlab.com/dbannon/lazarus/-/tree/newexamples, its a branch of my main fork that can track the official one.
Sorry but https://gitlab.com/dbannon/lazarus/ does not exist. Under https://gitlab.com/dbannon/ I only see your Laz_Examples project.
Maybe I cannot use Gitlab properly yet. How to get to the Lazarus fork?
We could also give you rights to the main Lazarus repo and then create a Git branch for your work. It would work as any Git branch, Gitlab actions would not be needed.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

dbannon

  • Hero Member
  • *****
  • Posts: 2802
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Example projects window
« Reply #108 on: March 03, 2022, 12:22:59 am »
Oh Dear, I suspect I ave been caught again by by GitLab's model of making new repos PRIVATE by default. In Github its always public initially.  I'll check it shortly.

Sorry ....

Davo 

EDIT : yes, it was 'Private', seems that is the GitLab default. Its marked public now.

> IMO the old Example Window can be removed

Yep, thats how I am approaching it now. Just a bit preoccupied at present. Will get there ....

Davo
« Last Edit: March 03, 2022, 01:03:14 am by dbannon »
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dbannon

  • Hero Member
  • *****
  • Posts: 2802
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Example projects window
« Reply #109 on: March 04, 2022, 11:54:28 am »
OK, the Package now works with the Global Options Window. Not an easy task understanding that I must admit.

I will push content up into https://gitlab.com/dbannon/lazarus when we have made some progress with the Examples them selves.  I don't want to make one huge merge, would be a bit scary !

It will then be easier to strip out existing Examples Window.

Davo


Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
Re: Example projects window
« Reply #110 on: March 04, 2022, 03:33:56 pm »
OK, the Package now works with the Global Options Window. Not an easy task understanding that I must admit.
I will push content up into https://gitlab.com/dbannon/lazarus when we have made some progress with the Examples them selves.
How am I supposed to test your code if you don't push it?
I cloned your Lazarus fork repo and found the newexamples thread with 2 commits for the actual example projects. No other commits from you anywhere.

Quote
I don't want to make one huge merge, would be a bit scary !
Merge into where? The only purpose of your Lazarus fork in Gitlab is to let other people test it. You can do local experiments without forking by just cloning the official Lazarus Gitlab repo. I don't fully understand what is going on.

Quote
It will then be easier to strip out existing Examples Window.
It can be stripped out any time. I can do it for you if you want. I don't know why you are so attached to it.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

dbannon

  • Hero Member
  • *****
  • Posts: 2802
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Example projects window
« Reply #111 on: March 05, 2022, 12:20:31 am »
Sigh, we really don't seem to be communicating very well here.  I thought I had discussed the model and you were comfortable with it. But obviously not !

The 'dbannon/lazarus/newexamples' branch has all the examples projects in ~/examples cleaned up and metadata added. While two commits it does represent quite a lot of change (and work).

It now sounds to me like you want to see everything, the complete transform, all in that branch ?  Sure, I can do that, almost immediately.  That will be everything EXCEPT removal of existing Examples Window, I'll start on that next.

Quote
It can be stripped out any time. I can do it for you if you want. I don't know why you are so attached to it.

OK, OK, I'll do that next.

I was trying to get as much as possible done that did not alter core LazarusIDE code. Thats because its better to base a branch on as recent as possible main to avoid merge conflicts. My plan was to merge the Examples, merge the Examples Package and then branch off for the parts that require changes to core LazarusIDE.

As it is, newexamples is already ten days old. Its likely, people will have made some changes to the files I will need to change since then. And I will need several more days to remove the old Examples Window. Lets hope its still a reasonably easy merge.

Davo

EDIT : OK, dbannon/lazarus/newexamples now contains the code to display the new Examples Window. Its gets its one solitary bit of config from the Lazarus Options Window.  But I have, at this stage -

1) Not removed the old Examples Window, it will appear if you click the button on the Project Wizard or the upper "Example Projects" menu item under the Tools Menu.

2) Not added this Package to the Install/Uninstall Packages Window, I don't yet know how to.  To install this package, you should use Package -> Open Package File (.lpk) and browse to <lazarusDir>/components/examplesWindow/exampleprojects.lpk

3) Not extensively tested on anything except a Lazarus installed from SRC on Linux. There are bound to be dragons....

4) Not tested or provided metadata for the many examples that appear under directories other than ~/examples

I will address those four points as my free time permits.

Davo
« Last Edit: March 05, 2022, 01:39:57 am by dbannon »
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
Re: Example projects window
« Reply #112 on: March 05, 2022, 02:12:40 pm »
Sigh, we really don't seem to be communicating very well here.  I thought I had discussed the model and you were comfortable with it. But obviously not !
The 'dbannon/lazarus/newexamples' branch has all the examples projects in ~/examples cleaned up and metadata added. While two commits it does represent quite a lot of change (and work).
Yes, I believe there was some work involved. I was eager to see the user experience. Now I pulled you fork and yes, I can see a commit "New Examples Window, old one still exists". I will test it soon ...
Thanks for your efforts so far.
I don't think anybody else modified the example projects recently meaning your changes can be merged easily. You can always check it by rebasing your branch to the latest "main" branch HEAD.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
Re: Example projects window
« Reply #113 on: March 05, 2022, 04:36:29 pm »
OK, I built Lazarus with the new package. It shows a GUI but no example projects are listed yet. No problem, it is under construction.
True, the old GUI can stay there until the new one shows the local example projects.

I went through the actual examples. Looks good. I created patches from your Git branch and applied the 2 first ones to my development repo. No conflicts, good.
I created a new patch from my repo and uploaded it here :
 https://gitlab.com/freepascal.org/lazarus/lazarus/-/issues/35446
to make it easy for anybody to test. The patch includes your original "metadata tweaks" commit.
Shall we apply it to Lazarus trunk (main branch) soon? I will wait for comments from others a while.
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

avra

  • Hero Member
  • *****
  • Posts: 2514
    • Additional info
Re: Example projects window
« Reply #114 on: March 06, 2022, 12:56:09 am »
Does it make sense to have screenshot of some example projects? If it does, then you could check for screenshot.png in project directory and show it.
ct2laz - Conversion between Lazarus and CodeTyphon
bithelpers - Bit manipulation for standard types
pasettimino - Siemens S7 PLC lib

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
Re: Example projects window
« Reply #115 on: March 06, 2022, 07:57:34 am »
Does it make sense to have screenshot of some example projects? If it does, then you could check for screenshot.png in project directory and show it.
Yes, a good idea!
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

dbannon

  • Hero Member
  • *****
  • Posts: 2802
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Example projects window
« Reply #116 on: March 06, 2022, 10:23:44 am »
It shows a GUI but no example projects are listed yet.

OK, thats bad. You definitely should see 104 example projects (and fully functional examples window, view metadata, copy a project to a working area, open that project in lazarus).

I see no obvious reason why you would not, so have to assume I have overlooked 'something', but cannot replicate it here. There should be a debug statement that will drop three lines (to stdio, I am guessing you are on Linux Juha ??) when you open the Examples Window.  In my case, like this -

Code: Pascal  [Select][+][-]
  1. TExampleData.LoadExData - found 0 examples
  2. Lazarus Dir (ie source tree) = /home/dbannon/bin/Lazarus/lazarus-drb/
  3. Lazarus Config Dir = /home/dbannon/bin/LazConfig/lazarus-drb/
  4. Examples Home Dir  = /home/dbannon/bin/LazConfig/lazarus-drb/examples_work_dir/

Make sure those first two directories are valid, they may give me an idea whats happening. The first one should point to the top of your Lazarus source tree, there should be the ~/examples dir there and all the examples below that.

(Just to be sure, I have just pushed a small change so that the debug statements appear always, not just when there are no projects found. You could 'pull' and re-add the package to the IDE.)

Shall we apply it to Lazarus trunk (main branch) soon? I will wait for comments from others a while.

Well, as I indicated previously, I believe the examples can and should be committed now. They still work with the old Examples Window but have a number of problem ones removed and a few problems fixed.  Right now, the new Examples Window code is all there as an uninstalled package so does no harm and its easily removed if the overall project is rejected. But, as you noted, it has at least one bug !  So, lets get to bottom of that first.

Davo
 
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

dbannon

  • Hero Member
  • *****
  • Posts: 2802
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Example projects window
« Reply #117 on: March 06, 2022, 10:35:25 am »
Does it make sense to have screenshot of some example projects? If it does, then you could check for screenshot.png in project directory and show it.

Yes, good idea but maybe not now while the examples are being distributed as part of the Source ?  I am thinking of the extra size we would be adding to the source tree, we could double it.  But would sure help a user determine if its the project that answers their particular question.

Davo
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

JuhaManninen

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4474
  • I like bugs.
Re: Example projects window
« Reply #118 on: March 06, 2022, 01:03:18 pm »
Code: [Select]
TExampleData.LoadExData - found 0 examples
Lazarus Dir (ie source tree) = /home/dbannon/bin/Lazarus/lazarus-drb/
Lazarus Config Dir = /home/dbannon/bin/LazConfig/lazarus-drb/
Examples Home Dir  = /home/dbannon/bin/LazConfig/lazarus-drb/examples_work_dir/

My version:
Code: [Select]
TExampleData.LoadExData - found examples = 1
Lazarus Dir (ie source tree) = ../SW/lazarus/
Lazarus Config Dir = /home/juha/.lazarus/
Examples Home Dir  = /home/juha/.lazarus/examples_work_dir/
My Lazarus sources are in ~/SW/lazarus. I start the executable directly from there as "./lazarus &".
"../SW/lazarus/" is wrong. It should be "../lazarus/" or just "."

Quote
(Just to be sure, I have just pushed a small change so that the debug statements appear always, not just when there are no projects found. You could 'pull' and re-add the package to the IDE.)
It was useful. I test now with my main development repo (instead of your fork), and the GUI finds one example, Beginner/listview. Maube it came from testing your standalone app earlier.

Is anybody else testing this? Please do.

Yes, good idea but maybe not now while the examples are being distributed as part of the Source ?  I am thinking of the extra size we would be adding to the source tree, we could double it.  But would sure help a user determine if its the project that answers their particular question.
True, we must not bloat the distribution more. Instead we should move more examples to an online place.
For an online project a screenshot would be useful. It is a good use case for a thread. The GUI would download a screenshot in background and show it when ready.
« Last Edit: March 06, 2022, 01:49:09 pm by JuhaManninen »
Mostly Lazarus trunk and FPC 3.2 on Manjaro Linux 64-bit.

dbannon

  • Hero Member
  • *****
  • Posts: 2802
    • tomboy-ng, a rewrite of the classic Tomboy
Re: Example projects window
« Reply #119 on: March 07, 2022, 12:51:34 am »

EDIT:  I normally put a lazarus.cfg file in my lazarus installs, has a --PCP= setting to make sure I don't cross connect.

If I remove that and let it use the default ~/.lazarus config dir, the files in there all have relative paths !  Gives me somewhere to start experimenting from !





Lazarus Dir (ie source tree) = /home/dbannon/bin/Lazarus/lazarus-drb/

My version:
Code: [Select]
Lazarus Dir (ie source tree) = ../SW/lazarus/My Lazarus sources are in ~/SW/lazarus. I start the executable directly from there as "./lazarus &".
"../SW/lazarus/" is wrong. It should be "../lazarus/" or just "."

IMHO, it should be (eg) /home/juha/SW/lazarus/  I prefer full paths to avoid problems with Lazarus internally changing default directory. But you are getting a relative directory, puzzling. I read the Lazarus Dir directly from environmentoptions.xml and I see this (from the LazConfig dir) on my system -

Code: Bash  [Select][+][-]
  1. dbannon@dell:~/bin/LazConfig/lazarus-drb$ cat environmentoptions.xml | grep LazarusDirectory
  2.     <LazarusDirectory Value="/home/dbannon/bin/Lazarus/lazarus-drb">
  3.     </LazarusDirectory>

I am guessing you have a relative path there. While its easy to convert that to absolute, if Lazarus has already changed its default dir (why would it ?) it will still get the wrong answer.  So, I have two rhetorical questions -
1. Why do you have a relative path in there and I have absolute ? I have five different installs of Lazarus and they all have absolute paths to LazarusDirectory.
2. Why is Lazarus changing its working dir from what it was when that relative path was written  ?  Thats going to break other things too IMHO. 

I added ResolveDots() to the code that reads environmentoptions.xml and I manually edited environmentoptions.xml to have a relative path ../. and then started Lazarus. The initial Configure Lazarus screen popped up and put it back the way it was !  I do not understand why your system is behaving so differently.

(I can now push up a version that does not have the older Examples Window, starts mine from ProjectWizard etc. But would rather wait until the above issue is clarified)

Davo





« Last Edit: March 07, 2022, 01:02:08 am by dbannon »
Lazarus 3, Linux (and reluctantly Win10/11, OSX Monterey)
My Project - https://github.com/tomboy-notes/tomboy-ng and my github - https://github.com/davidbannon

 

TinyPortal © 2005-2018