<commit_before># Touchy is Copyright (c) 2009  <NAME> <<EMAIL>>
#
# Touchy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Touchy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.



class emc_control:
        def __init__(self, emc):
                self.emc = emc
                self.emccommand = emc.command()
                self.masked = 0;

        def mask(self):
                # updating toggle button active states dumbly causes spurious events
                self.masked = 1

        def unmask(self):
                self.masked = 0

        def mist_on(self, b):
                if self.masked: return
                self.emccommand.mist(1)

        def mist_off(self, b):
                if self.masked: return
                self.emccommand.mist(0)

        def estop(self, b):
                if self.masked: return
                self.emccommand.state(self.emc.STATE_ESTOP)

        def estop_reset(self, b):
                if self.masked: return
                self.emccommand.state(self.emc.STATE_ESTOP_RESET)

        def machine_off(self, b):
                if self.masked: return
                self.emccommand.state(self.emc.STATE_OFF)

        def machine_on(self, b):
                if self.masked: return
                self.emccommand.state(self.emc.STATE_ON)

        def home_all(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.home(-1)

        def unhome_all(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.unhome(-1)

        def home_x(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.home(0)

        def home_y(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.home(1)

        def home_z(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.home(2)

        def unhome_x(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.unhome(0)

        def unhome_y(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.unhome(1)

        def unhome_z(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.unhome(2)

        def jogging(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)

        def override_limits(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.override_limits()

class emc_status:
        def __init__(self, gtk, emc, dros, error, homes,
                     unhomes, estops, machines, override_limit):
                self.gtk = gtk
                self.dros = dros
                self.error = error
                self.homes = homes
                self.unhomes = unhomes
                self.estops = estops
                self.machines = machines
                self.override_limit = override_limit
                self.emc = emc
                self.emcstat = emc.stat()
                self.emcerror = emc.error_channel()
                self.initted = 0

        def periodic(self):
                self.emcstat.poll()
                # XXX tlo?
                self.dros['xr'].set_text("X:% 9.4f" % (self.emcstat.actual_position[0] - self.emcstat.origin[0]))
                self.dros['yr'].set_text("Y:% 9.4f" % (self.emcstat.actual_position[1] - self.emcstat.origin[1]))
                self.dros['zr'].set_text("Z:% 9.4f" % (self.emcstat.actual_position[2] - self.emcstat.origin[2]))
                self.dros['xa'].set_text("X:% 9.4f" % self.emcstat.actual_position[0])
                self.dros['ya'].set_text("Y:% 9.4f" % self.emcstat.actual_position[1])
                self.dros['za'].set_text("Z:% 9.4f" % self.emcstat.actual_position[2])
                self.dros['xd'].set_text("X:% 9.4f" % self.emcstat.dtg[0])
                self.dros['yd'].set_text("Y:% 9.4f" % self.emcstat.dtg[1])
                self.dros['zd'].set_text("Z:% 9.4f" % self.emcstat.dtg[2])

                for j,name in [(0,'x'), (1,'y'), (2,'z')]:
                        self.homes[name].set_active(self.emcstat.homed[j])
                        self.unhomes[name].set_active(not self.emcstat.homed[j])

                estopped = self.emcstat.task_state == self.emc.STATE_ESTOP
                self.estops['estop'].set_active(estopped)
                self.estops['estop_reset'].set_active(not estopped)

                on = self.emcstat.task_state == self.emc.STATE_ON
                self.machines['on'].set_active(on)
                self.machines['off'].set_active(not on)              

                ol = self.emcstat.axis[0]['override_limits']
                self.override_limit.set_active(ol)

                e = self.emcerror.poll()<commit_msg>show tlo in relative dro<commit_after># Touchy is Copyright (c) 2009  <NAME> <<EMAIL>>
#
# Touchy is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# Touchy is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.



class emc_control:
        def __init__(self, emc):
                self.emc = emc
                self.emccommand = emc.command()
                self.masked = 0;

        def mask(self):
                # updating toggle button active states dumbly causes spurious events
                self.masked = 1

        def unmask(self):
                self.masked = 0

        def mist_on(self, b):
                if self.masked: return
                self.emccommand.mist(1)

        def mist_off(self, b):
                if self.masked: return
                self.emccommand.mist(0)

        def estop(self, b):
                if self.masked: return
                self.emccommand.state(self.emc.STATE_ESTOP)

        def estop_reset(self, b):
                if self.masked: return
                self.emccommand.state(self.emc.STATE_ESTOP_RESET)

        def machine_off(self, b):
                if self.masked: return
                self.emccommand.state(self.emc.STATE_OFF)

        def machine_on(self, b):
                if self.masked: return
                self.emccommand.state(self.emc.STATE_ON)

        def home_all(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.home(-1)

        def unhome_all(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.unhome(-1)

        def home_x(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.home(0)

        def home_y(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.home(1)

        def home_z(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.home(2)

        def unhome_x(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.unhome(0)

        def unhome_y(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.unhome(1)

        def unhome_z(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.unhome(2)

        def jogging(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)

        def override_limits(self, b):
                if self.masked: return
                self.emccommand.mode(self.emc.MODE_MANUAL)
                self.emccommand.override_limits()

class emc_status:
        def __init__(self, gtk, emc, dros, error, homes,
                     unhomes, estops, machines, override_limit):
                self.gtk = gtk
                self.dros = dros
                self.error = error
                self.homes = homes
                self.unhomes = unhomes
                self.estops = estops
                self.machines = machines
                self.override_limit = override_limit
                self.emc = emc
                self.emcstat = emc.stat()
                self.emcerror = emc.error_channel()
                self.initted = 0

        def periodic(self):
                self.emcstat.poll()
                # XXX tlo?
                self.dros['xr'].set_text("X:% 9.4f" % (self.emcstat.actual_position[0] - self.emcstat.origin[0] - self.emcstat.tool_offset[0]))
                self.dros['yr'].set_text("Y:% 9.4f" % (self.emcstat.actual_position[1] - self.emcstat.origin[1]))
                self.dros['zr'].set_text("Z:% 9.4f" % (self.emcstat.actual_position[2] - self.emcstat.origin[2] - self.emcstat.tool_offset[2]))
                self.dros['xa'].set_text("X:% 9.4f" % self.emcstat.actual_position[0])
                self.dros['ya'].set_text("Y:% 9.4f" % self.emcstat.actual_position[1])
                self.dros['za'].set_text("Z:% 9.4f" % self.emcstat.actual_position[2])
                self.dros['xd'].set_text("X:% 9.4f" % self.emcstat.dtg[0])
                self.dros['yd'].set_text("Y:% 9.4f" % self.emcstat.dtg[1])
                self.dros['zd'].set_text("Z:% 9.4f" % self.emcstat.dtg[2])

                for j,name in [(0,'x'), (1,'y'), (2,'z')]:
                        self.homes[name].set_active(self.emcstat.homed[j])
                        self.unhomes[name].set_active(not self.emcstat.homed[j])

                estopped = self.emcstat.task_state == self.emc.STATE_ESTOP
                self.estops['estop'].set_active(estopped)
                self.estops['estop_reset'].set_active(not estopped)

                on = self.emcstat.task_state == self.emc.STATE_ON
                self.machines['on'].set_active(on)
                self.machines['off'].set_active(not on)              

                ol = self.emcstat.axis[0]['override_limits']
                self.override_limit.set_active(ol)

                e = self.emcerror.poll()
{'fraction_non_alphanumeric': 0.11096433289299867, 'fraction_numerical': 0.009511228533685601, 'mean_word_length': 1.637862950058072, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4541853', 'n_tokens_mistral': 3796, 'n_tokens_neox': 3515, 'n_words': 669}