mirror of
https://github.com/slint-ui/slint.git
synced 2025-07-23 04:55:28 +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
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue