Recent

Author Topic: tvPlanit - datasource goes Frankenstein  (Read 700 times)

Nicole

  • Hero Member
  • *****
  • Posts: 970
tvPlanit - datasource goes Frankenstein
« on: August 05, 2022, 07:44:51 pm »
When I read in iCal-data, the events will go to category0. - I do not want them there.

This is what I did:
- I deleted (=renamed) the datastore-ini
- I started the program and a new ini-file was created
- I read in the first iCals series
- I closed down the program and made by this the ini be written
- by a text editor I changed the category from 0 to the wanted one

This I did with 3 groups of icals for three times and three categories.

I restored my datastore-ini.
I copied / added the new lines from the text-files into my datastore-ini.

Worked? hm.
The events are there, the category matches.

But I get messages "out of range".
So internally the lines and events seem to be counted and do not like to be cheated.

And idea, what I can do?


wp

  • Hero Member
  • *****
  • Posts: 11915
Re: tvPlanit - datasource goes Frankenstein
« Reply #1 on: August 05, 2022, 09:02:05 pm »
Can't help you here since I don't know what exactly you were doing.

Anyway, I just committed a new version in which a method ImportICalFile() has been separated from the popup menu handler so that it can be called separately.
Code: Pascal  [Select][+][-]
  1. { Reads the events listed in the specified ical file and adds them to the
  2.   day view control. All events imported are collected in the Result array.
  3.   ADefaultCategory is the category to which the event is assigned if no fitting
  4.   category has been found in the ical, i.e. when the event's category is 0.
  5.   If you are not happy with this category replacement you can iterate over the
  6.   Result array and change it. }
  7. function TVpDayView.ImportICalFile(AFileName: String;  ADefaultCategory: Integer = -1): TVpEventArr;  // where TVpEventArr = array of TVpEvent;

It is implemented for VpDayView and VpWeekView, as well as VpTaskList. The ADefaultCategory is the event category to which the imported event is assigned in case no category information has been found in the ical file. Since an ical event/task can contain multiple events/tasks this category gets assigned to all imported events/tasks. If you don't like this you can iterate over all events/tasks imported (they are collected in the returned array of the method) and adjust it.

Code: Pascal  [Select][+][-]
  1. procedure TForm1.BtnImportICalClick(Sender: TObject);
  2. var
  3.   events: TVpEventArr;
  4.   i: Integer;
  5. begin
  6.   events := VpDayView1.ImportICalFile('test.ical', 1);
  7.   for i:=0 to High(events) do
  8.     if events[i].Location = 'somewhere' then
  9.       events[i].Category := 2;
  10. end;
« Last Edit: August 05, 2022, 10:15:40 pm by wp »

Nicole

  • Hero Member
  • *****
  • Posts: 970
Re: tvPlanit - datasource goes Frankenstein
« Reply #2 on: August 06, 2022, 12:45:14 pm »
This sounds like my dreams!

Unfortunately, I failed in living them.

I took the version 8367 yesterday.
I have two issues
- TVpEventArr is not accepted ( I used TvPEvent for compiling);
- ImportICalFile is not accepted

I enclose a screenshot

wp

  • Hero Member
  • *****
  • Posts: 11915
Re: tvPlanit - datasource goes Frankenstein
« Reply #3 on: August 06, 2022, 01:25:18 pm »
yes, of course. r8367 does not contain it, in the bugtracker report I wrote that it is in r8369-8370... In the attachment is a screenshot of the svn log messages as of today.

Your requests are so close to the active development that the sourceforge snapshots probably are not updated quickly enough. The only way to get the "fresh meat" is to use an svn client yourself. Since you are on Windows, install TortoiseSVN, and all the svn mystery is hidden in the context menu of the Windows explorer. Create a folder for your cloned repositories. Right-click on this folder and select "SVN Checkout" (or maybe "TortoiseSVN" > "SVN Checkout") from the context menu. Enter svn://svn.code.sf.net/p/lazarus-ccr/svn/components/tvplanit in the box "URL of repository" and the path to your tvplanit directory in the repository into the box "Checkout directory". The "OK" button loads the current tvplanit source into this folder. Then install the tvplanit packages into the IDE from here.

That's the more complicated part. When later there is an update in tvplanit, simply right-click on your tvplanit repository folder, and select "Tortoise SVN" > "SVN Update" which updates your local sources almost immediately. In most cases you simply can return to your project since the IDE will detect that sources have been changed and do all the necessary recompilations. Only when new published properties are introduced you must rebuild the IDE (of course, if you want to be on the safe side, you can do this after every "SVN Update").

When you right-click on your repository folder and select "Tortoise SVN" > "SVN Log" you see all the short descriptions of the various commits made. Your currently used revision is marked by bold font. When you see that there are newer commits (above the bold line) do the "SVN Update" trick already discussed. If your current revision does not work and you want to return to an older one right-click on the one that you want and select "Revert to this revision" from the context menu - and you local sources will be the same as this older revision shortly.

You can also take advantage of this technology for your own projects by selecting "Create repository here", but this goes beyond this tvplanit discussion.

Nicole

  • Hero Member
  • *****
  • Posts: 970
Re: tvPlanit - datasource goes Frankenstein
« Reply #4 on: August 06, 2022, 02:09:39 pm »
Thank you for the explanation. I am afraid, this repository is too much to me.
I just downloaded 8371.

My main focus is not programming. It is just something I learnt for my needs. Somehow, I feel like the gardener who learnt to build castles "besides" to beautify his garden.  :)

 

TinyPortal © 2005-2018