GScreen and some understanding gap of hal-widgets

More
16 Jun 2019 13:06 #137042 by Reinhard
I could restore a backup and can continue work.

self.widgets.work_GCodes.buf = self.widgets.edit_GCodes.buf

I suspect it won't work as you hope, but there shouldn't be an error.

You where right - it does not work. So I'll gona try another option.

I tried to add a bitmap/picture to a button - and it did not work either.

Then I played a bit with actions. An action has a label and as far as I understand the flyover help, this label should be used on buttons or menueitems.
I checked it together with a butten and the label of the action was not used.

... and how can I extend the behaviour of an action?
I use an action with a button to load a gcode file. That works fine so far.
But I'd like to display the filename in another widget.
My handler has no connection to the action and changing the action code to add the labels name seems wrong to me.
So how and where could I add a callback or trigger?

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

More
16 Jun 2019 14:20 #137045 by pl7i92
darf ich fragen in welchem kenzeichenbereich du dich befindest

und um welche art maschine es sich handelt

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

More
16 Jun 2019 18:01 #137051 by cmorley
sourceview: did it error or just not do anything. I'm sure i can make this work, when i have time. I believe the problem is that the buffer is set up at widget initialization time and when you change the buffer later it doesn't set up the necessary callback etc.
If the setting of a buffer was moved to it's own function then that should be possible.

Action: did you try setting the button label rather then the action label?

updating a label:
Gstat library: linuxcnc.org/docs/devel/html/gui/GStat.html
is what you would use to catch linuxcnc events and act on them.
eg. the message 'file-loaded' would send you the newly loaded file path.
You could use that to update a label widget.

You set this up in the handler file (untested code here).

you would add:
from hal_glib import GStat
GSTAT = GStat()
to the top of the handler and then:
# connect a GSTAT message to a callback function
GSTAT.connect("file-loaded",self.update_file_label)
under the __init__ function

and finally a function to update the label:
def update_file_label(self,obj,path):
    self.widgets.YOURLABELNAME.set_text(path)

widget bug fixes - always willing to accept code to fix bugs or improve/add function.
gladevcp is 'long in the tooth' (old) and is do for an update do to python and GTK version changes that will soon be forced by distributions, so I would not put huge effort into relatively trivial things. Obviously docs is something you have brought to light.
Gscreen is a project i started a long time ago and was learning how to do things. Only recently has very many people started asking for help with it - it was in the opinion that nobody was interested in it - or I probably would have added more docs.

Chris M

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

More
17 Jun 2019 03:43 #137088 by Reinhard

darf ich fragen in welchem kenzeichenbereich du dich befindest

Du darfst mich alles fragen :)
Gerade wollte ich schreiben, dass Deine Fragen eher was für PN sind, aber hier scheint es keine PN zu geben.
Also gut ...

ich lebe in der Märklinstadt und hatte angefangen mir eine selbstentworfene Fräse zu bauen. Dann musste ich meine Werkstatt aufgeben (Haus wurde verkauft) und spiele jetzt mit dem Gedanken, mir eine FM45 oder so zuzulegen.
Ich habe mir ne 5i25 und einige 7i73 zugelegt - ein Bekannter hat mir ein Bitfile erstellt und vom Bohrwerk auf Arbeit weiß ich, dass die Pinole als W-Achse angesprochen wird.
So entstand die Idee für meine Oberfläche. Inspiriert u.a. auch von Heidenhain - bin ein Fan davon :)
.

sourceview: did it error or just not do anything.

no error - just did nothing.
Would be nice to use a GTK-Textbuffer like Hal-Actions - as global elements, that can be linked in.
The other option was: add a save button to the edit widget and reload the file in the readonly-widget on leaving edit mode.
But for that I have to learn how to xchange messages between widgets. I want to avoid needless user interactions.
.

Action: did you try setting the button label rather then the action label?

I set the button label to rubbish and the action label to somewhat meaningful - the result was rubbish ;)
.

Gstat library: linuxcnc.org/docs/devel/html/gui/GStat.html
is what you would use to catch linuxcnc events and act on them.

Thanks for the link. I will dive into it ...
.

Gscreen is a project i started a long time ago and was learning how to do things. Only recently has very many people started asking for help with it - it was in the opinion that nobody was interested in it

Well, I think, many people may think the way, I did:
I don't like to spend my time for a panel part, that is shown aside of axis or whatever.
When working on a ui - I want the whole app follow my ideas ...
Qt is the most recent ui system, but is the most instable system too. I never was a friend of Qt.
And together with linuxcnc I was not able to bring the designer to work with hal widgets.

