Skip to content

Commit

Permalink
Rename files, add fomod_controller skeleton
Browse files Browse the repository at this point in the history
  • Loading branch information
cyberrumor committed Oct 30, 2023
1 parent 47b6ed5 commit 0139b79
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 9 deletions.
4 changes: 2 additions & 2 deletions ammo/ammo.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import sys
from pathlib import Path
from .ui import UI
from .mod_organizer import ModOrganizer
from .mod_controller import ModController
from .game import Game

IDS = {
Expand Down Expand Up @@ -83,7 +83,7 @@ def main():
)

# Create an instance of the controller.
controller = ModOrganizer(DOWNLOADS, game)
controller = ModController(DOWNLOADS, game)

# Run the UI against the controller.
ui = UI(controller)
Expand Down
5 changes: 3 additions & 2 deletions ammo/controller.py
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,13 @@

class Controller(ABC):
"""
Public methods of this class are exposed to the UI.
Public methods of this class will be exposed
to the UI.
"""
@abstractmethod
def __init__(self, *args, **kwargs):
pass

@abstractmethod
def _prompt(self) -> str:
pass
return ""
10 changes: 10 additions & 0 deletions ammo/fomod_controller.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env python3

from .controller import Controller

class FomodController(Controller):
def __init__(self, *args, **kwargs):
pass

def _prompt(self) -> str:
return ""
4 changes: 2 additions & 2 deletions ammo/mod_organizer.py → ammo/mod_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
)


class ModOrganizer(Controller):
def __init__(self, downloads_dir: Path, game: Game, *args):
class ModController(Controller):
def __init__(self, downloads_dir: Path, game: Game, *args, **kwargs):
self.downloads_dir: Path = downloads_dir
self.game: Game = game
self.changes: bool = False
Expand Down
6 changes: 3 additions & 3 deletions test/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from xml.etree import ElementTree

from ammo.game import Game
from ammo.mod_organizer import ModOrganizer
from ammo.mod_controller import ModController
from ammo.mod import (
ComponentEnum,
DeleteEnum,
Expand All @@ -30,7 +30,7 @@ class AmmoController:
"""
Context manager for ammo's controller class.
Builds a ModOrganizer instance to run against /tmp/MockGame.
Builds a ModController instance to run against /tmp/MockGame.
Ammo's configuration directory will be set up as AMMO_DIR,
if it doesn't already exist.
Expand All @@ -47,7 +47,7 @@ def __enter__(self):
Return an instance of ammo's controller for tests to
interact with.
"""
return ModOrganizer(self.downloads_dir, self.game)
return ModController(self.downloads_dir, self.game)

def __exit__(self, *args, **kwargs):
"""
Expand Down

0 comments on commit 0139b79

Please sign in to comment.