Code Monkey home page Code Monkey logo

habitican-curse's People

Contributors

jasonuher avatar jwodder avatar rbavishi avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

habitican-curse's Issues

Implement Proper Unicode Handling

From @LordVladneutral in #8 - Sometimes there are issues with symobls in task names - this should fail gracefully.

python2.7 habitican-curse :(
Traceback (most recent call last):
File "habitican-curse", line 54, in
curses.wrapper(main)
File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
return func(stdscr, *args, **kwds)
File "habitican-curse", line 39, in main
G.reqManager.FetchData()
File "/usr/lib/python2.7/site-packages/habitican_curse/request_manager.py", line 221, in FetchData
logger.debug("Processing a TODO: %s" % str(i['text']))
UnicodeEncodeError: 'ascii' codec can't encode character u'\xea' in position 10: ordinal not in range(128)

What happens if you try to delete a challenge task ? (very low priority)

I like to mess around with programs and to test their limits. You cannot normally delete a task from a challenge, but in habitican-curse you can flag it for deletion, and that gets you this error message (when you try to write the changes) :

python2.7 habitican-curse
Traceback (most recent call last):
  File "habitican-curse", line 54, in <module>
    curses.wrapper(main)
  File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "habitican-curse", line 48, in main
    G.intf.Input()
  File "/usr/lib/python2.7/site-packages/habitican_curse/interface.py", line 354, in Input
    self.Command(command)
  File "/usr/lib/python2.7/site-packages/habitican_curse/interface.py", line 262, in Command
    G.reqManager.Flush() #Send the queue
  File "/usr/lib/python2.7/site-packages/habitican_curse/request_manager.py", line 320, in Flush
    self.DeleteTask(i.task.taskID)
  File "/usr/lib/python2.7/site-packages/habitican_curse/request_manager.py", line 123, in DeleteTask
    return self.APIV3_call("tasks/"+task_id,method='delete')
  File "/usr/lib/python2.7/site-packages/habitican_curse/request_manager.py", line 73, in APIV3_call
    raise ValueError("HTTP Response not recognized: %d" % resp.status_code)
ValueError: HTTP Response not recognized: 401
python2.7 habitican-curse  7,42s user 0,70s system 0% cpu 5:33:29,51 total

Of course nobody should do that, I certainly won't do it again, but in case, there are two fixes you can make for this :

  • You make a proper error handling so the program doesn't exit and says one task cannot be deleted because it is from a challenge.
  • Or you prevent tasks from challenge to be flagged for deletion (but that would require the program to know if a given task is from a challenge or not to begin with). Looks a bit harder to code, but possible.

This is how I see it.

Doesn't take count of custom start hour (feature suggestion)

Again, just messing around with the program, I noticed it didn't take count of the custom start hour. My cron happens at 6 AM, but if I refresh after midnight, the due dailies are shown as those for the next day.

Not even really an issue, I can deal with that, but it is a possible improvement.

habitica.py crashes with KeyError: 'specialClass' not in gearStats

Here's the backtrace:

karanbavishi:Habitican-Curse karan$ python habitica.py
Traceback (most recent call last):
  File "habitica.py", line 53, in <module>
    curses.wrapper(main)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "habitica.py", line 50, in main
    G.intf.Input()
  File "/Users/karan/Habitican-Curse/interface.py", line 278, in Input
    self.Command(command)
  File "/Users/karan/Habitican-Curse/interface.py", line 240, in Command
    CT.GetData()
  File "/Users/karan/Habitican-Curse/content.py", line 149, in GetData
    userStats = H.GetUserStats(data)
  File "/Users/karan/Habitican-Curse/helper.py", line 265, in GetUserStats
    (gearStats['klass'] == "special" and gearStats['specialClass'] == userClass)):
KeyError: 'specialClass'

Make available via pip

It would be fantastic if this were an executable available via pip instead of manual installation.

Using python2.7 i get this error

Traceback (most recent call last):
File "/usr/local/bin/habitican-curse", line 45, in
curses.wrapper(main)
File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
return func(stdscr, *args, **kwds)
File "/usr/local/bin/habitican-curse", line 32, in main
G.intf.Init()
File "/usr/local/lib/python2.7/dist-packages/habitican_curse/interface.py", line 36, in Init
G.HabitMenu.SetXY(1, 2)
AttributeError: 'NoneType' object has no attribute 'SetXY'

anyone have any suggestions?

