Cannot open file with filechooserbutton

More
21 Aug 2015 18:19 #61618 by phillc54
I am not able to open a file with the filechooserbutton, I get the following error:

File "/usr/lib/pymodules/python2.7/gladevcp/hal_filechooser.py", line 132, in get_filter_program
return self.ini.find("FILTER", ext[1:])
AttributeError: 'EMC_FileChooserButton' object has no attribute 'ini'

I have changed the file hal_filechooser.py in /usr/share/pyshared/gladevcp/ two different ways and both appear to work ok, could someone please check to see if I am on the right track.

Attached are two slightly different patch files.

Thanks, Phill.

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

More
24 Aug 2015 18:18 #61740 by phillc54
After a bit more hair pulling, I edited the original hal_filechooser.py in /usr/share/pyshared/gladevcp by changing the blank line number 170 to self.put_whatever_you_like_here = 'it works but I do not know why'
it works, it opens a file without any errors.
It does not make any sense to me.

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

More
25 Aug 2015 03:03 #61756 by BigJohnT
Not sure what your trying to do but to add more file extensions you just add them in the filter section of your ini file.

www.linuxcnc.org/docs/2.7/html/config/in...html#_filter_section

JT

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

More
25 Aug 2015 06:17 #61764 by phillc54
I am attempting to create a gui for LCNC.

I am trying to use a VCP FileChooserButton to open a file and whenever I try I get the above error message and the file does not get loaded into HAL Gremlin or the VCP SourceView widget.

If I use a button connected to a VCP Action Open it does work.

It seems both these actions use /usr/share/pyshared/gladevcp/hal_filechooser.py.

Originally I was doing this on a virtual machine so on the weekend I made a machine using the hybrid iso from the LCNC site and then upgraded to LCNC 2.6.9 and I am am still having the same problem.

If I put the nonsense line into hal_filechooser.py as previously stated it does work.

I am not doing anything at all with file extensions (that I am aware of ).

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

More
25 Aug 2015 13:25 - 25 Aug 2015 13:28 #61772 by cmorley
looks to me filechooser may have meant to require some python code. from Gmoccapy:
# Initialize the file to load dialog, setting an title and the correct
    # folder as well as a file filter
    def _init_file_to_load( self ):
        file_dir = self.get_ini_info.get_program_prefix()
        self.widgets.file_to_load_chooser.set_current_folder( file_dir )
        title = _( "Select the file you want to be loaded at program start" )
        self.widgets.file_to_load_chooser.set_title( title )
        self.widgets.ff_file_to_load.set_name( "linuxcnc files" )
        self.widgets.ff_file_to_load.add_pattern( "*.ngc" )
        file_ext = self.get_ini_info.get_file_ext()
        for ext in file_ext:
            self.widgets.ff_file_to_load.add_pattern( ext )


Chris M
Last edit: 25 Aug 2015 13:28 by cmorley.

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

More
25 Aug 2015 13:29 #61773 by cmorley
In your glade panel do you have an EMC_STAT widget?
Chris M

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

More
25 Aug 2015 13:37 #61774 by cmorley
I agree that is a weird error.
If I find time this week I will investigate deeper

Chris M
The following user(s) said Thank You: phillc54

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

More
25 Aug 2015 17:51 #61778 by BigJohnT

I am attempting to create a gui for LCNC.


Are you using gscreen as your starting point or are you starting from scratch?

I do have a little tutorial on creating a gui here.

gnipsel.com/linuxcnc/gui/index.html

JT
The following user(s) said Thank You: phillc54

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

More
26 Aug 2015 04:57 #61793 by phillc54
Chris, I don't have an EMC_STAT as yet, I will play around with the code you posted later today.

John, I am starting from scratch and have previously checked out your tutorials.

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

More
28 Aug 2015 04:47 #61845 by phillc54
I have decided to abandon the idea of using a filechooser_button and instead use a action_open plus a textview.

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

Moderators: HansU
Time to create page: 0.079 seconds
Powered by Kunena Forum