[autofix.ci] apply automated fixes

This commit is contained in:
autofix-ci[bot] 2025-02-16 11:28:39 +00:00 committed by Simon Hausmann
parent 7d2905e02c
commit 650e0ef775
3 changed files with 55 additions and 28 deletions

View file

@ -25,7 +25,7 @@ import json
# The full version, including alpha/beta/rc tags # The full version, including alpha/beta/rc tags
version = "1.10.0" version = "1.10.0"
project = f'Slint {version} C++ API' project = f"Slint {version} C++ API"
copyright = "SixtyFPS GmbH" copyright = "SixtyFPS GmbH"
author = "Slint Developers <info@slint.dev>" author = "Slint Developers <info@slint.dev>"
@ -36,8 +36,13 @@ cpp_index_common_prefix = ["slint::", "slint::interpreter::"]
# Add any Sphinx extension module names here, as strings. They can be # Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones. # ones.
extensions = ["breathe", "myst_parser", "exhale", extensions = [
"sphinx_markdown_tables", "sphinxcontrib.jquery"] "breathe",
"myst_parser",
"exhale",
"sphinx_markdown_tables",
"sphinxcontrib.jquery",
]
breathe_projects = {"Slint": "./docs/xml"} breathe_projects = {"Slint": "./docs/xml"}
breathe_default_project = "Slint" breathe_default_project = "Slint"
@ -109,23 +114,32 @@ html_show_sourcelink = False
html_logo = "https://slint.dev/logo/slint-logo-small-light.svg" html_logo = "https://slint.dev/logo/slint-logo-small-light.svg"
myst_enable_extensions = [ myst_enable_extensions = ["html_image", "colon_fence", "substitution"]
"html_image", "colon_fence", "substitution"
]
# Annotate h1/h2 elements with anchors # Annotate h1/h2 elements with anchors
myst_heading_anchors = 2 myst_heading_anchors = 2
myst_url_schemes = { myst_url_schemes = {
"slint-reference": f"https://slint.dev/releases/{version}/docs/slint/{{{{path}}}}", "slint-reference": f"https://slint.dev/releases/{version}/docs/slint/{{{{path}}}}",
'http': None, 'https': None, 'mailto': None, "http": None,
"https": None,
"mailto": None,
} }
rst_epilog = "" rst_epilog = ""
myst_substitutions = {} myst_substitutions = {}
with open(os.path.join(os.path.dirname(__file__), "..", "..", "internal", "core-macros", "link-data.json")) as link_data: with open(
os.path.join(
os.path.dirname(__file__),
"..",
"..",
"internal",
"core-macros",
"link-data.json",
)
) as link_data:
links = json.load(link_data) links = json.load(link_data)
for key in links.keys(): for key in links.keys():
@ -135,5 +149,6 @@ for key in links.keys():
rst_epilog += f".. |{key}| replace:: :code:`{key}`\n" rst_epilog += f".. |{key}| replace:: :code:`{key}`\n"
rst_epilog += f".. _{key}: {url}\n" rst_epilog += f".. _{key}: {url}\n"
def setup(app): def setup(app):
app.add_css_file("theme_tweak.css") app.add_css_file("theme_tweak.css")

View file

@ -7,6 +7,7 @@ from datetime import timedelta, datetime
import os import os
import copy import copy
import sys import sys
sys.path.append(os.path.join(os.path.dirname(__file__), "..")) sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
PrinterQueueItem = slint.loader.ui.printerdemo.PrinterQueueItem PrinterQueueItem = slint.loader.ui.printerdemo.PrinterQueueItem
@ -15,18 +16,21 @@ PrinterQueueItem = slint.loader.ui.printerdemo.PrinterQueueItem
class MainWindow(slint.loader.ui.printerdemo.MainWindow): class MainWindow(slint.loader.ui.printerdemo.MainWindow):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
self.ink_levels = ListModel([ self.ink_levels = ListModel(
{"color": Color("#0ff"), "level": 0.4}, [
{"color": Color("#ff0"), "level": 0.2}, {"color": Color("#0ff"), "level": 0.4},
{"color": Color("#f0f"), "level": 0.5}, {"color": Color("#ff0"), "level": 0.2},
{"color": Color("#000"), "level": 0.8}, {"color": Color("#f0f"), "level": 0.5},
]) {"color": Color("#000"), "level": 0.8},
]
)
# Copy the read-only mock data from the UI into a mutable ListModel # Copy the read-only mock data from the UI into a mutable ListModel
self.printer_queue = ListModel(self.PrinterQueue.printer_queue) self.printer_queue = ListModel(self.PrinterQueue.printer_queue)
self.PrinterQueue.printer_queue = self.printer_queue self.PrinterQueue.printer_queue = self.printer_queue
self.print_progress_timer = Timer() self.print_progress_timer = Timer()
self.print_progress_timer.start( self.print_progress_timer.start(
TimerMode.Repeated, timedelta(seconds=1), self.update_jobs) TimerMode.Repeated, timedelta(seconds=1), self.update_jobs
)
@slint.callback @slint.callback
def quit(self): def quit(self):
@ -34,15 +38,17 @@ class MainWindow(slint.loader.ui.printerdemo.MainWindow):
@slint.callback(global_name="PrinterQueue", name="start_job") @slint.callback(global_name="PrinterQueue", name="start_job")
def push_job(self, title): def push_job(self, title):
self.printer_queue.append(PrinterQueueItem( self.printer_queue.append(
status="waiting", PrinterQueueItem(
progress=0, status="waiting",
title=title, progress=0,
owner="Me", title=title,
pages=1, owner="Me",
size="100kB", pages=1,
submission_date=str(datetime.now()), size="100kB",
)) submission_date=str(datetime.now()),
)
)
@slint.callback(global_name="PrinterQueue") @slint.callback(global_name="PrinterQueue")
def cancel_job(self, index): def cancel_job(self, index):

View file

@ -15,15 +15,21 @@ class MainWindow(slint.loader.memory.MainWindow):
def __init__(self): def __init__(self):
super().__init__() super().__init__()
initial_tiles = self.memory_tiles initial_tiles = self.memory_tiles
tiles = ListModel(itertools.chain( tiles = ListModel(
map(copy.copy, initial_tiles), map(copy.copy, initial_tiles))) itertools.chain(
map(copy.copy, initial_tiles), map(copy.copy, initial_tiles)
)
)
random.shuffle(tiles) random.shuffle(tiles)
self.memory_tiles = tiles self.memory_tiles = tiles
@slint.callback @slint.callback
def check_if_pair_solved(self): def check_if_pair_solved(self):
flipped_tiles = [(index, copy.copy(tile)) for index, tile in enumerate( flipped_tiles = [
self.memory_tiles) if tile.image_visible and not tile.solved] (index, copy.copy(tile))
for index, tile in enumerate(self.memory_tiles)
if tile.image_visible and not tile.solved
]
if len(flipped_tiles) == 2: if len(flipped_tiles) == 2:
tile1_index, tile1 = flipped_tiles[0] tile1_index, tile1 = flipped_tiles[0]
tile2_index, tile2 = flipped_tiles[1] tile2_index, tile2 = flipped_tiles[1]