Machinist Calculator

More
03 Nov 2012 20:46 - 03 Nov 2012 20:46 #26227 by BigJohnT
Replied by BigJohnT on topic Machinist Calculator
Ok, I found a short tutorial on Qt 4 designer and python and have created a simple gui. So far so good... now to see if it will run in Windoze.

The only thing I don't like about Qt is all that humpyback stuff...

John
Last edit: 03 Nov 2012 20:46 by BigJohnT.

Please Log in or Create an account to join the conversation.

More
04 Nov 2012 00:31 #26238 by ArcEye
Replied by ArcEye on topic Machinist Calculator
Hi John

Sorry I've been out all day shooting, its that time of year over here.

I now use Qt4, used Qt3 for a long time but its getting old, Qt5 is in beta at present.

The only thing I don't like about Qt is all that humpyback stuff...

The use of the Designer .ui file directly in the make process takes a bit of getting used to, to start with I resisted it and just used the generated code within hand written code.

However once you get your head around how to use the created class properly, it means that you can just change your GUI in Designer and then re-compile and it is there.
All you have to do is write the slots which receive the signals from buttons you created being pressed etc.

Designer is not always intuitive, but google is your friend, if you are having problems getting it to do something you can bet someone else has in the past.

regards

Please Log in or Create an account to join the conversation.

More
04 Nov 2012 00:51 #26240 by ArcEye
Replied by ArcEye on topic Machinist Calculator
A quick for instance, based upon the simple qtVCP panel I posted here when talking to Chris
www.linuxcnc.org/index.php/english/forum...or-linuxcnc?start=18

The Designer .ui file is generated into a header file called ui_qtVCPTest.h which defines the class Ui_qtVCPTest and contains a setupUI() function which builds it.

All you need to do in C++ is to specify this class in the inheritance of your new qtVCPTest class and then just call setupUI() to build the window.
This snippet is the declaration
#include "ui_qtVCPTest.h"

class qtVCPTest  : public QMainWindow , private Ui_qtVCPWindow
{
    Q_OBJECT
public:

    qtVCPTest(int argc, char** argv);
    
    NML_Access *_nml;
    
    void blankPins();

private slots:
    virtual void onTool_1();
    virtual void onTool_2();
    virtual void onTool_3();
    virtual void onTool_4();
    virtual void onTool_5();
    virtual void onTool_6();
    virtual void onTool_7();
    virtual void onTool_8();                            
};
and this the constructor for the class and a few slots linked to buttons
qtVCPTest::qtVCPTest(int argc, char** argv)
{
QString str;
    
    // build the main window from ui
    setupUi(this);

// ....other setup stuff here
    
}

//slots for pushbuttons etc

void qtVCPTest::blankPins()
{
    for (int i = 0; i < ARRAY_LEN; i ++)
       _nml->setBitPinValue(name_array[i], false);        
}

void qtVCPTest::onTool_1()
{
    blankPins();     
    _nml->setBitPinValue("tool-1", true);
}

void qtVCPTest::onTool_2()
{
    blankPins();        
    _nml->setBitPinValue("tool-2", true);
}
// and so on for all 8 buttons

You are obviously getting into the programming, I'll convert you to C++ yet! :laugh:

regards

Please Log in or Create an account to join the conversation.

More
04 Nov 2012 04:41 #26248 by cmorley
Replied by cmorley on topic Machinist Calculator
One thing ArcEye and I were talking of is it is not clear if QT can be embedded into existing linuxcnc GUIs.
It would have to be a stand alone program.
Personally I would like to see it available inside a GUI rather then only stand alone.
(similar problem with NGCGUI -It can only be included in a TCL parent program - though it could be fixed)

My 2 cents
Chris

Please Log in or Create an account to join the conversation.

More
04 Nov 2012 18:34 #26250 by ArcEye
Replied by ArcEye on topic Machinist Calculator
I don't think that something like a Calculator needs to be built in to Axis.
It will only get occasional use and could easily be free standing just as the Arc Buddy etc are.

One thing ArcEye and I were talking of is it is not clear if QT can be embedded into existing linuxcnc GUIs.

Thus far I have not got any further with this.

The parent of a Qt window is a QWidget*, not an X11 WinID, and whilst the WinID is contained in a member of the QWidget class, there seems nothing useful you can do with that so far as embedding goes.
Embedding of X11 apps into a QX11EmbedContainer works the other way round no problem, I wrote a Webcam program that used mplayer embedded to display the camera view.

The only solution really is to write a Qt GUI for Linuxcnc to completely replace Axis. Then you could have the main window as a docking frame, within which any number of child windows could be open and docked in various positions or on tabs etc. Designer itself is an example of this window docking.

I may get around to this at some point as a logical extension of the HAL and NML access libraries I am working on.
Other projects will take precedence for now.

regards

Please Log in or Create an account to join the conversation.

More
04 Nov 2012 22:43 #26252 by BigJohnT
Replied by BigJohnT on topic Machinist Calculator
Well I did get the python gtk version to run in windoze and I did get a python gt program to run. Not sure at this point what I want to try and do. One thing for sure is there is not any good information about building a windoze executable on the web...

John

Please Log in or Create an account to join the conversation.

More
05 Nov 2012 19:23 #26267 by piasdom
Replied by piasdom on topic Machinist Calculator
i tried the calculator and got attached error win. but may not
know how to start. i opened py file in linuxcnc.


Attachments:

Please Log in or Create an account to join the conversation.

More
05 Nov 2012 19:43 - 05 Nov 2012 19:46 #26269 by BigJohnT
Replied by BigJohnT on topic Machinist Calculator
Just run it outside of LinuxCNC as there is no advantage to trying to open it as a filter is has not output to LinuxCNC and it looks like you don't have all the files in the same directory. Put the 4 files that came in the zip into a directory and use the file manager to launch it.

It does look like I need to fix the path finding in order to run it from a desktop launcher.

John
Last edit: 05 Nov 2012 19:46 by BigJohnT.

Please Log in or Create an account to join the conversation.

More
05 Nov 2012 19:47 - 05 Nov 2012 19:52 #26270 by piasdom
Replied by piasdom on topic Machinist Calculator
after reading the readme(dumass:) i see it says;

In Ubuntu run sfc.pyc either by clicking on it in the file manager or from a
terminal with ./sfc.pyc

i don't see the .pyc file. i do have the four file in one folder, that
and the readme file

opening in terminal works. is just the thread working ?
Last edit: 05 Nov 2012 19:52 by piasdom.

Please Log in or Create an account to join the conversation.

More
05 Nov 2012 20:03 #26271 by BigJohnT
Replied by BigJohnT on topic Machinist Calculator
It should say .py not .pyc.

The threads tab is the only one that is finished so far. I'm working on the drilling tab now.

John
The following user(s) said Thank You: piasdom

Please Log in or Create an account to join the conversation.

Moderators: piasdom
Time to create page: 0.111 seconds
Powered by Kunena Forum