<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">import gtk
import gladevcp
import linuxcnc
import pygtk
import hal
import os


class HandlerClass:

    def __init__(self, halcomp, builder, useropts):
        # make a class reference to builder 
        # (self.ANYTHING is available anywhere in the HandlerClas class)
        self.builder = builder

        # make a class reference to the open vcp_action
        self.open = builder.get_object('open')

        # change a property in the iconchooser so all programs show
        # this shouldn't be required - it's a bug
        builder.get_object('file').set_property("filetypes", '*')

    # This is a callback function from the icon chooser selected in the GLADE signal editor
    # in GTK the first variable is always the widget that owned the signal that called this function
    # any other variables depend on the widget, in this case icon view sends the path
    def on_file_selected(self, widget, path):
        print path
        if path:
            self.open.load_file(path)
 
# boiler code
def get_handlers(halcomp,builder,useropts):
    return [HandlerClass(halcomp,builder,useropts)]






</pre></body></html>