Skip to content

Commit 375ba88

Browse files
committed
Resolve conflicts upon merging with _using_pyvisa
2 parents ccd654b + cb443ef commit 375ba88

File tree

175 files changed

+18158
-2223
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+18158
-2223
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ _past*
55
*.pyc
66
.DS_Store
77
docs/_build/
8+
docs/_snippets/
89
docs/drivers
910
.idea
1011
_test*

docs/_static/blocks/loop.png

22.3 KB
Loading

docs/_static/blocks/scan.png

23.2 KB
Loading

docs/_static/blocks/scanfeat.png

24.8 KB
Loading

docs/_static/guides/scanfrequency.png

41 KB
Loading
File renamed without changes.

docs/_static/tutorial/fungen.ui

+90
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<ui version="4.0">
3+
<class>MainWindow</class>
4+
<widget class="QMainWindow" name="MainWindow">
5+
<property name="geometry">
6+
<rect>
7+
<x>0</x>
8+
<y>0</y>
9+
<width>328</width>
10+
<height>231</height>
11+
</rect>
12+
</property>
13+
<property name="windowTitle">
14+
<string>Function Generator</string>
15+
</property>
16+
<widget class="QWidget" name="centralwidget">
17+
<layout class="QVBoxLayout" name="verticalLayout">
18+
<item>
19+
<widget class="QGroupBox" name="configBox">
20+
<property name="title">
21+
<string>Configuration</string>
22+
</property>
23+
<layout class="QVBoxLayout" name="verticalLayout_3">
24+
<item>
25+
<layout class="QFormLayout" name="formLayout">
26+
<property name="fieldGrowthPolicy">
27+
<enum>QFormLayout::FieldsStayAtSizeHint</enum>
28+
</property>
29+
<item row="0" column="0">
30+
<widget class="QLabel" name="amplitudeLabel">
31+
<property name="text">
32+
<string>Amplitude</string>
33+
</property>
34+
</widget>
35+
</item>
36+
<item row="0" column="1">
37+
<widget class="QDoubleSpinBox" name="amplitude"/>
38+
</item>
39+
<item row="1" column="0">
40+
<widget class="QLabel" name="offsetLabel">
41+
<property name="text">
42+
<string>Offset</string>
43+
</property>
44+
</widget>
45+
</item>
46+
<item row="1" column="1">
47+
<widget class="QDoubleSpinBox" name="offset"/>
48+
</item>
49+
<item row="2" column="0">
50+
<widget class="QLabel" name="waveformLabel">
51+
<property name="text">
52+
<string>Waveform</string>
53+
</property>
54+
</widget>
55+
</item>
56+
<item row="2" column="1">
57+
<widget class="QComboBox" name="waveform"/>
58+
</item>
59+
<item row="3" column="0">
60+
<widget class="QLabel" name="frequencyLabel">
61+
<property name="text">
62+
<string>Frequency</string>
63+
</property>
64+
</widget>
65+
</item>
66+
<item row="3" column="1">
67+
<widget class="QDoubleSpinBox" name="frequency"/>
68+
</item>
69+
</layout>
70+
</item>
71+
</layout>
72+
</widget>
73+
</item>
74+
</layout>
75+
</widget>
76+
<widget class="QMenuBar" name="menubar">
77+
<property name="geometry">
78+
<rect>
79+
<x>0</x>
80+
<y>0</y>
81+
<width>328</width>
82+
<height>22</height>
83+
</rect>
84+
</property>
85+
</widget>
86+
<widget class="QStatusBar" name="statusbar"/>
87+
</widget>
88+
<resources/>
89+
<connections/>
90+
</ui>

docs/_static/tutorial/gui-app.png

-17.6 KB
Loading
47.3 KB
Loading

docs/agreement.rst

+4
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
.. _agreement:
22

3+
4+
Agreeement
5+
----------
6+
37
.. raw:: html
48

59
<iframe src="https://docs.google.com/spreadsheet/embeddedform?formkey=dEs1Qmk5bU1ua1dPcS1kX1A1bmtjS1E6MQ" width="760" height="816" frameborder="0" marginheight="0" marginwidth="0">Loading...</iframe>

docs/api/interfaces.rst

+1-9
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,10 @@
22
Interfacing to instruments
33
==========================
44

5-
.. automodule:: lantz.serial
6-
:members:
7-
:show-inheritance:
8-
9-
.. automodule:: lantz.network
5+
.. automodule:: lantz.messagebased
106
:members:
117
:show-inheritance:
128

139
.. automodule:: lantz.foreign
1410
:members:
1511
:show-inheritance:
16-
17-
.. automodule:: lantz.visa
18-
:members:
19-
:show-inheritance:

docs/api/support.rst

-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ Support
77

88
stats
99
processors
10-
visalib
1110
stringparser
1211

docs/api/visalib.rst

-4
This file was deleted.

docs/conf.py

+38-13
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,20 @@
1515
import pkg_resources
1616
import datetime
1717

