diff --git a/build.bat b/build.bat index 42d875e..9cd8c6c 100644 --- a/build.bat +++ b/build.bat @@ -3,7 +3,7 @@ rem This file executes the build command for the windows executable file. rem It is here because I am lazy rem --------------------------------------------------------------------- -set PATH=C:\Python25;%PATH% +set PATH=C:\Python26;%PATH% python py2exe_setup.py py2exe rmdir /S build diff --git a/f-engrave.py b/f-engrave.py index d1ea15a..fcb8026 100755 --- a/f-engrave.py +++ b/f-engrave.py @@ -260,9 +260,13 @@ - Mapped save function to Control-S for easier g-code saving Version 1.65 - Fixed bug in sort_for_v_carve that resulted in an error for certain designs. + + Version 1.66 - Fixed a problem with the origin when wrapping text in some cases. + - Decreased number of updates while doing computations which increases overall calculation speed. + - Fixed problem that can cause the program to freeze if the saved settings contain errors. """ -version = '1.65' +version = '1.66' #Setting QUIET to True will stop almost all console messages QUIET = False @@ -295,6 +299,7 @@ def next(item): if PIL == True: try: from PIL import Image + Image.MAX_IMAGE_PIXELS = None except: PIL = False @@ -1559,7 +1564,7 @@ def DXF_COORDS_GET(self,new_origin=True): ''' http://tkinter.unpythonic.net/wiki/ToolTip -Michael Lange +ichael Lange The ToolTip class provides a flexible tooltip widget for Tkinter; it is based on IDLE's ToolTip module which unfortunately seems to be broken (at least the version I saw). INITIALIZATION OPTIONS: @@ -2873,7 +2878,10 @@ def WriteGCode(self,config_file=False): loopa_old = loopa else: loop = loop + 1 - Depth = float(self.maxcut.get()) + try: + Depth = float(self.maxcut.get()) + except: + Depth = 0.0 if (rough_stock > 0): rough_again = True if ((rough_stock > 0) and(-maxDZ < rough_stock)): @@ -3200,7 +3208,10 @@ def WRITE_CLEAN_UP(self,bit_type="straight"): BitDia = float(self.clean_dia.get()) self.calc_depth_limit() - Depth = float(self.maxcut.get()) + try: + Depth = float(self.maxcut.get()) + except: + Depth = 0.0 if self.inlay.get(): Depth = Depth + float(self.allowance.get()) @@ -3899,7 +3910,10 @@ def calc_r_inlay_top(self): return r_inlay_top def calc_r_inlay_depth(self): - inlay_depth = float(self.maxcut.get()) + try: + inlay_depth = float(self.maxcut.get()) + except: + inlay_depth = 0.0 return inlay_depth @@ -6519,29 +6533,31 @@ def DoIt(self): miny = 99994.0 minx = 99995.0 - if Angle == 0.0: - if flip_flag: - miny = -font_line_height*YScale - else: - maxy = font_line_height*YScale - - elif (Angle == 90.0) or (Angle == -270.0): - if not mirror_flag: - minx = -font_line_height*YScale - else: - maxx = font_line_height*YScale - - elif (Angle == 270.0) or (Angle == -90.0): - if not mirror_flag: - maxx = font_line_height*YScale - else: - minx = -font_line_height*YScale - - elif (Angle == 180.0) or (Angle == -180.0): - if flip_flag: - maxy = font_line_height*YScale - else: - miny = -font_line_height*YScale +## ## Commented this section out in Version 1.66 +## if Radius == 0.0: +## if Angle == 0.0: +## if flip_flag: +## miny = -font_line_height*YScale +## else: +## maxy = font_line_height*YScale +## +## elif (Angle == 90.0) or (Angle == -270.0): +## if not mirror_flag: +## minx = -font_line_height*YScale +## else: +## maxx = font_line_height*YScale +## +## elif (Angle == 270.0) or (Angle == -90.0): +## if not mirror_flag: +## maxx = font_line_height*YScale +## else: +## minx = -font_line_height*YScale +## +## elif (Angle == 180.0) or (Angle == -180.0): +## if flip_flag: +## maxy = font_line_height*YScale +## else: +## miny = -font_line_height*YScale maxr2 = 0.0 for line in self.coords: @@ -6800,6 +6816,7 @@ def get_flop_staus(self,CLEAN_FLAG=False): def V_Carve_It(self,clean_flag=0,DXF_FLAG = False): global STOP_CALC + timestamp = 0 self.master.unbind("") STOP_CALC=0 @@ -7098,18 +7115,24 @@ def V_Carve_It(self,clean_flag=0,DXF_FLAG = False): break else: calc_flag = self.clean_segment[CUR_CNT] - #################################################### - CUR_PCT=float(CUR_LENGTH)/TOT_LENGTH*100.0 - if CUR_PCT > 0.0: - MIN_REMAIN =( time()-START_TIME )/60 * (100-CUR_PCT)/CUR_PCT - MIN_TOTAL = 100.0/CUR_PCT * ( time()-START_TIME )/60 - else: - MIN_REMAIN = -1 - MIN_TOTAL = -1 + if (not self.batch.get()): - self.statusMessage.set('%.1f %% ( %.1f Minutes Remaining | %.1f Minutes Total )' %( CUR_PCT, MIN_REMAIN, MIN_TOTAL ) ) - self.statusbar.configure( bg = 'yellow' ) - self.PreviewCanvas.update() + stamp=int(3*time()) #update every 1/3 of a second + if (stamp != timestamp): + timestamp=stamp #interlock + + #################################################### + CUR_PCT=float(CUR_LENGTH)/TOT_LENGTH*100.0 + if CUR_PCT > 0.0: + MIN_REMAIN =( time()-START_TIME )/60 * (100-CUR_PCT)/CUR_PCT + MIN_TOTAL = 100.0/CUR_PCT * ( time()-START_TIME )/60 + else: + MIN_REMAIN = -1 + MIN_TOTAL = -1 + + self.statusMessage.set('%.1f %% ( %.1f Minutes Remaining | %.1f Minutes Total )' %( CUR_PCT, MIN_REMAIN, MIN_TOTAL ) ) + self.statusbar.configure( bg = 'yellow' ) + self.PreviewCanvas.update() if STOP_CALC != 0: STOP_CALC=0 @@ -7512,11 +7535,19 @@ def sort_for_v_carve(self,sort_coords,LN_START=0): ##################################################### # For each loop determine if other loops are inside # ##################################################### + timestamp = 0 + global STOP_CALC + STOP_CALC = 0 for iloop in range(Nloops): CUR_PCT=float(iloop)/Nloops*100.0 if (not self.batch.get()): - self.statusMessage.set('Determining Which Side of Loop to Cut: %d of %d' %(iloop+1,Nloops)) - self.master.update() + stamp=int(3*time()) #update every 1/3 of a second + if (stamp != timestamp): + timestamp=stamp #interlock + self.statusMessage.set('Determining Which Side of Loop to Cut: %d of %d' %(iloop+1,Nloops)) + self.master.update() + if STOP_CALC != 0: + return [] ipoly = ecoords[Lbeg[iloop]:Lend[iloop]] ## Check points in other loops (could just check one) ## @@ -9419,7 +9450,10 @@ def temp_icon(icon_file_name): try: - app.master.iconbitmap(bitmap="@emblem64") + try: + app.master.iconbitmap(r'emblem') + except: + app.master.iconbitmap(bitmap="@emblem64") except: try: #Attempt to create temporary icon bitmap file temp_icon("f_engrave_icon") diff --git a/fengrave.ico b/fengrave.ico index 68ae737..9904588 100644 Binary files a/fengrave.ico and b/fengrave.ico differ diff --git a/py2exe_setup.py b/py2exe_setup.py index cc4953f..ff58d5e 100644 --- a/py2exe_setup.py +++ b/py2exe_setup.py @@ -5,7 +5,8 @@ import shutil import py2exe -script_name = "f-engrave-165.py" +script_name = "f-engrave.py" +icon_name = "fengrave.ico" fileName, fileExtension = os.path.splitext(script_name) console_name = fileName+"_c"+fileExtension @@ -17,7 +18,7 @@ windows = [ { "script": script_name, - "icon_resources":[(0,"fengrave.ico"),(0,"fengrave.ico")] + "icon_resources":[(0,icon_name),(0,icon_name)] } ], ) @@ -28,7 +29,7 @@ console=[ { "script":console_name, - "icon_resources":[(0,"fengrave.ico"),(0,"fengrave.ico")] + "icon_resources":[(0,icon_name),(0,icon_name)] } ] ) diff --git a/setup.py b/setup.py index 092627e..1f0e136 100644 --- a/setup.py +++ b/setup.py @@ -11,7 +11,7 @@ from setuptools import setup mainscript = 'f-engrave.py' -version = "1.65" +version = "1.66" url = "https://github.com/stephenhouser/f-engrave" if sys.platform == 'darwin':