adata.core module

Helpers and base class for WX applications.

  • Module: a base class to allow scripts to be loaded.
  • Application: a WX App running in a Twisted event loop
class Application

Bases: WX

The minimal Adata wx application class.

Here goes anything common to every concrete app

custom

alias of Custom

About(evt)

Display the About box

ConfigDict(config, section)

Read a configuration section.

Parameters:
  • config (configparser.ConfigParser) – File path
  • section (string) – [Section] title
Return type:

dict

ConfigParser(filepath)

Create a Windows style ini file parser

Parameters:filepath (string) – File path.
Returns:ConfigParser instance
Return type:configparser.ConfigParser
InitSystem()

Configure system paths before UI creation

ReactorLoop()

Run wxpython in a Twisted event loop.

Run(module='__auto__')

Execute the module.

Calls the function returned by the defined call method.

Parameters:module (string) – Module name.
Returns:
Return type:Unknown
load_module(name)

Custom modules loader

Configures the module definition and creates custom GUI elements.

static pub(**kwargs)

Publish a pubsub message.

Keyword arguments should follow the spec.

run_explorer(folder)

Open a new Windows Explorer.

run_file(path)

Run default application to open a file.

run_module(name)

Get the defined execution call.

The default method returns a function that calls if found:

    1. the run method: Code executed in main thread
    1. the task method: Start a new background task

TODO: use a loaded module cache

run_process_module(name)

TODO: multiprocessing modules

threads()

Get all runing threads.

loaded = []
module = {}
class Custom

Bases: object

A custom global configuration placeholder for modules

Common custom configuration options storage convention. at wx.GetApp().custom.module_name

class Module(app)

Bases: object

Every pluggable module should have a Define(Module) subclass

TODO: “Define” convention -> dir module classes issubclass(cls, Module)

call()

Function to execute this module

Returns:Callable handler
Return type:function
execute(event=None)

Call the run and task methods if defined

Parameters:event (wx.Event or None.) – optional
menuitems(menu)

Create menuitems

name = None
run = None
task = None
check_module(name)

Try to Import the module and show errors

Parameters:name (string) – Module name.
Returns:Module imported without errors
Return type:bool
check_modules(folder)

Check all modules in a folder.

A module should not do anything when imported. But a script does: try check_modules(app.path[“scripts”])

Parameters:folder (string) – Module folder path.

Previous topic

adata.cmd module

Next topic

adata.functions module