Template for \"Today\'s node\" – F8

Home Forums cherrytree Template for \"Today\'s node\" – F8

This topic contains 23 replies, has 4 voices, and was last updated by  Klaas Vaak 3 days, 10 hours ago.

Viewing 15 posts - 1 through 15 (of 24 total)
  • Author
    Posts
  • #124487

    Klaas Vaak
    Member

    I understand that for a regular node it is possible to design a node with a customised layout & text and to copy that node to the right place each time one needs it as a template.

    But it seems to me that that does not work for “Today’s node” because nodes generated that way (or with F8) are customised themselves in terms of title & their place in the tree hierarchy.

    So my question is: is there a way to use a template for the “Today’s node” part of the tree?

    #124532

    eureka
    Member

    In Ubuntu 16.04 I used searchmonkey tool to find where โ€œInsert Today’s Nodeโ€ is found in CherryTree source ..

    In CherryTree 0.38.2 it is found in

    /modules/menus.py

    Line Number: 236
    "tree_node_date": {"sk": "calendar", "sd": _("Insert Today's Node"), "kb": "F8", "dn": _("Insert a Node with Hierarchy Year/Month/Day"), "cb": dad.node_date},

    As to how to customise this .. I don’t know.

    #124533

    Klaas Vaak
    Member

    Eureka, thanks for following up ๐Ÿ™‚
    Apart from being on Windows, I don’t have the time to familiarise myself with code. I was wondering if somehow one could make a template without having to resort to coding. Unfortunately, it seems that that is not possible.

    #124534

    eureka
    Member

    As I have written in other posts, for my own ends I am finding ways of automating by using external scripts which avoid the need to hack CherryTree code.

    If you can expand on the type of template you need to apply to Today’s Node I’m sure that a work around can be thought through.

    #124535

    toxision
    Member

    Hi Klaas Vaak,
    thanks to eurekas post i found the corresponding lines in core.py
    It is in the lines between 2878 and 2902: def node_date(self, *args):
    Or you can tell what you would like to get and maybe there is a way…..

    Just keep in mind: I am not a developer and cannot promise a solution. (more some kind of a “code digger” 8-))
    And it is not exactly what the definition of a template is, but more a “fix” to be more/better adapted to your needs.

    Cheers,
    Chris

    #124540

    Klaas Vaak
    Member

    Hey Chris, many thanks for your kindness too. In order to avoid have 2 similar activities in parallel, I answered gave details of what I want to Eureka. I am not sure now if that answer gets shown because in my browser it does not, but when I try to repost it, the site tells me I have already said it.

    Anyway, if my template is too complicated to do with scripts, I’ll revert to you, if that is OK with you.

    #124541

    Klaas Vaak
    Member

    Eureka, I answered in detail, edited it a couple of times, but now it does not seem to get shown, even though reposting says “I have already said that”. I’ll try again later. Let me know if the info got through.

    #124543

    Klaas Vaak
    Member

    Eureka, thanks for following up, I am almost embarrassed by your kindness ๐Ÿ™‚
    Right now I use a template in OneNote for my daily journal entries. I like Ct’s calendar entries (“Today’s node”) better so am looking at changing to Ct.

    My OneNote template consists of various headers, below which there is a table consisting of 1 row & several columns where I add data, such as text, icon, checkmark, part of an excel table, graph, etc., all of which are copy/pasted.

    I have posted on Imgur 4 images of parts of the template from top to bottom:

    https://imgur.com/na2Et3Y
    https://imgur.com/5g7vCqZ
    https://imgur.com/lgtYHov
    https://imgur.com/XO8nXHb

    The headers are shown as follows:
    header 1: capitals
    header 2: blue text
    header 3: red text

    I do not necessarily need to stick with OneNote style tables.

    From time to time I amend the template, so would like to do that in the script too. I have AHK installed on my PC, if that is of any help.

    Well, this is a start. If it is too complicated to set this up with a script I understand, just tell me.

    #124544

    eureka
    Member

    I’ll experiment with this later .. but it’s a good start that you have AHK in Windows.

    I see that there have been earlier requests to import OneNote files into CherryTree.

    http://www.giuspen.com/2016/01/cherrytree-0-36-4-issued/

    My first rough thought is to create an AHK script (on Windows) which

    creates Today’s Node
    imports a template (HTML or OneNote)

    But I’ll look at this later.

    #124545

    Klaas Vaak
    Member

    OK Eureka, thanks.I’ll wait for the system to send me a mail telling me you have answered.

    #124553

    Klaas Vaak
    Member

    Hey Eureka, I was wondering if you have been able to have a look, and if what I want is feasible.

    #124554

    eureka
    Member

    Hello Klass

    Seems that I took on quite a task.

    I should explain that recently I purchased a new Dell tower PC (Windows 10 default) to migrate from older hardware. I have spent some time setting up dual boot Windows 10 + Ubuntu 16.04 and to bring them into line for cross-platform software development.

    Ubuntu 16.04 is my preferred OS but I keep Windows to test software across platforms.

    I have my own requirement to communicate between CherryTree and third party apps.

    I lost some time being hit by a Windows malware and purging this malware (anti virus did not block it). This underlines my first preference for Ubuntu.

    Now turning to the task at hand I started considering if I might embed an svg object (form) inside a CherryTree rich text node.

    I was surprised to see that I can import some svg files as an image. But other svg files gave the message “wrong file format”. I’m not sure why.
    So I deferred that approach (although I might return to this).

    I think that a dynamic svg form might be an interesting route. CherryTree does use svg.

    Next I considered creating an HTML web form in a local server and to achieve this I installed software which I use in Ubuntu:-

    python 2 and python 3
    jetty server
    java 8
    jquery-ui

    The idea is to create the form in HTML (emulating OneNote format) and then submit the data to CherryTree node.

    Now that approach is workable and a scripting engine such as AutoHotKey can receive the form data and โ€œpostโ€ to CherryTree node. But AutoHotkey does not work in Ubuntu and an alternative scripting tool is Actiona. I have Actiona in Ubuntu so I installed it in Windows.

    I tried OneNote in my Windows 10 and it has a Microsoft proprietary format so I will not be using OneNote for my own use.

    If you have a collection of OneNotes then I would explore the OneNote REST API which offers a possible export channel.

    https://msdn.microsoft.com/en-us/library/office/dn575425.aspx

    I created a small 20GB NTFS partition – SHARE – where I keep cross platform copies of CherryTree files and other cross platform resources. So I can jump between Windows and Ubuntu to access common notes (not possible with OneNote which is Microsoft only).

    So the summary is … it is tricky to actually embed an HTML form inside CherryTree but a browser based form (built using jquery-ui) can pass data to CherryTree.

    http://jqueryui.com

    https://dzone.com/articles/installing-and-running-jetty

    https://wiki.actiona.tools/doku.php?id=:en:start

    If that approach fits your workflow I can expand further. The user can toggle between CherryTree window and browser window (using hot keys) so it is not as integrated as having a form embedded in a CherryTree node.

    I am also writing a python script which will allow jquery-ui form components to be rapidly created from a text ini file. A bit like Markdown form creation.

    I will post the workflow to set this up when I finish testing.

    If I do find a way to embed svg objects in rich text and associate some javascript then I could avoid external apps such as jetty server

    • This reply was modified 1 week ago by  eureka. Reason: some typo errors corrected
    #124556

    Klaas Vaak
    Member

    Hey Eureka,
    Well now, that is quite a reply, and quite a lot of work you are doing for me, aside from your own work setting up your new PC.

    I am nowhere near your level of knowledge about scripting & programming, so cannot follow the details of what you write, but I think I can follow the overall thought process of what you are trying to achieve.

    I do not want to saddle you with a huge workload for me. Even though the HTML way is probably doable for the end user when an AHK script is used, it seems to me it is too complex & time-consuming to set up. What’s more, if I would want to change the template sometime in the future, I would be stuck because it would have to be done in the programming/scripting part.

    As an outsider I would say that the svg approach is the least complicated, and, from what I can see, it would probably be feasible for me to change the template without having to go through programming/scripting.

    Is my reasoning correct? If not please set me right ๐Ÿ™‚
    If I am correct, do you still need a collection of OneNote notes? I assume you want them in the .one format.
    How many would you need?

    Last but not least, are you sure you want to take on this task? I will understand if you decide that it is too much for a zero return to you, and I will not bear you a grudge ๐Ÿ˜‰ In that case I will just carry on using OneNote for my journal entries.

    #124557

    Sisyfos
    Member

    Hi;
    I use a “template” made in CT (just entered headers and applicable text, not as detailed as in your screenshots) that I placed on the mother node, then I just copy and paste for each day.
    Maybe an alternative for the time being?
    /Sisyfos

    #124558

    eureka
    Member

    Klaas

    I assure you that I am not going through this exercise for you only. I have my own interest in creating a link between CherryTree node and external apps. So I’m using your own case as a testbed for my ideas. Hopefully you will get some benefit from these experiments.

    There are many ways this could go:

    You can use a simple copy of node template as suggested by @sisyfos.
    But I’m assuming that you need to process and analyse this accumulating data in some way (as I do). So this suggests an interface to some database so that the form data can be submitted to a database through a submit process (as in jquery-ui form).

    There is a special option for a user like me with dual boot Windows 10 and Ubuntu. In Windows 10 I have learned that there is a new feature, Windows Subsystem which forms a bridge between Windows 10 and Ubuntu. This means that within Windows 10 I can use the bash shell as if I was in Ubuntu 14. This can be a useful experiment which I will follow.

    Do you have latest Windows 10 OS build or is your Windows an earlier version?

    I would like to avoid automation scripting (e.g. AHK or Actiona) if possible, but it does have its uses on occasions for binding processes to hot keys.

    One current thought is to simply copy a code box (say python) inside the journal node. This can be run to launch an interactive form in a python window (assuming that you have first installed python in Windows 10).

    I do not need more examples of OneNote format.

Viewing 15 posts - 1 through 15 (of 24 total)

You must be logged in to reply to this topic.