On a ticket... add a comment with a checklist in it?

86 views
Skip to first unread message

Aikido Guy

unread,
Sep 23, 2020, 1:50:00 PM9/23/20
to Trac Users
Hi,

Is there any way to add a comment on a ticket that contains a check list with boxes that could be checked as TODO items are completed?

I'm using Trac 1.4.2. Maybe there is a plugin? Or maybe I'd had to build one? I know that I could add check boxes to a ticket via customization, but I'm looking for something that does not alter the basic functionality (data) on a ticket but is only related to one comment on one ticket.

Any and all thoughts welcome!

Kindly,
Aikido Guy

Ryan Ollos

unread,
Sep 23, 2020, 2:00:37 PM9/23/20
to Trac Users

Aikido Guy

unread,
Sep 23, 2020, 2:04:47 PM9/23/20
to Trac Users
Maybe along the lines of adding a comment that contained something similar to [ticket-custom]...

Possible mockup for a comment containing checkboxes:

[comment-custom]
test_one = checkbox
test_one.label = Some checkbox checked at the start... and possibly unchecked by clicking on a box
test_one.value = 1

test_two = checkbox
test_two.label = Some checkbox unchecked at the start... and possibly checked by clicking on a box

Aikido Guy

unread,
Sep 23, 2020, 2:06:52 PM9/23/20
to Trac Users
Our posts passed each other...

I like the plugin... however, the checkboxes are not interactive... I'm wondering if something interactive could be done?

Aikido Guy

unread,
Sep 23, 2020, 2:18:27 PM9/23/20
to Trac Users
Maybe a little bit of CSS styling could be used to change the font colour on checked vs unchecked boxes using the plugin. The plugin looks to be very small; which I like...

Any thoughts how I might accomplish this?

Aikido Guy

unread,
Sep 23, 2020, 4:15:49 PM9/23/20
to Trac Users
I have mocked up an html file that can display what I want.

Now I'm looking at the source code of the checkbox plugin you kindly shared.

In particular:
    def get_wiki_syntax(self):
        yield (
            "\[(?P<contents>[ xX+])\]",
            lambda x, y, z: self._format_checkbox(z.group("contents")))