Opposite is true for gscreen. The bad side - it only works with rip-installations.
But ok - if that's the price, I'll go for it. I found docs for pyGtk and some tutorials for glade ...
That's a good starting point.
The bad part: you don't get any meaningful message upon making mistakes.
LinuxCNC shuts down and you have to research why. That's the hard work. So progress will be very very slow - well, at least for me, as I don't know linuxcnc nor python nor gtk nor glade ...

If you don't know any widget system supported by linuxcnc it does not matter, which one to learn. So as glade seems to be the most stable system, its obvious, that more people are interested in glade and gscreen :)

As I already wrote - I came from mach4, which uses lua as interpreter and wxwindows as widget system. wxwindows has a smart designer too, which creates xml-files and wxlua interprets them.
lua is the fastest interpreter I ever got in touch with. Easy to learn, as lua is almoust C-language.
And wxlua is a lot more stable, than Qt.
May be its easier to create a linuxcnc with wxlua than migrating linuxcnc to python3 ... :dry:

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

More
17 Jun 2019 05:50 #137096 by Reinhard
Ok, so message handling with GSTAT works as described. Thanks!
I was able to handle condensed filename together with entire filename.
But saving edited GCodes by save-action did not work.
... and as I'm not able to access the buffer content - I have to give up :(

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

More
17 Jun 2019 05:52 #137097 by cmorley
IMHO linuxcnc doesn't need another language thrown in. python , c, and c++ does the job fine.
QT is new to us - pyqt is cutting edge for linuxcnc
just like languages , each widget toolkit has it's good and bad points.
I find GTK more forgiving then QT - but QT seems supported better.

I've had qtvcp and gscreen/gladevcp all work in an installed version of linuxcnc.
I find it very difficult to diagnose install problems - systems have some many variables.
I'm not entirely surprised qtvcp has some problems - it's not been released yet.

The learning curve is steep - but it gets easier.

Chris M

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

More
17 Jun 2019 06:10 #137098 by Reinhard

I find it very difficult to diagnose install problems

Hm, I'm willing to help.
Let me know, if I can help researching ...

I thought, creating an installation in a virtual box would be the cleanest way to do things.
But QtDesigner crashes there as well. So I don't know, what I could do any better.

When I start designer with installations based on tutorials, this is what happens.
Konsole will print:
KCrash: crashing... crashRecursionCounter = 2
KCrash: Application Name = designer path = /usr/lib/x86_64-linux-gnu/qt5/bin pid = 25291
KCrash: Arguments: /usr/lib/x86_64-linux-gnu/qt5/bin/designer 
KCrash: Attempting to start /usr/lib/x86_64-linux-gnu/libexec/drkonqi from kdeinit
sock_file=/run/user/1000/kdeinit5__0
and crashreport from kde is this:
Application: designer (designer), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f948cb463c0 (LWP 25291))]

Thread 3 (Thread 0x7f946fca2700 (LWP 25293)):
#0  0x00007f94885410e9 in g_mutex_lock () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#1  0x00007f94884fb9db in ?? () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#2  0x00007f94884fbb0c in g_main_context_iteration () from /lib/x86_64-linux-gnu/libglib-2.0.so.0
#3  0x00007f948b33c1eb in QEventDispatcherGlib::processEvents(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#4  0x00007f948b2e5d1a in QEventLoop::exec(QFlags<QEventLoop::ProcessEventsFlag>) () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007f948b114093 in QThread::exec() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#6  0x00007f948ca9c6e5 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5DBus.so.5
#7  0x00007f948b118d48 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#8  0x00007f948a42f4a4 in start_thread (arg=0x7f946fca2700) at pthread_create.c:456
#9  0x00007f948aa31d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Thread 2 (Thread 0x7f9481004700 (LWP 25292)):
#0  0x00007f948aa288bd in poll () at ../sysdeps/unix/syscall-template.S:84
#1  0x00007f9485485150 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2  0x00007f9485486ee9 in xcb_wait_for_event () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3  0x00007f9484bf6b89 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5XcbQpa.so.5
#4  0x00007f948b118d48 in ?? () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#5  0x00007f948a42f4a4 in start_thread (arg=0x7f9481004700) at pthread_create.c:456
#6  0x00007f948aa31d0f in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:97

