d
This commit is contained in:
22
v4/ContextController.py
Normal file
22
v4/ContextController.py
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
import memory_Context
|
||||||
|
|
||||||
|
class ContextController:
|
||||||
|
def __init__(self):
|
||||||
|
self.c = memory_createContext()
|
||||||
|
|
||||||
|
def executeFunctions(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def reportCallbacks(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def set(self, field, value):
|
||||||
|
setattr(self.c, field, value)
|
||||||
|
self.c.recentField = field
|
||||||
|
self.executeFunctions()
|
||||||
|
self.reportCallbacks()
|
||||||
|
|
||||||
|
ctrl = ContextController()
|
||||||
|
ctrl.callback(printOutput)
|
||||||
|
|
||||||
|
ctrl.set("didLaunch", True)
|
||||||
@@ -7,8 +7,8 @@ def cli_greetUser(
|
|||||||
c: memory_Context
|
c: memory_Context
|
||||||
) -> memory_Context:
|
) -> memory_Context:
|
||||||
if (
|
if (
|
||||||
c.recentField == "launched" and
|
c.recentField == "didLaunch" and
|
||||||
c.launched == True
|
c.didLaunch == True
|
||||||
):
|
):
|
||||||
c.outputGreeting = "OGS Memory Command Line Interface"
|
c.outputGreeting = "OGS Memory Command Line Interface"
|
||||||
c.recentField = "outputGreeting"
|
c.recentField = "outputGreeting"
|
||||||
|
|||||||
@@ -5,8 +5,8 @@ from memory_Context import *
|
|||||||
def cli_test_greetUser(
|
def cli_test_greetUser(
|
||||||
) -> str:
|
) -> str:
|
||||||
c = memory_createContext()
|
c = memory_createContext()
|
||||||
c.launched = True
|
c.didLaunch = True
|
||||||
c.recentField = "launched"
|
c.recentField = "didLaunch"
|
||||||
c = cli_greetUser(c)
|
c = cli_greetUser(c)
|
||||||
if (
|
if (
|
||||||
c.recentField == "outputGreeting"
|
c.recentField == "outputGreeting"
|
||||||
|
|||||||
11
v4/main.py
11
v4/main.py
@@ -19,6 +19,17 @@ print(cli_test_greetUser())
|
|||||||
##print(cli_test_shouldReportIvalidItemSelection_outOfBoundsMin())
|
##print(cli_test_shouldReportIvalidItemSelection_outOfBoundsMin())
|
||||||
#print(cli_test_showHelp_h())
|
#print(cli_test_showHelp_h())
|
||||||
#print(cli_test_showHelp_help())
|
#print(cli_test_showHelp_help())
|
||||||
|
|
||||||
|
def printOutput(c):
|
||||||
|
if c.recentField.startswith("output")):
|
||||||
|
print(getatter(c, c.recentField))
|
||||||
|
|
||||||
|
ctrl = ContextController()
|
||||||
|
ctrl.callback(printOutput)
|
||||||
|
|
||||||
|
ctrl.set("didLaunch", True)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
#c = shell_createContext()
|
#c = shell_createContext()
|
||||||
#c.cCLI = cli_createContext()
|
#c.cCLI = cli_createContext()
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
class memory_Context:
|
class memory_Context:
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
|
self.didLaunch = False
|
||||||
self.hiddenItems = []
|
self.hiddenItems = []
|
||||||
self.input = ""
|
self.input = ""
|
||||||
self.mismatchedItems = []
|
self.mismatchedItems = []
|
||||||
|
|||||||
Reference in New Issue
Block a user