forked from lucbeaulieu/KanbanView
-
-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' of https://github.com/AlexanderWillner/KanbanView
- Loading branch information
Showing
17 changed files
with
115 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,15 +10,16 @@ | |
AUTHOR_MAIL = "[email protected]" | ||
DESCRIPTON = "A simple read-only CLI, API and Web Service for Things 3" | ||
URL = "https://github.com/alexanderwillner/kanbanview" | ||
VERSION = "2.5.0.dev0" | ||
VERSION = "2.5.0" | ||
DATA_FILES = [('resources', ["resources/logo.png"]), | ||
('resources', ["resources/logo-dark.png"]), | ||
('resources', ["resources/kanban.js"]), | ||
('resources', ["resources/kanban.css"]), | ||
('resources', ["resources/kanban.html"]), | ||
('resources', ["resources/demo.sqlite3"]), | ||
('resources', ["resources/chart.css"]), | ||
('resources', ["resources/chart.bundle.min.js"]) | ||
('resources', ["resources/chart.bundle.min.js"]), | ||
('resources', ["resources/chartjs-plugin-labels.min.js"]) | ||
] | ||
OPTIONS = { | ||
'argv_emulation': False, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
__copyright__ = "2020 Alexander Willner" | ||
__credits__ = ["Alexander Willner"] | ||
__license__ = "Apache License 2.0" | ||
__version__ = "2.5.0.dev0" | ||
__version__ = "2.5.0" | ||
__maintainer__ = "Alexander Willner" | ||
__email__ = "[email protected]" | ||
__status__ = "Development" | ||
|
@@ -19,30 +19,18 @@ | |
from random import shuffle | ||
from os import environ | ||
import getpass | ||
import configparser | ||
from pathlib import Path | ||
|
||
|
||
# pylint: disable=R0904 | ||
class Things3(): | ||
"""Simple read-only API for Things 3.""" | ||
# Variables | ||
debug = False | ||
database = None | ||
json = False | ||
filter = "" | ||
tag_waiting = "Waiting" if not environ.get('TAG_WAITING') \ | ||
else environ.get('TAG_WAITING') | ||
tag_mit = "MIT" if not environ.get('TAG_MIT') \ | ||
else environ.get('TAG_MIT') | ||
tag_cleanup = "Cleanup" if not environ.get('TAG_CLEANUP') \ | ||
else environ.get('TAG_CLEANUP') | ||
anonymize = bool(environ.get('ANONYMIZE')) | ||
|
||
# Database info | ||
FILE_DB = '/Library/Containers/'\ | ||
'com.culturedcode.ThingsMac/Data/Library/'\ | ||
'Application Support/Cultured Code/Things/Things.sqlite3' | ||
FILE_SQLITE = '/Users/' + getpass.getuser() + FILE_DB \ | ||
if not environ.get('THINGSDB') else environ.get('THINGSDB') | ||
|
||
TABLE_TASK = "TMTask" | ||
TABLE_AREA = "TMArea" | ||
|
@@ -70,18 +58,57 @@ class Things3(): | |
IS_OPEN = "status = 0" | ||
IS_CANCELLED = "status = 2" | ||
IS_DONE = "status = 3" | ||
RECURRING_IS_NOT_PAUSED = "instanceCreationPaused = 0" | ||
RECURRING_HAS_NEXT_STARTDATE = "nextInstanceStartDate IS NOT NULL" | ||
MODE_TASK = "type = 0" | ||
MODE_PROJECT = "type = 1" | ||
|
||
# Variables | ||
debug = False | ||
user = getpass.getuser() | ||
database = f"/Users/{user}/{FILE_DB}" | ||
filter = "" | ||
tag_waiting = "Waiting" | ||
tag_mit = "MIT" | ||
tag_cleanup = "Cleanup" | ||
anonymize = False | ||
config = configparser.ConfigParser() | ||
config.read(str(Path.home()) + '/.kanbanviewrc') | ||
|
||
# pylint: disable=R0913 | ||
def __init__(self, | ||
database=FILE_SQLITE, | ||
tag_waiting='Waiting', | ||
tag_mit='MIT', | ||
json=False): | ||
self.database = database if database is not None else self.FILE_SQLITE | ||
self.tag_mit = tag_mit | ||
self.tag_waiting = tag_waiting | ||
self.json = json | ||
database=None, | ||
tag_waiting=None, | ||
tag_mit=None, | ||
tag_cleanup=None, | ||
anonymize=None): | ||
|
||
cfg = self.get_from_config(self.config, tag_waiting, 'TAG_WAITING') | ||
self.tag_waiting = cfg if cfg else self.tag_waiting | ||
|
||
cfg = self.get_from_config(self.config, anonymize, 'ANONYMIZE') | ||
self.anonymize = cfg if cfg else self.anonymize | ||
|
||
cfg = self.get_from_config(self.config, tag_mit, 'TAG_MIT') | ||
self.tag_mit = cfg if cfg else self.tag_mit | ||
|
||
cfg = self.get_from_config(self.config, tag_cleanup, 'TAG_CLEANUP') | ||
self.tag_cleanup = cfg if cfg else self.tag_cleanup | ||
|
||
cfg = self.get_from_config(self.config, database, 'THINGSDB') | ||
self.database = cfg if cfg else self.database | ||
|
||
@staticmethod | ||
def get_from_config(config, variable, preference): | ||
"""Set variable. Priority: input, environment, config""" | ||
result = None | ||
if variable is not None: | ||
result = variable | ||
elif environ.get(preference): | ||
result = environ.get(preference) | ||
elif 'DATABASE' in config and preference in config['DATABASE']: | ||
result = config['DATABASE'][preference] | ||
return result | ||
|
||
@staticmethod | ||
def anonymize_string(string): | ||
|
@@ -387,7 +414,7 @@ def get_empty_projects(self): | |
TASK.{self.IS_NOT_TRASHED} AND | ||
TASK.{self.IS_OPEN} AND | ||
TASK.{self.IS_PROJECT} AND | ||
(TASK.{self.IS_ANYTIME} OR TASK.{self.IS_SCHEDULED}) | ||
TASK.{self.IS_ANYTIME} | ||
GROUP BY TASK.uuid | ||
HAVING | ||
(SELECT COUNT(uuid) | ||
|
@@ -396,7 +423,13 @@ def get_empty_projects(self): | |
PROJECT_TASK.project = TASK.uuid AND | ||
PROJECT_TASK.{self.IS_NOT_TRASHED} AND | ||
PROJECT_TASK.{self.IS_OPEN} AND | ||
PROJECT_TASK.{self.IS_ANYTIME} | ||
(PROJECT_TASK.{self.IS_ANYTIME} OR | ||
PROJECT_TASK.{self.IS_SCHEDULED} OR | ||
(PROJECT_TASK.{self.IS_RECURRING} AND | ||
PROJECT_TASK.{self.RECURRING_IS_NOT_PAUSED} AND | ||
PROJECT_TASK.{self.RECURRING_HAS_NEXT_STARTDATE} | ||
) | ||
) | ||
) = 0 | ||
""" | ||
return self.get_rows(query) | ||
|
@@ -525,6 +558,7 @@ def get_cleanup(self): | |
result.extend(self.get_lint()) | ||
result.extend(self.get_empty_projects()) | ||
result.extend(self.get_tag(self.tag_cleanup)) | ||
result = [i for n, i in enumerate(result) if i not in result[n + 1:]] | ||
return result | ||
|
||
@staticmethod | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
__copyright__ = "Copyright 2020 Alexander Willner" | ||
__credits__ = ["Alexander Willner"] | ||
__license__ = "Apache License 2.0" | ||
__version__ = "2.5.0.dev0" | ||
__version__ = "2.5.0" | ||
__maintainer__ = "Alexander Willner" | ||
__email__ = "[email protected]" | ||
__status__ = "Development" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,7 @@ | |
__copyright__ = "Copyright 2020 Alexander Willner" | ||
__credits__ = ["Luc Beaulieu", "Alexander Willner"] | ||
__license__ = "Apache License 2.0" | ||
__version__ = "2.5.0.dev0" | ||
__version__ = "2.5.0" | ||
__maintainer__ = "Alexander Willner" | ||
__email__ = "[email protected]" | ||
__status__ = "Development" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
__copyright__ = "2020 Alexander Willner" | ||
__credits__ = ["Alexander Willner"] | ||
__license__ = "Apache License 2.0" | ||
__version__ = "2.5.0.dev0" | ||
__version__ = "2.5.0" | ||
__maintainer__ = "Alexander Willner" | ||
__email__ = "[email protected]" | ||
__status__ = "Development" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,7 @@ | |
__copyright__ = "Copyright 2020 Alexander Willner" | ||
__credits__ = ["Luc Beaulieu", "Alexander Willner"] | ||
__license__ = "Apache License 2.0" | ||
__version__ = "2.5.0.dev0" | ||
__version__ = "2.5.0" | ||
__maintainer__ = "Alexander Willner" | ||
__email__ = "[email protected]" | ||
__status__ = "Development" | ||
|
@@ -28,7 +28,7 @@ def write_html_column(cssclass, file, header, rows): | |
"""Create a column in the output.""" | ||
|
||
file.write("<div class='column'><div class=''>" + | ||
"<h2 class='" + cssclass + "'>" + header + | ||
"<h2 class='h2 " + cssclass + "'>" + header + | ||
"<span class='size'>" + str(len(rows)) + | ||
"</span></h2>") | ||
|
||
|