diff --git a/FlatCAMDraw.py b/FlatCAMDraw.py index d9a9dae4..6a3ccc3d 100644 --- a/FlatCAMDraw.py +++ b/FlatCAMDraw.py @@ -28,6 +28,8 @@ from numpy.linalg import solve from rtree import index as rtindex +from GUIElements import FCEntry + class BufferSelectionTool(FlatCAMTool): """ @@ -717,19 +719,23 @@ class FlatCAMDraw(QtCore.QObject): self.delete_btn = self.drawing_toolbar.addAction(QtGui.QIcon('share/deleteshape32.png'), "Delete Shape '-'") ### Snap Toolbar ### + self.snap_toolbar = QtGui.QToolBar("Grid Toolbar") self.grid_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share/grid32.png'), 'Snap to grid') - self.grid_gap_x_entry = QtGui.QLineEdit() + self.grid_gap_x_entry = FCEntry() + self.grid_gap_x_entry.setMaximumWidth(70) self.grid_gap_x_entry.setToolTip("Grid X distance") self.snap_toolbar.addWidget(self.grid_gap_x_entry) - self.grid_gap_y_entry = QtGui.QLineEdit() + self.grid_gap_y_entry = FCEntry() self.grid_gap_y_entry.setMaximumWidth(70) self.grid_gap_y_entry.setToolTip("Grid Y distante") self.snap_toolbar.addWidget(self.grid_gap_y_entry) + self.corner_snap_btn = self.snap_toolbar.addAction(QtGui.QIcon('share/corner32.png'), 'Snap to corner') - self.snap_max_dist_entry = QtGui.QLineEdit() + self.snap_max_dist_entry = FCEntry() + self.snap_max_dist_entry.setMaximumWidth(70) self.snap_max_dist_entry.setToolTip("Max. magnet distance") self.snap_toolbar.addWidget(self.snap_max_dist_entry) diff --git a/GUIElements.py b/GUIElements.py index b962248f..d46aaf24 100644 --- a/GUIElements.py +++ b/GUIElements.py @@ -77,6 +77,18 @@ class LengthEntry(QtGui.QLineEdit): 'MM': {'IN': 25.4, 'MM': 1.0} } + self.readyToEdit = True + + def mousePressEvent(self, e, Parent=None): + super(LengthEntry, self).mousePressEvent(e) # required to deselect on 2e click + if self.readyToEdit: + self.selectAll() + self.readyToEdit = False + + def focusOutEvent(self, e): + super(LengthEntry, self).focusOutEvent(e) # required to remove cursor on focusOut + self.deselect() + self.readyToEdit = True def returnPressed(self, *args, **kwargs): val = self.get_value() @@ -111,6 +123,18 @@ class LengthEntry(QtGui.QLineEdit): class FloatEntry(QtGui.QLineEdit): def __init__(self, parent=None): super(FloatEntry, self).__init__(parent) + self.readyToEdit = True + + def mousePressEvent(self, e, Parent=None): + super(FloatEntry, self).mousePressEvent(e) # required to deselect on 2e click + if self.readyToEdit: + self.selectAll() + self.readyToEdit = False + + def focusOutEvent(self, e): + super(FloatEntry, self).focusOutEvent(e) # required to remove cursor on focusOut + self.deselect() + self.readyToEdit = True def returnPressed(self, *args, **kwargs): val = self.get_value() @@ -139,6 +163,18 @@ class IntEntry(QtGui.QLineEdit): super(IntEntry, self).__init__(parent) self.allow_empty = allow_empty self.empty_val = empty_val + self.readyToEdit = True + + def mousePressEvent(self, e, Parent=None): + super(IntEntry, self).mousePressEvent(e) # required to deselect on 2e click + if self.readyToEdit: + self.selectAll() + self.readyToEdit = False + + def focusOutEvent(self, e): + super(IntEntry, self).focusOutEvent(e) # required to remove cursor on focusOut + self.deselect() + self.readyToEdit = True def get_value(self): @@ -160,6 +196,18 @@ class IntEntry(QtGui.QLineEdit): class FCEntry(QtGui.QLineEdit): def __init__(self, parent=None): super(FCEntry, self).__init__(parent) + self.readyToEdit = True + + def mousePressEvent(self, e, Parent=None): + super(FCEntry, self).mousePressEvent(e) # required to deselect on 2e click + if self.readyToEdit: + self.selectAll() + self.readyToEdit = False + + def focusOutEvent(self, e): + super(FCEntry, self).focusOutEvent(e) # required to remove cursor on focusOut + self.deselect() + self.readyToEdit = True def get_value(self): return str(self.text()) @@ -171,6 +219,18 @@ class FCEntry(QtGui.QLineEdit): class EvalEntry(QtGui.QLineEdit): def __init__(self, parent=None): super(EvalEntry, self).__init__(parent) + self.readyToEdit = True + + def mousePressEvent(self, e, Parent=None): + super(EvalEntry, self).mousePressEvent(e) # required to deselect on 2e click + if self.readyToEdit: + self.selectAll() + self.readyToEdit = False + + def focusOutEvent(self, e): + super(EvalEntry, self).focusOutEvent(e) # required to remove cursor on focusOut + self.deselect() + self.readyToEdit = True def returnPressed(self, *args, **kwargs): val = self.get_value() diff --git a/make_win32.py b/make_win32.py index 9f998533..5837fadd 100644 --- a/make_win32.py +++ b/make_win32.py @@ -22,12 +22,20 @@ import os, site, sys from cx_Freeze import setup, Executable +# this is done to solve the tkinter not being found (Python3) +# still the DLL's need to be copied to the lib folder but the script can't do it +PYTHON_INSTALL_DIR = os.path.dirname(os.path.dirname(os.__file__)) +os.environ['TCL_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tcl8.6') +os.environ['TK_LIBRARY'] = os.path.join(PYTHON_INSTALL_DIR, 'tcl', 'tk8.6') + ## Get the site-package folder, not everybody will install ## Python into C:\PythonXX site_dir = site.getsitepackages()[1] include_files = [] include_files.append((os.path.join(site_dir, "shapely"), "shapely")) +include_files.append((os.path.join(site_dir, "svg"), "svg")) +include_files.append((os.path.join(site_dir, "svg/path"), "svg")) include_files.append((os.path.join(site_dir, "matplotlib"), "matplotlib")) include_files.append(("share", "share")) include_files.append((os.path.join(site_dir, "rtree"), "rtree")) @@ -41,9 +49,7 @@ if sys.platform == "win32": base = "Win32GUI" buildOptions = dict( - compressed=False, include_files=include_files, - icon='share/flatcam_icon48.ico', # excludes=['PyQt4', 'tk', 'tcl'] excludes=['scipy.lib.lapack.flapack.pyd', 'scipy.lib.blas.fblas.pyd', @@ -60,5 +66,5 @@ setup( version="8.5", description="FlatCAM: 2D Computer Aided PCB Manufacturing", options=dict(build_exe=buildOptions), - executables=[Executable("FlatCAM.py", base=base)] + executables=[Executable("FlatCAM.py", icon='share/flatcam_icon48.ico', base=base)] ) \ No newline at end of file diff --git a/tclCommands/TclCommandFollow.py b/tclCommands/TclCommandFollow.py index 46bc4cb3..36ec3f31 100644 --- a/tclCommands/TclCommandFollow.py +++ b/tclCommands/TclCommandFollow.py @@ -1,8 +1,7 @@ -from ObjectCollection import * -import TclCommand +from tclCommands.TclCommand import * -class TclCommandFollow(TclCommand.TclCommandSignaled): +class TclCommandFollow(TclCommandSignaled): """ Tcl shell command to follow a Gerber file """