move and rename module
This commit is contained in:
@@ -37,7 +37,7 @@ from textual.widgets.option_list import Option
|
|||||||
from src.utils.file_icons import get_file_icon
|
from src.utils.file_icons import get_file_icon
|
||||||
|
|
||||||
# Import our DocumentViewerScreen
|
# Import our DocumentViewerScreen
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), "src", "maildir_gtd"))
|
sys.path.append(os.path.join(os.path.dirname(__file__), "src", "mail"))
|
||||||
from screens.DocumentViewer import DocumentViewerScreen
|
from screens.DocumentViewer import DocumentViewerScreen
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ cli.add_command(ticktick)
|
|||||||
cli.add_command(godspeed)
|
cli.add_command(godspeed)
|
||||||
cli.add_command(gitlab_monitor)
|
cli.add_command(gitlab_monitor)
|
||||||
|
|
||||||
|
# Add 'mail' as an alias for email
|
||||||
|
cli.add_command(email, name="mail")
|
||||||
# Add 'tt' as a short alias for ticktick
|
# Add 'tt' as a short alias for ticktick
|
||||||
cli.add_command(ticktick, name="tt")
|
cli.add_command(ticktick, name="tt")
|
||||||
# Add 'gs' as a short alias for godspeed
|
# Add 'gs' as a short alias for godspeed
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import click
|
import click
|
||||||
from src.maildir_gtd.app import launch_email_viewer
|
from src.mail.app import launch_email_viewer
|
||||||
|
|
||||||
|
|
||||||
@click.command()
|
@click.command()
|
||||||
|
|||||||
1
src/mail/__init__.py
Normal file
1
src/mail/__init__.py
Normal file
@@ -0,0 +1 @@
|
|||||||
|
# Initialize the mail package
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
from .config import get_config, MaildirGTDConfig
|
from .config import get_config, MailAppConfig
|
||||||
from .message_store import MessageStore
|
from .message_store import MessageStore
|
||||||
from .widgets.ContentContainer import ContentContainer
|
from .widgets.ContentContainer import ContentContainer
|
||||||
from .widgets.EnvelopeListItem import EnvelopeListItem, GroupHeader
|
from .widgets.EnvelopeListItem import EnvelopeListItem, GroupHeader
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
"""Configuration system for MaildirGTD email reader using Pydantic."""
|
"""Configuration system for Mail email reader using Pydantic."""
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
@@ -90,7 +90,7 @@ class LinkPanelConfig(BaseModel):
|
|||||||
close_on_open: bool = False
|
close_on_open: bool = False
|
||||||
|
|
||||||
|
|
||||||
class MailConfig(BaseModel):
|
class MailOperationsConfig(BaseModel):
|
||||||
"""Configuration for mail operations."""
|
"""Configuration for mail operations."""
|
||||||
|
|
||||||
# Folder to move messages to when archiving
|
# Folder to move messages to when archiving
|
||||||
@@ -103,8 +103,8 @@ class ThemeConfig(BaseModel):
|
|||||||
theme_name: str = "monokai"
|
theme_name: str = "monokai"
|
||||||
|
|
||||||
|
|
||||||
class MaildirGTDConfig(BaseModel):
|
class MailAppConfig(BaseModel):
|
||||||
"""Main configuration for MaildirGTD email reader."""
|
"""Main configuration for Mail email reader."""
|
||||||
|
|
||||||
task: TaskBackendConfig = Field(default_factory=TaskBackendConfig)
|
task: TaskBackendConfig = Field(default_factory=TaskBackendConfig)
|
||||||
envelope_display: EnvelopeDisplayConfig = Field(
|
envelope_display: EnvelopeDisplayConfig = Field(
|
||||||
@@ -112,7 +112,7 @@ class MaildirGTDConfig(BaseModel):
|
|||||||
)
|
)
|
||||||
content_display: ContentDisplayConfig = Field(default_factory=ContentDisplayConfig)
|
content_display: ContentDisplayConfig = Field(default_factory=ContentDisplayConfig)
|
||||||
link_panel: LinkPanelConfig = Field(default_factory=LinkPanelConfig)
|
link_panel: LinkPanelConfig = Field(default_factory=LinkPanelConfig)
|
||||||
mail: MailConfig = Field(default_factory=MailConfig)
|
mail: MailOperationsConfig = Field(default_factory=MailOperationsConfig)
|
||||||
keybindings: KeybindingsConfig = Field(default_factory=KeybindingsConfig)
|
keybindings: KeybindingsConfig = Field(default_factory=KeybindingsConfig)
|
||||||
theme: ThemeConfig = Field(default_factory=ThemeConfig)
|
theme: ThemeConfig = Field(default_factory=ThemeConfig)
|
||||||
|
|
||||||
@@ -120,15 +120,15 @@ class MaildirGTDConfig(BaseModel):
|
|||||||
def get_config_path(cls) -> Path:
|
def get_config_path(cls) -> Path:
|
||||||
"""Get the path to the config file."""
|
"""Get the path to the config file."""
|
||||||
# Check environment variable first
|
# Check environment variable first
|
||||||
env_path = os.getenv("MAILDIR_GTD_CONFIG")
|
env_path = os.getenv("LUK_MAIL_CONFIG")
|
||||||
if env_path:
|
if env_path:
|
||||||
return Path(env_path)
|
return Path(env_path)
|
||||||
|
|
||||||
# Default to ~/.config/luk/maildir_gtd.toml
|
# Default to ~/.config/luk/mail.toml
|
||||||
return Path.home() / ".config" / "luk" / "maildir_gtd.toml"
|
return Path.home() / ".config" / "luk" / "mail.toml"
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def load(cls, config_path: Optional[Path] = None) -> "MaildirGTDConfig":
|
def load(cls, config_path: Optional[Path] = None) -> "MailAppConfig":
|
||||||
"""Load config from TOML file with defaults for missing values."""
|
"""Load config from TOML file with defaults for missing values."""
|
||||||
if config_path is None:
|
if config_path is None:
|
||||||
config_path = cls.get_config_path()
|
config_path = cls.get_config_path()
|
||||||
@@ -161,19 +161,19 @@ class MaildirGTDConfig(BaseModel):
|
|||||||
|
|
||||||
|
|
||||||
# Global config instance (lazy-loaded)
|
# Global config instance (lazy-loaded)
|
||||||
_config: Optional[MaildirGTDConfig] = None
|
_config: Optional[MailAppConfig] = None
|
||||||
|
|
||||||
|
|
||||||
def get_config() -> MaildirGTDConfig:
|
def get_config() -> MailAppConfig:
|
||||||
"""Get the global config instance, loading it if necessary."""
|
"""Get the global config instance, loading it if necessary."""
|
||||||
global _config
|
global _config
|
||||||
if _config is None:
|
if _config is None:
|
||||||
_config = MaildirGTDConfig.load()
|
_config = MailAppConfig.load()
|
||||||
return _config
|
return _config
|
||||||
|
|
||||||
|
|
||||||
def reload_config() -> MaildirGTDConfig:
|
def reload_config() -> MailAppConfig:
|
||||||
"""Force reload of the config from disk."""
|
"""Force reload of the config from disk."""
|
||||||
global _config
|
global _config
|
||||||
_config = MaildirGTDConfig.load()
|
_config = MailAppConfig.load()
|
||||||
return _config
|
return _config
|
||||||
@@ -13,7 +13,7 @@ from textual.containers import Container, Vertical
|
|||||||
from textual.screen import ModalScreen
|
from textual.screen import ModalScreen
|
||||||
from textual.widgets import Label, ListView, ListItem, Static
|
from textual.widgets import Label, ListView, ListItem, Static
|
||||||
|
|
||||||
from src.maildir_gtd.config import get_config
|
from src.mail.config import get_config
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -5,8 +5,8 @@ from textual.containers import Vertical, ScrollableContainer
|
|||||||
from textual.widgets import Static, Markdown, Label
|
from textual.widgets import Static, Markdown, Label
|
||||||
from textual.reactive import reactive
|
from textual.reactive import reactive
|
||||||
from src.services.himalaya import client as himalaya_client
|
from src.services.himalaya import client as himalaya_client
|
||||||
from src.maildir_gtd.config import get_config
|
from src.mail.config import get_config
|
||||||
from src.maildir_gtd.screens.LinkPanel import extract_links_from_content, LinkItem
|
from src.mail.screens.LinkPanel import extract_links_from_content, LinkItem
|
||||||
import logging
|
import logging
|
||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from typing import Literal, List
|
from typing import Literal, List
|
||||||
@@ -7,7 +7,7 @@ from textual.app import ComposeResult
|
|||||||
from textual.containers import Horizontal, Vertical
|
from textual.containers import Horizontal, Vertical
|
||||||
from textual.widgets import Label, Static
|
from textual.widgets import Label, Static
|
||||||
|
|
||||||
from src.maildir_gtd.config import EnvelopeDisplayConfig, get_config
|
from src.mail.config import EnvelopeDisplayConfig, get_config
|
||||||
|
|
||||||
|
|
||||||
class EnvelopeListItem(Static):
|
class EnvelopeListItem(Static):
|
||||||
@@ -1 +0,0 @@
|
|||||||
# Initialize the maildir_gtd package
|
|
||||||
@@ -4,7 +4,7 @@ import json
|
|||||||
import logging
|
import logging
|
||||||
import subprocess
|
import subprocess
|
||||||
|
|
||||||
from src.maildir_gtd.config import get_config
|
from src.mail.config import get_config
|
||||||
|
|
||||||
|
|
||||||
async def list_envelopes(limit: int = 9999) -> Tuple[List[Dict[str, Any]], bool]:
|
async def list_envelopes(limit: int = 9999) -> Tuple[List[Dict[str, Any]], bool]:
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import logging
|
|||||||
import shlex
|
import shlex
|
||||||
from typing import Tuple, List, Dict, Any, Optional
|
from typing import Tuple, List, Dict, Any, Optional
|
||||||
|
|
||||||
from src.maildir_gtd.config import get_config
|
from src.mail.config import get_config
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user