Skip to content

[PPTX] pptx_export.py — ResearchNotePPTX core module with 16:9 presentation skeleton #41

Description

@DogInfantry

Part of epic: #32

What

Create pptx_export.py with the ResearchNotePPTX class, GS-style colour palette constants, 16:9 widescreen presentation setup, and the build() / save() scaffold. Individual slide methods will be implemented in follow-up sub-issues (#42, #43).

Implementation

from pptx import Presentation
from pptx.util import Inches, Pt
from pptx.dml.color import RGBColor

# GS-style palette
GS_BLUE  = RGBColor(0x00, 0x38, 0x6B)
GS_GOLD  = RGBColor(0xC8, 0xA8, 0x50)
WHITE    = RGBColor(0xFF, 0xFF, 0xFF)
LIGHT_GREY = RGBColor(0xF5, 0xF5, 0xF5)
GREEN    = RGBColor(0x00, 0x7A, 0x33)  # BUY
RED      = RGBColor(0xC0, 0x39, 0x2B)  # SELL

RATING_COLOURS = {'BUY': GREEN, 'HOLD': LIGHT_GREY, 'SELL': RED}

class ResearchNotePPTX:
    SLIDE_W = Inches(13.33)  # 16:9 widescreen
    SLIDE_H = Inches(7.5)

    def __init__(self, note_json: dict, chart_paths: dict = None):
        self.note = note_json
        self.charts = chart_paths or {}
        self.prs = Presentation()
        self.prs.slide_width = self.SLIDE_W
        self.prs.slide_height = self.SLIDE_H

    def build(self) -> Presentation:
        """Build all slides and return presentation object."""
        self._add_cover_slide()
        self._add_exec_summary_slide()
        self._add_thesis_slide()
        self._add_financials_slide()
        self._add_valuation_slide()
        self._add_price_chart_slide()
        self._add_peer_comparison_slide()
        self._add_risks_slide()
        self._add_catalysts_slide()
        self._add_appendix_slide()
        return self.prs

    def save(self, output_path: str) -> None:
        self.build().save(output_path)

    def _blank_slide(self):
        """Return a blank slide layout."""
        blank_layout = self.prs.slide_layouts[6]
        return self.prs.slides.add_slide(blank_layout)

    def _add_header_bar(self, slide, title: str, subtitle: str = ''):
        """Add GS-blue header bar with white title text to any slide."""
        ...

    # Stub methods to be implemented in follow-up issues
    def _add_cover_slide(self): ...
    def _add_exec_summary_slide(self): ...
    def _add_thesis_slide(self): ...
    def _add_financials_slide(self): ...
    def _add_valuation_slide(self): ...
    def _add_price_chart_slide(self): ...
    def _add_peer_comparison_slide(self): ...
    def _add_risks_slide(self): ...
    def _add_catalysts_slide(self): ...
    def _add_appendix_slide(self): ...

Dependencies

python-pptx>=0.6.21

Acceptance Criteria

  • pptx_export.py exists and is importable
  • ResearchNotePPTX(note_json).save('test.pptx') runs without error
  • Output .pptx is 16:9 widescreen (13.33 x 7.5 inches)
  • GS colour constants defined at module level
  • python-pptx added to requirements.txt
  • _blank_slide() and _add_header_bar() helpers implemented and tested

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions