diff --git a/FlatCAMApp.py b/FlatCAMApp.py index a12daf54..c3b7b67d 100644 --- a/FlatCAMApp.py +++ b/FlatCAMApp.py @@ -50,7 +50,7 @@ from flatcamTools import * from multiprocessing import Pool import tclCommands -from ParseFont import * +# from ParseFont import * ######################################## @@ -87,7 +87,7 @@ class App(QtCore.QObject): log.addHandler(handler) # Version - version = 8.902 + version = 8.903 version_date = "2019/01/20" beta = True @@ -398,6 +398,9 @@ class App(QtCore.QObject): for name in list(self.postprocessors.keys()): self.geometry_defaults_form.geometry_group.pp_geometry_name_cb.addItem(name) + # HPGL postprocessor is only for Geometry objects therefore it should not be in the Excellon Preferences + if name == 'hpgl': + continue self.excellon_defaults_form.excellon_group.pp_excellon_name_cb.addItem(name) self.defaults = LoudDict() @@ -808,6 +811,7 @@ class App(QtCore.QObject): self.plotcanvas.vis_connect('mouse_press', self.on_mouse_click_over_plot) self.plotcanvas.vis_connect('mouse_release', self.on_mouse_click_release_over_plot) self.plotcanvas.vis_connect('mouse_double_click', self.on_double_click_over_plot) + # Keys over plot enabled self.plotcanvas.vis_connect('key_press', self.on_key_over_plot) self.plotcanvas.vis_connect('key_release', self.on_key_release_over_plot) @@ -1128,8 +1132,8 @@ class App(QtCore.QObject): self.install_tools() ### System Font Parsing ### - self.f_parse = ParseFont(self) - self.parse_system_fonts() + # self.f_parse = ParseFont(self) + # self.parse_system_fonts() # test if the program was started with a script as parameter if self.cmd_line_shellfile: @@ -1247,7 +1251,6 @@ class App(QtCore.QObject): except Exception as e: log.debug("Could not open FlatCAM project file as App parameter due: %s" % str(e)) - def defaults_read_form(self): for option in self.defaults_form_fields: try: @@ -1346,9 +1349,9 @@ class App(QtCore.QObject): self.install_tools() self.log.debug("Tools are initialized.") - def parse_system_fonts(self): - self.worker_task.emit({'fcn': self.f_parse.get_fonts_by_types, - 'params': []}) + # def parse_system_fonts(self): + # self.worker_task.emit({'fcn': self.f_parse.get_fonts_by_types, + # 'params': []}) def object2editor(self): """ diff --git a/FlatCAMEditor.py b/FlatCAMEditor.py index 80cf2c5b..c8ae5e36 100644 --- a/FlatCAMEditor.py +++ b/FlatCAMEditor.py @@ -28,6 +28,7 @@ from numpy.linalg import solve from rtree import index as rtindex from GUIElements import OptionalInputSection, FCCheckBox, FCEntry, FCEntry2, FCComboBox, FCTextAreaRich, \ VerticalScrollArea, FCTable +from ParseFont import * from vispy.scene.visuals import Markers from copy import copy import freetype as ft @@ -140,6 +141,9 @@ class TextInputTool(FlatCAMTool): self.app = app self.text_path = [] + self.f_parse = ParseFont(self) + self.f_parse.get_fonts_by_types() + # this way I can hide/show the frame self.text_tool_frame = QtWidgets.QFrame() self.text_tool_frame.setContentsMargins(0, 0, 0, 0) @@ -278,10 +282,11 @@ class TextInputTool(FlatCAMTool): font_to_geo_type = 'bi' elif self.font_bold is False and self.font_italic is False: font_to_geo_type = 'regular' + string_to_geo = self.text_input_entry.get_value() font_to_geo_size = self.font_size_cb.get_value() - self.text_path = self.app.f_parse.font_to_geometry( + self.text_path = self.f_parse.font_to_geometry( char_string=string_to_geo, font_name=self.font_name, font_size=font_to_geo_size, @@ -1214,6 +1219,7 @@ class FCText(FCShapeTool): self.start_msg = "Click on the Destination point..." self.origin = (0, 0) + self.text_gui = TextInputTool(self.app) self.text_gui.run() @@ -1252,6 +1258,7 @@ class FCText(FCShapeTool): except: return + class FCBuffer(FCShapeTool): def __init__(self, draw_app): FCShapeTool.__init__(self, draw_app) diff --git a/FlatCAMGUI.py b/FlatCAMGUI.py index f7eb34ba..61c1ac36 100644 --- a/FlatCAMGUI.py +++ b/FlatCAMGUI.py @@ -11,6 +11,7 @@ from PyQt5.QtCore import Qt from GUIElements import * import platform + class FlatCAMGUI(QtWidgets.QMainWindow): # Emitted when persistent window geometry needs to be retained geom_update = QtCore.pyqtSignal(int, int, int, int, int, name='geomUpdate') @@ -1868,6 +1869,10 @@ class ExcellonPrefGroupUI(OptionsGroupUI): grid2.addWidget(excellon_gcode_type_label, 13, 0) grid2.addWidget(self.excellon_gcode_type_radio, 13, 1) + # until I decide to implement this feature those remain disabled + excellon_gcode_type_label.setDisabled(True) + self.excellon_gcode_type_radio.setDisabled(True) + #### Milling Holes #### self.mill_hole_label = QtWidgets.QLabel('Mill Holes') self.mill_hole_label.setToolTip( diff --git a/FlatCAMWorker.py b/FlatCAMWorker.py index df882a6b..2ccb0d9a 100644 --- a/FlatCAMWorker.py +++ b/FlatCAMWorker.py @@ -60,7 +60,7 @@ class Worker(QtCore.QObject): task['fcn'](*task['params']) except Exception as e: self.app.thread_exception.emit(e) - raise e + # raise e finally: self.task_completed.emit(self.name) diff --git a/ParseFont.py b/ParseFont.py index 745bcce8..5ecc85c4 100644 --- a/ParseFont.py +++ b/ParseFont.py @@ -229,7 +229,11 @@ class ParseFont(): # split the installed fonts by type: regular, bold, italic (oblique), bold-italic and # store them in separate dictionaries {name: file_path/filename.ttf} for font in system_fonts: - name, family = ParseFont.get_font_name(font) + try: + name, family = ParseFont.get_font_name(font) + except Exception as e: + log.debug("ParseFont.get_fonts_by_types() --> Could not get the font name. %s" % str(e)) + continue if 'Bold' in name and 'Italic' in name: name = name.replace(" Bold Italic", '') diff --git a/README.md b/README.md index 29e031cd..27254b4f 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,10 @@ CAD program, and create G-Code for Isolation routing. - when saving HPGL code it will be saved as a file with extension .plt - the units mentioned in HPGL format are only METRIC therefore if FlatCAM units are in INCH they will be transform to METRIC - the minimum unit in HPGL is 0.025mm therefore the coordinates are rounded to a multiple of 0.025mm +- removed the raise statement in do_worker_task() function as this is fatal in conjunction with PyQt5 +- added a try - except clause for the situations when for a font can't be determined the family and name +- moved font parsing to the Geometry Editor: it is done everytime the Text tool is invoked +- made sure that the HPGL postprocessor is not populated in the Excellon postprocessors in Preferences as it make no sense (HPGL is useful only for Geometries) 19.01.2019