Beispiel #1
0
 def on_ohmicProbe_button_press_event(self,widget,event):
     if event.type == gdk._2BUTTON_PRESS:
         if hal.pin_has_writer('debounce.0.2.in'):
             sp.Popen(['halcmd unlinkp plasmactest.ohmicProbe'], shell=True)
             sp.Popen(['halcmd setp debounce.0.2.in 1'], shell=True)
         else:
             sp.Popen(['halcmd setp debounce.0.2.in 0'], shell=True)
             sp.Popen(['halcmd net p_test:ohmic-probe plasmactest.ohmicProbe'], shell=True)
Beispiel #2
0
 def on_breakawaySwitch_button_press_event(self,widget,event):
     if event.type == gdk._2BUTTON_PRESS:
         if hal.pin_has_writer('debounce.0.1.in'):
             sp.Popen(['halcmd unlinkp plasmactest.breakawaySwitch'], shell=True)
             sp.Popen(['halcmd setp debounce.0.1.in 1'], shell=True)
         else:
             sp.Popen(['halcmd setp debounce.0.1.in 0'], shell=True)
             sp.Popen(['halcmd net p_test:breakaway-switch plasmactest.breakawaySwitch'], shell=True)
Beispiel #3
0
    def __init__(self):
        self.lcnc = linuxCNC()
#        gtk.settings_get_default().set_property('gtk-theme-name', self.lcnc.iniFile.find('PLASMAC', 'THEME'))
        self.gui = "./plasmac/test/plasmac_test.glade"
        self.B = gtk.Builder()
        self.B.add_from_file(self.gui)
        self.B.connect_signals(self)
        self.W=self.B.get_object("window1")
        self.halcomp = hal.component('plasmactest')
        self.panel = gladevcp.makepins.GladePanel(self.halcomp, self.gui, self.B, None)
        self.torch = hal_glib.GPin(self.halcomp.newpin('torch-on', hal.HAL_BIT, hal.HAL_IN))
        self.halcomp.ready()
        sp.Popen(['halcmd net plasmac:torch-on plasmactest.torch-on'], shell=True)
        self.torch.connect('value-changed', self.torch_changed)
        if not hal.pin_has_writer('plasmac.arc-ok-in'):
            sp.Popen(['halcmd net p_test:arc-ok-in plasmactest.arcOk plasmac.arc-ok-in'], shell=True)
        if not hal.pin_has_writer('plasmac.arc-voltage-in'):
            sp.Popen(['halcmd net p_test:arc-voltage-in plasmactest.arcVoltage plasmac.arc-voltage-in'], shell=True)
        if not hal.pin_has_writer('debounce.0.0.in'):
            sp.Popen(['halcmd net p_test:float-switch plasmactest.floatSwitch debounce.0.0.in'], shell=True)
        if not hal.pin_has_writer('debounce.0.1.in'):
            sp.Popen(['halcmd net p_test:breakaway-switch plasmactest.breakawaySwitch debounce.0.1.in'], shell=True)
        if not hal.pin_has_writer('debounce.0.2.in'):
            sp.Popen(['halcmd net p_test:ohmic-probe plasmactest.ohmicProbe debounce.0.2.in'], shell=True)
        if not hal.pin_has_writer('plasmac.move-down'):
            sp.Popen(['halcmd net p_test:move-down plasmactest.moveDown plasmac.move-down'], shell=True)
        if not hal.pin_has_writer('plasmac.move-up'):
            sp.Popen(['halcmd net p_test:move-up plasmactest.moveUp plasmac.move-up'], shell=True)
        self.W.connect('delete_event', self.ignore)
        self.W.set_type_hint(gdk.WINDOW_TYPE_HINT_MENU)
        self.W.set_keep_above(True)
        self.W.show_all()
        mode = self.lcnc.iniFile.find('PLASMAC', 'MODE') or '0'
        if mode not in '012':
            mode = 0
        self.B.get_object('mode' + mode).set_active(1)
        functions = {'0': self.on_mode0_toggled(0), '1': self.on_mode1_toggled(0), '2': self.on_mode2_toggled(0), }
        if mode in functions:
            functions[mode]