- Posts: 457
- Thank you received: 124
LinuxCNC Features - a kind of NGCGUI
- FernV
- Offline
- Platinum Member
-
Less
More
11 years 8 months ago #55913
by FernV
Replied by FernV on topic LinuxCNC Features - a kind of NGCGUI
Hi Martin
Pydev needs Java 7 to work well, so I guess you already have it installed and see the pydev perspective.
Python is not typed like C, C++ or Delphi and this is why we do not know what the variable is all about. You just declare a variable name. I like language where we declare :
integer newvar;
or
newvar: Integer;
Python makes it much more difficult to debug.
This issue prevents from creating important scripts.
I was thinking this morning that it could be easier to manipulate the treestore directly instead of converting first to XML and convert back to treestore.
What do you think ?
Fern
Pydev needs Java 7 to work well, so I guess you already have it installed and see the pydev perspective.
Python is not typed like C, C++ or Delphi and this is why we do not know what the variable is all about. You just declare a variable name. I like language where we declare :
integer newvar;
or
newvar: Integer;
Python makes it much more difficult to debug.
This issue prevents from creating important scripts.
I was thinking this morning that it could be easier to manipulate the treestore directly instead of converting first to XML and convert back to treestore.
What do you think ?
Fern
The following user(s) said Thank You: turbospeedskater
Please Log in or Create an account to join the conversation.
- turbospeedskater
- Offline
- New Member
-
Less
More
- Posts: 16
- Thank you received: 0
11 years 8 months ago #55944
by turbospeedskater
Replied by turbospeedskater on topic LinuxCNC Features - a kind of NGCGUI
Hi Fern,
yes: not permanently converting between two formats sounds easier .
And: I also like variable declarations
But I don't now if all utility functions (element handling inside a treestore object) are available.
...and in every case saving the files in XML is a good feature.
As I said earlier: I am not a python programmer, and normally I don't ever write software
running under graphical environment. So I have no experience about the available routines
in all those toolkits and libraries that are used nowadays.
I feel more comfortable in microcontroller environments, where I can measure voltages, currents,
temperatures etc. and the bits I switch control coils/motors and things like that.
So even object oriented programming is not a thing I do every day.
Sometimes I still write assembler if there is something time critical....
But this software is something that is exactly what I need, so I am willing to spend some time
to understand and optimize it. And I already have ported my old ngcgui-subroutines to it, because
it looks much nicer and can also be used by my colleagues without too much CNC knowledge.
BTW: I have done some more testing in the meantime to find out, where the items in groups (if
there is more than one) move from one group to another. I have made a xml file (externally, with gedit)
containing two groups, each having two items (posted before). When I load it, the 1st display is ok.
Each group is still having two items. When I do any change to the xml program with the features software
e.g. add a hole or whatever, the items move from the 2nd group to the 1st.
So I guess, the problem is in converting treestore back to xml.
It can not be in the xml to treestore, because then also the 1st display of the new loaded xml should be wrong....
This weekend I have to finish a big milling job in stainless steel, so I don't think I will have time to put into
this problem. But I will try
best regards,
Martin.
yes: not permanently converting between two formats sounds easier .
And: I also like variable declarations
But I don't now if all utility functions (element handling inside a treestore object) are available.
...and in every case saving the files in XML is a good feature.
As I said earlier: I am not a python programmer, and normally I don't ever write software
running under graphical environment. So I have no experience about the available routines
in all those toolkits and libraries that are used nowadays.
I feel more comfortable in microcontroller environments, where I can measure voltages, currents,
temperatures etc. and the bits I switch control coils/motors and things like that.
So even object oriented programming is not a thing I do every day.
Sometimes I still write assembler if there is something time critical....
But this software is something that is exactly what I need, so I am willing to spend some time
to understand and optimize it. And I already have ported my old ngcgui-subroutines to it, because
it looks much nicer and can also be used by my colleagues without too much CNC knowledge.
BTW: I have done some more testing in the meantime to find out, where the items in groups (if
there is more than one) move from one group to another. I have made a xml file (externally, with gedit)
containing two groups, each having two items (posted before). When I load it, the 1st display is ok.
Each group is still having two items. When I do any change to the xml program with the features software
e.g. add a hole or whatever, the items move from the 2nd group to the 1st.
So I guess, the problem is in converting treestore back to xml.
It can not be in the xml to treestore, because then also the 1st display of the new loaded xml should be wrong....
This weekend I have to finish a big milling job in stainless steel, so I don't think I will have time to put into
this problem. But I will try
best regards,
Martin.
Please Log in or Create an account to join the conversation.
- FernV
- Offline
- Platinum Member
-
Less
More
- Posts: 457
- Thank you received: 124
11 years 8 months ago #55951
by FernV
Replied by FernV on topic LinuxCNC Features - a kind of NGCGUI
Hi Martin
I agree that saving to XML is a must so we do not have to start over again for the same or very similar job.
I do not know if you came across this page :
www.pygtk.org/pygtk2tutorial/ch-TreeViewWidget.html
but I think this one and the followings are where we will find the most usefull information, everything seems to be there
When this issue is solved I will work on the Duplicate/copy function issue where the ID is not changed
I am not a programmer myself but the owner of a small business. I learned Delphi from D3 then D5, D2006 and finally D2010. Most of the apps we use I programmed. Three years ago I started a motion simulator and then I learned microcontroller programming first with Arduino and quickly shifted to STM32 which is more powerfull but I had some time getting used to all the peripherals.
I only started last fall to use Python (and I will never be a fan) because I found too many things not working in Features.
Btw, does it happen to you that after LinuxCNC updates you have to re-install Features ? Is there a way to prevent updates to recreate the content of /usr/lib/pymodules/python2.7/gladevcp, /usr/share/pyshared/gladevcp/ and /usr/share/glade3/catalogs ?
I had to re-install about once every month
Regards
Fern
I agree that saving to XML is a must so we do not have to start over again for the same or very similar job.
I do not know if you came across this page :
www.pygtk.org/pygtk2tutorial/ch-TreeViewWidget.html
but I think this one and the followings are where we will find the most usefull information, everything seems to be there
When this issue is solved I will work on the Duplicate/copy function issue where the ID is not changed
I am not a programmer myself but the owner of a small business. I learned Delphi from D3 then D5, D2006 and finally D2010. Most of the apps we use I programmed. Three years ago I started a motion simulator and then I learned microcontroller programming first with Arduino and quickly shifted to STM32 which is more powerfull but I had some time getting used to all the peripherals.
I only started last fall to use Python (and I will never be a fan) because I found too many things not working in Features.
Btw, does it happen to you that after LinuxCNC updates you have to re-install Features ? Is there a way to prevent updates to recreate the content of /usr/lib/pymodules/python2.7/gladevcp, /usr/share/pyshared/gladevcp/ and /usr/share/glade3/catalogs ?
I had to re-install about once every month
Regards
Fern
Please Log in or Create an account to join the conversation.
- FernV
- Offline
- Platinum Member
-
Less
More
- Posts: 457
- Thank you received: 124
11 years 8 months ago #55981
by FernV
Replied by FernV on topic LinuxCNC Features - a kind of NGCGUI
Hi,
I am sure now that the problem is in converting to XML and back
I modified the code to manipulate the treestore directly for moving up/down or inserting/removing from a group.
I then added 10 features and 4 groups.
I moved up/down, inserted/removed from groups about 30 times and ALL features stayed in their groups. I then added a new feature and every other features moved to the first group.
I moved everything so I can have about the same layout I had before then saved to XML, cleared the tree and reloaded with again ALL features in the first group. Every time it is converted, it is messed.
I think I am close to the solution.
Regards
Fern
Regards
I am sure now that the problem is in converting to XML and back
I modified the code to manipulate the treestore directly for moving up/down or inserting/removing from a group.
I then added 10 features and 4 groups.
I moved up/down, inserted/removed from groups about 30 times and ALL features stayed in their groups. I then added a new feature and every other features moved to the first group.
I moved everything so I can have about the same layout I had before then saved to XML, cleared the tree and reloaded with again ALL features in the first group. Every time it is converted, it is messed.
I think I am close to the solution.
Regards
Fern
Regards
Please Log in or Create an account to join the conversation.
- FernV
- Offline
- Platinum Member
-
Less
More
- Posts: 457
- Thank you received: 124
11 years 8 months ago - 11 years 8 months ago #55994
by FernV
Replied by FernV on topic LinuxCNC Features - a kind of NGCGUI
Hi Martin, Nick
I solved the problem with groups
replace def treestore_to_xml_recursion(self, iter, xmlpath):
with the following including definition line
def treestore_to_xml_recursion(self, itr, xmlpath):
while itr :
f = self.treestore.get(itr, 0)[0]
if f.__class__ == Feature :
xmlpath.append(f.to_xml())
# check for the childrens
citer = self.treestore.iter_children(itr)
while citer :
p = self.treestore.get(citer, 0)[0]
itm = p.get_attr('type')
if (itm == 'items'):
pa = f.get_attr('path')
xmlpath_ = xmlpath.find(".//*[@path='%s']/param[@type='items']" % pa)
if xmlpath_ != None:
self.treestore_to_xml_recursion(self.treestore.iter_children(citer), xmlpath_)
citer = self.treestore.iter_next(citer)
# check for next items
itr = self.treestore.iter_next(itr)
To make sure the tabs are right,
download the attached file
Regards
Fern
I solved the problem with groups
replace def treestore_to_xml_recursion(self, iter, xmlpath):
with the following including definition line
def treestore_to_xml_recursion(self, itr, xmlpath):
while itr :
f = self.treestore.get(itr, 0)[0]
if f.__class__ == Feature :
xmlpath.append(f.to_xml())
# check for the childrens
citer = self.treestore.iter_children(itr)
while citer :
p = self.treestore.get(citer, 0)[0]
itm = p.get_attr('type')
if (itm == 'items'):
pa = f.get_attr('path')
xmlpath_ = xmlpath.find(".//*[@path='%s']/param[@type='items']" % pa)
if xmlpath_ != None:
self.treestore_to_xml_recursion(self.treestore.iter_children(citer), xmlpath_)
citer = self.treestore.iter_next(citer)
# check for next items
itr = self.treestore.iter_next(itr)
To make sure the tabs are right,
download the attached file
Regards
Fern
Last edit: 11 years 8 months ago by FernV.
The following user(s) said Thank You: turbospeedskater
Please Log in or Create an account to join the conversation.
- turbospeedskater
- Offline
- New Member
-
Less
More
- Posts: 16
- Thank you received: 0
11 years 8 months ago #56005
by turbospeedskater
Replied by turbospeedskater on topic LinuxCNC Features - a kind of NGCGUI
Hi Fern,
great work!!! Thanks. Now it works!!!
As I expected, I have not had even a minute last weekend to think about this....
My next step will now be to write some kind of documentation about the things I have done
to the features library and about my subroutines. And I hope to get some input what functions
you and other user would like to have.
As long as I can do improvements in "xml" files, "ini" files and G-code: no problem...
Thanks,
best regards,
Martin.
great work!!! Thanks. Now it works!!!
As I expected, I have not had even a minute last weekend to think about this....
My next step will now be to write some kind of documentation about the things I have done
to the features library and about my subroutines. And I hope to get some input what functions
you and other user would like to have.
As long as I can do improvements in "xml" files, "ini" files and G-code: no problem...
Thanks,
best regards,
Martin.
Please Log in or Create an account to join the conversation.
Time to create page: 0.164 seconds