Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python
- import pygtk
- pygtk.require("2.0")
- import gtk
- import gladevcp.makepins
- from gladevcp.gladebuilder import GladeBuilder
- import hal
- import sys,os
- # set up paths to files
- BASE = os.path.abspath(os.path.join(os.path.dirname(sys.argv[0]), ".."))
- libdir = os.path.join(BASE, "lib", "python")
- sys.path.insert(0, libdir)
- datadir = os.path.join(BASE, "share", "linuxcnc")
- xmlname = os.path.join(datadir,"jtgui.glade")
- # language stuff I think
- import gettext
- LOCALEDIR = os.path.join(BASE, "share", "locale")
- gettext.install("linuxcnc", localedir=LOCALEDIR, unicode=True)
- gtk.glade.bindtextdomain("linuxcnc", LOCALEDIR)
- gtk.glade.textdomain("linuxcnc")
- TCLPATH = os.environ['LINUXCNC_TCL_DIR']
- def set_active(w, s):
- if not w: return
- os = w.get_active()
- if os != s: w.set_active(s)
- def set_label(w, l):
- if not w: return
- ol = w.get_label()
- if ol != l: w.set_label(l)
- def set_text(w, t):
- if not w: return
- ot = w.get_label()
- if ot != t: w.set_label(t)
- import linuxcnc
- from jtgui import emc_interface
- from jtgui import mdi
- from jtgui import preferences
- class jtgui(object):
- def on_MainWindow_destroy(self, widget, data=None):
- print "quit with cancel"
- gtk.main_quit()
- def on_gtk_quit_activate(self, menuitem, data=None):
- print "quit from menu"
- gtk.main_quit()
- def __init__(self):
- self.emc = linuxcnc
- self.status = self.emc.stat()
- self.builder = gtk.Builder()
- self.builder.add_from_file(xmlname)
- self.halcomp = hal.component("jtgui")
- self.builder.connect_signals(self)
- self.window = self.builder.get_object("window1")
- self.window.show()
- self.panel = gladevcp.makepins.GladePanel(self.halcomp, xmlname, self.builder, None)
- self.halcomp.ready()
- def on_test_button_clicked(self, widget, data=None):
- self.status.poll()
- print self.status.g5x_offset[0]
- if __name__ == "__main__":
- app = jtgui()
- gtk.main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement