Merged in marius_stanciu/flatcam_beta/Beta (pull request #174)

Beta
This commit is contained in:
Marius Stanciu 2019-08-03 20:13:05 +00:00
commit a5de4b0ff6
5 changed files with 65 additions and 28 deletions

View File

@ -96,8 +96,8 @@ class App(QtCore.QObject):
# ####################################
# Version and VERSION DATE ###########
# ####################################
version = 8.920
version_date = "2019/07/31"
version = 8.93
version_date = "2019/08/31"
beta = True
# current date now
@ -295,6 +295,7 @@ class App(QtCore.QObject):
QtCore.QObject.__init__(self)
self.ui = FlatCAMGUI(self.version, self.beta, self)
self.set_ui_title(name="New Project")
self.ui.geom_update[int, int, int, int, int].connect(self.save_geometry)
self.ui.final_save.connect(self.final_save)
@ -2075,6 +2076,14 @@ class App(QtCore.QObject):
except Exception as e:
log.debug("Could not open FlatCAM Script file as App parameter due: %s" % str(e))
def set_ui_title(self, name):
self.ui.setWindowTitle('FlatCAM %s %s - %s %s' %
(self.version,
('BETA' if self.beta else ''),
platform.architecture()[0],
name)
)
def defaults_read_form(self):
for option in self.defaults_form_fields:
try:
@ -6256,6 +6265,9 @@ class App(QtCore.QObject):
# take the focus of the Notebook on Project Tab.
self.ui.notebook.setCurrentWidget(self.ui.project_tab)
self.set_ui_title(name="New Project")
def obj_properties(self):
self.report_usage("obj_properties()")
@ -6445,8 +6457,10 @@ class App(QtCore.QObject):
return
# Check for more compatible types and add as required
if (not isinstance(obj, FlatCAMGeometry) and not isinstance(obj, FlatCAMGerber) and not isinstance(obj, FlatCAMCNCjob)
and not isinstance(obj, FlatCAMExcellon)):
if (not isinstance(obj, FlatCAMGeometry)
and not isinstance(obj, FlatCAMGerber)
and not isinstance(obj, FlatCAMCNCjob)
and not isinstance(obj, FlatCAMExcellon)):
msg = _("[ERROR_NOTCL] Only Geometry, Gerber and CNCJob objects can be used.")
msgbox = QtWidgets.QMessageBox()
msgbox.setInformativeText(msg)
@ -6455,7 +6469,7 @@ class App(QtCore.QObject):
msgbox.exec_()
return
name = self.collection.get_active().options["name"]
name = obj.options["name"]
filter = "SVG File (*.svg);;All Files (*.*)"
try:
@ -6988,6 +7002,8 @@ class App(QtCore.QObject):
self.file_opened.emit("project", self.project_filename)
self.file_saved.emit("project", self.project_filename)
self.set_ui_title(name=self.project_filename)
self.should_we_save = False
def on_file_saveprojectas(self, make_copy=False, thread=True, quit=False):
@ -7039,6 +7055,7 @@ class App(QtCore.QObject):
if not make_copy:
self.project_filename = filename
self.set_ui_title(name=self.project_filename)
self.should_we_save = False
def export_svg(self, obj_name, filename, scale_factor=0.00):
@ -8089,6 +8106,7 @@ class App(QtCore.QObject):
self.should_we_save = False
self.file_opened.emit("project", filename)
self.set_ui_title(name=self.project_filename)
App.log.debug("Project loaded")

View File

@ -188,7 +188,7 @@ class FlatCAMObj(QtCore.QObject):
self.muted_ui = False
def on_name_activate(self):
def on_name_activate(self, silent=None):
old_name = copy(self.options["name"])
new_name = self.ui.name_entry.get_value()
@ -205,7 +205,8 @@ class FlatCAMObj(QtCore.QObject):
self.options["name"] = self.ui.name_entry.get_value()
self.default_data["name"] = self.ui.name_entry.get_value()
self.app.collection.update_view()
self.app.inform.emit(_("[success] Name changed from {old} to {new}").format(old=old_name, new=new_name))
if silent:
self.app.inform.emit(_("[success] Name changed from {old} to {new}").format(old=old_name, new=new_name))
def on_offset_button_click(self):
self.app.report_usage("obj_on_offset_button")
@ -5638,6 +5639,10 @@ class FlatCAMCNCjob(FlatCAMObj, CNCjob):
"[WARNING_NOTCL] Export Machine Code cancelled ..."))
return
new_name = os.path.split(str(filename))[1].rpartition('.')[0]
self.ui.name_entry.set_value(new_name)
self.on_name_activate(silent=True)
preamble = str(self.ui.prepend_text.get_value())
postamble = str(self.ui.append_text.get_value())

