Menu

Decimal values in plot RangeLineEdit

Anonymous
2016-01-02
2016-01-12
1 2 3 4 > >> (Page 1 of 4)
  • Anonymous

    Anonymous - 2016-01-02

    Hi Stefan,
    another proposal for a small improvement.
    In the file scriptplotwidget.cpp change the validators from QIntValidator to QDoubleValidator for accepting decimal values.
    Example:

    m_yMinRangeLineEdit->setValidator(new QDoubleValidator((double)INT_MIN, (double)INT_MAX,3, m_yMinRangeLineEdit));
    

    Cheers,
    Pier Andrea

     

    Last edit: Anonymous 2016-01-02
  • Stefan Zieker

    Stefan Zieker - 2016-01-02

    Hi Pier,

    you are rigth. You can add doubles to the plot, therfore the range must contain doubles too. Are you using the plot witget in a project?

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2016-01-02

    Hi Stefan,
    I'm developing a new multichannel data acquisition system based on a MCU and I need very reliable (error-free) serial transmission protocols and fast data plotting At moment Scriptcommunicator is working very well but I'm founding new problems with data overloading (mainly in plots).
    I need to record data for long periods of time (hours or days).
    I'm starting to think to remove data points from the start of the plot and leaving just recent data points (like a ciclyc buffer). At moment I'm studying the plot component documentation and your adaptation inside ScriptCommunicator. If you want, I can send you info about improvements and suggestions (of course you can not introduce them in future versions of ScriptCommunicator; it is possible that some improvements are too specifically related to my project and no so useful for other users).
    Thank you again for your great feedback.
    Pier Andrea.

     

    Last edit: Anonymous 2016-01-02
  • Stefan Zieker

    Stefan Zieker - 2016-01-02

    Hi Pier,

    I have never used the plot widget in a real project (I thought that it could be usefull in a future project). Therfore I would appreciate a feedback from you.

    If it is possible for you to send me your code I will perform a code review (and maybe we can discuss your solution). You have to keep in mind that all GUI elements must run in the main-thread (therefore all GUI elements are created in the main-thread and all function-calls in a script which influence a GUI element normally result in a main-threadfunction).

    PS: I have uploaded a new version which contains the double validator.

    Best regards,
    Stefan

     

    Last edit: Stefan Zieker 2016-01-03
  • Stefan Zieker

    Stefan Zieker - 2016-01-03

    Hi Pier,

    I have added the function setMaxDataPointsPerGraph which sets the max. number of data points per graph (to avoid running out of memory). You can find this in the newest pre-release under Files/Tests.

    Best regards,
    Stefan

     

    Last edit: Stefan Zieker 2016-01-03
  • Anonymous

    Anonymous - 2016-01-03

    Hi Stefan,
    Thank you very much for this new routine.I'll check its behaviour ASAP. In the meantime the new readlines() routine seems to work very well. I'll send you a feedback.
    At moment I do not have a complete source code for my project, I have some sub-projects and I'm addressing specific issues (data request/data receive/data record/data visualization etc.). After your posts I'm thinking about the possibility to use a number o scripts (one-script-one-thread) for doing specific things. I have some questions about this issue. Do you think it could be possible to start/pause/stop a script (programmatically) from another script? I do not think it could be possible to pass to a script a pointer to an object created in another script because you structured the scripts as "insulated" entities. Also without this last possibility (now it's is impossible to share i.e. a serialport object among scripts) it could be possible to exchange data and create control semaphores by using global variables.
    Immagine this scenario:
    Script1 = GUI (control and visualization: launches Script2 and Script3 "with arguments" by means of global variables and accesses to global vars)
    Script2 = Serial thread (send/receive/parse/memorize received data on global vars)
    Script3 = Save data to disk (by accessing to data stored in global vars)
    Every script has to have non-blocking routines and when you close the GUI of Script1 also Script2 and Script3 have to stop.
    In this manner you can add functionality in PARALLEL without oveloading a single script thread (i.e. Script1).
    I've found these wide options only inside ScriptCommunicator and I thank you again for your efforts.
    My best regards,
    Pier Andrea.

     

    Last edit: Anonymous 2016-01-03
  • Stefan Zieker

    Stefan Zieker - 2016-01-03

    Hi Pier,

    'Do you think it could be possible to start/pause/stop a script (programmatically) from another script?'
    ->This is possible

    Your idea of 3 script sounds good to me. But at the moment the scripts have to poll at the shared variables. Therefore it would be better if the scripts could connect to a signal which is emitted if a global variable has been changed.

    I will implement this asap.

    Best regards,
    Stefan

     
  • Stefan Zieker

    Stefan Zieker - 2016-01-03

    Hi Pier,

    you can find following new functions the pre-release under Files/Test:

    • setScriptState->Start, pause or stop a script (the script must be in the script window script-table)
    • globalStringChangedSignal, globalDataArrayChangedSignal, globalUnsignedChangedSignal, globalSignedChangedSignal

    Best regards,
    Stefan

     

    Last edit: Stefan Zieker 2016-01-03
  • Anonymous

    Anonymous - 2016-01-03

    Hi Stefan,
    you are able to implement new solutions so fast!I look forward to try the new version.
    Thank you again.
    Kindest regards.
    Pier Andrea.

     
  • Anonymous

    Anonymous - 2016-01-03

    Hi Stefan,
    I'm trying to use your new functionality. I've modified the Receiver script of your interscript communication example in this manner:

    function globalStringChangedSlot(name,string) {
    scriptThread.appendTextToConsole(name + ": " + string);
    }
    
    scriptThread.appendTextToConsole("script data exchange receiver started");
    scriptThread.globalStringChangedSignal.connect(globalStringChangedSlot);
    

    When I launch both scripts (Sender and Receiver) ,no errors from ScriptCommunicator but
    the globalStringChangedSlot() routine is never triggered.
    The routine is triggered only INSIDE the script that changed the value of the global variable (Sender in this case) . This behaviour is useless for an interscript application. I do not know if it could be possible to implement xxxChangedSignal() routines in this complex manner because of the insulation of the scripts. It could be great but, at moment, every script can just poll for asking the state of a specific global var.
    Regards,
    Pier Andrea.

     

    Last edit: Anonymous 2016-01-03
  • Stefan Zieker

    Stefan Zieker - 2016-01-04

    Hi Pier,

    It was an implementation error. I have uploaded a new pre-release which fix this (the example scripts under WorkerScripts\InterWorkerScriptDataExchange use this new feature).

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2016-01-04

    Hi Stefan,
    I've uploaded a small example of script interactions using callbck functions. It works great.
    You can launch both just by dragging the *.js files on the ScripCommunicator.exe icon (under Windows). Both scripts are launched at startup but, because the script names (in the script window table) contain the full path it is difficult to stop the worker.js script from the ScriptGui.js script.
    When you close ScriptGui.js the other script continues to work in background (it is impossble to close it now without using the exitScriptCommunicator() function but this is a quick and dirty solution).
    If you can please correct this by shorting the filename. Because the script windows is hidden by default I wrapped the startup by creating a batch file to observe the ScriptWindow behaviour:

    ScriptCommunicator.exe -withScriptWindow %1 %2

    Regards,
    Pier Andrea

     
  • Anonymous

    Anonymous - 2016-01-04

    Stefan,
    just for "closing" the global var issue,
    For completness I've succesfully added two routines to my recompiled version of ScriptCommunicator:

    static QMap<QString, double> g_realNumberMap; 
    static QMutex g_realNumberMapMutex; 
    
    void ScriptThread::setGlobalRealNumber(QString name, double number)
    QList<double> ScriptThread::getGlobalRealNumber(QString name, bool removeValue)
    

    If you want you can introduce them in the next version (by adding the new callback signal mechanism).

    I think it could be useful for scientific purposes to work directly with doubles so one or more background scripts can do the hard work and just pass the result to the gui/control script. I know, You can convert to strings and reconvert-back to doubles but I think this solution is more elegant.

    Thank you again.
    Pier Andrea.

     

    Last edit: Anonymous 2016-01-04
  • Stefan Zieker

    Stefan Zieker - 2016-01-04

    Hi Pier,

    I have uploaded a new pre-release which includes:
    - setGlobalRealNumber, getGlobalRealNumber and globalRealChangedSignal
    - all scripts which are started by command-line are added in the script-table with their full name (without the file extension) now.

    Keep in mind that setScriptState needs the name of the script in the script-table (and not the complete filename). If you want to start (for example) C:/test.js you have to call setScriptState(0, "test").

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2016-01-04

    Hi Stefan,
    the new test version works like a charm! I can transfer also doubles among scripts!
    Now I start to split my project in several scripts in a modular manner just to enhance the parallel computing approach. I think that the maintenance end the extension of functionalities is much more simple now...just add scripts and link slots to globalvars signals. This approach is incredibly powerful.
    We'll keep in touch,
    Thank you so much again.
    Kindest regards,
    Pier Andrea.

     

    Last edit: Anonymous 2016-01-04
  • Stefan Zieker

    Stefan Zieker - 2016-01-04

    Hi Pier,

    it's a pleasure for me to help you :-).

    Best regards,
    Stefan

     
  • Stefan Zieker

    Stefan Zieker - 2016-01-04

    Hi Pier,

    I have released a new official version of ScriptCommunicator which includes the newest version of QCustomPlot.

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2016-01-05

    Hi Stefan,
    this is a great release.
    Today I've tryed to use the pseudo-include mechanism you developed for sharing constant values and routines among scripts (just one common.js included by several workers.js). When I've defined the global mapped variables they are (obviously) re-initialized by every script. Do you think it could be possible to write a function for returning the name of the scriptThread? (I know you can access it in the same manner you did inside the scriptThread.setScriptState() routine).
    If the script name is available you can simulate the C preprocessor

    #ifdef/#endif 
    

    and activate sections of code in relationship with the script that is opening the "include" file.
    My best regards,
    Pier Andrea.

     

    Last edit: Anonymous 2016-01-05
  • Stefan Zieker

    Stefan Zieker - 2016-01-05

    Hi Pier,

    I have uploaded a new pre-release. Under exampleScripts\WorkerScripts\StartPauseStopOtherScript you can find an example of scriptThread.getScriptTableName() .

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2016-01-05

    Hi Stefan,
    thank you again for your rapid response.
    Kindest regards,
    Pier Andrea.

     
  • Anonymous

    Anonymous - 2016-01-05

    Hi Stefan,
    in attachment a preliminary test of a multiscript application. The Launcher is an AutoIt script. Once launched, the scripts are started in the order of argument by ScriptCommunicator.
    I've used global unsigned numbers for triggering events and the other global types for passing arguments.Also the code maintenance is simplified,
    Kindest regards,
    Pier Andrea.

     
  • Stefan Zieker

    Stefan Zieker - 2016-01-05

    Hi Pier,

    looks like a good and modular (and therefor simple to maintain and extend) design.

    Best regards,
    Stefan

     

    Last edit: Stefan Zieker 2016-01-05
  • Anonymous

    Anonymous - 2016-01-06

    Hi Stefan,
    Yestarday and Today I did a very hard work to try to finish the preliminary version of a complete ADC system interfaced with the new Four-Channel Potentiostat I developed for Biosensor applications.
    In attachemt you can se the complete GUI interacting with other scripts (SerialWorker, TimeWorker, DataWorker and FileWorker). The system is very fluid and the work is now divided in five threads.
    I have a suggestion about the PlotWidget.
    The groupBox in the routine ScriptPlotWidget::addGraphSlot() in the file scriptplotwidget.cpp reppresent the name of the graps as graph1, graph2 etc. This is no so good in comparison with the label; indeed the routiine doesn't check if the graph name is an empty string. I suggest you to do this:

        if (name != "") m_plotWidget->graph(index)->setName(name);
        else m_plotWidget->graph(index)->setName(QString("Graph %1").arg(index + 1));
    

    end, few lines after...

       //box->setText(QString("graph %1").arg(index + 1));
        box->setText(m_plotWidget->graph(index)->name());
    

    if the name is too long is not so bad, it is cut out automatically.
    I've increased the width of every control (included the groupBox) to 100:

    m_groupBox->setMaximumWidth(100); 
    

    in the routine

    ScriptPlotWidget::ScriptPlotWidget()
    

    I suggest you to incude a showLegend checkbox for hiding/showing the legend directly from the panel.
    Kindest Regards,
    Pier Andrea

     

    Last edit: Anonymous 2016-01-06
  • Stefan Zieker

    Stefan Zieker - 2016-01-07

    Hi Pier,

    I have uploded a new pre-release which includes:
    - a show legend check box
    - addGraphSlot sets the name now (if the name string is not empty)
    - you can set the max. width of the show group box in showHelperElements now (the default is 80)

    PS: You have created a nice GUI :-)

    Best regards,
    Stefan

     
  • Anonymous

    Anonymous - 2016-01-07

    Hi Stefan,
    as usual, your solution is the best.
    Thank you,
    Pier Andrea.

     
1 2 3 4 > >> (Page 1 of 4)

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.