moobius.quickstart#
Module-level functions#
download_folder#
Downloads from the GroupUltra Public-CCS-demos..
**download_folder**(local_folder, sub_git_folder)
__local_folder:__ Local folder to download to.
__sub_git_folder:__ The subfolder within the git repo.
None.
(this function does not raise any notable errors)
open_folder_in_explorer#
Lets the user select a folder. This is used for gui-mode only.
**open_folder_in_explorer**(folder_path)
__folder_path:__ Default folder to pick.
None.
(this function does not raise any notable errors)
download_text_file_to_string#
A simple download, used to get CCS code from GitHub.
**download_text_file_to_string**(url)
__url:__ URL.
The text. Raises network exceptions if the request fails.
(this function does not raise any notable errors)
create_channel#
Creates a channel.
**create_channel**(email, password, url)
__email:__ Email.
__password:__ Password.
__url:__ Url.
The service_id, channel_id. Used if no channel is specified.
(this function does not raise any notable errors)
save#
Saves a file. Makes dirs if need be.
**save**(fname, x)
__fname:__ Filename.
__x:__ A string.
None.
(this function does not raise any notable errors)
submit#
Saves the CCS files (code and config) to a folder.
**submit**(out)
__out:__ Configuration dict with all the settings.
The sys.exit().
Calling this function will read the current gui state.
(this function does not raise any notable errors)
make_box#
Makes a box for GUI usage. None options means fill in.
**make_box**(root, name, detailed_name, default, options)
__root:__ Tk.root.
__name:__ The box name.
__detailed_name:__ More details.
__default:__ The GUI default.
__options=None:__ The options to pick, for boxes with options.
The ttk.Combobox object.
(this function does not raise any notable errors)
save_starter_ccs#
Reads sys.argv, as well as gui interaction if specified. Uses this information to construct a CCS app and saves to the folder that was specified. This function is called, from the __init__.py in src/moobius, when “python -m moobius” is typed into the command line.
**save_starter_ccs**()
__(this function accepts no arguments):__
None.
(this function does not raise any notable errors)
maybe_make_template_files#
Makes template files if there is a need to do so, based on args and sys.argv. Called by wand.run() before initializing the Moobius class if it doesn’t have any templates.
- Which files are created:
A service.py file that runs everything. A sample config.py:
Only created if “config_path” is in args (or system args) AND the file does not exist. This requires user information:
email: If no system arg “email my@email.com” or “username my@email.com” is specified, prompts for one with input(). password: If no system arg “password my_sec**t_pword”, prompts for one. channels: If no system arg “channels abc… def…” to specify one or more channels, prompts for one or more.
Note: if the user gives an empty response to input(), a nonfunctional default is used, which can be filled in later.
- Unittests to run in a python prompt in an empty folder:
>>> # Prompt the user for credentials and put these in the service.json (NOTE: will generate an error b/c None class): >>> import sys; from moobius import MoobiusWand; MoobiusWand().run(None, config_path="config/service.json") >>> # Provide credentials, making a service.json with no user input (NOTE: will generate an error b/c None class): >>> import sys; sys.argv = '_ email abc@123.com password IAmSecret channels abc-123 def-4561111111111111111111'.split(' '); from moobius import MoobiusWand; MoobiusWand().run(0, config_path="config/service.json") >>> # Provide agent credentials. There is no need to provide a channel id (NOTE: will generate an error b/c None class). >>> import sys; sys.argv = '_ email abc@123.com password IAmSecret'.split(' '); from moobius import MoobiusWand; MoobiusWand().run(0, config_path="config/agent.json", is_agent=True).
**maybe_make_template_files**(args)
__args:__ The list of args.
None.
(this function does not raise any notable errors)