_curses.error: init_pair() returned ERR

The curses library seems REALLY fragile. It doesn't work using xfce4-terminal:

$ habitican-curse
Traceback (most recent call last):
  File "/usr/bin/habitican-curse", line 45, in <module>
    curses.wrapper(main)
  File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/bin/habitican-curse", line 27, in main
    G.screen.Initialize()
  File "/usr/lib/python2.7/site-packages/habitican_curse/screen.py", line 64, in Initialize
    curses.init_pair(C.SCR_COLOR_LIGHT_ORANGE, 209, C.SCR_COLOR_BGRD)
_curses.error: init_pair() returned ERR

Uusing Termite gets a little farther:

[screen clear]

Connecting...

[screen clear]

Traceback (most recent call last):
  File "/usr/bin/habitican-curse", line 45, in <module>
    curses.wrapper(main)
  File "/usr/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "/usr/bin/habitican-curse", line 32, in main
    G.intf.Init()
  File "/usr/lib/python2.7/site-packages/habitican_curse/interface.py", line 55, in Init
    G.screen.SaveInRegister(0)
  File "/usr/lib/python2.7/site-packages/habitican_curse/screen.py", line 101, in SaveInRegister
    self.screen.putwin(self.ctxts[register])
_curses.error: putwin() returned ERR

Doesn't even work on xterm...

What's up?

I've installed on python2 on Arch Linux.

Curses Failures

I see a ton of errors related to curses when using this - mainly to do with resizing windows and drawing lists, output, etc. I think it stems from the fact that, while curses is being used, it's just one plain window and everything is being drawn by hand inside. I''m going to take a crack at "cursifying" this a bit more and using the API to handle the windowing a bit more in line with the curses design guide.

Branch is here and is very much a WIP at this point: https://github.com/jasonuher/Habitican-Curse/tree/UI_fixes

time data None error

Problem

Installed without sudo, ran habitican-curse :help and entered uuid and api copy and pasted from site. Was returned an error. I think this must have contained a space character at the end as it was copy pasted from the site so I assumed the uuid/api was incorrect. Deleted ~/.habiticarc and reentered password on prompt (it would be good to be informed I was storing my password in plaintext). Reinstalled with sudo. habitican-curse :help. Got the same error.

System

OSX 10.10.5

Stacktrace error

Traceback (most recent call last):
  File "/Users/kungfujam/anaconda/bin/habitican-curse", line 45, in <module>
    curses.wrapper(main)
  File "/Users/kungfujam/anaconda/lib/python2.7/curses/wrapper.py", line 43, in wrapper
    return func(stdscr, *args, **kwds)
  File "/Users/kungfujam/anaconda/bin/habitican-curse", line 30, in main
    G.reqManager.FetchData()
  File "/Users/kungfujam/anaconda/lib/python2.7/site-packages/habitican_curse/request_manager.py", line 120, in FetchData
    item = T.TODO(i)
  File "/Users/kungfujam/anaconda/lib/python2.7/site-packages/habitican_curse/task.py", line 299, in __init__
    self.dueDate = H.DateTime(str(data['date'])).DueDateFormat()
  File "/Users/kungfujam/anaconda/lib/python2.7/site-packages/habitican_curse/helper.py", line 176, in __init__
    self.date = self.ConvertDate(inpDate)
  File "/Users/kungfujam/anaconda/lib/python2.7/site-packages/habitican_curse/helper.py", line 193, in ConvertDate
    retDate = datetime.strptime(date,"%Y-%m-%dT%H:%M:%S.%fZ")
  File "/Users/kungfujam/anaconda/lib/python2.7/_strptime.py", line 325, in _strptime
    (data_string, format))
ValueError: time data 'None' does not match format '%Y-%m-%dT%H:%M:%S.%fZ'

Enhance habitica.py to ask for user credentials if .habiticarc doesn't have them

We can't assume that the user has entered his credentials in the correct manner in .habiticarc. Eg. What if he enters the key followed by the UUID?

We should maybe let .habiticarc be a collection of key-value pairs to avoid confusion. Eg.

uuid=wayne_rooney
key=ballondor

Also, asking the user to create this file is a little cumbersome, and habitica.py should not assume that it has been created.

Let habitica.py first check if .habiticarc exists and if it contains the user credentials. If not, it should create the file itself before communicating with the server

Read extra notes

It would be great if the program could display and/or modify the extra notes for any given task. I don't think it would be hard to add either.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.