Thread 1 (Thread 0x7f948cb463c0 (LWP 25291)):
[KCrash Handler]
#6  0x00007f944d601b6f in ?? () from ~/.local/lib/python2.7/site-packages/cv2/.libs/libQtTest-1183da5d.so.4.8.7
#7  0x00007f948ca2179a in call_init (l=<optimized out>, argc=argc@entry=1, argv=argv@entry=0x7fffd88c1628, env=env@entry=0x7fffd88c1638) at dl-init.c:72
#8  0x00007f948ca218ab in call_init (env=0x7fffd88c1638, argv=0x7fffd88c1628, argc=1, l=<optimized out>) at dl-init.c:30
#9  _dl_init (main_map=main_map@entry=0x556a2f847ae0, argc=1, argv=0x7fffd88c1628, env=0x7fffd88c1638) at dl-init.c:120
#10 0x00007f948ca25e58 in dl_open_worker (a=a@entry=0x7fffd88becd0) at dl-open.c:575
#11 0x00007f948ca21644 in _dl_catch_error (objname=objname@entry=0x7fffd88becc0, errstring=errstring@entry=0x7fffd88becc8, mallocedp=mallocedp@entry=0x7fffd88becbf, operate=operate@entry=0x7f948ca25a70 <dl_open_worker>, args=args@entry=0x7fffd88becd0) at dl-error.c:187
#12 0x00007f948ca25609 in _dl_open (file=0x556a2f83dfc0 "~/.local/lib/python2.7/site-packages/cv2/cv2.so", mode=-2147483646, caller_dlopen=0x7f94612373b0 <_PyImport_GetDynLoadFunc+288>, nsid=-2, argc=<optimized out>, argv=<optimized out>, env=0x7fffd88c1638) at dl-open.c:660
#13 0x00007f94887c5ee9 in dlopen_doit (a=a@entry=0x7fffd88bef00) at dlopen.c:66
#14 0x00007f948ca21644 in _dl_catch_error (objname=0x556a2e698020, errstring=0x556a2e698028, mallocedp=0x556a2e698018, operate=0x7f94887c5e90 <dlopen_doit>, args=0x7fffd88bef00) at dl-error.c:187
#15 0x00007f94887c6531 in _dlerror_run (operate=operate@entry=0x7f94887c5e90 <dlopen_doit>, args=args@entry=0x7fffd88bef00) at dlerror.c:163
#16 0x00007f94887c5f82 in __dlopen (file=<optimized out>, mode=<optimized out>) at dlopen.c:87
#17 0x00007f94612373b0 in _PyImport_GetDynLoadFunc () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#18 0x00007f94612aef51 in _PyImport_LoadDynamicModule () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#19 0x00007f94612afda1 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#20 0x00007f94612b110e in PyImport_ImportModuleLevel () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#21 0x00007f94611af328 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#22 0x00007f94611fc5c3 in PyObject_Call () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#23 0x00007f946130f6c7 in PyEval_CallObjectWithKeywords () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#24 0x00007f94611a32ca in PyEval_EvalFrameEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#25 0x00007f946131029c in PyEval_EvalCodeEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#26 0x00007f94611a09c9 in PyEval_EvalCode () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#27 0x00007f94612adc64 in PyImport_ExecCodeModuleEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#28 0x00007f94612ae650 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#29 0x00007f94612af5c1 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#30 0x00007f94612afda1 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#31 0x00007f94612b1435 in PyImport_ImportModuleLevel () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#32 0x00007f94611af328 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#33 0x00007f94611fc5c3 in PyObject_Call () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#34 0x00007f946130f6c7 in PyEval_CallObjectWithKeywords () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#35 0x00007f94611a32ca in PyEval_EvalFrameEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#36 0x00007f946131029c in PyEval_EvalCodeEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#37 0x00007f94611a09c9 in PyEval_EvalCode () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#38 0x00007f94612adc64 in PyImport_ExecCodeModuleEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#39 0x00007f94612ae650 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#40 0x00007f94612afda1 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#41 0x00007f94612b11cc in PyImport_ImportModuleLevel () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#42 0x00007f94611af328 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#43 0x00007f94611fc5c3 in PyObject_Call () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#44 0x00007f946130f6c7 in PyEval_CallObjectWithKeywords () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#45 0x00007f94611a32ca in PyEval_EvalFrameEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#46 0x00007f946131029c in PyEval_EvalCodeEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#47 0x00007f94611a09c9 in PyEval_EvalCode () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#48 0x00007f94612adc64 in PyImport_ExecCodeModuleEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#49 0x00007f94612ae650 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#50 0x00007f94612afda1 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#51 0x00007f94612b11cc in PyImport_ImportModuleLevel () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#52 0x00007f94611af328 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#53 0x00007f94611fc5c3 in PyObject_Call () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#54 0x00007f946130f6c7 in PyEval_CallObjectWithKeywords () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#55 0x00007f94611a32ca in PyEval_EvalFrameEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#56 0x00007f946131029c in PyEval_EvalCodeEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#57 0x00007f94611a09c9 in PyEval_EvalCode () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#58 0x00007f94612adc64 in PyImport_ExecCodeModuleEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#59 0x00007f94612ae650 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#60 0x00007f94612afda1 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#61 0x00007f94612b11cc in PyImport_ImportModuleLevel () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#62 0x00007f94611af328 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#63 0x00007f94611fc5c3 in PyObject_Call () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#64 0x00007f946130f6c7 in PyEval_CallObjectWithKeywords () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#65 0x00007f94611a32ca in PyEval_EvalFrameEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#66 0x00007f946131029c in PyEval_EvalCodeEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#67 0x00007f94611a09c9 in PyEval_EvalCode () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#68 0x00007f94612adc64 in PyImport_ExecCodeModuleEx () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#69 0x00007f94612ae650 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#70 0x00007f94612afda1 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#71 0x00007f94612b110e in PyImport_ImportModuleLevel () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#72 0x00007f94611af328 in ?? () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#73 0x00007f94611fc5c3 in PyObject_Call () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#74 0x00007f94611fda15 in PyObject_CallFunction () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#75 0x00007f94612b1b96 in PyImport_Import () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#76 0x00007f94612b1d0a in PyImport_ImportModule () from /usr/lib/x86_64-linux-gnu/libpython2.7.so.1.0
#77 0x00007f94616bb6e4 in PyCustomWidgets::importPlugins(QString const&, QStringList const&) () from /usr/lib/x86_64-linux-gnu/qt5/plugins/designer/libpyqt5_py2.so
#78 0x00007f94616bc643 in PyCustomWidgets::PyCustomWidgets(QObject*) () from /usr/lib/x86_64-linux-gnu/qt5/plugins/designer/libpyqt5_py2.so
#79 0x00007f94616bd39f in qt_plugin_instance () from /usr/lib/x86_64-linux-gnu/qt5/plugins/designer/libpyqt5_py2.so
#80 0x00007f948b2d02bb in QPluginLoader::instance() () from /usr/lib/x86_64-linux-gnu/libQt5Core.so.5
#81 0x00007f948c37ae98 in QDesignerPluginManager::instance(QString const&) const () from /usr/lib/x86_64-linux-gnu/libQt5Designer.so.5
#82 0x00007f948c37b3fa in QDesignerPluginManager::instances() const () from /usr/lib/x86_64-linux-gnu/libQt5Designer.so.5
#83 0x0000556a2e421f73 in ?? ()
#84 0x0000556a2e4236bf in ?? ()
#85 0x0000556a2e41bec2 in ?? ()
#86 0x0000556a2e409e16 in ?? ()
#87 0x00007f948a9692e1 in __libc_start_main (main=0x556a2e409dc0, argc=1, argv=0x7fffd88c1628, init=<optimized out>, fini=<optimized out>, rtld_fini=<optimized out>, stack_end=0x7fffd88c1618) at ../csu/libc-start.c:291
#88 0x0000556a2e409eea in ?? ()

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

