# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Hazzy. If not, see <http://www.gnu.org/licenses/>. # Description: # This handles the initialization of the application and the creation of the # the main window. The window will be populated based on the layout defined # in the XML file specified in [DISPLAY] XML_FILE in the INI. If that file # does not exist or is not valid, one window containing one blank screen will # be created for the user to add widgets to. import time from utilities import logger log = logger.get('MAIN') def log_time(task, times=[time.time(), time.time()]): now = time.time() log.debug("yellow<Time:> {:.3f} (green<{:+.3f}>) - {}".format( now - times[0], now - times[1], task)) times[1] = now log_time("in script") import os import sys import datetime import linuxcnc, hal
# GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with Hazzy. If not, see <http://www.gnu.org/licenses/>. # Description: # Basic expression evaluator for use in data entries etc. import ast import operator as op from utilities import ini_info from utilities.constants import Units # Set up logging from utilities import logger log = logger.get(__name__) # Supported operators operators = { ast.Add: op.add, ast.Sub: op.sub, ast.Mult: op.mul, ast.Div: op.truediv, ast.Pow: op.pow, ast.BitXor: op.xor, ast.USub: op.neg } is_metric = ini_info.get_machine_name() == Units.MM log.info(is_metric)
from gi.repository import Gtk from gi.repository import Gdk # Setup paths PYDIR = os.path.abspath(os.path.dirname(__file__)) HAZZYDIR = os.path.abspath(os.path.join(PYDIR, '../../..')) if HAZZYDIR not in sys.path: sys.path.insert(1, HAZZYDIR) UIDIR = os.path.join(PYDIR, 'ui') STYLEDIR = os.path.join(HAZZYDIR, 'themes') # Setup logging from utilities import logger log = logger.get("HAZZY.KEYBOARD") class TouchPad: def __init__(self, test=False): self.window = TouchPadWindow() self.dro = None self.original_text = None if test: self.window.disable_dot_button() self.window.show_all() def show(self, widget, kind="float"): if kind != "float":