18+
os.environ['QT_API'] = 'mock'
19+
os.environ['LANTZ_BUILDING_DOCS'] = 'True'
20+
21+
from unittest.mock import MagicMock
22+
23+
class Mock(MagicMock):
24+
25+
@classmethod
26+
def __getattr__(cls, name):
27+
return Mock()
28+
29+
MOCK_MODULES = ['numpy', ]
30+
sys.modules.update((mod_name, Mock()) for mod_name in MOCK_MODULES)
31+
1832
# If extensions (or modules to document with autodoc) are in another directory,
1933
# add these directories to sys.path here. If the directory is relative to the
2034
# documentation root, use os.path.abspath to make it absolute, like shown here.
@@ -29,10 +43,12 @@
2943
# Add any Sphinx extension module names here, as strings. They can be extensions
3044
# coming with Sphinx (named 'sphinx.ext.*') or your custom ones.
3145
extensions = ['sphinx.ext.viewcode', 'sphinx.ext.autodoc', 'sphinx.ext.intersphinx',
46+
'sphinxcontrib.images',
3247
]#'autodriver']
3348
# 'sphinxcontrib.spelling']
3449

35-
intersphinx_mapping = {'python': ('http://docs.python.org/3.2', None)}
50+
intersphinx_mapping = {'python': ('http://docs.python.org/3.4', None),
51+
'pyvisa': ('http://pyvisa.readthedocs.org/en/latest', None)}
3652

3753
autodoc_member_order = 'groupwise'
3854
autoclass_content = 'both'
@@ -57,7 +73,11 @@
5773
# |version| and |release|, also used in various other places throughout the
5874
# built documents.
5975

60-
version = pkg_resources.get_distribution(project).version
76+
try:
77+
version = pkg_resources.get_distribution(project).version
78+
except:
79+
version = 'unknown'
80+
6181
release = version
6282
this_year = datetime.date.today().year
6383
copyright = '%s, %s' % (this_year, author)
@@ -96,24 +116,29 @@
96116
# A list of ignored prefixes for module index sorting.
97117
modindex_common_prefix = ['lantz.']
98118

99-
100-
import driversdoc
101-
driversdoc.main()
102-
103119
# -- Options for HTML output ---------------------------------------------------
104-
sys.path.append(os.path.abspath('_themes'))
105120
# The theme to use for HTML and HTML Help pages. See the documentation for
106121
# a list of builtin themes.
107-
html_theme = 'lantz'
122+
html_theme = 'sphinx_rtd_theme'
123+
124+
on_rtd = os.environ.get('READTHEDOCS', None) == 'True'
125+
126+
if not on_rtd: # only import and set the theme if we're building docs locally
127+
try:
128+
import sphinx_rtd_theme
129+
except ImportError:
130+
print('\n\nTheme not found. Please install Sphinx Read The Docs Themes using:\n\n'
131+
' pip install sphinx_rtd_theme\n')
132+
sys.exit(1)
133+
html_theme_path = [sphinx_rtd_theme.get_html_theme_path()]
134+
135+
import driversdoc
136+
driversdoc.main()
108137

109138
# Theme options are theme-specific and customize the look and feel of a theme
110139
# further. For a list of options available for each theme, see the
111140
# documentation.
112-
#html_theme_options = {}
113-
html_theme_options = {'collapsiblesidebar': True}
114-
115-
# Add any paths that contain custom themes here, relative to this directory.
116-
html_theme_path = ['_themes']
141+
html_theme_options = {}
117142

118143
# The name for this set of Sphinx documents. If None, it defaults to
119144
# "<project> v<release> documentation".

docs/contributing-core.rst

+4-10
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ There are always at least two branches:
1616
* master: appropriate for users. It must always be in a working state.
1717
* develop: appropriate for developers. Might not be in a working state.
1818

19-
The master branch only accepts atomic, small commits. Larger changes that might break the master branch should happen in the develop branch. The develop branch will be merged into the master after deep testing. If you want to refactor major parts of the code or try new ideas, create a dedicated branch. This branch will merged into develop once tested.
19+
The master branch only accepts atomic, small commits. Larger changes that might break the master branch should happen in the develop branch . The develop branch will be merged into the master after deep testing. If you want to refactor major parts of the code or try new ideas, create a dedicated branch. This will merged into develop once tested.
2020

2121
The easiest way to start hacking Lantz codebase is using a virtual environment
2222
and cloning an editable package.
@@ -133,7 +133,7 @@ module, a small description and the copyright message. For example:
133133
Submitting your changes
134134
-----------------------
135135

136-
Changes must be submitted for merging as patches or pull requests.
136+
Changes must be submitted for merging as pull requests.
137137

138138
Before doing so, please check that:
139139
* The new code is functional.
@@ -143,14 +143,7 @@ Before doing so, please check that:
143143
* Any new file contains an appropriate header.
144144
* You commit to the head of the appropriate branch (usually develop).
145145

