Exemplo n.º 1
0
	def __init__(master):
	
		master = tk.Tk()
		master.geometry("400x450")
		master.title("Commander Pi")
		th.window_list.append(master)
		mainframe = Frame(master)
		mainframe.pack(padx=10, pady=10)	
		
		titleframe = Frame(mainframe)
		titleframe.pack(fill=X)
				
		image = Image.open(home_path+"/CommanderPi/src/icons/logo.png")
		photo = ImageTk.PhotoImage(image, master=titleframe) 

		title_label = tk.Label( titleframe, text = "  About Application", font=("TkDefaultFont", 18, "bold"), image = photo, compound=LEFT, anchor='w')
		title_label.image = photo
		title_label.pack(side=LEFT)
	
		separator = ttk.Separator(mainframe, orient='horizontal')
		separator.pack(fill=X, expand=True, pady=15)		

		content_frame = Frame(mainframe)
		content_frame.pack()
		
		about_label = tk.Label( content_frame, text = "Commander Pi 2020\n", justify=CENTER, font=("TkDefaultFont", 11, "bold"))
		about_label.pack()
		
		text_label = tk.Label( content_frame, text="By Jack477\nFor Twister OS Armbian\n\nGraphic elements by grayduck\nIcon derived from a work by Vectors Market", justify=CENTER)
		text_label.pack(fill=X)
		
		version_label = tk.Label( content_frame, text=rs.get_app_version(), font=("TkDefaultFont", 11, "bold"), justify=CENTER)
		version_label.pack()
		
		link = tk.Label( content_frame, text="Changelog", cursor="hand2", fg="#1D81DA", pady=5)
		link.pack(fill=X)
		mlink = 'https://github.com/Jack477/CommanderPi/blob/master/CHANGELOG.md'
		link.bind("<Button-1>", lambda e: rs.cpi_open_url(mlink))
		
		separator2 = ttk.Separator(mainframe, orient='horizontal')
		separator2.pack(fill=X, expand=True, pady=15)
		
		update_button = Button(mainframe, text="Check for updates", command=lambda:update_x(), cursor="hand2", font=("TkDefaultFont", 11, "bold"), state=DISABLED)
		update_button.pack()

		color_buton = Button(mainframe, text="Change color theme", command=lambda:change_theme(master), cursor="hand2", font=("TkDefaultFont", 11, "bold"))
		color_buton.pack()

		def update_x():
			up.update_cpi()

		
		bind_label = tk.Label( mainframe, text="Press [Esc] to close", font=("TkDefaultFont", 11, "bold") )
		bind_label.pack(side=BOTTOM)
		master.bind('<Escape>', lambda e:killwindow(e, master))
		th.set_theme(master)
		master.protocol("WM_DELETE_WINDOW", lambda:on_Window_Close(master))		
		master.mainloop()
Exemplo n.º 2
0
    def __init__(master):

        master = tk.Tk()

        width = master.winfo_screenwidth()
        height = master.winfo_screenheight()

        xw = int(width) / 2 - 210
        xw = int(xw)
        xh = int(height) / 2 - 250
        xh = int(xh)

        xsize = "420x500+" + str(xw) + "+" + str(xh)
        #master.attributes('-type','dock')
        master.geometry(xsize)

        master.title("TwistPatch")
        master.resizable(False, False)
        #master.focus_force()

        mainframe = Frame(master)
        mainframe.pack(padx=10, pady=10)
        titleframe = Frame(mainframe)
        titleframe.pack()

        loadimg = Image.open(home_path + "/patcher/src/icons/title_logo.png")
        img = ImageTk.PhotoImage(image=loadimg)

        img_label = tk.Label(titleframe, image=img)
        img_label.image = img
        img_label.grid(row=0, column=0, columnspan=2)

        separator = ttk.Separator(mainframe, orient='horizontal')
        separator.pack(fill=X, expand=True, pady=10)

        infoframe = Frame(mainframe)
        infoframe.pack(fill=X)

        twistver = tk.Label(infoframe, text=rs.twistver, fg="red", anchor='w')
        twistver.grid(row=1, column=0, columnspan=2, sticky=W)

        separator2 = ttk.Separator(mainframe, orient='horizontal')
        separator2.pack(fill=X, expand=True, pady=10)

        content_frame = Frame(mainframe)
        content_frame.hidden = 0
        content_frame.pack(fill=X)

        photo1 = PhotoImage(file=home_path + "/patcher/src/icons/update.png")

        update_button = Button(content_frame,
                               text="Update Twister OS",
                               command=lambda: up.update_twist(),
                               width=180,
                               height=200,
                               cursor="hand2",
                               image=photo1,
                               compound=TOP)
        update_button.grid(row=0, column=0, padx=0)
        update_button.pack(side=BOTTOM, pady=5)

        btn = Button(mainframe,
                     text="About",
                     command=lambda: change_frame(),
                     font=("TkDefaultFont", 11, "bold"),
                     cursor="hand2")
        btn.pack(side=BOTTOM, pady=5)

        content_frame2 = Frame(mainframe)

        about_label = tk.Label(content_frame2,
                               text="TwistPatch, Commander Pi 2020\n",
                               justify=CENTER,
                               font=("TkDefaultFont", 11, "bold"))
        about_label.pack()

        text_label = tk.Label(
            content_frame2,
            text=
            "By Jack477\nFor Twister OS\n\nGraphic elements by grayduck\nApp idea by Raspberry Pi News\nTwistPatch by setLillie (FlameKat53) and Raspberry Pi News",
            justify=CENTER)
        text_label.pack(fill=X)

        version_label = tk.Label(content_frame2,
                                 text=rs.get_app_version(),
                                 font=("TkDefaultFont", 11, "bold"),
                                 justify=CENTER)
        version_label.pack()

        #cv.update()
        def on_click(self, event):
            self.focus_force()

        def change_frame():
            if content_frame.hidden == 0:
                content_frame.pack_forget()
                content_frame2.pack()
                btn['text'] = 'Back to main window'
                content_frame.hidden = 1
            else:
                content_frame2.pack_forget()
                content_frame.pack()
                btn['text'] = 'About/Update Patcher'
                content_frame.hidden = 0

        bind_label = tk.Label(mainframe,
                              text="Press [Esc] to close",
                              font=("TkDefaultFont", 11, "bold"))
        bind_label.pack(side=BOTTOM)
        master.bind('<Escape>', lambda e: killwindow(e, master))
        master.bind("<Button>", lambda event: on_click(master, event))
        master.protocol("WM_DELETE_WINDOW", lambda: on_Window_Close(master))

        if sys.argv[2] == "1":
            up.update_twist()

        if up.check_online() == False:
            msb.showinfo(
                title="TwistPatch",
                message="Network is disconnected\nThe patcher will now close")
            sys.exit(0)

        master.mainloop()