Part 2b

Add Action to the GUI

The Python

Well we don’t need to do much so this will be easy. Make a copy of and save it as Change gui1 to gui2 in the python file in three places as shown then save the file. The execute permission should have been copied over.
#!/usr/bin/env python

import gtk
import gladevcp.makepins
from gladevcp.gladebuilder import GladeBuilder
import hal

class gui_one(object):

  def on_window1_destroy(self, widget, data=None):
    print "quit with cancel"

  def on_gtk_quit_activate(self, menuitem, data=None):
    print "quit from menu"

  def __init__(self):
    self.builder = gtk.Builder()
    halcomp = hal.component("gui2")
    self.window = self.builder.get_object("window1")
    panel = gladevcp.makepins.GladePanel( halcomp, "", self.builder, None)

if __name__ == "__main__":
  app = gui_one()

Start up the Axis sim as before and run as before. The screen should pop up like the following and mirror any DRO numbers shown on the Axis screen.


In our custom screen press the E-Stop and Power buttons then in the Axis screen home the simulator. You should see the back plot in both screens move around as it homes.

Now back in our custom screen we can use File > Open to select a file to run. If we selected a file that would run in Axis it will run in our custom GUI.


When your finished just close Axis and our Custom GUI will close as well.

Next up running our custom GUI from the INI file without Axis…