本文整理汇总了Python中Function.gtext方法的典型用法代码示例。如果您正苦于以下问题:Python Function.gtext方法的具体用法?Python Function.gtext怎么用?Python Function.gtext使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Function
的用法示例。
在下文中一共展示了Function.gtext方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: update_network
# 需要导入模块: import Function [as 别名]
# 或者: from Function import gtext [as 别名]
def update_network(host, SN, listPkt):
func.warning("\nP2P >> CREATION NETWORK")
while True:
nGroup = input("Inserire il numero del gruppo: ")
nElement = input("Inserire il numero dell'elemento del gruppo: ")
nPort = input("Inserire il numero della porta: ")
Fhost = [("172.030." + func.format_string(nGroup, const.LENGTH_SECTION_IPV4, "0") +
"." + func.format_string(nElement, const.LENGTH_SECTION_IPV4, "0") +
"|fc00:0000:0000:0000:0000:0000:" + func.format_string(nGroup, const.LENGTH_SECTION_IPV6, "0") +
":" + func.format_string(nElement, const.LENGTH_SECTION_IPV6, "0")), nPort]
if SN:
pk = pack.request_sn(host, const.PORT_SN)
func.add_pktid(pk[4:20], listPkt, const.PORT_SN)
else:
pk = pack.request_sn(host, const.PORT)
func.add_pktid(pk[4:20], listPkt, const.PORT)
s = func.create_socket_client(func.roll_the_dice(Fhost[0]), Fhost[1]);
if s is None:
func.error("Errore nella scelta del primo nodo vicino, scegline un altro.")
else:
s.sendall(pk)
s.close()
break
# Caricamento
print("Loading...")
for i in range(0, int(const.MAX_TIME / 1000)):
print("|", end = "")
print("|||" * i + " " * ((int(const.MAX_TIME / 1000) * 3) - (i * 3)) + "|")
time.sleep(1)
print("|" + "|||" * int(const.MAX_TIME / 1000) + "|")
if SN:
func.success("NETWORK CREATED:")
for h in sn_network:
func.gtext(h[0] + " - " + h[1])
if SN:
SN_host = [host, const.PORT_SN]
else:
SN_host = func.choose_SN(sn_network)
return SN_host
示例2: input
# 需要导入模块: import Function [as 别名]
# 或者: from Function import gtext [as 别名]
if SN:
func.warning("\nP2P >> INIZIALIZZAZIONE COME SUPER NODO")
else:
func.warning("\nP2P >> INIZIALIZZAZIONE COME PEER")
if host == "":
nGroup = input("Inserire il numero del gruppo: ")
nElement = input("Inserire il numero dell'elemento del gruppo: ")
host = ("172.030." + func.format_string(nGroup, const.LENGTH_SECTION_IPV4, "0") +
"." + func.format_string(nElement, const.LENGTH_SECTION_IPV4, "0") +
"|fc00:0000:0000:0000:0000:0000:" + func.format_string(nGroup, const.LENGTH_SECTION_IPV6, "0") +
":" + func.format_string(nElement, const.LENGTH_SECTION_IPV6, "0"))
func.gtext("IP: " + host)
####### DEMONI
if SN:
daemonThreadSN = daemon.Daemon(host, True, sn_network, listPkt, listUsers, listFiles, True)
daemonThreadSN.setName("DAEMON SN")
daemonThreadSN.start()
daemonThreadP = daemon.Daemon(host, True, sn_network, listPkt, listUsers, listFiles, False)
daemonThreadP.setName("DAEMON PEER")
daemonThreadP.start()
else:
daemonThreadP = daemon.Daemon(host, False, sn_network, listPkt, listUsers, listFiles, False)
daemonThreadP.setName("DAEMON PEER")