Пример #1
0
	def __init__(master):
	

		master = tk.Tk()
		master.geometry("340x410")
		master.title("Commander Pi")


		bootloader_label = tk.Label( master, text=btl.bootloader_version,  borderwidth=2, relief="groove", justify="center", wraplength="310")
		bootloader_label.pack(fill=X)
		
		link = tk.Label( master, text="Official bootloader documentation", cursor="hand2", fg="blue")
		link.pack(fill=X)
		mlink = 'https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md'
		link.bind("<Button-1>", lambda e: rs.cpi_open_url(mlink))
		
		test = tk.Label(master, text=btl.read_bootloader(),  borderwidth=2, relief="groove", justify="left")
		test.pack(fill=X)
		#button = Button(master, text="test")
		#button.pack(side=RIGHT)
		bind_label = tk.Label( master, text="Press Escape to close" )
		bind_label.pack(side=BOTTOM)
		master.bind('<Escape>', lambda e:killwindow(e, master))
		
		master.mainloop()
Пример #2
0
	def __init__(master):
	
		master = tk.Tk()
		master.geometry("300x220")
		master.title("Commander Pi")

		title_label = tk.Label( master, text = "About application\n")	
		title_label.pack(fill=X)		

		about_label = tk.Label( master, text = "Commander Pi 2020 by Jack477\n for RaspbianX & iRaspbian\nIcon by Vectors Market\nInspired by Salva\n\nVersion 0.3.2", justify=CENTER, borderwidth=2, relief="groove" )
		about_label.pack(fill=X)
		
		link = tk.Label( master, text="changelog here", cursor="hand2", fg="blue", borderwidth=2, relief="groove", 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))
		
		
		update_button = Button(master, text="Update application", command=lambda:update_x(), cursor="hand2")
		update_button.pack(fill=X)
		def update_x():
			up.update_cpi()
			sys.exit(0)
		
		bind_label = tk.Label( master, text="Press Escape to close" )
		bind_label.pack(side=BOTTOM)
		master.bind('<Escape>', lambda e:killwindow(e, master))
		
		master.mainloop()		
