Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set configuration from the python files #29

Open
jbcolme opened this issue Apr 13, 2016 · 2 comments
Open

set configuration from the python files #29

jbcolme opened this issue Apr 13, 2016 · 2 comments

Comments

@jbcolme
Copy link

jbcolme commented Apr 13, 2016

From the examples, setting yLimits work but setting the timeWindow gives an error:

Traceback (most recent call last):
  File "<string>", line 7, in <module>
  File "/home/jcolmenares/development/signal-testing/oscilloscope.py", line 8, in <module>
    addPlot(timeWindow=20, yLimits=[-50, 50])
  File "<string>", line 153, in addPlot
AttributeError: PlotWidget has no attribute named 'setTimeWindow'

I'm just adding this line to the python file:

addPlot(timeWindow=20, yLimits=[-50, 50])

We would also like to be able to set the point size and line style from the python file, so that you don't have to load two files every time. Since this two things are global to all plots the idea is that the user sets them on the first plot and get done with it. If you guide me through the code a little bit I'll be more than happy to do it.

@patmarion
Copy link
Member

Are you sure you have an up-to-date build on the master branch? Signal-scope includes some example scripts, and a few of them use the timeWindow attribute with error, it works. For example, this example command should work:

$ signal-scope examples/example5.py

The Python api can call any Qt function which is marked as a slot. Simply edit plotwidget.h and move the methods such as setBackgroundColor() and setPointSize() to be listed under the "public slots:" tag, then recompile. Then you can call plot.setPointSize(4) from the Python console or script.

If you submit a pull request with that change I'd be happy to accept it, please also add a demonstration to one of the example py files. Thanks!

@jbcolme
Copy link
Author

jbcolme commented Apr 21, 2016

Done!

The error was on my side.

About loading the configuration from python, this is what I did. Since the curve style and point size are the same for all plots, I made a function on signalScopeSetup.py called "formatOptions". I also added the time window, so if its the same for all plots you have to write it only once. Plus, added the example about how to use it to the util_example that has three plots. I'll make the pull request so you can go through the code and let me know what you think.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants