isort followed by black
All checks were successful
CI / test (push) Successful in 9m47s
Lint / test (push) Successful in 40s
Trivy / test (push) Successful in 22s

This commit is contained in:
Miguel Jacq 2025-12-11 14:03:08 +11:00
parent 0862ce7fd6
commit fb873edcb5
Signed by: mig5
GPG key ID: 59B3F0C24135C6A9
56 changed files with 311 additions and 360 deletions

View file

@ -3,19 +3,17 @@ from __future__ import annotations
import importlib.metadata
import requests
from PySide6.QtWidgets import (
QDialog,
QVBoxLayout,
QLabel,
QTextEdit,
QDialogButtonBox,
QLabel,
QMessageBox,
QTextEdit,
QVBoxLayout,
)
from . import strings
BUG_REPORT_HOST = "https://nr.mig5.net"
ROUTE = "forms/bouquin/bugs"

View file

@ -1,15 +1,14 @@
from __future__ import annotations
from PySide6.QtCore import QSize, QRect, Qt
from PySide6.QtGui import QPainter, QPalette, QColor, QFont, QFontMetrics
from PySide6.QtCore import QRect, QSize, Qt
from PySide6.QtGui import QColor, QFont, QFontMetrics, QPainter, QPalette
from PySide6.QtWidgets import (
QDialog,
QVBoxLayout,
QPlainTextEdit,
QDialogButtonBox,
QComboBox,
QDialog,
QDialogButtonBox,
QLabel,
QPlainTextEdit,
QVBoxLayout,
QWidget,
)

View file

@ -1,9 +1,9 @@
from __future__ import annotations
import re
from typing import Optional, Dict
from typing import Dict, Optional
from PySide6.QtGui import QColor, QTextCharFormat, QFont
from PySide6.QtGui import QColor, QFont, QTextCharFormat
class CodeHighlighter:

View file

@ -5,16 +5,15 @@ import datetime as _dt
import hashlib
import html
import json
import markdown
import mimetypes
import re
from dataclasses import dataclass
from pathlib import Path
from sqlcipher3 import dbapi2 as sqlite
from sqlcipher3 import Binary
from typing import List, Sequence, Tuple, Dict
from typing import Dict, List, Sequence, Tuple
import markdown
from sqlcipher3 import Binary
from sqlcipher3 import dbapi2 as sqlite
from . import strings

View file

@ -8,8 +8,8 @@ and TagBrowserDialog).
from __future__ import annotations
from pathlib import Path
import tempfile
from pathlib import Path
from typing import TYPE_CHECKING, Optional
from PySide6.QtCore import QUrl

View file

@ -5,32 +5,32 @@ from typing import Optional
from PySide6.QtCore import Qt
from PySide6.QtGui import QColor
from PySide6.QtWidgets import (
QDialog,
QVBoxLayout,
QHBoxLayout,
QFormLayout,
QComboBox,
QLineEdit,
QTableWidget,
QTableWidgetItem,
QAbstractItemView,
QHeaderView,
QPushButton,
QComboBox,
QDialog,
QFileDialog,
QMessageBox,
QWidget,
QFormLayout,
QFrame,
QToolButton,
QHBoxLayout,
QHeaderView,
QLineEdit,
QListWidget,
QListWidgetItem,
QMessageBox,
QPushButton,
QSizePolicy,
QStyle,
QTableWidget,
QTableWidgetItem,
QToolButton,
QVBoxLayout,
QWidget,
)
from . import strings
from .db import DBManager, DocumentRow
from .settings import load_db_config
from .time_log import TimeCodeManagerDialog
from . import strings
class TodaysDocumentsWidget(QFrame):

View file

@ -1,20 +1,15 @@
from __future__ import annotations
from PySide6.QtCore import Qt, Signal
from PySide6.QtGui import (
QShortcut,
QTextCursor,
QTextCharFormat,
QTextDocument,
)
from PySide6.QtGui import QShortcut, QTextCharFormat, QTextCursor, QTextDocument
from PySide6.QtWidgets import (
QWidget,
QHBoxLayout,
QLineEdit,
QLabel,
QPushButton,
QCheckBox,
QHBoxLayout,
QLabel,
QLineEdit,
QPushButton,
QTextEdit,
QWidget,
)
from . import strings

View file

@ -1,19 +1,22 @@
from __future__ import annotations
import difflib, re, html as _html
import difflib
import html as _html
import re
from datetime import datetime
from PySide6.QtCore import Qt, Slot
from PySide6.QtWidgets import (
QAbstractItemView,
QDialog,
QVBoxLayout,
QHBoxLayout,
QListWidget,
QListWidgetItem,
QPushButton,
QMessageBox,
QTextBrowser,
QPushButton,
QTabWidget,
QAbstractItemView,
QTextBrowser,
QVBoxLayout,
)
from . import strings

View file

