Skip to content

Commit

Permalink
v0.57
Browse files Browse the repository at this point in the history
  • Loading branch information
stephenhouser committed Mar 23, 2021
1 parent cc5d0dc commit c45535f
Show file tree
Hide file tree
Showing 10 changed files with 715 additions and 82 deletions.
8 changes: 7 additions & 1 deletion Change_Log.txt
Original file line number Diff line number Diff line change
Expand Up @@ -284,4 +284,10 @@ Version 0.55:

Version 0.56:
- Added code to fix driver conflict new drivers added to Linux
- Changed default file type to svg/dxf
- Changed default file type to svg/dxf


Version 0.57:
- Fixed problem with start position (only occurred when using a custom "x scale" factor and "home in upper right")
- Added Command line option to enable debug mode
- Some other minor change to the way icons and internal images are handled (no change for user)
3 changes: 2 additions & 1 deletion build-macOS.sh
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ PYTHON=
# Install requirements
echo "Install Dependencies..."
pip3 install -r requirements.txt
pip3 install pyinstaller
check_failure "Failed to install python requirements"

echo "Build macOS Application Bundle..."
Expand Down Expand Up @@ -160,4 +161,4 @@ then
check_failure "Failed to build k40_whisperer dmg"
fi

echo "Done."
echo "Done."
634 changes: 634 additions & 0 deletions embedded_images.py

Large diffs are not rendered by default.

