本文整理匯總了Python中hal_glib.GStat.emit方法的典型用法代碼示例。如果您正苦於以下問題:Python GStat.emit方法的具體用法?Python GStat.emit怎麽用?Python GStat.emit使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類hal_glib.GStat
的用法示例。
在下文中一共展示了GStat.emit方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: OffsetPage
# 需要導入模塊: from hal_glib import GStat [as 別名]
# 或者: from hal_glib.GStat import emit [as 別名]
#.........這裏部分代碼省略.........
try:
if not self.display_units_mm == self.program_units and not row == 2:
if self.program_units == 1:
convert = 25.4
else:
convert = 1.0 / 25.4
qualified = float(locale.atof(new_text)) * convert
else:
qualified = float(locale.atof(new_text))
except:
print 'error'
# now update linuxcnc to the change
try:
global lncnc_runnning
if lncnc_running:
if self.status.task_mode != self.linuxcnc.MODE_MDI:
self.cmd.mode(self.linuxcnc.MODE_MDI)
self.cmd.wait_complete()
if row == 1:
self.cmd.mdi("G10 L2 P0 %s %10.4f" % (self.axisletters[axisnum], qualified))
elif row == 2:
if col == 3:
self.cmd.mdi("G10 L2 P0 R %10.4f" % (qualified))
elif row == 3:
self.cmd.mdi("G92 %s %10.4f" % (self.axisletters[axisnum], qualified))
else:
pnum = system_to_p(self.store[row][0])
if not pnum == None:
self.cmd.mdi("G10 L2 P%d %s %10.4f" % (pnum, self.axisletters[axisnum], qualified))
self.cmd.mode(self.linuxcnc.MODE_MANUAL)
self.cmd.wait_complete()
self.cmd.mode(self.linuxcnc.MODE_MDI)
self.cmd.wait_complete()
self.gstat.emit('reload-display')
except:
print "offsetpage widget error: MDI call error"
self.reload_offsets()
# callback to cancel G92 when button pressed
def zero_g92(self, widget):
# print "zero g92"
if lncnc_running:
try:
if self.status.task_mode != self.linuxcnc.MODE_MDI:
self.cmd.mode(self.linuxcnc.MODE_MDI)
self.cmd.wait_complete()
self.cmd.mdi("G92.1")
self.cmd.mode(self.linuxcnc.MODE_MANUAL)
self.cmd.wait_complete()
self.cmd.mode(self.linuxcnc.MODE_MDI)
self.cmd.wait_complete()
self.gstat.emit('reload-display')
except:
print "MDI error in offsetpage widget -zero G92"
# callback to zero rotational offset when button pressed
def zero_rot(self, widget):
# print "zero rotation offset"
if lncnc_running:
try:
if self.status.task_mode != self.linuxcnc.MODE_MDI:
self.cmd.mode(self.linuxcnc.MODE_MDI)
self.cmd.wait_complete()
self.cmd.mdi("G10 L2 P0 R 0")
self.cmd.mode(self.linuxcnc.MODE_MANUAL)