@ -2,44 +2,39 @@ from __future__ import annotations
from dataclasses import dataclass
from enum import Enum
from sqlcipher3 import dbapi2 as sqlite3
from PySide6.QtCore import Qt, QDate, QUrl, Signal
from PySide6.QtGui import (
QImage,
QTextDocument,
QPageLayout,
QDesktopServices,
)
from PySide6.QtCore import QDate, Qt, QUrl, Signal
from PySide6.QtGui import QDesktopServices, QImage, QPageLayout, QTextDocument
from PySide6.QtPrintSupport import QPrinter
from PySide6.QtWidgets import (
QDialog,
QVBoxLayout,
QHBoxLayout,
QFormLayout,
QLabel,
QLineEdit,
QAbstractItemView,
QButtonGroup,
QCheckBox,
QComboBox,
QDateEdit,
QCheckBox,
QTextEdit,
QTableWidget,
QTableWidgetItem,
QAbstractItemView,
QHeaderView,
QPushButton,
QRadioButton,
QButtonGroup,
QDialog,
QDoubleSpinBox,
QFileDialog,
QFormLayout,
QHBoxLayout,
QHeaderView,
QLabel,
QLineEdit,
QMessageBox,
QPushButton,
QRadioButton,
QTableWidget,
QTableWidgetItem,
QTextEdit,
QVBoxLayout,
QWidget,
)
from sqlcipher3 import dbapi2 as sqlite3
from . import strings
from .db import DBManager, TimeLogRow
from .reminders import Reminder, ReminderType
from .settings import load_db_config
from . import strings
class InvoiceDetailMode(str, Enum):

View file

@ -4,13 +4,13 @@ from pathlib import Path
from PySide6.QtWidgets import (
QDialog,
QVBoxLayout,
QDialogButtonBox,
QFileDialog,
QHBoxLayout,
QLabel,
QLineEdit,
QPushButton,
QDialogButtonBox,
QFileDialog,
QVBoxLayout,
)
from . import strings

View file

@ -1,7 +1,7 @@
from __future__ import annotations
from PySide6.QtCore import Qt, QEvent
from PySide6.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton
from PySide6.QtCore import QEvent, Qt
from PySide6.QtWidgets import QLabel, QPushButton, QVBoxLayout, QWidget
from . import strings
from .theme import ThemeManager

View file

@ -2,13 +2,14 @@ from __future__ import annotations
import sys
from pathlib import Path
from PySide6.QtWidgets import QApplication
from PySide6.QtGui import QIcon
from .settings import APP_NAME, APP_ORG, get_settings
from .main_window import MainWindow
from .theme import Theme, ThemeConfig, ThemeManager
from PySide6.QtGui import QIcon
from PySide6.QtWidgets import QApplication
from . import strings
from .main_window import MainWindow
from .settings import APP_NAME, APP_ORG, get_settings
from .theme import Theme, ThemeConfig, ThemeManager
def main():

View file

