working
This commit is contained in:
parent
f7e794774d
commit
09d181eba8
37 changed files with 1898 additions and 5 deletions
|
|
@ -0,0 +1,4 @@
|
|||
from models.astro_object import AstroObject
|
||||
from models.session import Session
|
||||
|
||||
__all__ = ['AstroObject', 'Session']
|
||||
BIN
models/__pycache__/__init__.cpython-313.pyc
Normal file
BIN
models/__pycache__/__init__.cpython-313.pyc
Normal file
Binary file not shown.
BIN
models/__pycache__/astro_object.cpython-313.pyc
Normal file
BIN
models/__pycache__/astro_object.cpython-313.pyc
Normal file
Binary file not shown.
BIN
models/__pycache__/session.cpython-313.pyc
Normal file
BIN
models/__pycache__/session.cpython-313.pyc
Normal file
Binary file not shown.
|
|
@ -0,0 +1,19 @@
|
|||
from dataclasses import dataclass
|
||||
from pathlib import Path
|
||||
|
||||
|
||||
@dataclass
|
||||
class AstroObject:
|
||||
"""Модель астрономического объекта"""
|
||||
name: str
|
||||
folder: Path
|
||||
photo_count: int = 0
|
||||
|
||||
def increment_photo_count(self):
|
||||
self.photo_count += 1
|
||||
|
||||
def get_object_log_path(self) -> Path:
|
||||
return self.folder / "ObjectLog.txt"
|
||||
|
||||
def __str__(self):
|
||||
return f"AstroObject(name='{self.name}', photos={self.photo_count})"
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
from dataclasses import dataclass, field
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import List, Optional
|
||||
from models.astro_object import AstroObject
|
||||
|
||||
|
||||
@dataclass
|
||||
class Session:
|
||||
"""Модель сессии наблюдения"""
|
||||
camera: str
|
||||
optics: str
|
||||
start_time: datetime
|
||||
end_time: Optional[datetime] = None
|
||||
objects: List[AstroObject] = field(default_factory=list)
|
||||
session_folder: Optional[Path] = None
|
||||
|
||||
def add_object(self, astro_object: AstroObject):
|
||||
self.objects.append(astro_object)
|
||||
|
||||
def get_current_object(self) -> Optional[AstroObject]:
|
||||
return self.objects[-1] if self.objects else None
|
||||
|
||||
def get_session_name(self) -> str:
|
||||
return f"AstroSession_{self.start_time.strftime('%Y-%m-%d')}"
|
||||
|
||||
def finish(self):
|
||||
self.end_time = datetime.now()
|
||||
|
||||
def is_active(self) -> bool:
|
||||
return self.end_time is None
|
||||
Loading…
Add table
Add a link
Reference in a new issue