ALBA-Synchrotron / IcepapOSC

GNU General Public License v3.0
0 stars 8 forks source link

Output to file #12

Closed inki2 closed 3 years ago

inki2 commented 5 years ago

Added support for saving data to file.

inki2 commented 5 years ago

@rhomspuron This solves issue #2 New functionality: New menu item / Ctrl+F / new button saves ALL buffered data to file. Some details could be polished but currently focus is on delivering functionality.

rhomspuron commented 5 years ago

Hi @inki2

I try to test it and it raises this exception:

Traceback (most recent call last):
  File "/homelocal/rhoms/develop/pycharm/IcepapOSC/icepaposc/window_main.py", line 459, in _save_to_file
    self._create_csv_file(fn)
  File "/homelocal/rhoms/develop/pycharm/IcepapOSC/icepaposc/window_main.py", line 476, in _create_csv_file
    df.to_csv(file_name)
  File "/home/rhoms/miniconda/envs/ipap/lib/python2.7/site-packages/pandas/core/generic.py", line 3019, in to_csv
    escapechar=escapechar, decimal=decimal)
  File "/home/rhoms/miniconda/envs/ipap/lib/python2.7/site-packages/pandas/io/formats/csvs.py", line 44, in __init__
    path_or_buf, encoding=encoding, compression=compression, mode=mode
  File "/home/rhoms/miniconda/envs/ipap/lib/python2.7/site-packages/pandas/io/common.py", line 232, in get_filepath_or_buffer
    raise ValueError(msg.format(_type=type(filepath_or_buffer)))
ValueError: Invalid file path or buffer object type: <class 'PyQt4.QtCore.QString'>

In addition, why you include one dependency of panda? Is it really need it?

I review the code and I have a doubt: Do you save the data continuously or only when you click on the button?

inki2 commented 5 years ago

@rhomspuron : I removed the use of pandas. Now the exception should be gone too (I could not recreate it in my environment). Also now there is BOTH manual "Save All From Start" (menu + ctrl+F + save-button) AND continuous save (hardcoded to 5 minute interval). Continuous save is also triggered just before a signal is removed or user presses the clear-button.

rhomspuron commented 5 years ago

@inki2 great, I will start to review the code. Thanks!

inki2 commented 5 years ago

@rhomspuron Code is again ready for review. Hopefully I've not left too many bugs around this time.