Skip to content

Commit d0fdcd9

Browse files
committed
Updated sphinx config and documentation
1 parent 2e5f69e commit d0fdcd9

File tree

5 files changed

+92
-22
lines changed

5 files changed

+92
-22
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
docs/_build/
22
env/
33
*.pyc
4+
dist/

docs/conf.py

+16-2
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#
2020
import os
2121
import sys
22+
import alabaster
2223
sys.path.insert(0, os.path.abspath('..'))
2324
from vix import __version__
2425

@@ -32,6 +33,7 @@
3233
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
3334
# ones.
3435
extensions = [
36+
'alabaster',
3537
'sphinx.ext.autodoc',
3638
]
3739

@@ -53,7 +55,7 @@
5355

5456
# General information about the project.
5557
project = 'vix'
56-
copyright = '2016, Naim A.'
58+
copyright = '2017, Naim A.'
5759
author = 'Naim A.'
5860

5961
# The version info for the project you're documenting, acts as replacement for
@@ -142,10 +144,14 @@
142144
'github_repo': 'vix',
143145
'description': 'The unofficial python binding for VIX',
144146
'analytics_id': 'UA-11289087-19',
147+
'sidebar_collapse': False,
148+
'show_related': True,
149+
'fixed_sidebar': True,
145150
}
146151

147152
# Add any paths that contain custom themes here, relative to this directory.
148153
# html_theme_path = []
154+
html_theme_path = [alabaster.get_path()]
149155

150156
# The name for this set of Sphinx documents.
151157
# "<project> v<release> documentation" by default.
@@ -191,7 +197,15 @@
191197

192198
# Custom sidebar templates, maps document names to template names.
193199
#
194-
# html_sidebars = {}
200+
html_sidebars = {
201+
'**': [
202+
'about.html',
203+
'navigation.html',
204+
'relations.html',
205+
'searchbox.html',
206+
'donate.html',
207+
]
208+
}
195209

196210
# Additional templates that should be rendered to pages, maps page names to
197211
# template names.

docs/index.rst

+24-18
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,37 @@
33
You can adapt this file completely to your liking, but it should at least
44
contain the root `toctree` directive.
55
6-
VIX python binding
6+
.. toctree::
7+
:maxdepth: 2
8+
:hidden:
9+
10+
tutorials
11+
vix
12+
13+
VIX Python binding
714
==================
815

916
This is an unofficial binding of VMware's VIX API.
1017

1118
The VIX project is hosted on GitHub: https://github.com/naim94a/vix.
1219
Feel free to submit pull requests and issues.
1320

14-
Example:
21+
About
22+
-----
23+
VIX is a C library created by VMWare, the aim of this project is to wrap it in python.
24+
This project allow Object-Oriented access to various VMWare products.
25+
26+
27+
Installing
28+
----------
29+
30+
.. code-block:: shell
31+
32+
pip install vix
33+
34+
35+
Example usage
36+
-------------
1537

1638
.. code-block:: python
1739
:caption: snapshot-demo.py
@@ -34,19 +56,3 @@ Example:
3456
3557
except VixError as ex:
3658
print("Operatation failed: {0}".format(ex))
37-
38-
API:
39-
40-
.. toctree::
41-
:maxdepth: 4
42-
43-
vix
44-
45-
46-
Indices and tables
47-
==================
48-
49-
* :ref:`genindex`
50-
* :ref:`modindex`
51-
* :ref:`search`
52-

docs/tutorials.rst

+49
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
Tutorials
2+
=========
3+
4+
Capturing screens
5+
-----------------
6+
Every wanted to take a screenshot of whats going on in a running VM?
7+
Well, you are in luck! VIX supports taking screenshots, this will require you to know a guest's username/password.
8+
9+
The VIX python binding can return a screenshot in PNG format. You can choose between having the file written to a file, or getting the PNG buffer.
10+
11+
This example will demonstrate how to take screenshots from a VM every 10 seconds.
12+
13+
.. code-block:: python
14+
:caption: screenshots.py
15+
16+
import time
17+
from vix import VixHost
18+
19+
host = VixHost()
20+
vm = host.open_vm('~/my vm.vmx')
21+
22+
# Must login to do some things...
23+
vm.login('root', 'toor')
24+
while True:
25+
vm.capture_screen_image('~/IMG_{name}_{timestamp:.0f}.png'.format(name=vm.name, timestamp=time.time()))
26+
time.sleep(10.0)
27+
28+
29+
Cloning Machines
30+
----------------
31+
Cloning machines are usually a more useful action then capturing screenshots. It is a pretty simple task to...
32+
33+
.. code-block:: python
34+
:caption: snapshot.py
35+
36+
from vix import VixHost
37+
38+
host = VixHost()
39+
vm = host.open_vm('~/template.vmx')
40+
41+
# Assuming that template.vmx is currently on a powered off snapshot.
42+
snapshot = vm.snapshot_get_current()
43+
44+
# This clone will be based of 'template.vmx' at the specified snapshot.
45+
# Linked snapshots take less space...
46+
cloned = vm.clone('~/cloned.vmx', snapshot=snapshot, linked=True)
47+
48+
# Let fire up our cloned machine!
49+
cloned.power_on()

docs/vix.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
vix package
2-
===========
1+
VIX Reference
2+
=============
33

44
VixHost class
55
-------------

0 commit comments

Comments
 (0)