132 changes: 60 additions & 72 deletions k40_whisperer.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"""
K40 Whisperer
Copyright (C) <2017-2020> <Scorch>
Copyright (C) <2017-2021> <Scorch>
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
Expand All @@ -17,7 +17,7 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
version = '0.56'
version = '0.57'
title_text = "K40 Whisperer V"+version

import sys
Expand All @@ -32,6 +32,7 @@
from interpolate import interpolate
from ecoords import ECoord
from convex_hull import hull2D
from embedded_images import K40_Whisperer_Images

import inkex
import simplestyle
Expand All @@ -42,6 +43,7 @@
import struct

DEBUG = False

if DEBUG:
import inspect

Expand Down Expand Up @@ -520,23 +522,23 @@ def createWidgets(self):
self.UnLock_Button = Button(self.master,text="Unlock Rail", command=self.Unlock)
self.Stop_Button = Button(self.master,text="Pause/Stop", command=self.Stop)

try:
self.left_image = self.Imaging_Free(Image.open("left.png"),bg=None)
self.right_image = self.Imaging_Free(Image.open("right.png"),bg=None)
self.up_image = self.Imaging_Free(Image.open("up.png"),bg=None)
self.down_image = self.Imaging_Free(Image.open("down.png"),bg=None)
try:
self.left_image = PhotoImage(data=K40_Whisperer_Images.left_B64, format='gif')
self.right_image = PhotoImage(data=K40_Whisperer_Images.right_B64, format='gif')
self.up_image = PhotoImage(data=K40_Whisperer_Images.up_B64, format='gif')
self.down_image = PhotoImage(data=K40_Whisperer_Images.down_B64, format='gif')

self.Right_Button = Button(self.master,image=self.right_image, command=self.Move_Right)
self.Left_Button = Button(self.master,image=self.left_image, command=self.Move_Left)
self.Up_Button = Button(self.master,image=self.up_image, command=self.Move_Up)
self.Down_Button = Button(self.master,image=self.down_image, command=self.Move_Down)

self.UL_image = self.Imaging_Free(Image.open("UL.png"),bg=None)
self.UR_image = self.Imaging_Free(Image.open("UR.png"),bg=None)
self.LR_image = self.Imaging_Free(Image.open("LR.png"),bg=None)
self.LL_image = self.Imaging_Free(Image.open("LL.png"),bg=None)
self.CC_image = self.Imaging_Free(Image.open("CC.png"),bg=None)
self.UL_image = PhotoImage(data=K40_Whisperer_Images.UL_B64, format='gif')
self.UR_image = PhotoImage(data=K40_Whisperer_Images.UR_B64, format='gif')
self.LR_image = PhotoImage(data=K40_Whisperer_Images.LR_B64, format='gif')
self.LL_image = PhotoImage(data=K40_Whisperer_Images.LL_B64, format='gif')
self.CC_image = PhotoImage(data=K40_Whisperer_Images.CC_B64, format='gif')

self.UL_Button = Button(self.master,image=self.UL_image, command=self.Move_UL)
self.UR_Button = Button(self.master,image=self.UR_image, command=self.Move_UR)
self.LR_Button = Button(self.master,image=self.LR_image, command=self.Move_LR)
Expand Down Expand Up @@ -2280,11 +2282,6 @@ def gcode_error_message(self,message):
return_value = StringVar()
return_value.set("none")

try:
error_report.iconbitmap(bitmap="@emblem64")
except:
debug_message(traceback.format_exc())
pass

def Close_Click(event):
return_value.set("close")
Expand Down Expand Up @@ -3029,7 +3026,8 @@ def Finish_Job(self, event=None):
if self.post_exec.get():
cmd = [self.batch_path.get()]
from subprocess import Popen, PIPE
proc = Popen(cmd, shell=True, stdin=None, stdout=PIPE, stderr=PIPE)
startupinfo=None
proc = Popen(cmd, shell=False, stdout=PIPE, stderr=PIPE, stdin=PIPE, startupinfo=startupinfo)
stdout,stderr = proc.communicate()

if self.post_disp.get() or stderr != '':
Expand Down Expand Up @@ -3379,7 +3377,8 @@ def send_data(self,operation_type=None, output_filename=None):
starty = ymax

if self.HomeUR.get():
FlipXoffset = abs(xmax-xmin)
Xscale = float(self.LaserXscale.get())
FlipXoffset = Xscale*abs(xmax-xmin)
if self.rotate.get():
startx = -xmin
else:
Expand Down Expand Up @@ -3855,8 +3854,8 @@ def menu_Calc_Raster_Time(self,event=None):


def menu_Help_About(self):

about = "K40 Whisperer Version %s\n\n" %(version)
application="K40 Whisperer"
about = "%s Version %s\n\n" %(application,version)
about = about + "By Scorch.\n"
about = about + "\163\143\157\162\143\150\100\163\143\157\162"
about = about + "\143\150\167\157\162\153\163\056\143\157\155\n"
Expand All @@ -3866,7 +3865,7 @@ def menu_Help_About(self):
except:
python_version = ""
about = about + "Python "+python_version+" (%d bit)" %(struct.calcsize("P") * 8)
message_box("About k40 Whisperer",about)
message_box("About %s" %(application),about)

def menu_Help_Web(self):
webbrowser.open_new(r"https://www.scorchworks.com/K40whisperer/k40whisperer.html")
Expand Down Expand Up @@ -4739,12 +4738,6 @@ def GEN_Settings_Window(self):
gen_settings.title('General Settings')
gen_settings.iconname("General Settings")

try:
gen_settings.iconbitmap(bitmap="@emblem64")
except:
debug_message(traceback.format_exc())
pass

D_Yloc = 6
D_dY = 26
xd_label_L = 12
Expand Down Expand Up @@ -4964,12 +4957,6 @@ def RASTER_Settings_Window(self):
raster_settings.title('Raster Settings')
raster_settings.iconname("Raster Settings")

try:
raster_settings.iconbitmap(bitmap="@emblem64")
except:
debug_message(traceback.format_exc())
pass

D_Yloc = 6
D_dY = 24
xd_label_L = 12
Expand All @@ -4980,8 +4967,6 @@ def RASTER_Settings_Window(self):
xd_entry_L=xd_label_L+w_label+10
xd_units_L=xd_entry_L+w_entry+5



D_Yloc=D_Yloc+D_dY
self.Label_Rstep = Label(raster_settings,text="Scanline Step", anchor=CENTER )
self.Label_Rstep.place(x=xd_label_L, y=D_Yloc, width=w_label, height=21)
Expand Down Expand Up @@ -5144,12 +5129,6 @@ def ROTARY_Settings_Window(self):
rotary_settings.title('Rotary Settings')
rotary_settings.iconname("Rotary Settings")

try:
rotary_settings.iconbitmap(bitmap="@emblem64")
except:
debug_message(traceback.format_exc())
pass

D_Yloc = 6
D_dY = 30
xd_label_L = 12
Expand Down Expand Up @@ -5213,11 +5192,6 @@ def TRACE_Settings_Window(self, dummy=None):
trace_window.resizable(0,0)
trace_window.title('Trace Boundary')
trace_window.iconname("Trace Boundary")
try:
trace_window.iconbitmap(bitmap="@emblem64")
except:
debug_message(traceback.format_exc())
pass

def Close_Click():
win_id=self.grab_current()
Expand Down Expand Up @@ -5295,11 +5269,6 @@ def EGV_Send_Window(self,EGV_filename):
egv_send.resizable(0,0)
egv_send.title('EGV Send')
egv_send.iconname("EGV Send")
try:
egv_send.iconbitmap(bitmap="@emblem64")
except:
debug_message(traceback.format_exc())
pass

D_Yloc = 0
D_dY = 28
Expand Down Expand Up @@ -5425,11 +5394,6 @@ def body(self, master):
self.resizable(0,0)
self.title('Units')
self.iconname("Units")

try:
self.iconbitmap(bitmap="@emblem64")
except:
pass

self.uom = StringVar()
self.uom.set("Millimeters")
Expand Down Expand Up @@ -5535,10 +5499,6 @@ def body(self, master):
self.resizable(0,0)
self.title('SVG Import Scale:')
self.iconname("SVG Scale")
try:
self.iconbitmap(bitmap="@emblem64")
except:
pass

###########################################################################
def Entry_custom_Check():
Expand Down Expand Up @@ -5730,7 +5690,7 @@ def apply(self):
viewbox = [self.minx_pixels, self.miny_pixels, width/25.4*pxpi, height/25.4*pxpi]
self.result = pxpi,viewbox
return

################################################################################
# Startup Application #
################################################################################
Expand All @@ -5756,29 +5716,52 @@ def apply(self):
except:
debug_message("Font Set Failed.")

################################## Set Icon ########################################
Icon_Set=False

try:
debug_message("Icon set %s" %(sys.argv[0]))
root.iconbitmap(default="emblem")
debug_message("Icon set worked %s" %(sys.argv[0]))
Icon_Set=True
except:
debug_message(traceback.format_exc())
Icon_Set=False

if not Icon_Set:
try:
app.master.iconbitmap(r'emblem')
scorch_ico_B64=b'R0lGODlhEAAQAIYAAA\
AAABAQEBYWFhcXFxsbGyUlJSYmJikpKSwsLC4uLi8vLzExMTMzMzc3Nzg4ODk5OTs7Oz4+PkJCQkRERE\
VFRUtLS0xMTE5OTlNTU1dXV1xcXGBgYGVlZWhoaGtra3FxcXR0dHh4eICAgISEhI+Pj5mZmZ2dnaKioq\
Ojo62tra6urrS0tLi4uLm5ub29vcLCwsbGxsjIyMzMzM/Pz9PT09XV1dbW1tjY2Nzc3OHh4eLi4uXl5e\
fn5+jo6Ovr6+/v7/Hx8fLy8vT09PX19fn5+fv7+/z8/P7+/v///wAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA\
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEKAEkALAAAAAAQABAAQAj/AJMIFBhBQYAACRIkWbgwAA\
4kEFEECACAxBAkGH8ESEKgBZIiAIQECBAjAA8kNwIkScKgQhAkRggAIJACCZIaJxgk2clgAY4OAAoEAO\
ABCIIDSZIwkIHEBw0YFAAA6IGDCBIkLAhMyICka9cAKZCIRTLEBIMkaA0MSNGjSBEVIgpESEK3LgMCI1\
aAWCFDA4EDSQInwaDACBEAImLwCAFARw4HFJJcgGADyZEAL3YQcMGBBpIjHx4EeIGkRoMFJgakWADABx\
IkPwIgcIGkdm0AMJDo1g3jQBIBRZAINyKAwxEkyHEUSMIcwYYbEgwYmQGgyI8SD5Jo327hgIIAAQ5cBs\
CQpHySgAA7'
icon_im =PhotoImage(data=scorch_ico_B64, format='gif')
root.call('wm', 'iconphoto', root._w, '-default', icon_im)
except:
app.master.iconbitmap(bitmap="@emblem64")
except:
pass
pass
#####################################################################################


if LOAD_MSG != "":
message_box("K40 Whisperer",LOAD_MSG)
debug_message("Debuging is turned on.")


opts, args = None, None
try:
opts, args = getopt.getopt(sys.argv[1:], "hp",["help", "pi"])
opts, args = getopt.getopt(sys.argv[1:], "hpd",["help", "pi", "debug"])
except:
print('Unable interpret command line options')
sys.exit()

for option, value in opts:
if option in ('-h','--help'):
pass
print(' ')
print('Usage: python k40_whisperer.py [-h -p]')
print('-h : print this help (also --help)')
Expand All @@ -5788,6 +5771,11 @@ def apply(self):
print("pi mode")
app.master.minsize(480,320)
app.master.geometry("480x320")
elif option in ('-d','--debug'):
DEBUG=True


if DEBUG:
import inspect
debug_message("Debuging is turned on.")

root.mainloop()
2 changes: 1 addition & 1 deletion k40_whisperer.spec
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ app = BUNDLE(exe,
'CFBundleIdentifier': 'com.scorchworks.k40_whisperer',
'CFBundleName': 'K40 Whisperer',
'CFBundleDisplayName': 'K40 Whisperer',
'CFBundleShortVersionString': '0.56'
'CFBundleShortVersionString': '0.57'
}
)
6 changes: 3 additions & 3 deletions macOS.patch
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
--- K40_Whisperer-0.56_src/k40_whisperer.py 2021-01-24 13:33:20.000000000 -0500
+++ k40_whisperer.py 2021-01-25 14:22:40.000000000 -0500
@@ -5744,10 +5744,10 @@
--- K40_Whisperer-0.57_src/k40_whisperer.py 2021-03-16 19:22:44.000000000 -0700
+++ k40_whisperer.py 2021-03-23 10:37:50.000000000 -0700
@@ -5704,10 +5704,10 @@
try:
try:
import tkFont
Expand Down
2 changes: 1 addition & 1 deletion py2app_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from setuptools import setup

app_name = 'K40 Whisperer'
app_version = "0.56"
app_version = "0.57"
app_copyright = u'Copyright © 2017-2019, Scorch Works, GNU General Public License'
main_script = 'k40_whisperer.py'
url = 'https://github.com/stephenhouser/k40-whisperer'
Expand Down
1 change: 0 additions & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@ lxml
pyusb
pillow
pyclipper
pyinstaller
6 changes: 4 additions & 2 deletions svg_reader.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env python
'''
Copyright (C) 2017-2020 Scorch www.scorchworks.com
Copyright (C) 2017-2021 Scorch www.scorchworks.com
Derived from dxf_outlines.py by Aaron Spike and Alvin Penner
This program is free software; you can redistribute it and/or modify
Expand Down Expand Up @@ -50,7 +50,7 @@ def run_external(cmd, timeout_sec):
stderr=None
FLAG=[True]
try:
proc = Popen(cmd, stdout=PIPE, stderr=PIPE)
proc = Popen(cmd, shell=False, stdout=PIPE, stderr=PIPE, stdin=PIPE, startupinfo=None)
except Exception as e:
raise Exception("\n%s\n\nExecutable Path:\n%s" %(e,cmd[0]))
if timeout_sec > 0:
Expand Down Expand Up @@ -168,6 +168,7 @@ def __init__(self):
def parse_svg(self,filename):
try:
self.parse(filename)
#self.parse(filename, encoding='utf-8')
except Exception as e:
exception_msg = "%s" %(e)
if exception_msg.find("encoding"):
Expand Down Expand Up @@ -691,6 +692,7 @@ def Make_PNG(self):
png_temp_file = os.path.join(tmp_dir, "k40w_image.png")
dpi = "%d" %(self.image_dpi)
self.document.write(svg_temp_file)
#self.document.write("svg_temp_file.svg", encoding='utf-8')

# Check Version of Inkscape
cmd = [ self.inkscape_exe, "-V"]
Expand Down
Loading

0 comments on commit c45535f

Please sign in to comment.