.. _moobius_quickstart:
###################################################################################
moobius.quickstart
###################################################################################
******************************
Module-level functions
******************************
.. _moobius.quickstart.download_folder:
download_folder
---------------------------------------------------------------------------------------------------------------------
Downloads from the GroupUltra Public-CCS-demos..
.. raw:: html
* **download_folder**(local_folder, sub_git_folder)
.. raw:: html
* __local_folder:__ Local folder to download to.
* __sub_git_folder:__ The subfolder within the git repo.
.. raw:: html
* None.
.. raw:: html
* (this function does not raise any notable errors)
.. _moobius.quickstart.open_folder_in_explorer:
open_folder_in_explorer
---------------------------------------------------------------------------------------------------------------------
Lets the user select a folder. This is used for gui-mode only.
.. raw:: html
* **open_folder_in_explorer**(folder_path)
.. raw:: html
* __folder_path:__ Default folder to pick.
.. raw:: html
* None.
.. raw:: html
* (this function does not raise any notable errors)
.. _moobius.quickstart.download_text_file_to_string:
download_text_file_to_string
---------------------------------------------------------------------------------------------------------------------
A simple download, used to get CCS code from GitHub.
.. raw:: html
* **download_text_file_to_string**(url)
.. raw:: html
* __url:__ URL.
.. raw:: html
* The text. Raises network exceptions if the request fails.
.. raw:: html
* (this function does not raise any notable errors)
.. _moobius.quickstart.create_channel:
create_channel
---------------------------------------------------------------------------------------------------------------------
Creates a channel.
.. raw:: html
* **create_channel**(email, password, url)
.. raw:: html
* __email:__ Email.
* __password:__ Password.
* __url:__ Url.
.. raw:: html
* The service_id, channel_id. Used if no channel is specified.
.. raw:: html
* (this function does not raise any notable errors)
.. _moobius.quickstart.save:
save
---------------------------------------------------------------------------------------------------------------------
Saves a file. Makes dirs if need be.
.. raw:: html
* **save**(fname, x)
.. raw:: html
* __fname:__ Filename.
* __x:__ A string.
.. raw:: html
* None.
.. raw:: html
* (this function does not raise any notable errors)
.. _moobius.quickstart.submit:
submit
---------------------------------------------------------------------------------------------------------------------
Saves the CCS files (code and config) to a folder.
.. raw:: html
* **submit**(out)
.. raw:: html
* __out:__ Configuration dict with all the settings.
.. raw:: html
* The sys.exit().
Calling this function will read the current gui state.
.. raw:: html
* (this function does not raise any notable errors)
.. _moobius.quickstart.make_box:
make_box
---------------------------------------------------------------------------------------------------------------------
Makes a box for GUI usage. None options means fill in.
.. raw:: html
* **make_box**(root, name, detailed_name, default, options)
.. raw:: html
* __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.
.. raw:: html
* The ttk.Combobox object.
.. raw:: html
* (this function does not raise any notable errors)
.. _moobius.quickstart.save_starter_ccs:
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.
.. raw:: html
* **save_starter_ccs**()
.. raw:: html
* __(this function accepts no arguments):__
.. raw:: html
* None.
.. raw:: html
* (this function does not raise any notable errors)
.. _moobius.quickstart.maybe_make_template_files:
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).
.. raw:: html
* **maybe_make_template_files**(args)
.. raw:: html
* __args:__ The list of args.
.. raw:: html
* None.
.. raw:: html
* (this function does not raise any notable errors)
**********************
Internals
**********************
.. toctree::
:maxdepth: 2
moobius.quickstart_internal_attrs