eshapard / AnkiHabitica

Anki 2.0/2.1 add-on for use with HabitRPG. Automatically scores habits when you reach the end of your Anki timebox and when you review all cards in a deck.
GNU General Public License v3.0
197 stars 31 forks source link

"show_popup = False" throws error when time comes for scoring #17

Closed FFLaguna closed 8 years ago

FFLaguna commented 8 years ago

When I set "show_popup = False", and the AnkiHabitica add-on fills up its counter and scores a completed Habitica task during normal reviews, there is no pop-up and only an Anki error message. Unfortunately, I no longer have the error message saved, but it was something about "Couldn't find reference to self.hrpg_tooltip" or something like that.

But I do remember exactly how I fixed this myself by making these changes:

I changed the following section of habitica_class.py to use "tooltip" from aqt.utils instead of self.hrpg_tooltip:

#Show message box
        if ah.settings.show_popup:
            self.hrpg_showInfo(hrpgresponse)
        else:
            tooltip(_("Huzzah! You Scored Points!"), period=2500)

And then added this at the top of habitica_class.py and ankihabitica.py:

from aqt.utils import tooltip

Now it doesn't throw an error, and it shows a tiny little "anki tooltip" in the corner when it comes time for scoring like intended, and Habitica also records my task completions successfully. I'm literally not a programmer, so I'm sure you can find a better way to fix it.

P.S. 2500 milliseconds seems to be the best unobtrusive, readable, yet quick time setting for this popup.

P.S.S. I have a lot of add-ons, but I don't believe this is a conflict.

P.S.S.S. This happened both with the previous stable release, and with last night's nightly which I upgraded to.

twilsonco commented 8 years ago

To be sure, hrpg_tooltip() should be part of the Habitica class but its definition is nowhere to be found. For now, I'll just change the call to hrpg_tooltip() to the utils.tooltip() as you have done.

P.S. When using multiple P.S.'s, it's the P's that are repeated, not the S's.

eshapard commented 8 years ago

Thanks. There used to be a hrpg_tooltip function, but I guess I deleted it or something and forgot there was any call to it... oh well. We'll just use utils.tooltip. Tim, my co-developer, is working on the code while I'm away. Sounds like he updated the code on github already.

The hrpg_tooltip function just called utils.tooltip but with a default value for the timeout. I can recreate it and use your timeout of 2500. Thanks 😃 On Jul 6, 2016 5:53 PM, "FFLaguna" notifications@github.com wrote:

I have a lot of add-ons, but I don't think this is a conflict. When I set "show_popup = False", whenever the AnkiHabitica add-on scores a Habitica task during normal reviews, there is no pop-up and only an Anki error message. Unfortunately, I no longer have the error message saved, but it was something about "Couldn't find reference to self.hrpg_tooltip" or something like that.

But I do remember exactly how I fixed this myself by making these changes:

I changed the following section of habitica_class.py to use "tooltip" from aqt.utils instead of self.hrpg_tooltip:

Show message box

    if ah.settings.show_popup:
        self.hrpg_showInfo(hrpgresponse)
    else:
        tooltip(_("Huzzah! You Scored Points!"), period=2500)

And then added this at the top of habitica_class.py and ankihabitica.py:

from aqt.utils import tooltip

Now it doesn't throw an error, and it shows a tiny little "anki tooltip" in the corner when it comes time for scoring, and Habitica records my task completions successfully. I'm literally not a programmer, so I'm sure you can find a better way to fix it.

P.S. 2500 milliseconds seems to be the best unobtrusive, readable, yet quick time setting for this popup.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/eshapard/AnkiHabitica/issues/17, or mute the thread https://github.com/notifications/unsubscribe/AF5-KgtSbbj26H6STpqiZYgoH_6Kp6Tfks5qS895gaJpZM4JGOoo .