146-
Commits must include a one-line description of the intended change followed, if necessary, by an empty line and detailed description. You can send your patch by e-mail to `[email protected]`::
147-
148-
$ git format-patch origin/develop..develop
149-
0001-Changed-Driver-class-to-enable-inheritance-of-Action.patch
150-
0002-Added-RECV_CHUNK-to-TextualMixin.patch
151-
152-
153-
or send a pull request.
146+
Commits must include a one-line description of the intended change followed, if necessary, by an empty line and detailed description..
154147

155148

156149
Copyright
@@ -183,3 +176,4 @@ Finally, we have a small Zen
183176
.. _git: http://git-scm.com/
184177
.. _reStructuredText: http://docutils.sf.net/rst.html
185178
.. _Sphinx: http://sphinx.pocoo.org/
179+
.. _`Lantz at Github`: https://github.com/hgrecco/lantz/

docs/contributing-drivers.rst

+5-4
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,15 @@ Contributing Drivers
55
====================
66

77
The most straightforward way to contribute to Lantz is by submitting instrument
8-
drivers. You do not need to clone or understand the whole structure of `Lantz`
9-
for this purpose and you can do it directly from you own projects.
8+
drivers as you do not need to understand the whole structure of `Lantz`.
109

11-
If you have installed Lantz using the tutorial (:ref:`installing`), you
10+
There are two ways:
1211

13-
$ lantz-contribute <filename>
12+
- Clone the repo in github and do a pull request
13+
- Upload your code to a gist_,
1414

1515
Please be sure that you have documented the code properly before submission. You
1616
can also use this tool if you want some feedback about your code.
1717

1818

19+
.. _gist: https://gist.github.com/

docs/driversdoc.py

+12-2
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@ def list_drivers(key, module):
306306

307307
def list_packages(root_package):
308308
packages = {}
309+
failed_packages = []
309310
path, prefix = root_package.__path__, root_package.__name__ + "."
310311
for importer, modname, ispkg in pkgutil.iter_modules(path, prefix):
311312
if not ispkg:
@@ -315,12 +316,13 @@ def list_packages(root_package):
315316
packages[package.__name__] = package
316317
print('+ Imported {}'.format(modname))
317318
except Exception as e:
319+
failed_packages.append(modname)
318320
print('- Cannot import {}: {}'.format(modname, e))
319-
return packages
321+
return packages, failed_packages
320322

321323
def main():
322324
print('\nGenerating documentation for drivers ...')
323-
packages = list_packages(drivers)
325+
packages, failed_packages = list_packages(drivers)
324326
class opts:
325327
pass
326328
opts.dryrun = False
@@ -341,6 +343,8 @@ class opts:
341343
fp.write(' *\n')
342344
last = ''
343345
for key in sorted(packages.keys()):
346+
if key == 'legacy':
347+
continue
344348
try:
345349
company = company_parser(packages[key].__doc__).strip()
346350
except Exception as e:
@@ -355,5 +359,11 @@ class opts:
355359
module = packages[key]
356360
fp.write(list_drivers(key, module))
357361

362+
if failed_packages:
363+
fp.write(format_heading(1, 'Failed to generate the docs for the following subpackages'))
364+
fp.write('\n')
365+
for key in sorted(failed_packages):
366+
fp.write('- {}\n'.format(key))
367+
358368
if __name__ == '__main__':
359369
main()

docs/extract_snippets.py

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import os
4+
5+
from docutils.core import publish_doctree
6+
from docutils.nodes import literal_block
7+
8+
9+
def extract_snippets(filename):
10+
with open(filename, 'r') as fp:
11+
doctree = publish_doctree(fp.read())
12+
13+
for part in doctree.traverse(literal_block):
14+
if not part.attributes.get('classes', None) == ['code', 'python']:
15+
continue
16+
yield part.rawsource
17+
18+
19+
def main(doc_folder=None):
20+
if doc_folder is None:
21+
doc_folder = os.getcwd()
22+
23+
join = os.path.join
24+
25+
snippet_folder = join(doc_folder, '_snippets')
26+
27+
print('Scanning %s' % doc_folder)
28+
print('Extracting snippets to %s' % snippet_folder)
29+
30+
for root, dirs, files in os.walk(doc_folder, topdown=True):
31+
dirs[:] = [d for d in dirs
32+
if d[0] != '_' and d not in ('drivers', 'api')]
33+
34+
dst_folder = join(snippet_folder, root[(len(doc_folder)+1):])
35+
36+
try:
37+
os.mkdir(dst_folder)
38+
except:
39+
pass
40+
41+
for name in files:
42+
if not name.endswith('.rst'):
43+
continue
44+
45+
for ndx, snippet in enumerate(extract_snippets(join(root, name))):
46+
with open(join(dst_folder, '%s_%02d.py' % (name, ndx)), 'w', encoding='utf-8') as fo:
47+
fo.write(snippet)
48+
49+
if __name__ == '__main__':
50+
main()

docs/faq.rst

+1-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ Slow operations such as numerical calculations are done using libraries such as
6262
How do I start?
6363
---------------
6464

65-
The :ref:`tutorial` is a good place.
65+
The :ref:`tutorials` is a good place.
6666

6767

6868
I want to help. What can I do?

0 commit comments

Comments
 (0)