Skip to content

Commit

Permalink
fix: fix realtive imports and config load from toml file (#8)
Browse files Browse the repository at this point in the history
Co-authored-by: Paolo <paolosofia@tutanota.com>
  • Loading branch information
paolo-sofia and Paolo committed Jun 11, 2023
1 parent 373d7ae commit cc056cd
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 31 deletions.
6 changes: 3 additions & 3 deletions background_setter/client/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
import uuid
from typing import List, Set

from background_setter.screen.screen_orientation import ScreenOrientation
from background_setter.used_images.available_images import ImagesList
from background_setter.used_images.used_images import UsedImages
from screen.screen_orientation import ScreenOrientation
from used_images.available_images import ImagesList
from used_images.used_images import UsedImages


class BackgroundSetterClient:
Expand Down
10 changes: 5 additions & 5 deletions background_setter/dektop/desktop.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import cv2
import numpy as np

from background_setter.screen.screen import Screen
from background_setter.screen.screen_resolution import ScreenResolution
from background_setter.window_protocol.desktop_environment import DesktopEnvironment
from background_setter.window_protocol.window_protocol import WindowProtocol
from background_setter.window_protocol.window_protocol_factory import WindowProtocolFactory
from screen.screen import Screen
from screen.screen_resolution import ScreenResolution
from window_protocol.desktop_environment import DesktopEnvironment
from window_protocol.window_protocol import WindowProtocol
from window_protocol.window_protocol_factory import WindowProtocolFactory


class Desktop:
Expand Down
8 changes: 4 additions & 4 deletions background_setter/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@

import cv2

from background_setter.client.client import BackgroundSetterClient
from background_setter.dektop.desktop import Desktop
from background_setter.screen.screen_orientation import ScreenOrientation
from client.client import BackgroundSetterClient
from dektop.desktop import Desktop
from screen.screen_orientation import ScreenOrientation


def validate_args(args: List[str]) -> bool: # sourcery skip: use-any
Expand All @@ -36,7 +36,7 @@ def load_config() -> Dict[str, Any]:
This function loads a TOML configuration file and returns its contents as a dictionary.
:return: A dictionary containing the data loaded from the "config.toml" file.
"""
with open("config.toml", "rb") as f:
with open( pathlib.Path(__file__).parent.absolute() / 'config.toml', "rb") as f:
data = tomllib.load(f)
return data

Expand Down
6 changes: 3 additions & 3 deletions background_setter/screen/screen.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from dataclasses import dataclass

from background_setter.screen.screen_offset import ScreenOffset
from background_setter.screen.screen_orientation import ScreenOrientation
from background_setter.screen.screen_resolution import ScreenResolution
from screen.screen_offset import ScreenOffset
from screen.screen_orientation import ScreenOrientation
from screen.screen_resolution import ScreenResolution


@dataclass(slots=True)
Expand Down
2 changes: 1 addition & 1 deletion background_setter/used_images/used_images.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import datetime
from dataclasses import dataclass, asdict

from background_setter.used_images.available_images import ImagesList
from used_images.available_images import ImagesList


@dataclass
Expand Down
4 changes: 2 additions & 2 deletions background_setter/window_protocol/wayland.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import pathlib
from typing import List

from background_setter.screen.screen import Screen
from background_setter.window_protocol.x11 import X11
from screen.screen import Screen
from window_protocol.x11 import X11


class Wayland(X11):
Expand Down
6 changes: 3 additions & 3 deletions background_setter/window_protocol/window_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
from abc import ABC, abstractmethod
from typing import List, Iterator

from background_setter.screen.screen import Screen
from background_setter.screen.screen_resolution import ScreenResolution
from background_setter.window_protocol.desktop_environment import DesktopEnvironment
from screen.screen import Screen
from screen.screen_resolution import ScreenResolution
from window_protocol.desktop_environment import DesktopEnvironment


class WindowProtocol(ABC):
Expand Down
10 changes: 5 additions & 5 deletions background_setter/window_protocol/window_protocol_factory.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
import os
from typing import Optional

from background_setter.window_protocol.desktop_environment import DesktopEnvironment
from background_setter.window_protocol.wayland import Wayland
from background_setter.window_protocol.window_protocol import WindowProtocol
from background_setter.window_protocol.window_protocol_type import WindowProtocolType
from background_setter.window_protocol.x11 import X11
from window_protocol.desktop_environment import DesktopEnvironment
from window_protocol.wayland import Wayland
from window_protocol.window_protocol import WindowProtocol
from window_protocol.window_protocol_type import WindowProtocolType
from window_protocol.x11 import X11


class WindowProtocolFactory:
Expand Down
10 changes: 5 additions & 5 deletions background_setter/window_protocol/x11.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
import subprocess
from typing import List, Iterator

from background_setter.screen.screen import Screen
from background_setter.screen.screen_offset import ScreenOffset
from background_setter.screen.screen_resolution import ScreenResolution
from background_setter.window_protocol.desktop_environment import DesktopEnvironment
from background_setter.window_protocol.window_protocol import WindowProtocol
from screen.screen import Screen
from screen.screen_offset import ScreenOffset
from screen.screen_resolution import ScreenResolution
from window_protocol.desktop_environment import DesktopEnvironment
from window_protocol.window_protocol import WindowProtocol


class X11(WindowProtocol):
Expand Down

0 comments on commit cc056cd

Please sign in to comment.