Skip to content

Commit

Permalink
docs
Browse files Browse the repository at this point in the history
  • Loading branch information
txemavs committed Apr 1, 2018
1 parent c7ee5be commit c4cc56a
Show file tree
Hide file tree
Showing 7 changed files with 283 additions and 177 deletions.
40 changes: 16 additions & 24 deletions src/adata/cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,8 @@ class Interpreter(code.InteractiveInterpreter):
def write(self, text):
'''Adata override: pubsub event send.
:parameters:
`text` : string
Output.
:param text: Output
:type line: string
'''
echo(text)

Expand All @@ -51,9 +50,8 @@ class Commands(Cmd):
def __init__(self, app):
'''Create a cmd2 interpreter.
:parameters:
`app` : ``adata.core.Application``
The main application.
:param app: The main application.
:type app: ``adata.core.Application``
'''
env = {
'app': app,
Expand Down Expand Up @@ -97,26 +95,22 @@ def poutput(self, msg, end='\n'):
def Prompt(self, console):
'''Attach a interactive input handler to a Console instance.
Try:
- 1. first word is in help: This interpreter
- 2. first word is a script file: import
- 3. code: python standard code.InteractiveInterpreter
:parameters:
`console` : ``adata.gui.text.Console``
The console.
Handler resolve order:
1. first word is a command listed in help: This cmd2 do method
2. first word is a script file: import or reload
3. else: python standard code.InteractiveInterpreter
:param console: The console.
:type console: ``adata.gui.text.Console``
:return: self
:rtype: `Commands`
'''

def handler(cmd):
'''
Console.Enter handler (Commands class overriden)
'''Console.Enter handler ( override Commands class method )
:parameters:
`cmd` : string
A command line.
:param cmd: A command line.
:type cmd: string
'''

if cmd=="help()": cmd = "import this"
Expand Down Expand Up @@ -193,10 +187,8 @@ def do_dir(self, args ):
def do_module(self, name):
'''Load or reload a module.
:parameters:
`name` : string
Module name
:param cmd: Module name.
:type cmd: string
:return: Module imported without errors
:rtype: bool
Expand Down
32 changes: 0 additions & 32 deletions src/adata/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -328,38 +328,6 @@ def ConfigDict(self, config, section):
data[name.upper()] = v
return data


def InitConfig(self):
'''Load application initial configuration.
'''
path = os.path.join(self.path["root"],"config.ini")
self.path["config"] = path
self.config = self.ConfigParser( path )
self.system = self.ConfigDict(self.config, "SYSTEM")
self.language = self.config.get("SYSTEM", "language")
self.database = self.config.get("SYSTEM", "database")

if "DEBUG" in self.system:
self.debug = self.system["DEBUG"]



def InitDataBase(self):
'''Create the local sqlite3 database for local user data.
'''
self.path["db"] = os.path.join(self.path["user"], self.database)
self.DB = DataBase(self.path["db"])
if len(self.DB.tables())==0:
print("Creating new SQLite file: %s" % self.path["db"])
sql_start = os.path.join(self.path["data"],"database.sql")
with open(sql_start) as file:
structure = file.read()
for query in structure.split(";"):
sql=""
for line in query.splitlines(): sql+=line
self.DB.query(sql)


def About(self, evt):
'''Display the About box
'''
Expand Down

0 comments on commit c4cc56a

Please sign in to comment.