Exemplo n.º 1
0
	def setInterfaces(self, interfaces):
		names = []
		if os.name=='nt':
			names = network.name_from_guid(network.interfaces())
		for i in interfaces:
			if os.name=='nt':
				self.menuAdapter.add_radiobutton(label=names[interfaces.index(i)])
			else:
				self.menuAdapter.add_radiobutton(label=i)
Exemplo n.º 2
0
    def __init__(self, root):
        menubar = Menu(root)
        root.config(menu=menubar)
        fileMenu = Menu(menubar, tearoff=0)
        fileMenu.add_command(label="Enter Manual IP", command=self.manualIP)
        fileMenu.add_command(label="Make file available", command=self.addFile)
        fileMenu.add_command(label="Display IP", command=self.setLabelIP)
        fileMenu.add_command(label="Set Password", command=self.setPassword)
        menubar.add_cascade(label="File", menu=fileMenu)
        self.menuAdapter = Menu(menubar, tearoff=0)
        names = []
        if os.name == "nt":
            names = network.name_from_guid(netifaces.interfaces())
        for i in netifaces.interfaces():

            def func(val):
                def f():
                    network.iface = val
                    server.s_thread = threading.Thread(target=server.start_server)
                    server.s_thread.setDaemon(True)
                    server.s_thread.start()
                    with open("prefs.txt", "w") as f:
                        f.write(val)
                    self.setLabelIP()

                return f

            if os.name == "nt":
                self.menuAdapter.add_radiobutton(label=names[netifaces.interfaces().index(i)], command=func(i))
            else:
                self.menuAdapter.add_radiobutton(label=i, command=func(i))
        menubar.add_cascade(label="Adapter", menu=self.menuAdapter)
        menubar.add_command(label="About", command=self.showAbout)
        self.frameList = FrameList(root)
        self.frameList.pack()
        self.btnFrame = FrameBtn(root)
        self.btnFrame.pack()
        self.pb = ttk.Progressbar(root, orient="horizontal", mode="determinate")
        self.pb.pack(fill=X)
        self.v = StringVar()
        self.lbl = Label(root, textvariable=self.v)
        self.v.set("Label")
        self.lbl.pack()
        self.btnFrame.btn2.config(command=self.updateFiles)
        self.btnFrame.btn1.config(command=self.downloadFile)