Skip to content

Tkinter based macos installer #15

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added macOS/Daisy_Icon_24x24.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
101 changes: 101 additions & 0 deletions macOS/macos_installer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
import os
import text
from tkinter import *

# Global Vars
title_text = ["Welcome to Daisy Toolchain Setup", "License Agreement", "Installing..."]
body_text = [text.body_text_0, text.body_text_1, "Installing..."]
next_button_text = ["Next>", "Agree and Install", "Install"]

page_num = 0

def Install():
print("Installing...")
os.system('install.command')

def UpdatePage():
global next_button_text, next_button, back_button, page_num

if(page_num > -1 and page_num < 3):
title_label['text'] = title_text[page_num]
body_label['text'] = body_text[page_num]
next_button['text'] = next_button_text[page_num]

if(page_num == 1):
body_label['height'] = 3
license_scroll.pack(side=TOP)
else:
license_scroll.pack_forget()
body_label['height'] = 7


if(page_num < 0):
page_num = 0
elif(page_num == 0):
back_button['state'] = 'disabled'
elif(page_num < 2):
back_button['state'] = 'active'
else:
next_button['state'] = 'disabled'
back_button['state'] = 'disabled'
Install()


def Next():
global next_button_text, next_button, back_button, page_num
page_num += 1
UpdatePage()

def Back():
global back_button_text, back_button, page_num
page_num -= 1
UpdatePage()

def Cancel():
exit()

# Graphics Setup
tk = Tk()
tk.geometry("500x400")
tk.title('Daisy Toolchain Installer')

try:
photo = PhotoImage(file="Daisy_Icon_24x24.png")
tk.iconphoto(False, photo)
except:
pass


# text
title_label = Label(tk, text=title_text[0], font=("Arial", 10))
title_label.pack(side=TOP, padx=5, pady=10)

body_label = Label(tk, text=body_text[0], font=("Arial", 10), height=7, width=80, justify='left', wraplength=450)
body_label.pack(padx=10, pady=5)

license_scroll = Text(tk, font=("Arial", 10), height=15, width=70)
license_scroll.insert('end', text.license_text)
license_scroll.config(state='disabled')

# buttons
butt_frame = Frame(tk, relief=FLAT, borderwidth=1, height=40)
butt_frame.pack(fill=X, expand=False, side=BOTTOM)
butt_frame.pack_propagate(0) # otherwise it wants to be chonky

# push the buttons to the left
butt_pad_frame = Frame(butt_frame, relief=FLAT, borderwidth=1, height=40, width=150)
butt_pad_frame.pack(fill=X, expand=False, side=RIGHT)
butt_pad_frame.pack_propagate(0) # otherwise it wants to be chonky

next_button = Button(butt_frame, text="Next>", command = Next)
next_button.pack(side=RIGHT, padx=5, pady=5)

back_button = Button(butt_frame, text="<Back", command = Back)
back_button['state'] = 'disabled'
back_button.pack(side=RIGHT, padx=5, pady=5)

cancel_button = Button(butt_frame, text="Cancel", command = Cancel)
cancel_button.pack(side=RIGHT, padx=5, pady=5)

# render graphics forever...
tk.mainloop()
36 changes: 36 additions & 0 deletions macOS/text.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# storage for the really long body text

body_text_0 = """
Setup will guide you through the installation of the Daisy Toolchain.

It is recommended that you close all other applications before starting Setup.
This will make it possible to update relevant system files without having to reboot your computer.

Click Next to continue.
"""

body_text_1 = """
If you accept the terms of the agreement, click Agree and Install to install the Daisy Toolchain.
You must accept the agreement to install the Daisy Toolchain.
"""

body_text_2 = """
Setup will install the Daisy Toolchain in the following folder.
To install in a different folder, click Browse and select another folder.
Click Install to start the installation.
"""

license_text = """
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Licenses for bundled software can be found here:
GNU Make: https://www.gnu.org/licenses/gpl-3.0.html
dfu-util: https://www.gnu.org/licenses/old-licenses/gpl-2.0.html
llvm (clang-format): https://llvm.org/docs/DeveloperPolicy.html#new-llvm-project-license-framework
GNU arm embedded toolchain: https://developer.arm.com/GetEula?Id=60d6ac36-03cc-4ffe-89eb-1d3d2a2cce22
openocd: https://sourceforge.net/p/openocd/code/ci/master/tree/LICENSES/license-rules.txt
"""