Skip to content

Commit 34ab843

Browse files
committed
v1.73
1 parent 0a0783b commit 34ab843

File tree

4 files changed

+78
-38
lines changed

4 files changed

+78
-38
lines changed

f-engrave.py

+49-9
Original file line numberDiff line numberDiff line change
@@ -279,11 +279,18 @@
279279
Version 1.71 - Changed Potrace version that is distributed with F-Engrave from 1.10 to 1.16
280280
- Fixed problem with cleanup cutting wrong area for some cases
281281
282+
Version 1.72 - Fixed a bug that resulted in bad cleanup tool paths in some situations
283+
- Explicitly set the font for the GUI
284+
285+
Version 1.73 - Made importing png images with clear backgrounds work better
286+
- Added PNG and TIF to the image file types that show up by default
287+
282288
"""
283289

284-
version = '1.71'
290+
version = '1.73'
285291
#Setting QUIET to True will stop almost all console messages
286292
QUIET = False
293+
DEBUG = False
287294

288295
import sys
289296
VERSION = sys.version_info[0]
@@ -423,6 +430,19 @@ def message_ask_ok_cancel(title, mess):
423430
result=tkMessageBox.askokcancel(title, mess)
424431
return result
425432

433+
################################################################################
434+
# Debug Message Box #
435+
################################################################################
436+
def debug_message(message):
437+
global DEBUG
438+
title = "Debug Message"
439+
if DEBUG:
440+
if VERSION == 3:
441+
tkinter.messagebox.showinfo(title,message)
442+
else:
443+
tkMessageBox.showinfo(title,message)
444+
pass
445+
426446
############################################################################
427447
# routine takes an x and a y coords and does a coordinate transformation #
428448
# to a new coordinate system at angle from the initial coordinate system #
@@ -2549,7 +2569,7 @@ def createWidgets(self):
25492569
command = self.menu_File_Open_G_Code_File)
25502570
top_File.add_separator()
25512571
if self.POTRACE_AVAIL == TRUE:
2552-
top_File.add("command", label = "Open DXF/Bitmap", \
2572+
top_File.add("command", label = "Open DXF/Image", \
25532573
command = self.menu_File_Open_DXF_File)
25542574
else:
25552575
top_File.add("command", label = "Open DXF", \
@@ -4822,7 +4842,7 @@ def menu_File_Open_DXF_File(self):
48224842

48234843
if self.POTRACE_AVAIL == TRUE:
48244844
if PIL:
4825-
fileselect = askopenfilename(filetypes=[("DXF/Bitmap Files", ("*.dxf","*.bmp","*.pbm","*.ppm","*.pgm","*.pnm")),
4845+
fileselect = askopenfilename(filetypes=[("DXF/Image Files", ("*.dxf","*.png","*.bmp","*.tif")),
48264846
("DXF Files","*.dxf"),\
48274847
("Bitmap Files",("*.bmp","*.pbm","*.ppm","*.pgm","*.pnm")),\
48284848
("Slower Image Files",("*.jpg","*.png","*.gif","*.tif")),\
@@ -6073,6 +6093,12 @@ def Read_image_file(self):
60736093
if PIL:
60746094
try:
60756095
PIL_im = Image.open(file_full)
6096+
mode = PIL_im.mode
6097+
if len(mode)>3:
6098+
blank = Image.new("RGB", PIL_im.size, (255,255,255))
6099+
blank.paste( PIL_im, (0, 0), PIL_im )
6100+
PIL_im = blank
6101+
60766102
PIL_im = PIL_im.convert("1")
60776103
file_full_tmp=self.HOME_DIR + "/fengrave_tmp.bmp"
60786104
PIL_im.save(file_full_tmp,"bmp")
@@ -7315,12 +7341,12 @@ def V_Carve_It(self,clean_flag=0,DXF_FLAG = False):
73157341
if calc_flag != 0:
73167342
CUR_LENGTH = CUR_LENGTH + Lseg
73177343
else:
7318-
#theta = phi #V1.62
7319-
#x0=x2 #V1.62
7320-
#y0=y2 #V1.62
7321-
#seg_sin0=seg_sin #V1.62
7322-
#seg_cos0=seg_cos #V1.62
7323-
#char_num0=char_num #V1.62
7344+
theta = phi #commented out in V1.62 brought back in V1.72
7345+
x0=x2 #commented out in V1.62 brought back in V1.72
7346+
y0=y2 #commented out in V1.62 brought back in V1.72
7347+
seg_sin0=seg_sin #commented out in V1.62 brought back in V1.72
7348+
seg_cos0=seg_cos #commented out in V1.62 brought back in V1.72
7349+
char_num0=char_num #commented out in V1.62 brought back in V1.72
73247350
continue
73257351

73267352

@@ -9682,7 +9708,21 @@ def temp_icon(icon_file_name):
96829708
app.master.title("F-Engrave V"+version)
96839709
app.master.iconname("F-Engrave")
96849710
app.master.minsize(780,540)
9711+
try:
9712+
try:
9713+
import tkFont
9714+
default_font = tkFont.nametofont("TkDefaultFont")
9715+
except:
9716+
import tkinter.font
9717+
default_font = tkinter.font.nametofont("TkDefaultFont")
96859718

9719+
default_font.configure(size=9)
9720+
default_font.configure(family='arial')
9721+
#print(default_font.cget("size"))
9722+
#print(default_font.cget("family"))
9723+
except:
9724+
debug_message("Font Set Failed.")
9725+
96869726
try:
96879727
try:
96889728
app.master.iconbitmap(r'emblem')

f-engrave.spec

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ app = BUNDLE(exe,
4949
'CFBundleIdentifier': 'com.scorchworks.f-engrave',
5050
'CFBundleName': 'F-Engrave',
5151
'CFBundleDisplayName': 'F-Engrave',
52-
'CFBundleShortVersionString': '1.71'
52+
'CFBundleShortVersionString': '1.73'
5353
}
5454
)

macOS.patch

+27-27
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
--- F-Engrave-1.71_src/f-engrave.py 2020-02-26 19:03:38.000000000 -0500
2-
+++ f-engrave.py 2020-04-25 10:53:24.000000000 -0400
3-
@@ -340,6 +340,54 @@
1+
--- F-Engrave-1.73_src/f-engrave.py 2020-07-06 21:57:22.000000000 -0700
2+
+++ f-engrave.py 2021-01-10 14:47:56.000000000 -0800
3+
@@ -347,6 +347,54 @@
44
Zero = 0.00001
55
STOP_CALC = 0
66

@@ -55,7 +55,7 @@
5555
#raw_input("PAUSED: Press ENTER to continue")
5656
################################################################################
5757
# Function for outputting messages to different locations #
58-
@@ -1805,7 +1853,7 @@
58+
@@ -1825,7 +1873,7 @@
5959
# fmessage("Python Imaging Library (PIL) was not found...Bummer")
6060
# fmessage(" PIL enables more image file formats.")
6161

@@ -64,7 +64,7 @@
6464
try:
6565
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
6666
stdout, stderr = p.communicate()
67-
@@ -1820,7 +1868,7 @@
67+
@@ -1840,7 +1888,7 @@
6868
fmessage("ttf2cxf_stream executable is not present/working...Bummer")
6969
self.TTF_AVAIL = FALSE
7070

@@ -73,7 +73,7 @@
7373
try:
7474
p = Popen(cmd, stdout=PIPE, stderr=PIPE)
7575
stdout, stderr = p.communicate()
76-
@@ -2422,8 +2470,14 @@
76+
@@ -2442,8 +2490,14 @@
7777
self.Listbox_1.bind("<Down>", self.Listbox_Key_Down)
7878

7979
try:
@@ -90,7 +90,7 @@
9090
except:
9191
font_files=" "
9292
for name in font_files:
93-
@@ -5364,7 +5418,7 @@
93+
@@ -5384,7 +5438,7 @@
9494
self.Checkbutton_useIMGsize.place_forget()
9595

9696
# Left Column #
@@ -99,7 +99,7 @@
9999
w_entry=60
100100
w_units=35
101101

102-
@@ -5518,15 +5572,15 @@
102+
@@ -5538,15 +5592,15 @@
103103
self.Recalculate.place(x=12, y=Ybut, width=95, height=30)
104104

105105
Ybut=self.h-60
@@ -118,7 +118,7 @@
118118
self.Input_Label.place(x=222, y=self.h-130, width=112, height=21, anchor=W)
119119
self.Input_frame.place(x=222, y=self.h-110, width=self.w-455, height=75)
120120

121-
@@ -5539,7 +5593,7 @@
121+
@@ -5559,7 +5613,7 @@
122122
self.Label_flip.configure(text="Flip Image")
123123
self.Label_mirror.configure(text="Mirror Image")
124124
# Left Column #
@@ -127,7 +127,7 @@
127127
w_entry=60
128128
w_units=35
129129

130-
@@ -5685,15 +5739,15 @@
130+
@@ -5705,15 +5759,15 @@
131131
self.Recalculate.place(x=12, y=Ybut, width=95, height=30)
132132

133133
Ybut=self.h-60
@@ -146,7 +146,7 @@
146146
self.Input_Label.place_forget()
147147
self.Input_frame.place_forget()
148148

149-
@@ -5918,7 +5972,7 @@
149+
@@ -5938,7 +5992,7 @@
150150
option = option + "-e"
151151
else:
152152
option = ""
@@ -155,7 +155,7 @@
155155
option,
156156
"-s",self.segarc.get(),
157157
file_full,"STDOUT"]
158-
@@ -5987,14 +6041,14 @@
158+
@@ -6007,14 +6061,14 @@
159159
try:
160160
#cmd = ["potrace","-b","dxf",file_full,"-o","-"]
161161
if self.bmp_longcurve.get() == 1:
@@ -172,7 +172,7 @@
172172
"-z", self.bmp_turnpol.get(),
173173
"-t", self.bmp_turdsize.get(),
174174
"-a",self.bmp_alphamax.get(),
175-
@@ -6025,14 +6079,14 @@
175+
@@ -6051,14 +6105,14 @@
176176

177177
#cmd = ["potrace","-b","dxf",file_full,"-o","-"]
178178
if self.bmp_longcurve.get() == 1:
@@ -189,7 +189,7 @@
189189
"-z", self.bmp_turnpol.get(),
190190
"-t", self.bmp_turdsize.get(),
191191
"-a",self.bmp_alphamax.get(),
192-
@@ -8499,6 +8553,10 @@
192+
@@ -8525,6 +8579,10 @@
193193
os.remove("f_engrave_icon")
194194
except:
195195
pass
@@ -200,7 +200,7 @@
200200
################################################################################
201201
# General Settings Window #
202202
################################################################################
203-
@@ -8600,18 +8658,18 @@
203+
@@ -8626,18 +8684,18 @@
204204

205205
D_Yloc=D_Yloc+D_dY
206206
self.Label_arcfit = Label(gen_settings,text="Arc Fitting")
@@ -226,7 +226,7 @@
226226
self.Radio_arcfit_center.configure(variable=self.arc_fit )
227227

228228
D_Yloc=D_Yloc+D_dY
229-
@@ -8643,28 +8701,25 @@
229+
@@ -8669,28 +8727,25 @@
230230
self.Checkbutton_var_dis.configure(variable=self.var_dis)
231231

232232
D_Yloc=D_Yloc+D_dY
@@ -262,7 +262,7 @@
262262

263263
if self.input_type.get() != "text":
264264
self.Entry_Fontdir.configure(state="disabled")
265-
@@ -8725,6 +8780,9 @@
265+
@@ -8751,6 +8806,9 @@
266266
self.GEN_Close.place(x=Xbut+65, y=Ybut, width=130, height=30, anchor="w")
267267
self.GEN_Close.bind("<ButtonRelease-1>", self.Close_Current_Window_Click)
268268

@@ -272,7 +272,7 @@
272272
################################################################################
273273
# V-Carve Settings window #
274274
################################################################################
275-
@@ -8761,21 +8819,18 @@
275+
@@ -8787,21 +8845,18 @@
276276
self.Label_cutter_type = Label(vcarve_settings,text="Cutter Type")
277277
self.Label_cutter_type.place(x=xd_label_L, y=D_Yloc, width=w_label, height=21)
278278

@@ -300,7 +300,7 @@
300300
self.Radio_Type_STRAIGHT.configure(variable=self.bit_shape)
301301

302302
self.bit_shape.trace_variable("w", self.Entry_Bit_Shape_var_Callback)
303-
@@ -8869,7 +8924,7 @@
303+
@@ -8895,7 +8950,7 @@
304304
self.Label_BoxGap_u.place(x=w_label+x_radio_offset+175, y=D_Yloc, width=100, height=21)
305305

306306
self.GEN_Reload = Button(vcarve_settings,text="Recalculate")
@@ -309,7 +309,7 @@
309309
self.GEN_Reload.bind("<ButtonRelease-1>", self.Recalculate_Click)
310310

311311
D_Yloc=D_Yloc+D_dY+12
312-
@@ -8976,8 +9031,8 @@
312+
@@ -9002,8 +9057,8 @@
313313
self.Label_clean = Label(vcarve_settings,text="Cleanup Operations")
314314
self.Label_clean.place(x=center_loc, y=D_Yloc, width=w_label, height=21,anchor=CENTER)
315315

@@ -320,7 +320,7 @@
320320

321321
D_Yloc=D_Yloc+D_dY
322322
self.Label_CLEAN_DIA = Label(vcarve_settings,text="Cleanup Cut Diameter")
323-
@@ -9006,18 +9061,18 @@
323+
@@ -9032,18 +9087,18 @@
324324
self.Label_clean_P = Label(vcarve_settings,text="Cleanup Cut Directions")
325325
self.Label_clean_P.place(x=xd_label_L, y=D_Yloc, width=w_label, height=21)
326326

@@ -344,7 +344,7 @@
344344

345345
D_Yloc=D_Yloc+12
346346

347-
@@ -9036,18 +9091,18 @@
347+
@@ -9062,18 +9117,18 @@
348348
self.Label_v_clean_P = Label(vcarve_settings,text="V-Bit Cut Directions")
349349
self.Label_v_clean_P.place(x=xd_label_L, y=D_Yloc, width=w_label, height=21)
350350

@@ -368,7 +368,7 @@
368368

369369
## V-Bit Picture ##
370370
self.PHOTO = PhotoImage(format='gif',data=
371-
@@ -9077,7 +9132,7 @@
371+
@@ -9103,7 +9158,7 @@
372372
Xbut=int(vcarve_settings.winfo_width()/2)
373373

374374
self.VCARVE_Recalculate = Button(vcarve_settings,text="Calculate V-Carve", command=self.VCARVE_Recalculate_Click)
@@ -377,7 +377,7 @@
377377

378378

379379
if self.cut_type.get() == "v-carve":
380-
@@ -9089,6 +9144,9 @@
380+
@@ -9115,6 +9170,9 @@
381381
self.VCARVE_Close.place(x=Xbut, y=Ybut, width=130, height=30, anchor="w")
382382
self.VCARVE_Close.bind("<ButtonRelease-1>", self.Close_Current_Window_Click)
383383

@@ -387,7 +387,7 @@
387387
####################################
388388
# Gcode class for creating G-Code
389389
####################################
390-
@@ -9639,5 +9697,9 @@
390+
@@ -9679,5 +9737,9 @@
391391
fmessage("Unable to create temporary icon file.")
392392

393393
app.f_engrave_init()
@@ -397,8 +397,8 @@
397397
+macOS_button_fix(root)
398398
root.mainloop()
399399

400-
--- F-Engrave-1.71_src/TTF2CXF_STREAM/Makefile 2013-07-21 22:03:00.000000000 -0400
401-
+++ TTF2CXF_STREAM/Makefile 2020-04-25 09:12:34.000000000 -0400
400+
--- F-Engrave-1.73_src/TTF2CXF_STREAM/Makefile 2013-07-21 23:03:00.000000000 -0700
401+
+++ TTF2CXF_STREAM/Makefile 2021-01-10 14:47:56.000000000 -0800
402402
@@ -2,9 +2,22 @@
403403
# Makefile for TTF2CXF_STREAM
404404
# Date: 6/28/2013

setup.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from setuptools import setup
1212

1313
mainscript = 'f-engrave.py'
14-
version = "1.71"
14+
version = "1.73"
1515
url = "https://github.com/stephenhouser/f-engrave"
1616

1717
if sys.platform == 'darwin':

0 commit comments

Comments
 (0)