Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

from setuptools import find_packages, setup


with open("timetagger/__init__.py") as fh:
VERSION = re.search(r"__version__ = \"(.*?)\"", fh.read()).group(1)

Expand Down
1 change: 0 additions & 1 deletion tests/test_both.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

import timetagger


server_fname = os.path.dirname(timetagger.server.__file__)
client_fname = os.path.dirname(timetagger.app.__file__)

Expand Down
1 change: 0 additions & 1 deletion tests/test_server_apiserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

import itemdb


USER = "test"
HEADERS = {}

Expand Down
1 change: 0 additions & 1 deletion tests/test_server_assetserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
from asgineer.testutils import MockTestServer
from _common import run_tests


# Create asset handler
assets = {}
assets.update(create_assets_from_dir(resources.files("timetagger.app")))
Expand Down
1 change: 0 additions & 1 deletion timetagger/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
enable_service_worker,
)


# Special hooks exit early
if __name__ == "__main__" and len(sys.argv) >= 2:
if sys.argv[1] in ("--version", "version"):
Expand Down
13 changes: 4 additions & 9 deletions timetagger/app/dialogs.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
isNaN,
)


if this_is_js():
tools = window.tools
dt = window.dt
Expand Down Expand Up @@ -165,8 +164,7 @@ def csvsplit(s, sep, i=0):
# so we should be fine with our own data.
global RawJS
parts = []
RawJS(
"""
RawJS("""
var mode = 0; // 0: between fields, 1: unescaped, 2: escaped
var sepcode = sep.charCodeAt(0);
var lastsplit = i;
Expand Down Expand Up @@ -215,8 +213,7 @@ def csvsplit(s, sep, i=0):
parts[j] = val.slice(1, val.length-1).replace('""', '"');
}
}
"""
)
""")
return parts, i


Expand Down Expand Up @@ -2757,8 +2754,7 @@ def _show_records(self):
record = window.store.records.get_by_key(key)
ds = record.ds or ""
date = dt.time2str(record.t1).split("T")[0]
lines.append(
f"""
lines.append(f"""
<a href='#date={date}'
style='cursor: pointer;'>
<span>{date}</span>
Expand All @@ -2768,8 +2764,7 @@ def _show_records(self):
<i class='fas'>\uf682</i>
<span>{ds}</span>
</a>
"""
)
""")
self._records_node.innerHTML = "<br />\n".join(lines)

def _open_record(self, key):
Expand Down
7 changes: 2 additions & 5 deletions timetagger/app/dt.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from pscript import this_is_js, RawJS
from pscript.stubs import Date, isNaN, Math, window


DAYS_SHORT = [
"Sun",
"Mon",
Expand Down Expand Up @@ -401,8 +400,7 @@ def get_weeknumber(t):
# From https://weeknumber.net/how-to/javascript
date = Date(t * 1000) # noqa
day_offfset = 7 - get_first_day_of_week() # noqa
RawJS(
"""
RawJS("""
date.setHours(0, 0, 0, 0);
// Thursday in current week decides the year.
date.setDate(date.getDate() + 3 - (date.getDay() + day_offfset) % 7);
Expand All @@ -411,8 +409,7 @@ def get_weeknumber(t):
// Adjust to Thursday in week 1 and count number of weeks from date to week1.
var res = 1 + Math.round(((date.getTime() - week1.getTime()) / 86400000
- 3 + (week1.getDay() + 6) % 7) / 7);
"""
)
""")
return res # noqa


Expand Down
1 change: 0 additions & 1 deletion timetagger/app/front.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
from pscript import this_is_js
from pscript.stubs import window, Math, time, perf_counter


if this_is_js():
dt = window.dt
utils = window.utils
Expand Down
13 changes: 4 additions & 9 deletions timetagger/app/stores.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,32 @@
from pscript import this_is_js
from pscript.stubs import Math, Date, JSON, window, console, RawJS


if this_is_js(): # pragma: no cover
tools = window.tools
utils = window.utils
dt = window.dt # noqa
random = Math.random

def to_int(x):
RawJS(
"""
RawJS("""
x = Number(x)
if (!isFinite(x)) {
var e = new Error("TypeError: Cannot convert to int");
e.name = "TypeError";
throw e;
}
"""
)
""")
return Math.floor(x)

def to_float(x):
RawJS(
"""
RawJS("""
x = Number(x)
if (!isFinite(x)) {
var e = new Error("TypeError: Cannot convert to int");
e.name = "TypeError";
throw e;
}
"""
)
""")
return x

def to_str(x):
Expand Down
1 change: 0 additions & 1 deletion timetagger/app/tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

from pscript.stubs import window, JSON, localStorage, location, console, fetch


# %% General


Expand Down
6 changes: 2 additions & 4 deletions timetagger/app/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,7 @@ def looks_like_desktop():
# hue is a number between 0 and 360, saturation and lightness are numbers between 0 and 100.
# returns an array of 3 numbers between 0 and 1, for the r, g, and b channel.
def _get_hsluv2rgb():
RawJS(
"""
RawJS("""
function f(a){var c=[],b=Math.pow(a+16,3)/1560896;b=b>g?b:a/k;for(var d=0;3>d;){var e=d++,h=l[e][0],w=l[e][1];e=l[e][2];for(var x=0;2>x;){var y=x++,z=(632260*e-126452*w)*b+126452*y;c.push({b:(284517*h-94839*e)*b/z,a:((838422*e+769860*w+731718*h)*a*b-769860*y*a)/z})}}return c}
function m(a){a=f(a);for(var c=Infinity,b=0;b<a.length;){var d=a[b];++b;c=Math.min(c,Math.abs(d.a)/Math.sqrt(Math.pow(d.b,2)+1))}return c}
function n(a,c){c=c/360*Math.PI*2;a=f(a);for(var b=Infinity,d=0;d<a.length;){var e=a[d];++d;e=e.a/(Math.sin(c)-e.b*Math.cos(c));0<=e&&(b=Math.min(b,e))}return b}
Expand All @@ -41,8 +40,7 @@ def _get_hsluv2rgb():
// hsluvToRgb:Q, hpluvToRgb:S
function hsluv2rgb(h, s, l) {return Q([h, s, l]);}
"""
)
""")
return hsluv2rgb


Expand Down
1 change: 0 additions & 1 deletion timetagger/images/_update_icons.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# import imageio
import webruntime


sizes = 16, 32, 48, 64, 128, 256

icon = webruntime.util.icon.Icon()
Expand Down
1 change: 0 additions & 1 deletion timetagger/server/_apiserver.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

from timetagger import __version__


logger = logging.getLogger("asgineer")


Expand Down
1 change: 0 additions & 1 deletion timetagger/server/_assets.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
from . import _utils as utils
from .. import __version__


versionstring = "v" + __version__


Expand Down
1 change: 0 additions & 1 deletion timetagger/server/_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

from .. import config


# Init directory paths
ROOT_TT_DIR = os.path.expanduser(config.datadir)
ROOT_USER_DIR = os.path.join(ROOT_TT_DIR, "users")
Expand Down