@ -2,21 +2,21 @@ from __future__ import annotations
import datetime
import os
import sys
import re
import sys
from pathlib import Path
from PySide6.QtCore import (
QDate,
QTimer,
Qt,
QSettings,
Slot,
QUrl,
QEvent,
QSignalBlocker,
QDateTime,
QEvent,
QSettings,
QSignalBlocker,
Qt,
QTime,
QTimer,
QUrl,
Slot,
)
from PySide6.QtGui import (
QAction,
@ -31,23 +31,24 @@ from PySide6.QtGui import (
QTextListFormat,
)
from PySide6.QtWidgets import (
QApplication,
QCalendarWidget,
QDialog,
QFileDialog,
QLabel,
QMainWindow,
QMenu,
QMessageBox,
QPushButton,
QSizePolicy,
QSplitter,
QTableView,
QTabWidget,
QVBoxLayout,
QWidget,
QLabel,
QPushButton,
QApplication,
)
from . import strings
from .bug_report_dialog import BugReportDialog
from .db import DBManager
from .documents import DocumentsDialog, TodaysDocumentsWidget
@ -60,10 +61,9 @@ from .pomodoro_timer import PomodoroManager
from .reminders import UpcomingRemindersWidget
from .save_dialog import SaveDialog
from .search import Search
from .settings import APP_ORG, APP_NAME, load_db_config, save_db_config
from .settings import APP_NAME, APP_ORG, load_db_config, save_db_config
from .settings_dialog import SettingsDialog
from .statistics_dialog import StatisticsDialog
from . import strings
from .tags_widget import PageTagsWidget
from .theme import ThemeManager
from .time_log import TimeLogWidget

View file

@ -5,28 +5,28 @@ import re
from pathlib import Path
from typing import Optional, Tuple
from PySide6.QtCore import QRect, Qt, QTimer, QUrl
from PySide6.QtGui import (
QDesktopServices,
QFont,
QFontDatabase,
QFontMetrics,
QImage,
QMouseEvent,
QTextBlock,
QTextBlockFormat,
QTextCharFormat,
QTextCursor,
QTextDocument,
QTextFormat,
QTextBlockFormat,
QTextImageFormat,
QDesktopServices,
)
from PySide6.QtCore import Qt, QRect, QTimer, QUrl
from PySide6.QtWidgets import QDialog, QTextEdit
from .theme import ThemeManager
from .markdown_highlighter import MarkdownHighlighter
from .code_block_editor_dialog import CodeBlockEditorDialog
from . import strings
from .code_block_editor_dialog import CodeBlockEditorDialog
from .markdown_highlighter import MarkdownHighlighter
from .theme import ThemeManager
class MarkdownEditor(QTextEdit):

View file

@ -14,7 +14,7 @@ from PySide6.QtGui import (
QTextDocument,
)
from .theme import ThemeManager, Theme
from .theme import Theme, ThemeManager
class MarkdownHighlighter(QSyntaxHighlighter):

View file

@ -6,10 +6,10 @@ from typing import Optional
from PySide6.QtCore import Qt, QTimer, Signal, Slot
from PySide6.QtWidgets import (
QFrame,
QVBoxLayout,
QHBoxLayout,
QLabel,
QPushButton,
QVBoxLayout,
QWidget,
)

View file

@ -4,30 +4,30 @@ from dataclasses import dataclass
from enum import Enum
from typing import Optional
from PySide6.QtCore import Qt, QDate, QTime, QDateTime, QTimer, Slot, Signal
from PySide6.QtCore import QDate, QDateTime, Qt, QTime, QTimer, Signal, Slot
from PySide6.QtWidgets import (
QDialog,
QVBoxLayout,
QHBoxLayout,
QFormLayout,
QLineEdit,
QAbstractItemView,
QComboBox,
QTimeEdit,
QPushButton,
QDateEdit,
QDialog,
QFormLayout,
QFrame,
QWidget,
QToolButton,
QHBoxLayout,
QHeaderView,
QLineEdit,
QListWidget,
QListWidgetItem,
QStyle,
QSizePolicy,
QMessageBox,
QPushButton,
QSizePolicy,
QSpinBox,
QStyle,
QTableWidget,
QTableWidgetItem,
QAbstractItemView,
QHeaderView,
QSpinBox,
QDateEdit,
QTimeEdit,
QToolButton,
QVBoxLayout,
QWidget,
)
from . import strings
@ -566,8 +566,8 @@ class UpcomingRemindersWidget(QFrame):
if not selected_items:
return
from PySide6.QtWidgets import QMenu
from PySide6.QtGui import QAction
from PySide6.QtWidgets import QMenu
menu = QMenu(self)

View file

@ -3,13 +3,7 @@ from __future__ import annotations
import datetime
from PySide6.QtGui import QFontMetrics
from PySide6.QtWidgets import (
QDialog,
QVBoxLayout,
QLabel,
QLineEdit,
QDialogButtonBox,
)
from PySide6.QtWidgets import QDialog, QDialogButtonBox, QLabel, QLineEdit, QVBoxLayout
from . import strings

View file

@ -6,12 +6,12 @@ from typing import Iterable, Tuple
from PySide6.QtCore import Qt, Signal
from PySide6.QtWidgets import (
QFrame,
QHBoxLayout,
QLabel,
QLineEdit,
QListWidget,
QListWidgetItem,
QSizePolicy,
QHBoxLayout,
QVBoxLayout,
QWidget,
)

View file

@ -1,6 +1,7 @@
from __future__ import annotations
from pathlib import Path
from PySide6.QtCore import QSettings, QStandardPaths
from .db import DBConfig

View file

@ -2,38 +2,36 @@ from __future__ import annotations
from pathlib import Path
from PySide6.QtCore import Qt, Slot
from PySide6.QtGui import QPalette
from PySide6.QtWidgets import (
QCheckBox,
QComboBox,
QDialog,
QFrame,
QDialogButtonBox,
QFileDialog,
QFormLayout,
QFrame,
QGroupBox,
QHBoxLayout,
QLabel,
QLineEdit,
QFormLayout,
QHBoxLayout,
QVBoxLayout,
QMessageBox,
QPushButton,
QDialogButtonBox,
QRadioButton,
QSizePolicy,
QSpinBox,
QMessageBox,
QWidget,
QTabWidget,
QTextEdit,
QVBoxLayout,
QWidget,
)
from PySide6.QtCore import Qt, Slot
from PySide6.QtGui import QPalette
from .db import DBConfig, DBManager
from .settings import load_db_config, save_db_config
from .theme import Theme
from .key_prompt import KeyPrompt
from . import strings
from .db import DBConfig, DBManager
from .key_prompt import KeyPrompt
from .settings import load_db_config, save_db_config
from .theme import Theme
class SettingsDialog(QDialog):

View file

@ -3,26 +3,25 @@ from __future__ import annotations
import datetime as _dt
from typing import Dict
from PySide6.QtCore import Qt, QSize, Signal
from PySide6.QtGui import QColor, QPainter, QPen, QBrush
from PySide6.QtCore import QSize, Qt, Signal
from PySide6.QtGui import QBrush, QColor, QPainter, QPen
from PySide6.QtWidgets import (
QComboBox,
QDialog,
QVBoxLayout,
QFormLayout,
QLabel,
QGroupBox,
QHBoxLayout,
QComboBox,
QLabel,
QScrollArea,
QWidget,
QSizePolicy,
QVBoxLayout,
QWidget,
)
from . import strings
from .db import DBManager
from .settings import load_db_config
# ---------- Activity heatmap ----------

View file

@ -1,5 +1,5 @@
from importlib.resources import files
import json
from importlib.resources import files
# Get list of locales
root = files("bouquin") / "locales"

View file

@ -1,22 +1,22 @@
from PySide6.QtCore import Qt, Signal
from PySide6.QtGui import QColor
from PySide6.QtWidgets import (
QColorDialog,
QDialog,
QVBoxLayout,
QHBoxLayout,
QInputDialog,
QLabel,
QMessageBox,
QPushButton,
QTreeWidget,
QTreeWidgetItem,
QPushButton,
QLabel,
QColorDialog,
QMessageBox,
QInputDialog,
QVBoxLayout,
)
from sqlcipher3.dbapi2 import IntegrityError
from . import strings
from .db import DBManager
from .settings import load_db_config
from . import strings
from sqlcipher3.dbapi2 import IntegrityError
class TagBrowserDialog(QDialog):

View file

@ -4,16 +4,16 @@ from typing import Optional
from PySide6.QtCore import Qt, Signal
from PySide6.QtWidgets import (
QCompleter,
QFrame,
QHBoxLayout,
QVBoxLayout,
QWidget,
QToolButton,
QLabel,
QLineEdit,
QSizePolicy,
QStyle,
QCompleter,
QToolButton,
QVBoxLayout,
QWidget,
)
from . import strings

View file

@ -1,11 +1,13 @@
from __future__ import annotations
from dataclasses import dataclass
from enum import Enum
from PySide6.QtGui import QPalette, QColor, QGuiApplication, QTextCharFormat
from PySide6.QtWidgets import QApplication, QCalendarWidget, QWidget
from PySide6.QtCore import QObject, Signal, Qt
from weakref import WeakSet
from PySide6.QtCore import QObject, Qt, Signal
from PySide6.QtGui import QColor, QGuiApplication, QPalette, QTextCharFormat
from PySide6.QtWidgets import QApplication, QCalendarWidget, QWidget
class Theme(Enum):
SYSTEM = "system"

View file

@ -2,50 +2,49 @@ from __future__ import annotations
import csv
import html
from collections import defaultdict
from datetime import datetime
from sqlcipher3.dbapi2 import IntegrityError
from typing import Optional
from PySide6.QtCore import Qt, QDate, QUrl, Signal
from PySide6.QtGui import QPainter, QColor, QImage, QTextDocument, QPageLayout
from PySide6.QtCore import QDate, Qt, QUrl, Signal
from PySide6.QtGui import QColor, QImage, QPageLayout, QPainter, QTextDocument
from PySide6.QtPrintSupport import QPrinter
from PySide6.QtWidgets import (
QAbstractItemView,
QCalendarWidget,
QComboBox,
QCompleter,
QDateEdit,
QDialog,
QDialogButtonBox,
QFrame,
QVBoxLayout,
QHBoxLayout,
QWidget,
QDoubleSpinBox,
QFileDialog,
QFormLayout,
QLabel,
QComboBox,
QLineEdit,
QDoubleSpinBox,
QPushButton,
QTableWidget,
QTableWidgetItem,
QAbstractItemView,
QFrame,
QHBoxLayout,
QHeaderView,
QTabWidget,
QInputDialog,
QLabel,
QLineEdit,
QListWidget,
QListWidgetItem,
QDateEdit,
QMessageBox,
QCompleter,
QToolButton,
QPushButton,
QSizePolicy,
QStyle,
QInputDialog,
QTableWidget,
QTableWidgetItem,
QTabWidget,
QToolButton,
QVBoxLayout,
QWidget,
)
from sqlcipher3.dbapi2 import IntegrityError
from . import strings
from .db import DBManager
from .settings import load_db_config
from .theme import ThemeManager
from . import strings
class TimeLogWidget(QFrame):

View file

@ -1,7 +1,7 @@
from __future__ import annotations
from PySide6.QtCore import Signal, Qt
from PySide6.QtGui import QAction, QKeySequence, QFont, QFontDatabase, QActionGroup
from PySide6.QtCore import Qt, Signal
from PySide6.QtGui import QAction, QActionGroup, QFont, QFontDatabase, QKeySequence
from PySide6.QtWidgets import QToolBar
from . import strings

View file

@ -5,23 +5,17 @@ import os
import re
import subprocess # nosec
import tempfile
from importlib.resources import files
from pathlib import Path
import requests
from importlib.resources import files
from PySide6.QtCore import QStandardPaths, Qt
from PySide6.QtWidgets import (
QApplication,
QMessageBox,
QWidget,
QProgressDialog,
)
from PySide6.QtGui import QPixmap, QImage, QPainter, QGuiApplication
from PySide6.QtGui import QGuiApplication, QImage, QPainter, QPixmap
from PySide6.QtSvg import QSvgRenderer
from PySide6.QtWidgets import QApplication, QMessageBox, QProgressDialog, QWidget
from .settings import APP_NAME
from . import strings
from .settings import APP_NAME
# Where to fetch the latest version string from
VERSION_URL = "https://mig5.net/bouquin/version.txt"

View file

@ -106,7 +106,7 @@ def freeze_qt_time(monkeypatch):
QTime.currentTime().addSecs(3600) is still the same calendar day.
"""
import bouquin.main_window as _mwmod
from PySide6.QtCore import QDate, QTime, QDateTime
from PySide6.QtCore import QDate, QDateTime, QTime
today = QDate.currentDate()
fixed_time = QTime(12, 0)

View file

@ -1,8 +1,8 @@
import bouquin.bug_report_dialog as bugmod
from bouquin.bug_report_dialog import BugReportDialog
from bouquin import strings
from PySide6.QtWidgets import QMessageBox
from bouquin.bug_report_dialog import BugReportDialog
from PySide6.QtGui import QTextCursor
from PySide6.QtWidgets import QMessageBox
def test_bug_report_truncates_text_to_max_chars(qtbot):

View file

@ -1,13 +1,11 @@
from PySide6.QtWidgets import QPushButton
from bouquin import strings
from PySide6.QtCore import QRect, QSize
from PySide6.QtGui import QPaintEvent, QFont
from bouquin.code_block_editor_dialog import (
CodeBlockEditorDialog,
CodeEditorWithLineNumbers,
)
from PySide6.QtCore import QRect, QSize
from PySide6.QtGui import QFont, QPaintEvent
from PySide6.QtWidgets import QPushButton
def _find_button_by_text(widget, text):

View file

@ -1,5 +1,5 @@
from bouquin.code_highlighter import CodeHighlighter, CodeBlockMetadata
from PySide6.QtGui import QTextCharFormat, QFont
from bouquin.code_highlighter import CodeBlockMetadata, CodeHighlighter
from PySide6.QtGui import QFont, QTextCharFormat
def test_get_language_patterns_python(app):

View file

@ -1,10 +1,12 @@
import pytest
import json, csv
import csv
import datetime as dt
from sqlcipher3 import dbapi2 as sqlite
from bouquin.db import DBManager
import json
from datetime import date, timedelta
import pytest
from bouquin.db import DBManager
from sqlcipher3 import dbapi2 as sqlite
def _today():
return dt.date.today().isoformat()

View file

@ -1,10 +1,10 @@
from unittest.mock import patch
from pathlib import Path
import tempfile
from pathlib import Path
from unittest.mock import patch
from PySide6.QtCore import QUrl
from PySide6.QtWidgets import QMessageBox, QWidget
from PySide6.QtGui import QDesktopServices
from PySide6.QtWidgets import QMessageBox, QWidget
def test_open_document_from_db_success(qtbot, app, fresh_db):

View file

@ -1,13 +1,12 @@
from unittest.mock import patch, MagicMock
from pathlib import Path
import tempfile
from pathlib import Path
from unittest.mock import MagicMock, patch
from bouquin.db import DBConfig
from bouquin.documents import TodaysDocumentsWidget, DocumentsDialog
from bouquin.documents import DocumentsDialog, TodaysDocumentsWidget
from PySide6.QtCore import Qt, QUrl
from PySide6.QtWidgets import QMessageBox, QDialog, QFileDialog
from PySide6.QtGui import QDesktopServices
from PySide6.QtWidgets import QDialog, QFileDialog, QMessageBox
# =============================================================================
# TodaysDocumentsWidget Tests

View file

@ -1,10 +1,9 @@
import pytest
from bouquin.find_bar import FindBar
from bouquin.markdown_editor import MarkdownEditor
from bouquin.theme import Theme, ThemeConfig, ThemeManager
from PySide6.QtGui import QTextCursor
from PySide6.QtWidgets import QTextEdit, QWidget
from bouquin.markdown_editor import MarkdownEditor
from bouquin.theme import ThemeManager, ThemeConfig, Theme
from bouquin.find_bar import FindBar
@pytest.fixture

View file

@ -1,7 +1,6 @@
from PySide6.QtWidgets import QWidget, QMessageBox, QApplication
from PySide6.QtCore import Qt, QTimer
from bouquin.history_dialog import HistoryDialog
from PySide6.QtCore import Qt, QTimer
from PySide6.QtWidgets import QApplication, QMessageBox, QWidget
def test_history_dialog_lists_and_revert(qtbot, fresh_db):

View file

@ -1,19 +1,17 @@
import pytest
from datetime import date, timedelta
from PySide6.QtCore import Qt, QDate
from PySide6.QtWidgets import QMessageBox
import pytest
from bouquin.invoices import (
InvoiceDetailMode,
InvoiceLineItem,
_invoice_due_reminder_text,
InvoiceDialog,
InvoicesDialog,
_INVOICE_REMINDER_TIME,
InvoiceDetailMode,
InvoiceDialog,
InvoiceLineItem,
InvoicesDialog,
_invoice_due_reminder_text,
)
from bouquin.reminders import Reminder, ReminderType
from PySide6.QtCore import QDate, Qt
from PySide6.QtWidgets import QMessageBox
# ============================================================================
# Tests for InvoiceDetailMode enum

View file

@ -1,5 +1,4 @@
from bouquin.key_prompt import KeyPrompt
from PySide6.QtCore import QTimer
from PySide6.QtWidgets import QFileDialog, QLineEdit

View file

@ -1,7 +1,7 @@
from bouquin.lock_overlay import LockOverlay
from bouquin.theme import Theme, ThemeConfig, ThemeManager
from PySide6.QtCore import QEvent
from PySide6.QtWidgets import QWidget
from bouquin.lock_overlay import LockOverlay
from bouquin.theme import ThemeManager, ThemeConfig, Theme
def test_lock_overlay_reacts_to_theme(app, qtbot):

View file

@ -1,5 +1,6 @@
import importlib
import runpy
import pytest

View file

@ -1,22 +1,19 @@
import pytest
import importlib.metadata
from datetime import date, timedelta
from pathlib import Path
import bouquin.main_window as mwmod
from bouquin.main_window import MainWindow
from bouquin.theme import Theme, ThemeConfig, ThemeManager
from bouquin.settings import get_settings
from bouquin.key_prompt import KeyPrompt
from bouquin.db import DBConfig, DBManager
from PySide6.QtCore import QEvent, QDate, QTimer, Qt, QPoint, QRect
from PySide6.QtWidgets import QTableView, QApplication, QWidget, QMessageBox, QDialog
from PySide6.QtGui import QMouseEvent, QKeyEvent, QTextCursor, QCloseEvent
from unittest.mock import Mock, patch
import bouquin.main_window as mwmod
import bouquin.version_check as version_check
import pytest
from bouquin.db import DBConfig, DBManager
from bouquin.key_prompt import KeyPrompt
from bouquin.main_window import MainWindow
from bouquin.settings import get_settings
from bouquin.theme import Theme, ThemeConfig, ThemeManager
from PySide6.QtCore import QDate, QEvent, QPoint, QRect, Qt, QTimer
from PySide6.QtGui import QCloseEvent, QKeyEvent, QMouseEvent, QTextCursor
from PySide6.QtWidgets import QApplication, QDialog, QMessageBox, QTableView, QWidget
def test_main_window_loads_and_saves(qtbot, app, tmp_db_cfg, fresh_db):

View file

@ -1,21 +1,20 @@
import base64
import pytest
from PySide6.QtCore import Qt, QPoint, QMimeData, QUrl
from PySide6.QtGui import (
QImage,
QColor,
QKeyEvent,
QTextCursor,
QTextDocument,
QFont,
QTextCharFormat,
)
from PySide6.QtWidgets import QApplication, QTextEdit
from bouquin.markdown_editor import MarkdownEditor
from bouquin.markdown_highlighter import MarkdownHighlighter
from bouquin.theme import ThemeManager, ThemeConfig, Theme
from bouquin.theme import Theme, ThemeConfig, ThemeManager
from PySide6.QtCore import QMimeData, QPoint, Qt, QUrl
from PySide6.QtGui import (
QColor,
QFont,
QImage,
QKeyEvent,
QTextCharFormat,
QTextCursor,
QTextDocument,
)
from PySide6.QtWidgets import QApplication, QTextEdit
def _today():

View file

@ -4,19 +4,18 @@ These tests should be added to test_markdown_editor.py.
"""
import pytest
from PySide6.QtCore import Qt, QPoint
from bouquin.markdown_editor import MarkdownEditor
from bouquin.theme import Theme, ThemeConfig, ThemeManager
from PySide6.QtCore import QPoint, Qt
from PySide6.QtGui import (
QImage,
QColor,
QImage,
QKeyEvent,
QMouseEvent,
QTextCursor,
QTextDocument,
QMouseEvent,
)
from bouquin.markdown_editor import MarkdownEditor
from bouquin.theme import ThemeManager, ThemeConfig, Theme
def text(editor) -> str:
return editor.toPlainText()
@ -145,8 +144,8 @@ def test_edit_code_block_checks_document(app, qtbot):
def test_edit_code_block_dialog_cancelled(editor, qtbot, monkeypatch):
"""Test _edit_code_block when dialog is cancelled."""
from PySide6.QtWidgets import QDialog
import bouquin.markdown_editor as markdown_editor
from PySide6.QtWidgets import QDialog
class CancelledDialog:
def __init__(self, code, language, parent=None, allow_delete=False):
@ -175,8 +174,8 @@ def test_edit_code_block_dialog_cancelled(editor, qtbot, monkeypatch):
def test_edit_code_block_with_delete(editor, qtbot, monkeypatch):
"""Test _edit_code_block when user deletes the block."""
from PySide6.QtWidgets import QDialog
import bouquin.markdown_editor as markdown_editor
from PySide6.QtWidgets import QDialog
class DeleteDialog:
def __init__(self, code, language, parent=None, allow_delete=False):
@ -214,8 +213,8 @@ def test_edit_code_block_with_delete(editor, qtbot, monkeypatch):
def test_edit_code_block_language_change(editor, qtbot, monkeypatch):
"""Test _edit_code_block with language change."""
from PySide6.QtWidgets import QDialog
import bouquin.markdown_editor as markdown_editor
from PySide6.QtWidgets import QDialog
class LanguageChangeDialog:
def __init__(self, code, language, parent=None, allow_delete=False):

View file

@ -1,8 +1,9 @@
from unittest.mock import Mock, patch
from bouquin.pomodoro_timer import PomodoroTimer, PomodoroManager
from bouquin.theme import ThemeManager, ThemeConfig, Theme
from PySide6.QtWidgets import QWidget, QVBoxLayout, QToolBar, QLabel
from bouquin.pomodoro_timer import PomodoroManager, PomodoroTimer
from bouquin.theme import Theme, ThemeConfig, ThemeManager
from PySide6.QtGui import QAction
from PySide6.QtWidgets import QLabel, QToolBar, QVBoxLayout, QWidget
class DummyTimeLogWidget(QWidget):

View file

@ -1,17 +1,16 @@
import pytest
from unittest.mock import patch, MagicMock
from bouquin.reminders import (
Reminder,
ReminderType,
ReminderDialog,
UpcomingRemindersWidget,
ManageRemindersDialog,
)
from PySide6.QtCore import QDateTime, QDate, QTime
from PySide6.QtWidgets import QDialog, QMessageBox, QWidget
from datetime import date, timedelta
from unittest.mock import MagicMock, patch
import pytest
from bouquin.reminders import (
ManageRemindersDialog,
Reminder,
ReminderDialog,
ReminderType,
UpcomingRemindersWidget,
)
from PySide6.QtCore import QDate, QDateTime, QTime
from PySide6.QtWidgets import QDialog, QMessageBox, QWidget
@pytest.fixture
@ -851,9 +850,9 @@ def test_edit_reminder_dialog(qtbot, fresh_db):
def test_upcoming_reminders_context_menu_shows(
qtbot, app, fresh_db, freeze_reminders_time, monkeypatch
):
from PySide6 import QtWidgets, QtGui
from PySide6.QtCore import QPoint
from bouquin.reminders import Reminder, ReminderType, UpcomingRemindersWidget
from PySide6 import QtGui, QtWidgets
from PySide6.QtCore import QPoint
# Add a future reminder for today
r = Reminder(
@ -909,9 +908,9 @@ def test_upcoming_reminders_context_menu_shows(
def test_upcoming_reminders_delete_selected_dedupes(
qtbot, app, fresh_db, freeze_reminders_time, monkeypatch
):
from PySide6.QtWidgets import QMessageBox
from PySide6.QtCore import QItemSelectionModel
from bouquin.reminders import Reminder, ReminderType, UpcomingRemindersWidget
from PySide6.QtCore import QItemSelectionModel
from PySide6.QtWidgets import QMessageBox
r = Reminder(
id=None,

View file

@ -1,9 +1,5 @@
from bouquin.settings import (
get_settings,
load_db_config,
save_db_config,
)
from bouquin.db import DBConfig
from bouquin.settings import get_settings, load_db_config, save_db_config
def _clear_db_settings():

View file

@ -1,11 +1,11 @@
from bouquin.db import DBManager, DBConfig
from bouquin.key_prompt import KeyPrompt
import bouquin.settings_dialog as sd
from bouquin.settings_dialog import SettingsDialog
from bouquin.theme import ThemeManager, ThemeConfig, Theme
from bouquin.db import DBConfig, DBManager
from bouquin.key_prompt import KeyPrompt
from bouquin.settings import get_settings
from bouquin.settings_dialog import SettingsDialog
from bouquin.theme import Theme, ThemeConfig, ThemeManager
from PySide6.QtCore import QTimer
from PySide6.QtWidgets import QApplication, QMessageBox, QWidget, QDialog
from PySide6.QtWidgets import QApplication, QDialog, QMessageBox, QWidget
def test_settings_dialog_config_roundtrip(qtbot, tmp_db_cfg, fresh_db):

View file

@ -1,13 +1,11 @@
import datetime as _dt
from datetime import datetime, timedelta, date
from datetime import date, datetime, timedelta
from bouquin import strings
from PySide6.QtCore import Qt, QPoint, QDate
from PySide6.QtWidgets import QLabel, QWidget
from PySide6.QtTest import QTest
from bouquin.statistics_dialog import DateHeatmap, StatisticsDialog
from PySide6.QtCore import QDate, QPoint, Qt
from PySide6.QtTest import QTest
from PySide6.QtWidgets import QLabel, QWidget
class FakeStatsDB:

View file

@ -1,12 +1,11 @@
import types
from PySide6.QtWidgets import QFileDialog
from PySide6.QtGui import QTextCursor
from bouquin.theme import ThemeManager, ThemeConfig, Theme
from bouquin.settings import get_settings
from bouquin.main_window import MainWindow
from bouquin.history_dialog import HistoryDialog
from bouquin.main_window import MainWindow
from bouquin.settings import get_settings
from bouquin.theme import Theme, ThemeConfig, ThemeManager
from PySide6.QtGui import QTextCursor
from PySide6.QtWidgets import QFileDialog
def test_tabs_open_and_deduplicate(qtbot, app, tmp_db_cfg, fresh_db):

View file

@ -1,24 +1,21 @@
import bouquin.strings as strings
import pytest
from PySide6.QtCore import Qt, QPoint, QEvent, QDate
from PySide6.QtGui import QMouseEvent, QColor
from bouquin.db import DBManager
from bouquin.flow_layout import FlowLayout
from bouquin.strings import load_strings
from bouquin.tag_browser import TagBrowserDialog
from bouquin.tags_widget import PageTagsWidget, TagChip
from PySide6.QtCore import QDate, QEvent, QPoint, Qt
from PySide6.QtGui import QColor, QMouseEvent
from PySide6.QtWidgets import (
QApplication,
QMessageBox,
QInputDialog,
QColorDialog,
QDialog,
QInputDialog,
QMessageBox,
)
from bouquin.db import DBManager
from bouquin.strings import load_strings
from bouquin.tags_widget import PageTagsWidget, TagChip
from bouquin.tag_browser import TagBrowserDialog
from bouquin.flow_layout import FlowLayout
from sqlcipher3.dbapi2 import IntegrityError
import bouquin.strings as strings
# ============================================================================
# DB Layer Tag Tests
# ============================================================================
@ -1649,7 +1646,7 @@ def test_default_tag_colour_none(fresh_db):
def test_flow_layout_take_at_invalid_index(app):
"""Test FlowLayout.takeAt with out-of-bounds index"""
from PySide6.QtWidgets import QWidget, QLabel
from PySide6.QtWidgets import QLabel, QWidget
widget = QWidget()
layout = FlowLayout(widget)
@ -1673,7 +1670,7 @@ def test_flow_layout_take_at_invalid_index(app):
def test_flow_layout_take_at_boundary(app):
"""Test FlowLayout.takeAt at exact boundary"""
from PySide6.QtWidgets import QWidget, QLabel
from PySide6.QtWidgets import QLabel, QWidget
widget = QWidget()
layout = FlowLayout(widget)

View file

@ -1,8 +1,7 @@
from bouquin.theme import Theme, ThemeConfig, ThemeManager
from PySide6.QtGui import QPalette
from PySide6.QtWidgets import QApplication, QCalendarWidget, QWidget
from bouquin.theme import Theme, ThemeConfig, ThemeManager
def test_theme_manager_apply_light_and_dark(app):
cfg = ThemeConfig(theme=Theme.LIGHT)

View file

@ -1,24 +1,18 @@
import pytest
from datetime import date, timedelta
from PySide6.QtCore import Qt, QDate
from PySide6.QtWidgets import (
QMessageBox,
QInputDialog,
QFileDialog,
QDialog,
)
from sqlcipher3.dbapi2 import IntegrityError
from unittest.mock import MagicMock, patch
from bouquin.theme import ThemeManager, ThemeConfig, Theme
import bouquin.strings as strings
import pytest
from bouquin.theme import Theme, ThemeConfig, ThemeManager
from bouquin.time_log import (
TimeLogWidget,
TimeLogDialog,
TimeCodeManagerDialog,
TimeLogDialog,
TimeLogWidget,
TimeReportDialog,
)
import bouquin.strings as strings
from unittest.mock import patch, MagicMock
from PySide6.QtCore import QDate, Qt
from PySide6.QtWidgets import QDialog, QFileDialog, QInputDialog, QMessageBox
from sqlcipher3.dbapi2 import IntegrityError
@pytest.fixture

View file

@ -1,8 +1,8 @@
import pytest
from PySide6.QtWidgets import QWidget
from bouquin.markdown_editor import MarkdownEditor
from bouquin.theme import ThemeManager, ThemeConfig, Theme
from bouquin.theme import Theme, ThemeConfig, ThemeManager
from bouquin.toolbar import ToolBar
from PySide6.QtWidgets import QWidget
@pytest.fixture

View file

@ -1,9 +1,10 @@
import pytest
from unittest.mock import Mock, patch
import subprocess
from unittest.mock import Mock, patch
import pytest
from bouquin.version_check import VersionChecker
from PySide6.QtWidgets import QMessageBox, QWidget
from PySide6.QtGui import QPixmap
from PySide6.QtWidgets import QMessageBox, QWidget
def test_version_checker_init(app):