Пример #3
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()
Пример #4
0
    def __init__(master):

        master = tk.Tk()
        master.geometry("430x550")
        master.title("Commander Pi")

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

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

        image = Image.open("/home/pi/CommanderPi/src/icons/Bootloaders.png")
        photo = ImageTk.PhotoImage(image, master=titleframe)

        title_label = tk.Label(titleframe,
                               text="  Bootloader",
                               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=5)

        versionx_label = tk.Label(mainframe,
                                  text="Version information:",
                                  font=("TkDefaultFont", 11, "bold"),
                                  anchor='w')
        versionx_label.pack(fill=X)
        #310

        bootloader_version_label = tk.Label(mainframe,
                                            text=btl.bootloader_version,
                                            justify="left",
                                            wraplength="360",
                                            anchor='w')
        bootloader_version_label.pack(fill=X)

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

        bootloader_label = tk.Label(boot_frame,
                                    text=btl.read_bootloader(),
                                    justify="left",
                                    anchor='w')
        bootloader_label.grid(row=0, column=0, rowspan=11)

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

        setup_b = tk.Button(mainframe,
                            text="Setup config",
                            command=lambda: config_boot(),
                            font=("TkDefaultFont", 10, "bold"),
                            cursor="hand2")
        setup_b.pack()

        link = tk.Label(mainframe,
                        text="Official bootloader documentation",
                        cursor="hand2",
                        fg="#1D81DA")
        link.pack(fill=X)
        mlink = 'https://www.raspberrypi.org/documentation/hardware/raspberrypi/bcm2711_bootloader_config.md'
        link.bind("<Button-1>", lambda e: rs.cpi_open_url(mlink))

        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))

        def config_boot():
            msb.showwarning(
                title="Warning",
                message=
                "This is only for advanced users!\nDo it on your own risk!")
            #boot_frame.grid_forget()
            setup_b.destroy()
            bootloader_label.destroy()
            config_stuff = "BOOT_UART:\nWAKE_ON_GPIO:\nPOWER_OFF_ON_HALT:\nDHCP_TIMEOUT:\nDHCP_REQ_TIMEOUT:\nTFTP_FILE_TIMEOUT:\nTFTP_IP:\nTFTP_PREFIX:\nBOOT_ORDER:\nSD_BOOT_MAX_RETRIES:\nNET_BOOT_MAX_RETRIES:\n"
            #bootloader_label.config(text=config_stuff, font=("TkDefaultFont", 12))
            #config_text_label = tk.Label(boot_frame, text=config_stuff, justify="left", anchor='w')
            #config_text_label.grid(row=0, column=0, rowspan=11)
            btl_label1 = tk.Label(boot_frame,
                                  text="BOOT_UART:",
                                  justify=LEFT,
                                  width=25,
                                  anchor='w')
            btl_label1.grid(row=0, column=0)

            BOOT_UART_entry = tk.Entry(boot_frame, justify=CENTER, width=10)
            BOOT_UART_entry.grid(row=0, column=1, pady=0, sticky=N)

            btl_label2 = tk.Label(boot_frame,
                                  text="WAKE_ON_GPIO:",
                                  justify=LEFT,
                                  width=25,
                                  anchor='w')
            btl_label2.grid(row=1, column=0)
            WAKE_ON_GPIO_entry = tk.Entry(boot_frame, justify=CENTER, width=10)
            WAKE_ON_GPIO_entry.grid(row=1, column=1, pady=0, sticky=N)

            btl_label3 = tk.Label(boot_frame,
                                  text="POWER_OFF_ON_HALT:",
                                  justify=LEFT,
                                  width=25,
                                  anchor='w')
            btl_label3.grid(row=2, column=0)
            POWER_OFF_ON_HALT_entry = tk.Entry(boot_frame,
                                               justify=CENTER,
                                               width=10)
            POWER_OFF_ON_HALT_entry.grid(row=2, column=1, pady=0, sticky=N)

            btl_label4 = tk.Label(boot_frame,
                                  text="DHCP_TIMEOUT:",
                                  justify=LEFT,
                                  width=25,
                                  anchor='w')
            btl_label4.grid(row=3, column=0)
            DHCP_TIMEOUT_entry = tk.Entry(boot_frame, justify=CENTER, width=10)
            DHCP_TIMEOUT_entry.grid(row=3, column=1, pady=0, sticky=N)

            btl_label5 = tk.Label(boot_frame,
                                  text="DHCP_REQ_TIMEOUT:",
                                  justify=LEFT,
                                  width=25,
                                  anchor='w')
            btl_label5.grid(row=4, column=0)
            DHCP_REQ_TIMEOUT_entry = tk.Entry(boot_frame,
                                              justify=CENTER,
                                              width=10)
            DHCP_REQ_TIMEOUT_entry.grid(row=4, column=1, pady=0, sticky=N)

            btl_label6 = tk.Label(boot_frame,
                                  text="TFTP_FILE_TIMEOUT:",
                                  justify=LEFT,
                                  width=25,
                                  anchor='w')
            btl_label6.grid(row=5, column=0)
            TFTP_FILE_TIMEOUT_entry = tk.Entry(boot_frame,
                                               justify=CENTER,
                                               width=10)
            TFTP_FILE_TIMEOUT_entry.grid(row=5, column=1, pady=0, sticky=N)

            btl_label7 = tk.Label(boot_frame,
                                  text="TFTP_IP:",
                                  justify=LEFT,
                                  width=25,
                                  anchor='w')
            btl_label7.grid(row=6, column=0)
            TFTP_IP_entry = tk.Entry(boot_frame, justify=CENTER, width=10)
            TFTP_IP_entry.grid(row=6, column=1, pady=0, sticky=N)

            btl_label8 = tk.Label(boot_frame,
                                  text="TFTP_PREFIX:",
                                  justify=LEFT,
                                  width=25,
                                  anchor='w')
            btl_label8.grid(row=7, column=0)
            TFTP_PREFIX_entry = tk.Entry(boot_frame, justify=CENTER, width=10)
            TFTP_PREFIX_entry.grid(row=7, column=1, pady=0, sticky=N)

            btl_label9 = tk.Label(boot_frame,
                                  text="BOOT_ORDER",
                                  justify=LEFT,
                                  width=25,
                                  anchor='w')
            btl_label9.grid(row=8, column=0)
            BOOT_ORDER_entry = tk.Entry(boot_frame, justify=CENTER, width=10)
            BOOT_ORDER_entry.grid(row=8, column=1, pady=0, sticky=N)

            btl_label10 = tk.Label(boot_frame,
                                   text="SD_BOOT_MAX_RETRIES:",
                                   justify=LEFT,
                                   width=25,
                                   anchor='w')
            btl_label10.grid(row=9, column=0)
            SD_BOOT_MAX_RETRIES_entry = tk.Entry(boot_frame,
                                                 justify=CENTER,
                                                 width=10)
            SD_BOOT_MAX_RETRIES_entry.grid(row=9, column=1, pady=0, sticky=N)

            btl_label11 = tk.Label(boot_frame,
                                   text="NET_BOOT_MAX_RETRIES:",
                                   justify=LEFT,
                                   width=25,
                                   anchor='w')
            btl_label11.grid(row=10, column=0)
            NET_BOOT_MAX_RETRIES_entry = tk.Entry(boot_frame,
                                                  justify=CENTER,
                                                  width=10)
            NET_BOOT_MAX_RETRIES_entry.grid(row=10, column=1, pady=0, sticky=N)

            btl_btn1 = tk.Button(boot_frame,
                                 text="Apply and save",
                                 font=("TkDefaultFont", 10, "bold"),
                                 cursor="hand2",
                                 command=lambda: push_config())
            btl_btn1.grid(row=11, column=1)
            btl_btn2 = tk.Button(boot_frame,
                                 text="Cancel",
                                 font=("TkDefaultFont", 10, "bold"),
                                 cursor="hand2",
                                 command=lambda: cancel())
            btl_btn2.grid(row=11, column=0, sticky=W)

            #BOOT_UART_entry.insert(END, btl.BOOT_UART[-2:-1])
            #WAKE_ON_GPIO_entry.insert(END, btl.WAKE_ON_GPIO[-2:-1])
            #POWER_OFF_ON_HALT_entry.insert(END, btl.POWER_OFF_ON_HALT[-2:-1])
            #DHCP_TIMEOUT_entry.insert(END, btl.DHCP_TIMEOUT[-6:-1])

            def push_config():
                confirm_msgb = msb.askyesno(title=None,
                                            message="Are you sure?")
                if confirm_msgb == True:
                    btl.set_bootloader_value("BOOT_UART",
                                             BOOT_UART_entry.get())
                    btl.set_bootloader_value("WAKE_ON_GPIO",
                                             WAKE_ON_GPIO_entry.get())
                    btl.set_bootloader_value("POWER_OFF_ON_HALT",
                                             POWER_OFF_ON_HALT_entry.get())
                    btl.set_bootloader_value("DHCP_TIMEOUT",
                                             DHCP_TIMEOUT_entry.get())
                    btl.set_bootloader_value("DHCP_REQ_TIMEOUT",
                                             DHCP_REQ_TIMEOUT_entry.get())
                    btl.set_bootloader_value("TFTP_FILE_TIMEOUT",
                                             TFTP_FILE_TIMEOUT_entry.get())
                    btl.set_bootloader_value("TFTP_IP", TFTP_IP_entry.get())
                    btl.set_bootloader_value("TFTP_PREFIX",
                                             TFTP_PREFIX_entry.get())
                    btl.set_bootloader_value("BOOT_ORDER",
                                             BOOT_ORDER_entry.get())
                    btl.set_bootloader_value("SD_BOOT_MAX_RETRIES",
                                             SD_BOOT_MAX_RETRIES_entry.get())
                    btl.set_bootloader_value("NET_BOOT_MAX_RETRIES",
                                             NET_BOOT_MAX_RETRIES_entry.get())
                    btl.write_bootloader()
                    master.destroy()
                    msb.showinfo(title="", message="Now you need to reboot")
                    #rs.reboot()
        def cancel():
            importlib.reload(btl)
            importlib.reload(rs)
            master.destroy()
            bopen(Bootloader_Info_Window)

        master.mainloop()