mirror of
https://github.com/slint-ui/slint.git
synced 2025-08-04 18:58:36 +00:00
[autofix.ci] apply automated fixes
This commit is contained in:
parent
7d2905e02c
commit
650e0ef775
3 changed files with 55 additions and 28 deletions
|
@ -25,7 +25,7 @@ import json
|
|||
# The full version, including alpha/beta/rc tags
|
||||
version = "1.10.0"
|
||||
|
||||
project = f'Slint {version} C++ API'
|
||||
project = f"Slint {version} C++ API"
|
||||
copyright = "SixtyFPS GmbH"
|
||||
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
|
||||
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
|
||||
# ones.
|
||||
extensions = ["breathe", "myst_parser", "exhale",
|
||||
"sphinx_markdown_tables", "sphinxcontrib.jquery"]
|
||||
extensions = [
|
||||
"breathe",
|
||||
"myst_parser",
|
||||
"exhale",
|
||||
"sphinx_markdown_tables",
|
||||
"sphinxcontrib.jquery",
|
||||
]
|
||||
|
||||
breathe_projects = {"Slint": "./docs/xml"}
|
||||
breathe_default_project = "Slint"
|
||||
|
@ -109,23 +114,32 @@ html_show_sourcelink = False
|
|||
|
||||
html_logo = "https://slint.dev/logo/slint-logo-small-light.svg"
|
||||
|
||||
myst_enable_extensions = [
|
||||
"html_image", "colon_fence", "substitution"
|
||||
]
|
||||
myst_enable_extensions = ["html_image", "colon_fence", "substitution"]
|
||||
|
||||
# Annotate h1/h2 elements with anchors
|
||||
myst_heading_anchors = 2
|
||||
|
||||
myst_url_schemes = {
|
||||
"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 = ""
|
||||
|
||||
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)
|
||||
|
||||
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}: {url}\n"
|
||||
|
||||
|
||||
def setup(app):
|
||||
app.add_css_file("theme_tweak.css")
|
||||
|
|
|
@ -7,6 +7,7 @@ from datetime import timedelta, datetime
|
|||
import os
|
||||
import copy
|
||||
import sys
|
||||
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))
|
||||
|
||||
PrinterQueueItem = slint.loader.ui.printerdemo.PrinterQueueItem
|
||||
|
@ -15,18 +16,21 @@ PrinterQueueItem = slint.loader.ui.printerdemo.PrinterQueueItem
|
|||
class MainWindow(slint.loader.ui.printerdemo.MainWindow):
|
||||
def __init__(self):
|
||||
super().__init__()
|
||||
self.ink_levels = ListModel([
|
||||
{"color": Color("#0ff"), "level": 0.4},
|
||||
{"color": Color("#ff0"), "level": 0.2},
|
||||
{"color": Color("#f0f"), "level": 0.5},
|
||||
{"color": Color("#000"), "level": 0.8},
|
||||
])
|
||||
self.ink_levels = ListModel(
|
||||
[
|
||||
{"color": Color("#0ff"), "level": 0.4},
|
||||
{"color": Color("#ff0"), "level": 0.2},
|
||||
{"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
|
||||
self.printer_queue = ListModel(self.PrinterQueue.printer_queue)
|
||||
self.PrinterQueue.printer_queue = self.printer_queue
|
||||
self.print_progress_timer = Timer()
|
||||
self.print_progress_timer.start(
|
||||
TimerMode.Repeated, timedelta(seconds=1), self.update_jobs)
|
||||
TimerMode.Repeated, timedelta(seconds=1), self.update_jobs
|
||||
)
|
||||
|
||||
@slint.callback
|
||||
def quit(self):
|
||||
|
@ -34,15 +38,17 @@ class MainWindow(slint.loader.ui.printerdemo.MainWindow):
|
|||
|
||||
@slint.callback(global_name="PrinterQueue", name="start_job")
|
||||
def push_job(self, title):
|
||||
self.printer_queue.append(PrinterQueueItem(
|
||||
status="waiting",
|
||||
progress=0,
|
||||
title=title,
|
||||
owner="Me",
|
||||
pages=1,
|
||||
size="100kB",
|
||||
submission_date=str(datetime.now()),
|
||||
))
|
||||
self.printer_queue.append(
|
||||
PrinterQueueItem(
|
||||
status="waiting",
|
||||
progress=0,
|
||||
title=title,
|
||||
owner="Me",
|
||||
pages=1,
|
||||
size="100kB",
|
||||
submission_date=str(datetime.now()),
|
||||
)
|
||||
)
|
||||
|
||||
@slint.callback(global_name="PrinterQueue")
|
||||
def cancel_job(self, index):
|
||||
|
|
|
@ -15,15 +15,21 @@ class MainWindow(slint.loader.memory.MainWindow):
|
|||
def __init__(self):
|
||||
super().__init__()
|
||||
initial_tiles = self.memory_tiles
|
||||
tiles = ListModel(itertools.chain(
|
||||
map(copy.copy, initial_tiles), map(copy.copy, initial_tiles)))
|
||||
tiles = ListModel(
|
||||
itertools.chain(
|
||||
map(copy.copy, initial_tiles), map(copy.copy, initial_tiles)
|
||||
)
|
||||
)
|
||||
random.shuffle(tiles)
|
||||
self.memory_tiles = tiles
|
||||
|
||||
@slint.callback
|
||||
def check_if_pair_solved(self):
|
||||
flipped_tiles = [(index, copy.copy(tile)) for index, tile in enumerate(
|
||||
self.memory_tiles) if tile.image_visible and not tile.solved]
|
||||
flipped_tiles = [
|
||||
(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:
|
||||
tile1_index, tile1 = flipped_tiles[0]
|
||||
tile2_index, tile2 = flipped_tiles[1]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue