diff --git a/qt/aqt/preferences.py b/qt/aqt/preferences.py index 5b7337a62..60aba18bb 100644 --- a/qt/aqt/preferences.py +++ b/qt/aqt/preferences.py @@ -221,7 +221,6 @@ class Preferences(QDialog): self.form.check_for_updates.setChecked(self.mw.pm.check_for_updates()) qconnect(self.form.check_for_updates.stateChanged, self.mw.pm.set_update_check) - self.update_login_status() qconnect(self.form.syncLogout.clicked, self.sync_logout) qconnect(self.form.syncLogin.clicked, self.sync_login) @@ -359,8 +358,6 @@ class Preferences(QDialog): self.form.theme.setCurrentIndex(self.mw.pm.theme().value) qconnect(self.form.theme.currentIndexChanged, self.on_theme_changed) - - self.form.styleComboBox.addItems(["Anki"] + (["Native"] if not is_win else [])) self.form.styleComboBox.setCurrentIndex(self.mw.pm.get_widget_style()) qconnect( @@ -372,7 +369,9 @@ class Preferences(QDialog): qconnect(self.form.resetWindowSizes.clicked, self.on_reset_window_sizes) self.form.color_blind.setChecked(self.mw.pm.color_blind()) - qconnect(self.form.color_blind.stateChanged, self.on_color_blind_checkbox_changed) + qconnect( + self.form.color_blind.stateChanged, self.on_color_blind_checkbox_changed + ) self.setup_language() self.setup_video_driver() @@ -387,7 +386,6 @@ class Preferences(QDialog): # checkbox is unchecked self.mw.pm.set_color_blind(False) - def update_global(self) -> None: restart_required = False diff --git a/qt/aqt/stats.py b/qt/aqt/stats.py index e080c18d4..4416bb988 100644 --- a/qt/aqt/stats.py +++ b/qt/aqt/stats.py @@ -151,7 +151,6 @@ class NewDeckStats(QDialog): self.form.web.load_sveltekit_page("graphs") - class DeckStats(QDialog): """Legacy deck stats, used by some add-ons.""" diff --git a/ts/routes/graphs/added.ts b/ts/routes/graphs/added.ts index 26623a7ed..d11ce24b9 100644 --- a/ts/routes/graphs/added.ts +++ b/ts/routes/graphs/added.ts @@ -85,7 +85,7 @@ export function buildHistogram( const isColourBlindMode = (window as any).colorBlindMode; // Changing color based on mode - if(isColourBlindMode){ + if (isColourBlindMode) { adjustedRange = scaleLinear().range([0.3, 0.7]); colourScale = scaleSequential((n) => interpolateViridis(adjustedRange(n)!)).domain([xMax!, xMin!]); } else { diff --git a/ts/routes/graphs/buttons.ts b/ts/routes/graphs/buttons.ts index e67092d55..1af54e33b 100644 --- a/ts/routes/graphs/buttons.ts +++ b/ts/routes/graphs/buttons.ts @@ -21,7 +21,7 @@ import { sum, } from "d3"; -import {type GraphBounds } from "./graph-helpers"; +import { type GraphBounds } from "./graph-helpers"; import { GraphRange } from "./graph-helpers"; import { setDataAvailable } from "./graph-helpers"; import { hideTooltip, showTooltip } from "./tooltip-utils.svelte"; @@ -167,7 +167,7 @@ export function renderButtons( let colour; // Changing color based on mode - if(isColourBlindMode){ + if (isColourBlindMode) { colour = scaleSequential(interpolateViridis).domain([1, 4]); } else { colour = scaleSequential(interpolateRdYlGn).domain([1, 4]); diff --git a/ts/routes/graphs/calendar.ts b/ts/routes/graphs/calendar.ts index 5b5091cb2..f8048c7af 100644 --- a/ts/routes/graphs/calendar.ts +++ b/ts/routes/graphs/calendar.ts @@ -10,6 +10,7 @@ import type { CountableTimeInterval } from "d3"; import { timeHour } from "d3"; import { interpolateBlues, + interpolateMagma, pointer, scaleLinear, scaleSequentialSqrt, @@ -20,7 +21,6 @@ import { timeSaturday, timeSunday, timeYear, - interpolateMagma } from "d3"; import type { GraphBounds, SearchDispatch } from "./graph-helpers"; @@ -137,21 +137,20 @@ export function renderCalendar( } } const data = Array.from(dayMap.values()); - const cappedRange = scaleLinear().range([1,0]); + const cappedRange = scaleLinear().range([1, 0]); const isColorBlindMode = (window as any).colorBlindMode; - let gradient; if (isColorBlindMode) { gradient = scaleSequentialSqrt() - .domain([0, maxCount]) - .interpolator((n) => interpolateMagma(cappedRange(n)!)); - } else { + .domain([0, maxCount]) + .interpolator((n) => interpolateMagma(cappedRange(n)!)); + } else { gradient = scaleSequentialSqrt() - .domain([0, maxCount]) - .interpolator((n) => interpolateBlues(cappedRange(n)!)); + .domain([0, maxCount]) + .interpolator((n) => interpolateBlues(cappedRange(n)!)); } function tooltipText(d: DayDatum): string { diff --git a/ts/routes/graphs/card-counts.ts b/ts/routes/graphs/card-counts.ts index 2207f78f5..157ab3356 100644 --- a/ts/routes/graphs/card-counts.ts +++ b/ts/routes/graphs/card-counts.ts @@ -33,28 +33,25 @@ export interface GraphData { let barColours; -if((window as any).colorBlindMode) -{ +if ((window as any).colorBlindMode) { barColours = [ - colorBlindColors.new, /* new */ - colorBlindColors.learn, /* learn */ - colorBlindColors.relearn, /* relearn */ - colorBlindColors.young, /* young */ - colorBlindColors.mature, /* mature */ - colorBlindColors.suspended, /* suspended */ - colorBlindColors.buried, /* buried */ + colorBlindColors.new, /* new */ + colorBlindColors.learn, /* learn */ + colorBlindColors.relearn, /* relearn */ + colorBlindColors.young, /* young */ + colorBlindColors.mature, /* mature */ + colorBlindColors.suspended, /* suspended */ + colorBlindColors.buried, /* buried */ ]; -} -else -{ +} else { barColours = [ - schemeBlues[5][2], /* new */ - schemeOranges[5][2], /* learn */ - schemeReds[5][2], /* relearn */ - schemeGreens[5][2], /* young */ - schemeGreens[5][3], /* mature */ - "#FFDC41", /* suspended */ - "#grey", /* buried */ + schemeBlues[5][2], /* new */ + schemeOranges[5][2], /* learn */ + schemeReds[5][2], /* relearn */ + schemeGreens[5][2], /* young */ + schemeGreens[5][3], /* mature */ + "#FFDC41", /* suspended */ + "#grey", /* buried */ ]; } diff --git a/ts/routes/graphs/ease.ts b/ts/routes/graphs/ease.ts index 0a9418c59..446c780ea 100644 --- a/ts/routes/graphs/ease.ts +++ b/ts/routes/graphs/ease.ts @@ -84,15 +84,11 @@ export function prepareData( .thresholds(ticks)(allEases.entries() as any); const total = sum(bins as any, getNumericMapBinValue); - let colourScale; - if ((window as any).colorBlindMode) - { + if ((window as any).colorBlindMode) { colourScale = scaleSequential(interpolateViridis).domain([xMin, 300]); - } - else - { + } else { colourScale = scaleSequential(interpolateRdYlGn).domain([xMin, 300]); } diff --git a/ts/routes/graphs/future-due.ts b/ts/routes/graphs/future-due.ts index 061d9ca81..2b7b74862 100644 --- a/ts/routes/graphs/future-due.ts +++ b/ts/routes/graphs/future-due.ts @@ -10,7 +10,7 @@ import * as tr from "@generated/ftl"; import { localizedNumber } from "@tslib/i18n"; import { dayLabel } from "@tslib/time"; import type { Bin } from "d3"; -import { bin, extent, interpolateGreens, scaleLinear, scaleSequential, sum, interpolateViridis} from "d3"; +import { bin, extent, interpolateGreens, interpolateViridis, scaleLinear, scaleSequential, sum } from "d3"; import type { SearchDispatch, TableDatum } from "./graph-helpers"; import { getNumericMapBinValue, GraphRange, numericMap } from "./graph-helpers"; @@ -108,14 +108,14 @@ export function buildHistogram( } const xTickFormat = (n: number): string => localizedNumber(n); - + let adjustedRange = scaleLinear().range([0.0, 1]); const isColorBlindMode = (window as any).colorBlindMode; let colourScale; - if(isColorBlindMode) { + if (isColorBlindMode) { colourScale = scaleSequential((n) => interpolateViridis(adjustedRange(n)!)).domain([xMin!, xMax!]); adjustedRange = scaleLinear().range([0.0, 1]); } else { @@ -123,11 +123,8 @@ export function buildHistogram( adjustedRange = scaleLinear().range([0.7, 0.3]); } - const total = sum(bins as any, getNumericMapBinValue); - - function hoverText( bin: Bin, cumulative: number, @@ -142,9 +139,6 @@ export function buildHistogram( return `${days}:
${cards}
${totalLabel}: ${localizedNumber(cumulative)}`; } - - - function onClick(bin: Bin): void { const start = bin.x0!; // x1 in last bin is inclusive diff --git a/ts/routes/graphs/graph-helpers.ts b/ts/routes/graphs/graph-helpers.ts index 5e665f1c3..148b2843b 100644 --- a/ts/routes/graphs/graph-helpers.ts +++ b/ts/routes/graphs/graph-helpers.ts @@ -117,5 +117,5 @@ export const colorBlindColors = { mature: "#882255", suspended: "#DDCC77", buried: "#332288", - filtered: "#AA4499" + filtered: "#AA4499", }; diff --git a/ts/routes/graphs/hours.ts b/ts/routes/graphs/hours.ts index 23f04c765..9c9e57a27 100644 --- a/ts/routes/graphs/hours.ts +++ b/ts/routes/graphs/hours.ts @@ -88,7 +88,7 @@ export function renderHours( let colour; const isColorBlindMode = (window as any).colorBlindMode; - if(isColorBlindMode) { + if (isColorBlindMode) { cappedRange = scaleLinear().range([0.0, 1]); colour = scaleSequential((n) => interpolateViridis(cappedRange(n)!)).domain([ 0, diff --git a/ts/routes/graphs/intervals.ts b/ts/routes/graphs/intervals.ts index f3f1fa653..ad5121163 100644 --- a/ts/routes/graphs/intervals.ts +++ b/ts/routes/graphs/intervals.ts @@ -150,13 +150,10 @@ export function prepareIntervalData( let adjustedRange; let colourScale; - if ((window as any).colorBlindMode) - { + if ((window as any).colorBlindMode) { adjustedRange = scaleLinear().range([0.3, 0.7]); colourScale = scaleSequential((n) => interpolateViridis(adjustedRange(n)!)).domain([xMax!, xMin!]); - } - else - { + } else { adjustedRange = scaleLinear().range([0.7, 0.3]); colourScale = scaleSequential((n) => interpolateBlues(adjustedRange(n)!)).domain([xMax!, xMin!]); } diff --git a/ts/routes/graphs/reviews.ts b/ts/routes/graphs/reviews.ts index e296b5402..b1cd04ab3 100644 --- a/ts/routes/graphs/reviews.ts +++ b/ts/routes/graphs/reviews.ts @@ -16,8 +16,10 @@ import { axisLeft, axisRight, bin, + color, cumsum, curveBasis, + hsl, interpolateBlues, interpolateGreens, interpolatePurples, @@ -30,8 +32,6 @@ import { scaleSequential, select, sum, - color, - hsl } from "d3"; import { colorBlindColors, type GraphBounds, type TableDatum } from "./graph-helpers"; @@ -193,10 +193,9 @@ export function renderReviews( const colorBlindMode = (window as any).colorBlindMode; - function makeColorBlindGradient(baseHex: string, satAdjust = 0.02, lightAdjust = 0.02) { const base = color(baseHex); - if (!base) {throw new Error(`Invalid color: ${baseHex}`)}; + if (!base) { throw new Error(`Invalid color: ${baseHex}`); } const lighter = hsl(base); lighter.s = Math.min(1, lighter.s + satAdjust); @@ -216,7 +215,7 @@ export function renderReviews( young: makeColorBlindGradient(colorBlindColors.young), suspended: makeColorBlindGradient(colorBlindColors.suspended), buried: makeColorBlindGradient(colorBlindColors.buried), - filtered: makeColorBlindGradient(colorBlindColors.filtered) + filtered: makeColorBlindGradient(colorBlindColors.filtered), }; Object.values(colorBlindScales).forEach(scale => scale.domain(x.domain() as any)); @@ -236,7 +235,6 @@ export function renderReviews( } } - function valueLabel(n: number): string { if (showTime) { return timeSpan(n / 1000, false, true, TimespanUnit.Hours);