View File

@ -9,6 +9,12 @@ CAD program, and create G-Code for Isolation routing.
=================================================
3.08.2019
- added project name to the window title
- fulfilled request: When saving a CNC file, if the file name is changed in the OS window, the new name does appear in the “Selected” (in name) and “Project” tabs (in cnc_job)
- solved bug such that the app is not crashing when some apertures in the Gerber file have no geometry. More than that, now the apertures that have geometry elements are bolded as opposed to the ones without geometry for which the text is unbolded
31.07.2019
- changed the order of the menu entries in the FIle -> Open ...

View File

@ -1737,7 +1737,11 @@ class FlatCAMGUI(QtWidgets.QMainWindow):
self.setWindowIcon(self.app_icon)
self.setGeometry(100, 100, 1024, 650)
self.setWindowTitle('FlatCAM %s %s - %s' % (version, ('BETA' if beta else ''), platform.architecture()[0]))
self.setWindowTitle('FlatCAM %s %s - %s' %
(version,
('BETA' if beta else ''),
platform.architecture()[0])
)
self.show()
self.filename = ""

View File

@ -112,6 +112,8 @@ class Properties(FlatCAMTool):
def addItems(self, obj):
parent = self.treeWidget.invisibleRootItem()
apertures = ''
tools = ''
font = QtGui.QFont()
font.setBold(True)
@ -131,11 +133,8 @@ class Properties(FlatCAMTool):
self.addChild(obj_type, ['Object Type:', ('%s' % (obj.kind.capitalize()))], True)
try:
self.addChild(obj_type,
['Geo Type:',
('%s' % ({False: "Single-Geo", True: "Multi-Geo"}[obj.multigeo]))
],
True
)
['Geo Type:', ('%s' % ({False: "Single-Geo", True: "Multi-Geo"}[obj.multigeo]))],
True)
except Exception as e:
log.debug("Properties.addItems() --> %s" % str(e))
@ -179,26 +178,31 @@ class Properties(FlatCAMTool):
self.addChild(options, [str(option), str(obj.options[option])], True)
if obj.kind.lower() == 'gerber':
temp_ap = {}
temp_ap = dict()
for ap in obj.apertures:
temp_ap.clear()
temp_ap = deepcopy(obj.apertures[ap])
temp_ap.pop('geometry', None)
if obj.apertures[ap]['geometry']:
solid_nr = 0
follow_nr = 0
clear_nr = 0
for el in obj.apertures[ap]['geometry']:
if 'solid' in el:
solid_nr += 1
if 'follow' in el:
follow_nr += 1
if 'clear' in el:
clear_nr += 1
temp_ap['Solid_Geo'] = '%s Polygons' % str(solid_nr)
temp_ap['Follow_Geo'] = '%s LineStrings' % str(follow_nr)
temp_ap['Clear_Geo'] = '%s Polygons' % str(clear_nr)
solid_nr = 0
follow_nr = 0
clear_nr = 0
if 'geometry' in obj.apertures[ap]:
if obj.apertures[ap]['geometry']:
font.setBold(True)
for el in obj.apertures[ap]['geometry']:
if 'solid' in el:
solid_nr += 1
if 'follow' in el:
follow_nr += 1
if 'clear' in el:
clear_nr += 1
else:
font.setBold(False)
temp_ap['Solid_Geo'] = '%s Polygons' % str(solid_nr)
temp_ap['Follow_Geo'] = '%s LineStrings' % str(follow_nr)
temp_ap['Clear_Geo'] = '%s Polygons' % str(clear_nr)
apid = self.addParent(apertures, str(ap), expanded=False, color=QtGui.QColor("#000000"), font=font)
for key in temp_ap: