Disabled "Ok"/"Update Geometry" button after first update. Solves issue #105.
This commit is contained in:
parent
681996d1f6
commit
e353413cd3
|
@ -417,7 +417,7 @@ class App(QtCore.QObject):
|
|||
# Toolbar
|
||||
self.ui.zoom_fit_btn.triggered.connect(self.on_zoom_fit)
|
||||
self.ui.zoom_in_btn.triggered.connect(lambda: self.plotcanvas.zoom(1.5))
|
||||
self.ui.zoom_out_btn.triggered.connect(lambda: self.plotcanvas.zoom(1/1.5))
|
||||
self.ui.zoom_out_btn.triggered.connect(lambda: self.plotcanvas.zoom(1 / 1.5))
|
||||
self.ui.clear_plot_btn.triggered.connect(self.plotcanvas.clear)
|
||||
self.ui.replot_btn.triggered.connect(self.on_toolbar_replot)
|
||||
self.ui.newgeo_btn.triggered.connect(lambda: self.new_object('geometry', 'New Geometry', lambda x, y: None))
|
||||
|
@ -539,6 +539,8 @@ class App(QtCore.QObject):
|
|||
self.info("Select a Geometry Object to edit.")
|
||||
return
|
||||
|
||||
self.ui.updategeo_btn.setEnabled(True)
|
||||
|
||||
self.draw.edit_fcgeometry(self.collection.get_active())
|
||||
|
||||
def editor2geometry(self):
|
||||
|
@ -555,6 +557,8 @@ class App(QtCore.QObject):
|
|||
self.draw.update_fcgeometry(geo)
|
||||
self.draw.deactivate()
|
||||
|
||||
self.ui.updategeo_btn.setEnabled(False)
|
||||
|
||||
geo.plot()
|
||||
|
||||
def get_last_folder(self):
|
||||
|
|
|
@ -738,6 +738,7 @@ class FlatCAMDraw(QtCore.QObject):
|
|||
assert isinstance(fcgeometry, Geometry)
|
||||
|
||||
self.clear()
|
||||
self.select_tool("select")
|
||||
|
||||
# Link shapes into editor.
|
||||
for shape in fcgeometry.flatten():
|
||||
|
@ -900,14 +901,15 @@ class FlatCAMDraw(QtCore.QObject):
|
|||
### Abort the current action
|
||||
if event.key == 'escape':
|
||||
# TODO: ...?
|
||||
self.on_tool_select("select")
|
||||
#self.on_tool_select("select")
|
||||
self.app.info("Cancelled.")
|
||||
|
||||
self.delete_utility_geometry()
|
||||
|
||||
self.replot()
|
||||
self.select_btn.setChecked(True)
|
||||
self.on_tool_select('select')
|
||||
# self.select_btn.setChecked(True)
|
||||
# self.on_tool_select('select')
|
||||
self.select_tool('select')
|
||||
return
|
||||
|
||||
### Delete selected object
|
||||
|
@ -1083,6 +1085,16 @@ class FlatCAMDraw(QtCore.QObject):
|
|||
|
||||
return storage
|
||||
|
||||
def select_tool(self, toolname):
|
||||
"""
|
||||
Selects a drawing tool. Impacts the object and GUI.
|
||||
|
||||
:param toolname: Name of the tool.
|
||||
:return: None
|
||||
"""
|
||||
self.tools[toolname]["button"].setChecked(True)
|
||||
self.on_tool_select(toolname)
|
||||
|
||||
def set_selected(self, shape):
|
||||
|
||||
# Remove and add to the end.
|
||||
|
|
|
@ -70,6 +70,7 @@ class FlatCAMGUI(QtGui.QMainWindow):
|
|||
self.menueditnew = self.menuedit.addAction(QtGui.QIcon('share/new_geo16.png'), 'New Geometry')
|
||||
self.menueditedit = self.menuedit.addAction(QtGui.QIcon('share/edit16.png'), 'Edit Geometry')
|
||||
self.menueditok = self.menuedit.addAction(QtGui.QIcon('share/edit_ok16.png'), 'Update Geometry')
|
||||
#self.menueditok.
|
||||
#self.menueditcancel = self.menuedit.addAction(QtGui.QIcon('share/cancel_edit16.png'), "Cancel Edit")
|
||||
self.menueditjoin = self.menuedit.addAction(QtGui.QIcon('share/join16.png'), 'Join Geometry')
|
||||
self.menueditdelete = self.menuedit.addAction(QtGui.QIcon('share/trash16.png'), 'Delete')
|
||||
|
@ -115,6 +116,7 @@ class FlatCAMGUI(QtGui.QMainWindow):
|
|||
self.newgeo_btn = self.toolbar.addAction(QtGui.QIcon('share/new_geo32.png'), "New Blank Geometry")
|
||||
self.editgeo_btn = self.toolbar.addAction(QtGui.QIcon('share/edit32.png'), "Edit Geometry")
|
||||
self.updategeo_btn = self.toolbar.addAction(QtGui.QIcon('share/edit_ok32.png'), "Update Geometry")
|
||||
self.updategeo_btn.setEnabled(False)
|
||||
#self.canceledit_btn = self.toolbar.addAction(QtGui.QIcon('share/cancel_edit32.png'), "Cancel Edit")
|
||||
self.delete_btn = self.toolbar.addAction(QtGui.QIcon('share/delete32.png'), "&Delete")
|
||||
self.shell_btn = self.toolbar.addAction(QtGui.QIcon('share/shell32.png'), "&Command Line")
|
||||
|
@ -215,7 +217,7 @@ class FlatCAMGUI(QtGui.QMainWindow):
|
|||
self.progress_bar = QtGui.QProgressBar()
|
||||
self.progress_bar.setMinimum(0)
|
||||
self.progress_bar.setMaximum(100)
|
||||
infobar.addWidget(self.progress_bar)
|
||||
#infobar.addWidget(self.progress_bar)
|
||||
|
||||
self.activity_view = FlatCAMActivityView()
|
||||
infobar.addWidget(self.activity_view)
|
||||
|
@ -245,6 +247,8 @@ class FlatCAMActivityView(QtGui.QWidget):
|
|||
def __init__(self, parent=None):
|
||||
super(FlatCAMActivityView, self).__init__(parent=parent)
|
||||
|
||||
self.setMinimumWidth(200)
|
||||
|
||||
self.icon = QtGui.QLabel(self)
|
||||
self.icon.setGeometry(0, 0, 12, 12)
|
||||
self.movie = QtGui.QMovie("share/active.gif")
|
||||
|
@ -253,6 +257,7 @@ class FlatCAMActivityView(QtGui.QWidget):
|
|||
|
||||
layout = QtGui.QHBoxLayout()
|
||||
layout.setContentsMargins(5, 0, 5, 0)
|
||||
layout.setAlignment(QtCore.Qt.AlignLeft)
|
||||
self.setLayout(layout)
|
||||
|
||||
layout.addWidget(self.icon)
|
||||
|
|
|
@ -34,6 +34,14 @@ class FCProcess(object):
|
|||
|
||||
|
||||
class FCProcessContainer(object):
|
||||
"""
|
||||
This is the process container, or controller (as in MVC)
|
||||
of the Process/Activity tracking.
|
||||
|
||||
FCProcessContainer keeps weak references to the FCProcess'es
|
||||
such that their __del__ method is called when the user
|
||||
looses track of their reference.
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
|
||||
|
@ -48,8 +56,6 @@ class FCProcessContainer(object):
|
|||
|
||||
proc.connect(self.on_done, event="done")
|
||||
|
||||
# if proc not in self.procs:
|
||||
# self.procs.append(proc)
|
||||
self.add(proc)
|
||||
|
||||
self.on_change(proc)
|
||||
|
@ -80,7 +86,6 @@ class FCVisibleProcessContainer(QtCore.QObject, FCProcessContainer):
|
|||
def __init__(self, view):
|
||||
assert isinstance(view, FlatCAMActivityView)
|
||||
|
||||
#super(FCVisibleProcessContainer, self).__init__()
|
||||
FCProcessContainer.__init__(self)
|
||||
QtCore.QObject.__init__(self)
|
||||
|
||||
|
|
|
@ -1428,6 +1428,7 @@ class Gerber (Geometry):
|
|||
gfile.close()
|
||||
self.parse_lines(gstr, follow=follow)
|
||||
|
||||
#@profile
|
||||
def parse_lines(self, glines, follow=False):
|
||||
"""
|
||||
Main Gerber parser. Reads Gerber and populates ``self.paths``, ``self.apertures``,
|
||||
|
@ -1915,6 +1916,7 @@ class Gerber (Geometry):
|
|||
poly_buffer.append(geo)
|
||||
|
||||
# --- Apply buffer ---
|
||||
log.warn("Joining %d polygons." % len(poly_buffer))
|
||||
if current_polarity == 'D':
|
||||
self.solid_geometry = self.solid_geometry.union(cascaded_union(poly_buffer))
|
||||
else:
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
# This script is for profiling Gerber.parse_lines() line by line.
|
||||
# Run kernprof -l -v gerber_parsing_line_profile_1.py
|
||||
|
||||
import sys
|
||||
sys.path.append('../../')
|
||||
|
||||
from camlib import *
|
||||
|
||||
log = logging.getLogger('base2')
|
||||
log.setLevel(logging.WARNING)
|
||||
|
||||
g = Gerber()
|
||||
g.parse_file("gerber1.gbr")
|
|
@ -10,6 +10,8 @@ log.setLevel(logging.WARNING)
|
|||
|
||||
g = Gerber()
|
||||
|
||||
cProfile.run('g.parse_file("gerber1.gbr")', 'gerber1_profile', sort='cumtime')
|
||||
#cProfile.run('g.parse_file("gerber1.gbr")', 'gerber1_profile', sort='cumtime')
|
||||
cProfile.run('g.parse_file("/home/jpcaram/flatcam_test_files/Gerbers/AVR_Transistor_Tester_silkscreen_top.GTO")',
|
||||
'gerber1_profile', sort='cumtime')
|
||||
p = pstats.Stats('gerber1_profile')
|
||||
p.strip_dirs().sort_stats('cumulative').print_stats(.1)
|
Loading…
Reference in New Issue