Browse Source

Remove config.local.ini from Git

master
Doug Le Tough 2 years ago
parent
commit
490c4b3906
3 changed files with 50 additions and 10 deletions
  1. +18
    -0
      calendarmgr/__init__.py
  2. +24
    -7
      displaymgr/__init__.py
  3. +8
    -3
      inputmgr/__init__.py

+ 18
- 0
calendarmgr/__init__.py View File

@ -63,6 +63,24 @@ class Todosmgr(object):
self.logger.info(" '--> {}".format(str(todo).split('/')[-1]))
self.todos.append(utils.todo_as_dict(todo))
def get_next_todo(self):
if len(self.todos):
if self.current_todo + 1 < len(self.todos):
self.current_todo += 1
return self.current_todo
self.current_todo = 0
return self.current_todo
return None
def get_previous_todo(self):
if len(self.todos):
if self.current_todo - 1 >= 0:
self.current_todo -= 1
return self.current_todo
self.current_todo = len(self.todos) - 1
return self.current_todo
return None
class Calendarmgr(object):
def __init__(self, scheme, url, user, passwd, collection, tz, logger):
self.logger = logger


+ 24
- 7
displaymgr/__init__.py View File

@ -162,6 +162,7 @@ class Displaymgr(object):
self.logger.info("[+] Displaying todos")
self.clear_window("todo")
max_height, max_width = self.windows['todo'][0].getmaxyx()
self.todos = todos
index = 0
for todo in todos:
ttodo = todo["VTODO"]["SUMMARY"]
@ -172,11 +173,11 @@ class Displaymgr(object):
index += 1
self.refresh_window('todo')
def select_event(self, event):
def select_event(self, event=0):
self.logger.info("[+] Selecting event: {}".format(event))
max_height, max_width = self.windows['events'][0].getmaxyx()
if event is not None:
v_offset = 3
v_offset = 3
try:
event = self.events[event]
for e in self.events:
if e == event:
@ -191,9 +192,25 @@ class Displaymgr(object):
self.windows['events'][0].addstr(v_offset, 1, " ")
v_offset += 1
v_offset += 1
self.refresh_window("events")
except IndexError as e:
self.logger.warn('[%s %s()]: %s "%s"' % (self.__class__, inspect.currentframe().f_code.co_name, e.__class__, e))
self.refresh_window("events")
def select_todo(self, todo):
def select_todo(self, todo=0):
self.logger.info("[+] Selecting todo: {}".format(todo))
if event:
pass
max_height, max_width = self.windows['todo'][0].getmaxyx()
v_offset = 2
try:
todo = self.todos[todo]
for t in self.todos:
if t == todo:
self.windows['todo'][0].addch(v_offset, 1, curses.ACS_VLINE)
self.windows['todo'][0].addch(v_offset, 2, curses.ACS_VLINE)
v_offset += 1
else:
self.windows['todo'][0].addstr(v_offset, 1, " ")
self.windows['todo'][0].addch(v_offset, 2, curses.ACS_BULLET)
v_offset += 1
except IndexError as e:
self.logger.warn('[%s %s()]: %s "%s"' % (self.__class__, inspect.currentframe().f_code.co_name, e.__class__, e))
self.refresh_window("todo")

+ 8
- 3
inputmgr/__init__.py View File

@ -73,7 +73,7 @@ class Inputmgr(object):
self.char = self.displaymgr.windows["help"][0].getch()
self.input_maps[self.mode][self.char]()
except KeyError as e:
self.logger.debug("Input: {} [{}] / Ctrl: {} / Mode: {}".format(curses.unctrl(self.char), self.char, curses.ascii.iscntrl(self.char), self.mode))
self.logger.warn("Input: {} [{}] / Ctrl: {} / Mode: {}".format(curses.unctrl(self.char), self.char, curses.ascii.iscntrl(self.char), self.mode))
except Exception as e:
self.logger.error('[%s %s()]: %s "%s"' % (self.__class__, inspect.currentframe().f_code.co_name, e.__class__, e))
self.cursesmgr.end()
@ -85,12 +85,17 @@ class Inputmgr(object):
def cycle_mode(self):
self.logger.info("[+] Switching mode:")
modes = ["nav", "event", "todo"]
actions = {"nav": None,
"event": self.displaymgr.select_event,
"todo": self.displaymgr.select_todo}
index = modes.index(self.mode) + 1
if index == len(modes):
index = 0
self.mode = modes[index]
self.logger.info(" '--> {}".format(self.mode))
self.displaymgr.display_help(self.mode)
if actions[self.mode]:
actions[self.mode]()
def next_day(self):
if curses.ascii.iscntrl(self.char):
@ -136,11 +141,11 @@ class Inputmgr(object):
def next_todo(self):
self.logger.info("[+] Going to next todo")
self.displaymgr.select_todo(1)
self.displaymgr.select_todo(self.calendarmgr.todosmgr.get_next_todo())
def prev_todo(self):
self.logger.info("[+] Going to previous todo")
self.displaymgr.select_todo(-1)
self.displaymgr.select_todo(self.calendarmgr.todosmgr.get_previous_todo())
def add_event(self):
self.logger.info("[+] Adding event")


Loading…
Cancel
Save