mirror of
https://github.com/aclist/dztui.git
synced 2026-11-10 03:50:38 +01:00
Compare commits
4
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
3677b01fdc | ||
|
|
4f6223f90b | ||
|
|
441066a1a0 | ||
|
|
fa1ac8fa31 |
No files matched your search
+5
-4
@@ -2,10 +2,10 @@ import hashlib
|
||||
import logging
|
||||
import re
|
||||
|
||||
from concurrent.futures import wait
|
||||
from concurrent.futures import ThreadPoolExecutor
|
||||
from concurrent.futures import ThreadPoolExecutor, wait
|
||||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
|
||||
from dzgui.api.steam import get_app_path
|
||||
from dzgui.api.servers import get_rules, fqip_to_record
|
||||
@@ -18,8 +18,7 @@ from dzgui.const.constants import (
|
||||
|
||||
from dzgui.config.query import lookup
|
||||
from dzgui.const.enum import Preferences
|
||||
|
||||
from typing import Any
|
||||
from dzgui.init.migrate import clean_legacy_versions_file
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
@@ -133,6 +132,8 @@ def remove_stale_signatures(
|
||||
versions.touch()
|
||||
return
|
||||
|
||||
clean_legacy_versions_file(versions)
|
||||
|
||||
path = lookup(config, Preferences.DEFAULT)
|
||||
steam_path = Path(path)
|
||||
if ids is None:
|
||||
|
||||
+1
-1
@@ -18,8 +18,8 @@ from dzgui.config.query import lookup
|
||||
from dzgui.config.userprefs import UserPrefs
|
||||
from dzgui.config.xdg import get_xdg_paths, parse_filepaths
|
||||
from dzgui.init.migrate import (
|
||||
has_new_config,
|
||||
copy_state_files,
|
||||
has_new_config,
|
||||
migrate_cols_file,
|
||||
)
|
||||
from dzgui.init.flock import lock_acquire
|
||||
|
||||
@@ -6,7 +6,8 @@ if TYPE_CHECKING:
|
||||
from dzgui.util.ip import Coords
|
||||
|
||||
|
||||
# NOTE: mutable dataclass, 'use_miles' key changes on demand
|
||||
# NOTE: mutable dataclass: 'use_miles' key changes on demand
|
||||
# 'frozen' cannot be True
|
||||
@dataclass(slots=True)
|
||||
class UserPrefs:
|
||||
is_steam_deck: bool
|
||||
|
||||
@@ -3,8 +3,8 @@ from typing import TYPE_CHECKING
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository.Gtk import ListStore
|
||||
from gi.repository import GObject
|
||||
from gi.repository.Gtk import ListStore # noqa E402
|
||||
from gi.repository import Gdk, GObject # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.const.enum import NotebookPage, ServerTab
|
||||
|
||||
@@ -32,7 +32,7 @@ from dzgui.views.dialogs.generic import ExceptionDialog
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk, GLib, GObject
|
||||
from gi.repository import Gtk, Gdk, GLib, GObject # noqa E402
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
+22
-1
@@ -1,12 +1,21 @@
|
||||
import json
|
||||
import logging
|
||||
import re
|
||||
import shutil
|
||||
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from dzgui.const.constants import LEGACY_CONFIG_PATH, LEGACY_COLS_PATH, LEGACY_IPS_PATH
|
||||
from dzgui.const.constants import (
|
||||
APP_NAME,
|
||||
LEGACY_CONFIG_PATH,
|
||||
LEGACY_COLS_PATH,
|
||||
LEGACY_IPS_PATH,
|
||||
)
|
||||
from dzgui.config.convert import rc2json
|
||||
from dzgui.util._json import read_json, write_json
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
def migrate_legacy_conf(config: Path) -> Any:
|
||||
old_conf = Path.home() / LEGACY_CONFIG_PATH
|
||||
@@ -70,3 +79,15 @@ def copy_ipdb(ips_path: Path) -> None:
|
||||
return
|
||||
# TODO: ensure that month file is copied
|
||||
shutil.copy(legacy, ips_path)
|
||||
|
||||
|
||||
def clean_legacy_versions_file(versions: Path) -> None:
|
||||
# NOTE: handling for #523
|
||||
try:
|
||||
pat = r"^(\d+),(\d+)$"
|
||||
lines = versions.read_text().splitlines()
|
||||
clean = [line for line in lines if re.match(pat, line)]
|
||||
concat = "\n".join(clean)
|
||||
versions.write_text(concat)
|
||||
except Exception as e:
|
||||
logger.warning(e)
|
||||
@@ -55,6 +55,11 @@ from dzgui.util.symlink import rebuild_symlinks
|
||||
from dzgui.views.dialogs.generic import ExceptionDialog
|
||||
from dzgui.views.dialogs.servers import ServerDetailsDialog, ServerModDialog
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.api.servers import A2SInfo, Record
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
@@ -30,7 +30,7 @@ import dzgui.api.pefile as PeFile
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
@@ -15,7 +15,7 @@ if TYPE_CHECKING:
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import GLib
|
||||
from gi.repository import Gtk, GLib # noqa E402
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
@@ -15,6 +15,11 @@ from dzgui.strings import dialogs
|
||||
from dzgui.managers.threading import call_on_thread, StoredFunc, ThreadingManager
|
||||
from dzgui.views.dialogs.generic import ExceptionDialog, QuitDialog
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
|
||||
@@ -7,8 +7,8 @@ from dzgui.util.strings import delimiter
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository.Gtk import ListStore, TreeIter
|
||||
from gi.repository import GObject
|
||||
from gi.repository.Gtk import ListStore, TreeIter # noqa E402
|
||||
from gi.repository import GObject # noqa E402
|
||||
|
||||
GTYPE_TO_PYTHON = {
|
||||
GObject.type_from_name(GObject.type_name(ptype)): ptype
|
||||
|
||||
@@ -21,7 +21,7 @@ from dzgui.views.dialogs.generic import ExceptionDialog
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib
|
||||
from gi.repository import Gtk, GLib # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.api.servers import A2SInfo, Record
|
||||
|
||||
+2
-1
@@ -1,7 +1,8 @@
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk
|
||||
gi.require_version("Gdk", "3.0")
|
||||
from gi.repository import Gtk, Gdk # noqa E402
|
||||
|
||||
|
||||
def copy_clipboard(text: str) -> None:
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ from dzgui.const.constants import APP_NAME_LOWER, CSS_PATH
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk
|
||||
from gi.repository import Gtk, Gdk # noqa E402
|
||||
|
||||
|
||||
def add_class(widget: Gtk.Widget, label: str) -> None:
|
||||
|
||||
@@ -7,6 +7,11 @@ from dzgui.const.constants import APP_NAME
|
||||
from dzgui.util.ip import get_coords
|
||||
from dzgui.util.localize import number
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from queue import Queue
|
||||
from dzgui.const.enum import ServerTab
|
||||
|
||||
@@ -7,7 +7,7 @@ from dzgui.util.strings import no_mods, no_servers, workshop
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
|
||||
def format_pango(text: str) -> str:
|
||||
|
||||
+1
-4
@@ -1,8 +1,6 @@
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gdk
|
||||
|
||||
from gi.repository import Gdk # noqa E402
|
||||
|
||||
def is_navkey(key: int) -> bool:
|
||||
nav_keys = [
|
||||
@@ -20,7 +18,6 @@ def is_navkey(key: int) -> bool:
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def is_ctrl_mask(event: Gdk.EventKey) -> bool:
|
||||
if event.state is Gdk.ModifierType.CONTROL_MASK:
|
||||
return True
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
def set_surrounding_margins(widget: Gtk.Widget, margin: int) -> None:
|
||||
"""
|
||||
|
||||
@@ -4,7 +4,7 @@ from typing import cast, TYPE_CHECKING
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gdk, GLib
|
||||
from gi.repository import Gtk, Gdk, GLib # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
gi.require_version("GLibUnix", "2.0")
|
||||
from gi.repository import Gtk, GLib, GLibUnix, Gdk # type: ignore
|
||||
from gi.repository import Gtk, GLib, GLibUnix, Gdk # type: ignore # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.config.userprefs import UserPrefs
|
||||
|
||||
@@ -7,7 +7,7 @@ from dzgui.const.enum import ButtonType
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk
|
||||
from gi.repository import Gtk, Gdk # noqa E402
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ from dzgui.strings import connect_panel
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib
|
||||
from gi.repository import Gtk, Gdk, GLib # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from gi.repository import GLib
|
||||
|
||||
@@ -18,7 +18,7 @@ from dzgui.views.components.labels import BoldLabel
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk
|
||||
from gi.repository import Gtk, Gdk # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
@@ -7,7 +7,7 @@ from dzgui.util.format import embolden
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk, GLib, Gdk, GObject, Pango # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
@@ -9,7 +9,7 @@ from dzgui.strings.errors import api_popover
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk, GObject
|
||||
from gi.repository import Gtk, Gdk, GObject # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
@@ -6,7 +6,7 @@ from dzgui.const.constants import HELP_BUBBLE
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk
|
||||
from gi.repository import Gtk, Gdk # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
@@ -17,7 +17,7 @@ from dzgui.views.components.labels import BoldLabel
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk, Pango, GLib
|
||||
from gi.repository import Gtk, Gdk, Pango, GLib # noqa E402
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
@@ -42,10 +42,7 @@ class ButtonGrid(Gtk.Grid):
|
||||
self.checks: list[Gtk.CheckButton] = []
|
||||
|
||||
flowbox = Gtk.FlowBox(
|
||||
halign=Gtk.Align.CENTER,
|
||||
min_children_per_line=3,
|
||||
max_children_per_line=3,
|
||||
selection_mode=Gtk.SelectionMode.NONE,
|
||||
halign=Gtk.Align.CENTER, min_children_per_line=3, max_children_per_line=3, selection_mode=Gtk.SelectionMode.NONE
|
||||
)
|
||||
|
||||
for check in defaults.keys():
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
|
||||
class Icon(Gtk.Image):
|
||||
|
||||
@@ -3,7 +3,7 @@ from dzgui.util.format import embolden
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
|
||||
class BoldLabel(Gtk.Label):
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk, GLib # noqa E402
|
||||
|
||||
|
||||
class MapsCombo(Gtk.EntryCompletion):
|
||||
|
||||
@@ -8,7 +8,7 @@ from dzgui.views.components.labels import BoldLabel
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
@@ -23,7 +23,7 @@ from dzgui.views.components.buttons import IconTextButton, RefreshButton, KeysBu
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk, GLib
|
||||
from gi.repository import Gtk, Gdk, GLib # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
@@ -7,7 +7,7 @@ from dzgui.views.components.buttons import LoggerAlertsButton
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.const.enum import ServerTab
|
||||
|
||||
@@ -2,9 +2,8 @@ from typing import Literal
|
||||
from dzgui.util import css
|
||||
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib
|
||||
from gi.repository import Gtk, GLib # noqa E402
|
||||
|
||||
|
||||
class Toast(Gtk.EventBox):
|
||||
|
||||
@@ -10,7 +10,7 @@ from dzgui.views.components.labels import BoldLabel
|
||||
from dzgui.views.components.box import VBox, HBox
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib, GObject
|
||||
from gi.repository import Gtk, GLib, GObject # type: ignore # noqa E402
|
||||
|
||||
DAY_START_TIME = time(hour=6, minute=0, second=0)
|
||||
DAY_END_TIME = time(hour=18, minute=0, second=0)
|
||||
|
||||
@@ -8,7 +8,7 @@ from dzgui.views.mixins.colorscheme import ColorAwareApp
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
|
||||
class AbortDialog(ColorAwareApp, Gtk.MessageDialog): # type: ignore
|
||||
|
||||
@@ -2,10 +2,10 @@ from pathlib import Path
|
||||
|
||||
from dzgui.util.strings import picker
|
||||
|
||||
import gi
|
||||
import gi # noqa E402
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
|
||||
class FilePicker(Gtk.FileChooserDialog):
|
||||
|
||||
@@ -8,7 +8,7 @@ from dzgui.views.components.buttons import ClipboardButton
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib
|
||||
from gi.repository import Gtk, GLib, Gdk, GObject, Pango # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
@@ -9,7 +9,7 @@ from dzgui.views.components.buttons import SteamTextButton
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk, GLib, Gdk, GObject, Pango # noqa E402
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
||||
@@ -3,10 +3,10 @@ from typing import Self, TYPE_CHECKING
|
||||
from dzgui.views.components.entry import ValidatedEntry
|
||||
from dzgui.views.dialogs.generic import GenericDialog
|
||||
|
||||
import gi
|
||||
import gi # noqa E402
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gdk, Gtk # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
@@ -18,7 +18,7 @@ from dzgui.views.mixins.colorscheme import ColorAwareApp
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib, Pango
|
||||
from gi.repository import Gtk, GLib, Pango # noqa E402
|
||||
|
||||
|
||||
class Assistant(Gtk.Assistant):
|
||||
|
||||
@@ -14,7 +14,7 @@ from dzgui.const.constants import (
|
||||
HERO_PATH,
|
||||
FLATPAK_ROOT_PATH,
|
||||
LEGACY_CONFIG_PATH,
|
||||
TMP_PATH,
|
||||
TMP_PATH
|
||||
)
|
||||
from dzgui.const.boilerplate import config_boilerplate
|
||||
from dzgui.const.endpoints import STEAM_API_SETUP
|
||||
@@ -35,7 +35,7 @@ from dzgui.views.trees.tree_simple import SimpleTree
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, GLib, GObject, GdkPixbuf
|
||||
from gi.repository import Gdk, Gtk, GLib, GObject, GdkPixbuf # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.config.xdg import Xdg
|
||||
|
||||
@@ -9,7 +9,7 @@ from dzgui.views.trees.tree_base import TreeView
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk
|
||||
from gi.repository import Gtk, GLib, Gdk, GObject, Pango # noqa E402
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
@@ -5,7 +5,7 @@ from dzgui.util.keys import is_ctrl_mask
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk
|
||||
from gi.repository import Gtk, GLib, Gdk, GObject, Pango # noqa E402
|
||||
|
||||
|
||||
class CursorMixin:
|
||||
|
||||
@@ -3,7 +3,7 @@ from dzgui.views.trees.tree_base import TreeView
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk, GLib, Gdk, GObject, Pango # noqa E402
|
||||
|
||||
|
||||
class ModsMixin:
|
||||
|
||||
@@ -15,7 +15,7 @@ from dzgui.views.mixins.scrollable_mixin import ScrollableMixin
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
@@ -7,10 +7,10 @@ from dzgui.util.strings import developers
|
||||
from dzgui.views.components.labels import BoldLabel
|
||||
from dzgui.views.trees.tree_base import TreeView
|
||||
|
||||
import gi
|
||||
import gi # noqa E402
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
@@ -4,7 +4,7 @@ from dzgui.views.trees.tree_menu import MenuTreeView
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
@@ -7,7 +7,7 @@ from dzgui.util.css import add_class
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
@@ -9,7 +9,7 @@ from dzgui.views.trees.tree_log import LogTreeView
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from dzgui.controllers.mc import Controller
|
||||
|
||||
@@ -18,7 +18,7 @@ from dzgui.views.trees.tree_server_mods import ServerModTreeView
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gdk, Gtk
|
||||
from gi.repository import Gdk, Gtk # noqa E402
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
|
||||
@@ -10,7 +10,7 @@ from dzgui.util.strings import server_labels
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk
|
||||
from gi.repository import Gtk, Gdk, GLib # noqa E402
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ from dzgui.views.mixins.scrollable_mixin import ScrollableMixin
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
# TODO: wrap and center long values
|
||||
if TYPE_CHECKING:
|
||||
|
||||
@@ -12,7 +12,7 @@ from dzgui.views.mixins.context_mixin import ContextMixin
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk, Gdk
|
||||
from gi.repository import Gtk, GLib, Gdk, GObject, Pango # noqa E402
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pathlib import Path
|
||||
|
||||
@@ -78,7 +78,6 @@ line-length = 88
|
||||
indent-width = 4
|
||||
extend-exclude = ["*lib/a2s"]
|
||||
lint.unfixable = ["F401", "I001"]
|
||||
lint.ignore = ["E402"]
|
||||
|
||||
[tool.ruff.format]
|
||||
quote-style = "double"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from shared import get_git_root
|
||||
from pathlib import Path
|
||||
|
||||
BOILERPLATE = """
|
||||
This file includes the combined licenses to the following components:
|
||||
@@ -40,7 +40,7 @@ class CombinedLicense:
|
||||
|
||||
def concat_license() -> str:
|
||||
combined = CombinedLicense()
|
||||
root = get_git_root()
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
licenses = root.joinpath("docs/licenses")
|
||||
|
||||
main_license = root.joinpath(LICENSE_FILE)
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
import shutil
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
from shared import get_git_root
|
||||
|
||||
root = get_git_root()
|
||||
clog = root.joinpath("CHANGELOG.md")
|
||||
target = root.joinpath("dzgui/data/CHANGELOG.md")
|
||||
par = Path(__file__).parent.parent
|
||||
clog = par / "CHANGELOG.md"
|
||||
target = par / "dzgui/data/CHANGELOG.md"
|
||||
|
||||
shutil.copy(clog, target)
|
||||
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
import tomllib
|
||||
from shared import get_git_root
|
||||
from pathlib import Path
|
||||
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
|
||||
|
||||
def get_entrypoint() -> None:
|
||||
root = get_git_root()
|
||||
p = root.joinpath("pyproject.toml")
|
||||
with open(p, "rb") as f:
|
||||
t = tomllib.load(f)
|
||||
|
||||
+2
-3
@@ -3,15 +3,14 @@ import requests
|
||||
import subprocess
|
||||
import tarfile
|
||||
|
||||
from pathlib import Path
|
||||
from urllib.parse import unquote
|
||||
|
||||
from shared import get_git_root
|
||||
|
||||
BUILD = "3.13.9"
|
||||
DATE = "20251014"
|
||||
CPYTHON_BUILD = f"cpython-{BUILD}"
|
||||
|
||||
root = get_git_root()
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
build_dir = root.joinpath("build")
|
||||
cpython_dir = build_dir.joinpath(CPYTHON_BUILD)
|
||||
|
||||
|
||||
+1
-2
@@ -9,7 +9,6 @@ from pathlib import Path
|
||||
from concat_licenses import concat_license
|
||||
from parse_toml import get_entrypoint
|
||||
from prebuild import get_pyapp, rebuild_cpython
|
||||
from shared import get_git_root
|
||||
|
||||
|
||||
def update_uname(info: tarfile.TarInfo) -> tarfile.TarInfo:
|
||||
@@ -18,7 +17,7 @@ def update_uname(info: tarfile.TarInfo) -> tarfile.TarInfo:
|
||||
return info
|
||||
|
||||
|
||||
root = get_git_root()
|
||||
root = Path(__file__).resolve().parents[1]
|
||||
dist_dir = root.joinpath("dist")
|
||||
build_dir = root.joinpath("build")
|
||||
|
||||
|
||||
+10
-1
@@ -1,7 +1,16 @@
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
from dzgui.app_init import build_gui
|
||||
from shared import get_git_root
|
||||
|
||||
|
||||
def get_git_root() -> Path:
|
||||
proc = subprocess.run(
|
||||
["git", "rev-parse", "--show-toplevel"], capture_output=True, text=True
|
||||
)
|
||||
if proc.returncode != 0:
|
||||
raise OSError("Failed to parse git root")
|
||||
return Path(proc.stdout.rstrip())
|
||||
|
||||
|
||||
def get_image_path() -> Path:
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
import subprocess
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def get_git_root() -> Path:
|
||||
proc = subprocess.run(
|
||||
["git", "rev-parse", "--show-toplevel"], capture_output=True, text=True
|
||||
)
|
||||
if proc.returncode != 0:
|
||||
raise OSError("Failed to parse git root")
|
||||
return Path(proc.stdout.rstrip())
|
||||
@@ -0,0 +1,38 @@
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def iterate(search_str: str) -> None:
|
||||
# TODO: exclude files from .gitignore
|
||||
print()
|
||||
print(f"Searching for '{search_str}'")
|
||||
print()
|
||||
files = Path(".").rglob("*")
|
||||
ignore = [
|
||||
"scripts/",
|
||||
".git",
|
||||
"egg",
|
||||
"CHANGELOG",
|
||||
".mypy",
|
||||
"build/",
|
||||
"test.py",
|
||||
"bugs",
|
||||
"pyproject.toml",
|
||||
]
|
||||
for file in files:
|
||||
if file.is_dir():
|
||||
continue
|
||||
if any(s in str(file) for s in ignore):
|
||||
continue
|
||||
try:
|
||||
text = file.read_text()
|
||||
if search_str in text:
|
||||
c = text.count(search_str)
|
||||
if 0 < c < 2:
|
||||
print(file, c)
|
||||
except Exception:
|
||||
continue
|
||||
|
||||
|
||||
imports = ["Pango", "GObject", "GLib", "Gdk", "Gtk"]
|
||||
for i in imports:
|
||||
iterate(i)
|
||||
@@ -6,7 +6,7 @@ from dzgui.views.dialogs.servers import ServerDetailsDialog
|
||||
import gi
|
||||
|
||||
gi.require_version("Gtk", "3.0")
|
||||
from gi.repository import Gtk
|
||||
from gi.repository import Gtk # noqa E402
|
||||
|
||||
|
||||
class MockController:
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
from typing import TYPE_CHECKING
|
||||
|
||||
from dzgui.init.migrate import clean_legacy_versions_file
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
def test_null_signature_stripping(tmp_path: "Path") -> None:
|
||||
tmp = tmp_path.joinpath("dzg.versions")
|
||||
lines = [
|
||||
"1111,2222",
|
||||
"3333,4444",
|
||||
"5555,null",
|
||||
"foo",
|
||||
",4555",
|
||||
"1111",
|
||||
" ",
|
||||
",,,",
|
||||
"-1",
|
||||
]
|
||||
expect = ["1111,2222", "3333,4444"]
|
||||
tmp.write_text("\n".join(lines))
|
||||
clean_legacy_versions_file(tmp)
|
||||
assert expect == tmp.read_text().splitlines()
|
||||
Reference in new issue
Block a user