I am guessing that the regular expression is, somehow, searching over the wiki markup (or the generate html... I'm not sure) and replacing the text with the respective html code.

I am wondering how to change this code so that I have both the text "[x]" (like above) but also the part after it up until the next newline... hints appreciated!

Chris Shelton

unread,
Sep 23, 2020, 5:04:48 PM9/23/20
to trac-...@googlegroups.com
Would this other plugin be more in line with what you are looking for:

Chris

--
You received this message because you are subscribed to the Google Groups "Trac Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to trac-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/trac-users/3644bc65-9b01-472b-9789-8c9adf95fd25n%40googlegroups.com.

Aikido Guy

unread,
Sep 23, 2020, 5:19:09 PM9/23/20
to Trac Users
I like the TracFormsPlugin. If I understand correctly, one starts by creating the "form", perhaps in a wiki page which becomes the template. Then the wiki page can be included in comments or somewhere else and that second location will have its own data.

I see 2 things that may trip me up:
1. Not sure how to customize a row so that the whole row could be a different colour
2. If the template changes over time then what happens to the comments that are using it? Create template A. Include it from comment B. Change template A... what happens to comment B?

I think the MilnCheckboxPlugin may be better because it keeps in the theme that a comment would need to be edited and then submitted. I was thinking clickon a checkbox might be a nice thing to do, but I'm waffling on that. My only issue with using MilnCheckboxPlugin is trying to modify the code to make it do what I'd like it to do. I've found the piece of the code that I think needs to change... perhaps I should directly contact the author of that plugin...

Thank you for pointing out TracFormsPlugin... seems very nice and I didn't know about it!

Aikido Guy

unread,
Sep 25, 2020, 4:25:44 PM9/25/20
to Trac Users
I contacted the author of Miln Checkbox. He no longer supports that plugin. I will build my own from scratch... that suites my needs.
- https://trac.edgewall.org/wiki/TracDev/IWikiSyntaxProviderExample looks like a very nice place for me to start learning how to do this

Thank you all for your help getting met to this point!

Kindly,
Aikido Guy

Aikido Guy

unread,
Sep 29, 2020, 12:01:46 PM9/29/20
to Trac Users
I have been able to manually place the Miln Checkbox in the plugins/ directory in a single trac environment using a vanilla Trac install (version 1.2) on ubuntu.

I am running into an issue when trying to manually place the NewsflashMacro.py file (and it's css file) into the plugins directory. Trac sees the plugin and it is enabled in the Admin pannel. The trac.log says that there is no handler for the css file.
  • Where should I put the css file?
  • What is the best practice for loading css files from plugins? i.e. is the NewsflashMacro.py plugin demonstrating current best practice for Trac 1.2 and Trac 1.4?
Kindly,
Aikido Guy

RjOllos

unread,
Sep 29, 2020, 12:05:22 PM9/29/20
to Trac Users
On Tuesday, September 29, 2020 at 9:01:46 AM UTC-7 aiki...@gmail.com wrote:
I have been able to manually place the Miln Checkbox in the plugins/ directory in a single trac environment using a vanilla Trac install (version 1.2) on ubuntu.

I am running into an issue when trying to manually place the NewsflashMacro.py file (and it's css file) into the plugins directory. Trac sees the plugin and it is enabled in the Admin pannel. The trac.log says that there is no handler for the css file.
  • Where should I put the css file?
  • What is the best practice for loading css files from plugins? i.e. is the NewsflashMacro.py plugin demonstrating current best practice for Trac 1.2 and Trac 1.4?
Kindly,
Aikido Guy

Where did you get NewflashMacro.py? The plugin should be packaged, not single-file:

Aikido Guy

unread,
Sep 29, 2020, 2:02:55 PM9/29/20
to Trac Users
Yes, that's where I downloaded the macro.py file and the newsflash.css file. Since I am attempting to create my own plugin, I thought I would start with an existing one and build it up. The only issue with that plugin is that the css file is not found when I manually put the macro.py file into the plugins/ directory. What part of NewsflashMacro should I read to learn where the css file should be placed?
 I saw:
def get_htdocs_dirs(self):

        yield 'newsflash', resource_filename(__name__, 'htdocs')

which led me to put the css file inside htdocs/css/newsflash.css but that did not work.

Aikido Guy

unread,
Sep 29, 2020, 2:25:55 PM9/29/20
to Trac Users
Solved my issue. The css file needs to be under plugins/htdocs/css/ rather than htdocs/css/

RjOllos

unread,
Sep 30, 2020, 12:27:57 AM9/30/20
to Trac Users
On Tuesday, September 29, 2020 at 11:25:55 AM UTC-7 aiki...@gmail.com wrote:
Solved my issue. The css file needs to be under plugins/htdocs/css/ rather than htdocs/css/

Normally, you'd build the egg "python setup.py bdist_egg" and put the egg in the plugins directory.

If you want to develop, "python setup.py develop", 

- Ryan

Aikido Guy

unread,
Sep 30, 2020, 8:44:20 AM9/30/20
to Trac Users
On Wednesday, September 30, 2020 at 12:27:57 AM UTC-4 RjOllos wrote:
On Tuesday, September 29, 2020 at 11:25:55 AM UTC-7 AikidoGuy wrote:
Solved my issue. The css file needs to be under plugins/htdocs/css/ rather than htdocs/css/

Normally, you'd build the egg "python setup.py bdist_egg" and put the egg in the plugins directory.

If you want to develop, "python setup.py develop", 

- Ryan

Excellent link; thank you! My new "plugin" works as I envisioned it. So building all of the deployment surrounding my new plugin is my next step and you are very timely with the information :)

Your web page describes building eggs (which I have never done before and that's ok... I can learn). However, I understand that wheels are what are being built now (because I had to download and install wheels when I upgraded my Trac version).
- Should I build an egg or a wheel? I'm guessing that an egg may be easier for a first timer to build...?
- If I should rather be building a wheel; how does one build a Trac plugin wheel for pypi?

Kindly,
Aikido Guy

RjOllos

unread,
Sep 30, 2020, 8:30:14 PM9/30/20
to Trac Users
Wheel is the newer packaging format and is preferred if installing to site-packages. However, you can mix formats. You can install Trac as a wheel, some plugins as a wheel, some plugins as an egg.

Usually, it doesn't matter much if you use a wheel or an egg since most Trac plugins are pure python. The important thing is to use pip package manager rather than easy_install, because pip is better maintained and has features like uninstall, so old versions will be uninstalled on upgrade. That only matters though if you are installing to site-packages. I always use a virtualenv and install to site-packages.

Eggs are still needed if installing in the global or environment plugins directory. You can't create a wheel, put it in the plugins directory, and expect Trac to load it correctly. The topic is discussed here:

You can create a wheel with:
python setup.py bdist_wheel
Then you can publish it to pypi with twine.

- Ryan 
Reply all
Reply to author
Forward
0 new messages