1 Star 0 Fork 0

icedRabbit/webapp

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
setapp.py 2.46 KB
一键复制 编辑 原始数据 按行查看 历史
sun jun 提交于 2018-07-04 17:56 . client小程序
#encoding=utf-8
#usr/local/bin/python3
from flexx import app,event,ui,config
from ctypes import *
import os
import sys
print(sys.path)
confPath=r"D://conf.ini"
CERTFILE = r'C:\Users\user\OneDrive\code space\python/tmp/self-signed.crt'
KEYFILE = r'C:\Users\user\OneDrive\code space\python/tmp/self-signed.key'
config.ssl_certfile = CERTFILE
config.ssl_keyfile = KEYFILE
class setPile(app.PyComponent):
x=0
def init(self):
self.widget = Example(self)
#self.updata_partcipantes()
@event.action
def echo(self,data):
confPath=data[3]
with open(confPath,"w") as f:
f.write(
"""HBTIMEOUT=30000
DEVICECODE={deviceCode}
POWTYPE={powtype}
GUN0NUM={gun0}
GUN1NUM={gun1}""".format(deviceCode=data[0][:-2],powtype=data[0][-2:-1],gun0=data[0][-1:],gun1=data[1][-1:]))
with open(confPath)as f:
line=f.read()
#print(line,data)
os.system(u"""netsh interface ip set address name="本地连接1" source=static addr={ip} mask=255.255.255.0 gateway={gate}""".format(ip=("192.168.100."+data[2]),gate="192.168.100.1"))
windll.user32.MessageBoxA(0,(line+"\n"+'192.168.100.'+data[2]).encode('gb2312'),u' 信息'.encode('gb2312'),0)
print(line);
class Example(ui.Widget):
def init(self,pycomp):
self.pycomp = pycomp
with ui.VBox(flex=1):
self.lab1=ui.Label(text='0号枪编号:')
self.l1 = ui.LineEdit(placeholder_text='431')
self.lab1=ui.Label(text='1号枪编号:')
self.l2 = ui.LineEdit(placeholder_text="432")
self.lab1=ui.Label(text='设置主机IP:')
self.l3 = ui.LineEdit(text="2")
self.lab1=ui.Label(text='位置')
self.l4 = ui.LineEdit(text=r"D://charge_station/conf.ini")
self.b1=ui.Button(text='确定')
self.label1=ui.Label(flex=1,wrap=True,text=confPath)
@event.reaction('b1.pointer_down')
def _add_label_text(self, *events):
#print(self.l1.text)
self.send_data((self.l1.text,self.l2.text,self.l3.text,self.l4.text))
self.label1.set_text(confPath)
#self.label1.set_text("输入成功")
@event.action
def send_data(self, data):
self.pycomp.echo(data)
@event.action
def receive_data(self, data):
0
#a = app.App(setPile)
#m = a.launch("firefox-browser") # for use during development
#app.run()
app.serve(setPile,'setPile')
app.start()
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/iceRabbit/webapp.git
git@gitee.com:iceRabbit/webapp.git
iceRabbit
webapp
webapp
master

搜索帮助

0d507c66 1850385 C8b1a773 1850385