More
17 Jun 2019 06:23 #137099 by cmorley

Ok, so message handling with GSTAT works as described. Thanks!
I was able to handle condensed filename together with entire filename.
But saving edited GCodes by save-action did not work.
... and as I'm not able to access the buffer content - I have to give up :(


Great that's a step forward.
Can you explain what you did to try and get save action to save?
My memory of gladevcp is a little hazzy - I didn't think the sourceview was editable as default.
but you can always use the action programmically:

self.widgets.YOUR_action_saveas.emit("activate")

oh and try this:
self.widgets.work_GCodes.set_buffer(self.widgets.edit_GCodes.buf)

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

More
17 Jun 2019 06:33 - 17 Jun 2019 06:34 #137101 by Reinhard

self.widgets.work_GCodes.set_buffer(self.widgets.edit_GCodes.buf)

GREAT! That did the job :)
Thank you very much!
So I should be able to do the saving on my own ... :)

Can you explain what you did to try and get save action to save?

I attached the action to the button, as I did with file open action (which works).
Then I activated the "pressed" action in glade designer for that button and added a handler method to my handler class with a print statement - but that did not output any text.
Last edit: 17 Jun 2019 06:34 by Reinhard.

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

More
17 Jun 2019 06:46 #137102 by cmorley
'Then I activated the "pressed" action in glade designer for that button and added a handler method to my handler class with a print statement - but that did not output any text. '

This is confusing to me - usually you use the action without any handler code.
You push the button and it calls the action to save.
(save-as might be easier to diagnose as it pops a dialog)

If you wish to connect a signal so it calls a function in the handler file that is different.

You can, of course have a button call a function in the handler file that then call the save-action to 'activate'

I need to find some time to add some samples to the docs...

Chris

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

Time to create page: 0.159 seconds
Powered by Kunena Forum