chang all
This commit is contained in:
177
Makefile
177
Makefile
@@ -1,177 +0,0 @@
|
||||
# Makefile for Sphinx documentation
|
||||
#
|
||||
|
||||
# You can set these variables from the command line.
|
||||
SPHINXOPTS =
|
||||
SPHINXBUILD = sphinx-build
|
||||
PAPER =
|
||||
BUILDDIR = build
|
||||
|
||||
# User-friendly check for sphinx-build
|
||||
ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
|
||||
$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
|
||||
endif
|
||||
|
||||
# Internal variables.
|
||||
PAPEROPT_a4 = -D latex_paper_size=a4
|
||||
PAPEROPT_letter = -D latex_paper_size=letter
|
||||
ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||
# the i18n builder cannot share the environment and doctrees with the others
|
||||
I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
|
||||
|
||||
.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
|
||||
|
||||
help:
|
||||
@echo "Please use \`make <target>' where <target> is one of"
|
||||
@echo " html to make standalone HTML files"
|
||||
@echo " dirhtml to make HTML files named index.html in directories"
|
||||
@echo " singlehtml to make a single large HTML file"
|
||||
@echo " pickle to make pickle files"
|
||||
@echo " json to make JSON files"
|
||||
@echo " htmlhelp to make HTML files and a HTML help project"
|
||||
@echo " qthelp to make HTML files and a qthelp project"
|
||||
@echo " devhelp to make HTML files and a Devhelp project"
|
||||
@echo " epub to make an epub"
|
||||
@echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
|
||||
@echo " latexpdf to make LaTeX files and run them through pdflatex"
|
||||
@echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
|
||||
@echo " text to make text files"
|
||||
@echo " man to make manual pages"
|
||||
@echo " texinfo to make Texinfo files"
|
||||
@echo " info to make Texinfo files and run them through makeinfo"
|
||||
@echo " gettext to make PO message catalogs"
|
||||
@echo " changes to make an overview of all changed/added/deprecated items"
|
||||
@echo " xml to make Docutils-native XML files"
|
||||
@echo " pseudoxml to make pseudoxml-XML files for display purposes"
|
||||
@echo " linkcheck to check all external links for integrity"
|
||||
@echo " doctest to run all doctests embedded in the documentation (if enabled)"
|
||||
|
||||
clean:
|
||||
rm -rf $(BUILDDIR)/*
|
||||
|
||||
html:
|
||||
$(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
|
||||
|
||||
dirhtml:
|
||||
$(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
|
||||
|
||||
singlehtml:
|
||||
$(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
|
||||
@echo
|
||||
@echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
|
||||
|
||||
pickle:
|
||||
$(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
|
||||
@echo
|
||||
@echo "Build finished; now you can process the pickle files."
|
||||
|
||||
json:
|
||||
$(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
|
||||
@echo
|
||||
@echo "Build finished; now you can process the JSON files."
|
||||
|
||||
htmlhelp:
|
||||
$(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run HTML Help Workshop with the" \
|
||||
".hhp project file in $(BUILDDIR)/htmlhelp."
|
||||
|
||||
qthelp:
|
||||
$(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
|
||||
@echo
|
||||
@echo "Build finished; now you can run "qcollectiongenerator" with the" \
|
||||
".qhcp project file in $(BUILDDIR)/qthelp, like this:"
|
||||
@echo "# qcollectiongenerator $(BUILDDIR)/qthelp/python3-cookbook.qhcp"
|
||||
@echo "To view the help file:"
|
||||
@echo "# assistant -collectionFile $(BUILDDIR)/qthelp/python3-cookbook.qhc"
|
||||
|
||||
devhelp:
|
||||
$(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
|
||||
@echo
|
||||
@echo "Build finished."
|
||||
@echo "To view the help file:"
|
||||
@echo "# mkdir -p $$HOME/.local/share/devhelp/python3-cookbook"
|
||||
@echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/python3-cookbook"
|
||||
@echo "# devhelp"
|
||||
|
||||
epub:
|
||||
$(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
|
||||
@echo
|
||||
@echo "Build finished. The epub file is in $(BUILDDIR)/epub."
|
||||
|
||||
latex:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo
|
||||
@echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
|
||||
@echo "Run \`make' in that directory to run these through (pdf)latex" \
|
||||
"(use \`make latexpdf' here to do that automatically)."
|
||||
|
||||
latexpdf:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through pdflatex..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
latexpdfja:
|
||||
$(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
|
||||
@echo "Running LaTeX files through platex and dvipdfmx..."
|
||||
$(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
|
||||
@echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
|
||||
|
||||
text:
|
||||
$(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
|
||||
@echo
|
||||
@echo "Build finished. The text files are in $(BUILDDIR)/text."
|
||||
|
||||
man:
|
||||
$(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
|
||||
@echo
|
||||
@echo "Build finished. The manual pages are in $(BUILDDIR)/man."
|
||||
|
||||
texinfo:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo
|
||||
@echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
|
||||
@echo "Run \`make' in that directory to run these through makeinfo" \
|
||||
"(use \`make info' here to do that automatically)."
|
||||
|
||||
info:
|
||||
$(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
|
||||
@echo "Running Texinfo files through makeinfo..."
|
||||
make -C $(BUILDDIR)/texinfo info
|
||||
@echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
|
||||
|
||||
gettext:
|
||||
$(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
|
||||
@echo
|
||||
@echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
|
||||
|
||||
changes:
|
||||
$(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
|
||||
@echo
|
||||
@echo "The overview file is in $(BUILDDIR)/changes."
|
||||
|
||||
linkcheck:
|
||||
$(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
|
||||
@echo
|
||||
@echo "Link check complete; look for any errors in the above output " \
|
||||
"or in $(BUILDDIR)/linkcheck/output.txt."
|
||||
|
||||
doctest:
|
||||
$(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
|
||||
@echo "Testing of doctests in the sources finished, look at the " \
|
||||
"results in $(BUILDDIR)/doctest/output.txt."
|
||||
|
||||
xml:
|
||||
$(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
|
||||
@echo
|
||||
@echo "Build finished. The XML files are in $(BUILDDIR)/xml."
|
||||
|
||||
pseudoxml:
|
||||
$(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
|
||||
@echo
|
||||
@echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
|
||||
@@ -4,6 +4,16 @@
|
||||
Topic: sample
|
||||
Desc :
|
||||
"""
|
||||
import re
|
||||
import os
|
||||
from os.path import join
|
||||
import logging
|
||||
|
||||
logging.basicConfig(level=logging.INFO,
|
||||
format='%(asctime)s %(filename)s[line:%(lineno)d] %(levelname)s %(message)s',
|
||||
datefmt='%Y-%m-%d %H:%M:%S',
|
||||
handlers=[logging.FileHandler('d:/logs/cookbook.log', 'w', 'utf-8')])
|
||||
_log = logging.getLogger('app.' + __name__)
|
||||
|
||||
|
||||
def read_demo():
|
||||
@@ -15,5 +25,54 @@ def read_demo():
|
||||
pass
|
||||
|
||||
|
||||
def read_plus(txt_file, init_c, base_dir):
|
||||
"""演示一下seek方法"""
|
||||
chapter = init_c - 1 # 章
|
||||
paper = 0 # 节
|
||||
write_file = None # 接下来要写入的文件
|
||||
temp_lines = [] # 临时存放章或节内容
|
||||
with open(txt_file, mode='r', encoding='utf-8') as f:
|
||||
for line in f:
|
||||
if re.match('^CHAPTER \d+$', line.strip()):
|
||||
chapter += 1
|
||||
# 开始新的一章了
|
||||
_log.info('开始新的一章了,第{}章!'.format(chapter))
|
||||
# 前面的给写入文件中
|
||||
if temp_lines:
|
||||
with open(write_file, mode='w', encoding='utf-8') as wf:
|
||||
wf.writelines(temp_lines)
|
||||
temp_lines.clear()
|
||||
# 首先创建一个章节源码目录
|
||||
c_dir = join(base_dir, 'cookbook', 'c{:02d}'.format(chapter))
|
||||
if not os.path.exists(c_dir):
|
||||
os.makedirs(c_dir)
|
||||
# 找到章节文件
|
||||
chapters_dir = join(c_dir, 'source', 'chapters')
|
||||
onlyfiles = [join(chapters_dir, f) for f in os.listdir(chapters_dir)
|
||||
if os.path.isfile(join(chapters_dir, f))]
|
||||
write_file = next(f for f in onlyfiles if f.startswith('p{:02d}'.format(chapter)))
|
||||
elif re.match('^{}.{}. '.format(chapter, paper + 1), line.strip()):
|
||||
f.seek(1, 1) # 往前进一行
|
||||
if f.readline().strip() == 'Problem':
|
||||
# 说明是新的一节开始了
|
||||
paper += 1
|
||||
f.seek(-1, 1) # 退一行
|
||||
_log.info('开始新的一节了,第{}章,第{}节!'.format(chapter, paper))
|
||||
# 前面的给写入文件中
|
||||
if temp_lines:
|
||||
with open(write_file, mode='w', encoding='utf-8') as wf:
|
||||
wf.writelines(temp_lines)
|
||||
temp_lines.clear()
|
||||
# 定义接下来要写入的节文件
|
||||
paper_dir = join(base_dir, 'source', 'c{:02d}'.format(chapter))
|
||||
pfs = [join(paper_dir, f) for f in os.listdir(paper_dir)
|
||||
if os.path.isfile(join(paper_dir, f))]
|
||||
write_file = next(f for f in pfs if f.startswith('p{:02d}'.format(chapter)))
|
||||
else:
|
||||
f.seek(-1, 1)
|
||||
else:
|
||||
temp_lines.append(line)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
read_demo()
|
||||
print('{:02d}'.format(11))
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: sample
|
||||
Desc : 这个是我自己的实用代码集锦
|
||||
"""
|
||||
__author__ = 'Xiong Neng'
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: sample
|
||||
Topic: 实用代码集锦
|
||||
Desc :
|
||||
"""
|
||||
|
||||
@@ -4,8 +4,11 @@
|
||||
Topic: sample
|
||||
Desc :
|
||||
"""
|
||||
import sys, os
|
||||
from . import consttype as const
|
||||
import sys
|
||||
import os
|
||||
|
||||
from basic.samples import consttype as const
|
||||
|
||||
__author__ = 'Xiong Neng'
|
||||
|
||||
const.ROOT_PATH = os.path.dirname(sys.path[0])
|
||||
@@ -222,7 +222,7 @@ def xlsx_to_table(xlsx_name):
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
excel = r'D:\download\20150505\gdc2.xlsx'
|
||||
excel = r'D:\download\20150505\gdc.xlsx'
|
||||
_init_table()
|
||||
conn = _connect()
|
||||
xlsx_to_table(excel)
|
||||
@@ -6,18 +6,19 @@ Desc : 最后的结果是我想要的,去除了页头和页脚的部分
|
||||
"""
|
||||
import re
|
||||
|
||||
|
||||
def beauty(txt_file):
|
||||
with open(txt_file, mode='r+', encoding='utf-8') as f:
|
||||
lines = f.readlines()
|
||||
f.seek(0)
|
||||
for line in lines:
|
||||
if line.startswith('www.it-ebooks.info'):
|
||||
f.seek(f.tell() - 1)
|
||||
f.seek(f.tell() - 1, 1)
|
||||
if f.readline().startswith('Chapter '):
|
||||
# 回退7位
|
||||
f.seek(f.tell() - 7)
|
||||
f.seek(f.tell() - 7, 1)
|
||||
else:
|
||||
f.seek(f.tell() - 5)
|
||||
f.seek(f.tell() - 5, 1)
|
||||
else:
|
||||
f.write(line)
|
||||
f.truncate()
|
||||
@@ -47,5 +48,13 @@ def beauty2(pre_txt, after_txt):
|
||||
f.writelines(result_lines)
|
||||
|
||||
|
||||
def generate_chapter():
|
||||
"""
|
||||
解析文本文件,生成最终的待翻译文件
|
||||
"""
|
||||
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
beauty2('pc_pre.txt', 'pc_after')
|
||||
# beauty2('pc_pre.txt', 'pc_after')
|
||||
pass
|
||||
@@ -1,13 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head lang="en">
|
||||
<meta charset="UTF-8">
|
||||
<title></title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>dddddddddd</h1>
|
||||
<p style="text-align: right; margin-top: 200px;">
|
||||
RRRRRRRRRR
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
@@ -1,6 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
def setup(app):
|
||||
import sphinx.search as search
|
||||
import zh
|
||||
search.languages["zh_CN"] = zh.SearchChinese
|
||||
275916
exts/main.dic
275916
exts/main.dic
File diff suppressed because it is too large
Load Diff
144
exts/smallseg.py
144
exts/smallseg.py
@@ -1,144 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import re
|
||||
import os
|
||||
import sys
|
||||
class SEG(object):
|
||||
def __init__(self):
|
||||
_localDir=os.path.dirname(__file__)
|
||||
_curpath=os.path.normpath(os.path.join(os.getcwd(),_localDir))
|
||||
curpath=_curpath
|
||||
self.d = {}
|
||||
print >> sys.stderr,"loading dict..."
|
||||
self.set([x.rstrip() for x in file(os.path.join(curpath,"main.dic")) ])
|
||||
self.specialwords= set([x.rstrip().decode('utf-8') for x in file(os.path.join(curpath,"suffix.dic"))])
|
||||
print >> sys.stderr,'dict ok.'
|
||||
#set dictionary(a list)
|
||||
def set(self,keywords):
|
||||
p = self.d
|
||||
q = {}
|
||||
k = ''
|
||||
for word in keywords:
|
||||
word = (chr(11)+word).decode('utf-8')
|
||||
if len(word)>5:
|
||||
continue
|
||||
p = self.d
|
||||
ln = len(word)
|
||||
for i in xrange(ln-1,-1,-1):
|
||||
char = word[i].lower()
|
||||
if p=='':
|
||||
q[k] = {}
|
||||
p = q[k]
|
||||
if not (char in p):
|
||||
p[char] = ''
|
||||
q = p
|
||||
k = char
|
||||
p = p[char]
|
||||
|
||||
pass
|
||||
|
||||
def _binary_seg(self,s):
|
||||
ln = len(s)
|
||||
if ln==1:
|
||||
return [s]
|
||||
R = []
|
||||
for i in xrange(ln,1,-1):
|
||||
tmp = s[i-2:i]
|
||||
R.append(tmp)
|
||||
return R
|
||||
|
||||
def _pro_unreg(self,piece):
|
||||
#print piece
|
||||
R = []
|
||||
tmp = re.sub(u"。|,|,|!|…|!|《|》|<|>|\"|'|:|:|?|\?|、|\||“|”|‘|’|;|—|(|)|·|\(|\)| "," ",piece).split()
|
||||
ln1 = len(tmp)
|
||||
for i in xrange(len(tmp)-1,-1,-1):
|
||||
mc = re.split(r"([0-9A-Za-z\-\+#@_\.]+)",tmp[i])
|
||||
for j in xrange(len(mc)-1,-1,-1):
|
||||
r = mc[j]
|
||||
if re.search(r"([0-9A-Za-z\-\+#@_\.]+)",r)!=None:
|
||||
R.append(r)
|
||||
else:
|
||||
R.extend(self._binary_seg(r))
|
||||
return R
|
||||
|
||||
|
||||
def cut(self,text):
|
||||
"""
|
||||
"""
|
||||
text = text.decode('utf-8','ignore')
|
||||
p = self.d
|
||||
ln = len(text)
|
||||
i = ln
|
||||
j = 0
|
||||
z = ln
|
||||
q = 0
|
||||
recognised = []
|
||||
mem = None
|
||||
mem2 = None
|
||||
while i-j>0:
|
||||
t = text[i-j-1].lower()
|
||||
#print i,j,t,mem
|
||||
if not (t in p):
|
||||
if (mem!=None) or (mem2!=None):
|
||||
if mem!=None:
|
||||
i,j,z = mem
|
||||
mem = None
|
||||
elif mem2!=None:
|
||||
delta = mem2[0]-i
|
||||
if delta>=1:
|
||||
if (delta<5) and (re.search(ur"[\w\u2E80-\u9FFF]",t)!=None):
|
||||
pre = text[i-j]
|
||||
#print pre
|
||||
if not (pre in self.specialwords):
|
||||
i,j,z,q = mem2
|
||||
del recognised[q:]
|
||||
mem2 = None
|
||||
|
||||
p = self.d
|
||||
if((i<ln) and (i<z)):
|
||||
unreg_tmp = self._pro_unreg(text[i:z])
|
||||
recognised.extend(unreg_tmp)
|
||||
recognised.append(text[i-j:i])
|
||||
#print text[i-j:i],mem2
|
||||
i = i-j
|
||||
z = i
|
||||
j = 0
|
||||
continue
|
||||
j = 0
|
||||
i -= 1
|
||||
p = self.d
|
||||
continue
|
||||
p = p[t]
|
||||
j+=1
|
||||
if chr(11) in p:
|
||||
if j<=2:
|
||||
mem = i,j,z
|
||||
#print text[i-1]
|
||||
if (z-i<2) and (text[i-1] in self.specialwords) and ((mem2==None) or ((mem2!=None and mem2[0]-i>1))):
|
||||
#print text[i-1]
|
||||
mem = None
|
||||
mem2 = i,j,z,len(recognised)
|
||||
p = self.d
|
||||
i -= 1
|
||||
j = 0
|
||||
continue
|
||||
#print mem
|
||||
p = self.d
|
||||
#print i,j,z,text[i:z]
|
||||
if((i<ln) and (i<z)):
|
||||
unreg_tmp = self._pro_unreg(text[i:z])
|
||||
recognised.extend(unreg_tmp)
|
||||
recognised.append(text[i-j:i])
|
||||
i = i-j
|
||||
z = i
|
||||
j = 0
|
||||
mem = None
|
||||
mem2 = None
|
||||
#print mem
|
||||
if mem!=None:
|
||||
i,j,z = mem
|
||||
recognised.extend(self._pro_unreg(text[i:z]))
|
||||
recognised.append(text[i-j:i])
|
||||
else:
|
||||
recognised.extend(self._pro_unreg(text[i-j:z]))
|
||||
return recognised
|
||||
114
exts/suffix.dic
114
exts/suffix.dic
@@ -1,114 +0,0 @@
|
||||
和
|
||||
是
|
||||
了
|
||||
中
|
||||
有
|
||||
都
|
||||
的
|
||||
来
|
||||
在
|
||||
次
|
||||
还
|
||||
但
|
||||
为
|
||||
里
|
||||
用
|
||||
外
|
||||
上
|
||||
下
|
||||
就
|
||||
以
|
||||
去
|
||||
即
|
||||
丁
|
||||
万
|
||||
乔
|
||||
余
|
||||
候
|
||||
傅
|
||||
冯
|
||||
刘
|
||||
单
|
||||
卢
|
||||
史
|
||||
叶
|
||||
吕
|
||||
吴
|
||||
唐
|
||||
夏
|
||||
姚
|
||||
姜
|
||||
孔
|
||||
孙
|
||||
孟
|
||||
宋
|
||||
尹
|
||||
崔
|
||||
常
|
||||
康
|
||||
廖
|
||||
张
|
||||
彭
|
||||
徐
|
||||
戴
|
||||
文
|
||||
方
|
||||
易
|
||||
曹
|
||||
曾
|
||||
朱
|
||||
李
|
||||
杜
|
||||
杨
|
||||
林
|
||||
梁
|
||||
武
|
||||
段
|
||||
毛
|
||||
江
|
||||
汤
|
||||
沈
|
||||
潘
|
||||
熊
|
||||
王
|
||||
田
|
||||
白
|
||||
石
|
||||
秦
|
||||
罗
|
||||
肖
|
||||
胡
|
||||
苏
|
||||
范
|
||||
董
|
||||
蒋
|
||||
薛
|
||||
袁
|
||||
谢
|
||||
谭
|
||||
贾
|
||||
赖
|
||||
赵
|
||||
邓
|
||||
邱
|
||||
邵
|
||||
邹
|
||||
郑
|
||||
郝
|
||||
郭
|
||||
金
|
||||
钟
|
||||
钱
|
||||
阎
|
||||
陆
|
||||
陈
|
||||
雷
|
||||
韩
|
||||
顾
|
||||
马
|
||||
高
|
||||
魏
|
||||
黄
|
||||
黎
|
||||
龙
|
||||
龚
|
||||
16
exts/zh.py
16
exts/zh.py
@@ -1,16 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from sphinx.search import SearchLanguage
|
||||
from smallseg import SEG
|
||||
|
||||
class SearchChinese(SearchLanguage):
|
||||
lang = 'zh'
|
||||
|
||||
def init(self, options):
|
||||
print "reading Chiniese dictionary"
|
||||
self.seg = SEG()
|
||||
|
||||
def split(self, input):
|
||||
return self.seg.cut(input.encode("utf8"))
|
||||
|
||||
def word_filter(self, stemmed_word):
|
||||
return len(stemmed_word) > 1
|
||||
@@ -1,22 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: 工具集合
|
||||
Desc :
|
||||
"""
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
def resource_path(relative_path):
|
||||
"""获取实际路径"""
|
||||
if hasattr(sys, "_MEIPASS"):
|
||||
base_path = sys._MEIPASS
|
||||
else:
|
||||
base_path = os.path.abspath(".")
|
||||
return os.path.join(base_path, relative_path)
|
||||
|
||||
|
||||
def userhome_file(filename):
|
||||
userhome = os.path.expanduser('~')
|
||||
return os.path.join(userhome, filename)
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: sample
|
||||
Desc :
|
||||
"""
|
||||
__author__ = 'Xiong Neng'
|
||||
@@ -1,47 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: 简单的一个button,点击关闭窗口
|
||||
Desc :
|
||||
"""
|
||||
__author__ = 'Xiong Neng'
|
||||
import wx
|
||||
|
||||
|
||||
class MyFrame(wx.Frame):
|
||||
"""Frame class that displays an image"""
|
||||
|
||||
def __init__(self, parent, id):
|
||||
"""Create a frame instnace and display image"""
|
||||
wx.Frame.__init__(self, parent,id,'Frame With Button', size=(300,100))
|
||||
panel = wx.Panel(self) # 创建画板
|
||||
# 将按钮添加到画板中去
|
||||
button = wx.Button(panel, label='Close', pos=(125, 10), size=(50, 50))
|
||||
# 绑定按钮单击事件
|
||||
self.Bind(wx.EVT_BUTTON, self.OnCloseMe, button)
|
||||
# 绑定窗口关闭事件
|
||||
self.Bind(wx.EVT_CLOSE, self.OnCloseWindow)
|
||||
|
||||
|
||||
def OnCloseMe(self, event):
|
||||
self.Close(True)
|
||||
|
||||
|
||||
def OnCloseWindow(self, event):
|
||||
self.Destroy()
|
||||
|
||||
|
||||
class MyApp(wx.App):
|
||||
"""Application class."""
|
||||
|
||||
def OnInit(self):
|
||||
self.frame = MyFrame(parent=None, id=-1)
|
||||
self.frame.Show(True)
|
||||
self.SetTopWindow(self.frame)
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
app = MyApp()
|
||||
app.MainLoop()
|
||||
|
||||
@@ -1,75 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: 创建自定义事件并绑定,两个按钮都点击后才产生事件
|
||||
Desc :
|
||||
"""
|
||||
import wx
|
||||
|
||||
|
||||
class TwoButtonEvent(wx.PyCommandEvent):
|
||||
"""先定义一个自定义事件"""
|
||||
|
||||
def __init__(self, evtType, id):
|
||||
wx.PyCommandEvent.__init__(self, evtType, id)
|
||||
self.clickCount = 0
|
||||
|
||||
def getClickCount(self):
|
||||
return self.clickCount
|
||||
|
||||
def setClickCount(self, count):
|
||||
self.clickCount = count
|
||||
|
||||
|
||||
EVT_TWO_BUTTON_TYPE = wx.NewEventType() # 创建一个事件类型
|
||||
EVT_TWO_BUTTON = wx.PyEventBinder(EVT_TWO_BUTTON_TYPE, 1) # 创建一个绑定器对象
|
||||
|
||||
|
||||
class TwoButtonPanel(wx.Panel):
|
||||
def __init__(self, parent, id=-1, leftText='Left', rightText='Right'):
|
||||
wx.Panel.__init__(self, parent, id)
|
||||
self.leftButton = wx.Button(self, label=leftText)
|
||||
self.rightButton = wx.Button(self, label=rightText, pos=(100, 0))
|
||||
self.leftClick = False
|
||||
self.rightClick = False
|
||||
self.clickCount = 0
|
||||
# 4 下面两行绑定更低级的事件
|
||||
self.leftButton.Bind(wx.EVT_LEFT_DOWN, self.OnLeftClick)
|
||||
self.rightButton.Bind(wx.EVT_LEFT_DOWN, self.OnRightClick)
|
||||
|
||||
def OnLeftClick(self, event):
|
||||
self.leftClick = True
|
||||
self.OnClick()
|
||||
event.Skip() # 继续处理
|
||||
|
||||
def OnRightClick(self, event):
|
||||
self.rightClick = True
|
||||
self.OnClick()
|
||||
event.Skip()
|
||||
|
||||
def OnClick(self):
|
||||
self.clickCount += 1
|
||||
if self.leftClick and self.rightClick:
|
||||
self.leftClick = False
|
||||
self.rightClick = False
|
||||
# 创建自定义事件
|
||||
myevent = TwoButtonEvent(EVT_TWO_BUTTON_TYPE, self.GetId())
|
||||
myevent.setClickCount(self.clickCount) # 添加数据到事件
|
||||
self.GetEventHandler().ProcessEvent(myevent) # 处理事件
|
||||
|
||||
|
||||
class CustomEventFrame(wx.Frame):
|
||||
def __init__(self, parent, id):
|
||||
wx.Frame.__init__(self, parent, id, 'Click Count: 0', size=(300, 100))
|
||||
panel = TwoButtonPanel(self)
|
||||
self.Bind(EVT_TWO_BUTTON, self.OnTwoClick, panel) # 绑定自定义事件
|
||||
|
||||
def OnTwoClick(self, event): # 定义一个事件处理器
|
||||
self.SetTitle('Click count: %s' % event.getClickCount())
|
||||
|
||||
|
||||
def main():
|
||||
app = wx.App()
|
||||
frame = CustomEventFrame(parent=None, id=-1)
|
||||
frame.Show()
|
||||
app.MainLoop()
|
||||
@@ -1,32 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: 对话框
|
||||
Desc :
|
||||
"""
|
||||
__author__ = 'Xiong Neng'
|
||||
import wx
|
||||
|
||||
|
||||
def main():
|
||||
app = wx.App()
|
||||
# --------------------确认对话框--------------------------
|
||||
# dlg = wx.MessageDialog(None, 'Is this the coolest thing ever!',
|
||||
# 'MessageDialog', wx.YES_NO | wx.ICON_QUESTION)
|
||||
# # wx.ID_YES, wx.ID_NO, wx.ID_CANCEL, wx.ID_OK
|
||||
# result = dlg.ShowModal()
|
||||
# ---------------------文本输入对话框-----------------------
|
||||
# dlg = wx.TextEntryDialog(None, "Who is buried in Grant's tomb?",
|
||||
# 'A Question', 'Cary Grant')
|
||||
# if dlg.ShowModal() == wx.ID_OK:
|
||||
# response = dlg.GetValue()
|
||||
# ---------------------列表选择对话框-----------------------
|
||||
dlg = wx.SingleChoiceDialog(None,
|
||||
'What version of Python are you using?',
|
||||
'Single Choice',
|
||||
['1.5.2', '2.0', '2.6.3', '2.7', '2.7.8'])
|
||||
if dlg.ShowModal() == wx.ID_OK:
|
||||
response = dlg.GetStringSelection()
|
||||
print(response)
|
||||
app.MainLoop()
|
||||
|
||||
@@ -1,55 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: 事件绑定示例
|
||||
Desc :
|
||||
"""
|
||||
import wx
|
||||
|
||||
|
||||
class MouseEventFrame(wx.Frame):
|
||||
def __init__(self, parent, id):
|
||||
wx.Frame.__init__(self, parent, id, 'Show Event Bindings', size=(300, 100))
|
||||
self.panel = wx.Panel(self)
|
||||
self.button = wx.Button(self.panel, label='Not Over', pos=(100, 15))
|
||||
self.Bind(wx.EVT_BUTTON, self.OnButtonClick, self.button) # 绑定button点击事件
|
||||
self.button.Bind(wx.EVT_ENTER_WINDOW, self.OnEnterWindow) # 光标位于其上事件
|
||||
self.button.Bind(wx.EVT_LEAVE_WINDOW, self.OnLeaveWindow) # 光标离开事件
|
||||
|
||||
def OnButtonClick(self, event):
|
||||
self.panel.SetBackgroundColour('Green')
|
||||
self.panel.Refresh()
|
||||
|
||||
def OnEnterWindow(self, event):
|
||||
self.button.SetLabel('Over Me!')
|
||||
event.Skip()
|
||||
|
||||
def OnLeaveWindow(self, event):
|
||||
self.button.SetLabel('Not Over')
|
||||
event.Skip()
|
||||
|
||||
class DoubleEventFrame(wx.Frame):
|
||||
"""同时监听两个事件"""
|
||||
def __init__(self, parent, id):
|
||||
wx.Frame.__init__(self, parent, id, 'Show Event Bindings', size=(300, 100))
|
||||
self.panel = wx.Panel(self)
|
||||
self.button = wx.Button(self.panel, label='Not Over', pos=(100, 15))
|
||||
self.Bind(wx.EVT_BUTTON, self.OnButtonClick, self.button) # 绑定button点击事件
|
||||
self.button.Bind(wx.EVT_LEFT_DOWN, self.OnMouseDown) # 鼠标左键点击
|
||||
|
||||
def OnButtonClick(self, event):
|
||||
"""鼠标点击后释放才会有这个Click事件"""
|
||||
self.panel.SetBackgroundColour('Green')
|
||||
self.panel.Refresh()
|
||||
|
||||
def OnMouseDown(self, event):
|
||||
self.button.SetLabel('Over Me!')
|
||||
event.Skip() # 鼠标左键事件会优先产生,这时候Skip()会继续去传递这个事件
|
||||
|
||||
def main():
|
||||
app = wx.App()
|
||||
# frame = MouseEventFrame(parent=None, id=-1)
|
||||
frame = DoubleEventFrame(parent=None, id=-1)
|
||||
frame.Show()
|
||||
app.MainLoop()
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: 布局管理器gridbag sizer
|
||||
Desc :
|
||||
"""
|
||||
import wx
|
||||
|
||||
|
||||
class BlockWindow(wx.Panel):
|
||||
def __init__(self, parent, ID=-1, label='',
|
||||
pos=wx.DefaultPosition, size=(100, 25)):
|
||||
wx.Panel.__init__(self, parent, ID, pos, size,
|
||||
wx.RAISED_BORDER, label)
|
||||
self.label = label
|
||||
self.SetBackgroundColour('white')
|
||||
self.SetMinSize(size)
|
||||
self.Bind(wx.EVT_PAINT, self.OnPaint)
|
||||
|
||||
def OnPaint(self, evt):
|
||||
sz = self.GetClientSize()
|
||||
dc = wx.PaintDC(self)
|
||||
w, h = dc.GetTextExtent(self.label)
|
||||
dc.SetFont(self.GetFont())
|
||||
dc.DrawText(self.label, (sz.width - w) / 2, (sz.height - h) / 2)
|
||||
|
||||
|
||||
labels = 'one two three four five six seven eight nine'.split()
|
||||
|
||||
|
||||
class GridbagFrame(wx.Frame):
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, -1, 'GridBagSizer')
|
||||
sizer = wx.GridBagSizer(hgap=5, vgap=5)
|
||||
for col in range(3):
|
||||
for row in range(3):
|
||||
bw = BlockWindow(self, label=labels[row * 3 + col])
|
||||
sizer.Add(bw, pos=(row, col))
|
||||
|
||||
# 跨行
|
||||
bw = BlockWindow(self, label='span 3 rows')
|
||||
sizer.Add(bw, pos=(0, 3), span=(3, 1), flag=wx.EXPAND)
|
||||
# 跨列
|
||||
bw = BlockWindow(self, label='span all columns')
|
||||
sizer.Add(bw, pos=(3, 0), span=(1, 4), flag=wx.EXPAND)
|
||||
# 使最后的行和列可增加
|
||||
sizer.AddGrowableCol(3)
|
||||
sizer.AddGrowableRow(3)
|
||||
self.SetSizer(sizer)
|
||||
self.Fit()
|
||||
|
||||
|
||||
def main():
|
||||
app = wx.App()
|
||||
GridbagFrame().Show()
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: 菜单栏、工具栏、状态栏
|
||||
Desc :
|
||||
"""
|
||||
__author__ = 'Xiong Neng'
|
||||
import wx
|
||||
import wx.py.images as images
|
||||
|
||||
|
||||
class MenuToobarFrame(wx.Frame):
|
||||
"""Frame class that displays an image"""
|
||||
|
||||
def __init__(self, parent, id):
|
||||
"""Create a frame instnace and display image"""
|
||||
wx.Frame.__init__(self, parent,id,'Toolbars', size=(300, 200))
|
||||
panel = wx.Panel(self) # 创建画板
|
||||
panel.SetBackgroundColour('White')
|
||||
statusBar = self.CreateStatusBar() # 创建状态栏
|
||||
toolbar = self.CreateToolBar() # 创建工具栏
|
||||
# 给工具栏增加一个工具
|
||||
toolbar.AddSimpleTool(wx.NewId(), images.getPyBitmap(), 'New', "Long help for 'New'")
|
||||
toolbar.Realize() # 准备显示工具栏
|
||||
menuBar = wx.MenuBar() # 创建一个菜单栏
|
||||
# 创建两个菜单
|
||||
menu1 = wx.Menu()
|
||||
menuBar.Append(menu1, '&File')
|
||||
menu1.Append(-1, "&Open...", 'Open new file')
|
||||
menuItem = menu1.Append(-1, "&Exit...", 'Exit System')
|
||||
# 菜单项绑定事件
|
||||
self.Bind(wx.EVT_MENU, self.OnCloseMe, menuItem)
|
||||
menu2 = wx.Menu()
|
||||
# 创建菜单项MenuItem
|
||||
menu2.Append(wx.NewId(), '&Copy', 'Copy in status bar')
|
||||
menu2.Append(wx.NewId(), '&Cut', '')
|
||||
menu2.Append(wx.NewId(), '&Paste','')
|
||||
menu2.AppendSeparator()
|
||||
menu2.Append(wx.NewId(), '&Options', 'Display Options')
|
||||
menuBar.Append(menu2, '&Edit') # 在菜单栏上附上菜单
|
||||
self.SetMenuBar(menuBar) # 在Frame上面附加菜单
|
||||
|
||||
def OnCloseMe(self, event):
|
||||
self.Close(True)
|
||||
|
||||
|
||||
def main():
|
||||
app = wx.App()
|
||||
frame = MenuToobarFrame(parent=None, id=-1)
|
||||
frame.Show()
|
||||
app.MainLoop()
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: 进度条
|
||||
Desc :
|
||||
"""
|
||||
import time
|
||||
import wx
|
||||
|
||||
from threading import Thread
|
||||
|
||||
from wx.lib.pubsub import pub
|
||||
|
||||
########################################################################
|
||||
class TestThread(Thread):
|
||||
"""Test Worker Thread Class."""
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def __init__(self):
|
||||
"""Init Worker Thread Class."""
|
||||
Thread.__init__(self)
|
||||
self.start() # start the thread
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def run(self):
|
||||
"""Run Worker Thread."""
|
||||
# This is the code executing in the new thread.
|
||||
for i in range(20):
|
||||
time.sleep(1)
|
||||
wx.CallAfter(pub.sendMessage, "update", msg="")
|
||||
|
||||
|
||||
########################################################################
|
||||
class MyProgressDialog(wx.Dialog):
|
||||
""""""
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def __init__(self):
|
||||
"""Constructor"""
|
||||
wx.Dialog.__init__(self, None, title="Progress")
|
||||
self.count = 0
|
||||
|
||||
self.progress = wx.Gauge(self, -1, 50, (20, 50), size=(250, 25))
|
||||
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
sizer.Add(self.progress, 0, wx.EXPAND)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
# create a pubsub receiver
|
||||
pub.subscribe(self.updateProgress, "update")
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def updateProgress(self, msg):
|
||||
""""""
|
||||
self.count += 1
|
||||
|
||||
if self.count >= 50:
|
||||
self.Destroy()
|
||||
|
||||
self.progress.SetValue(self.count)
|
||||
|
||||
|
||||
########################################################################
|
||||
class MyForm(wx.Frame):
|
||||
# ----------------------------------------------------------------------
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, wx.ID_ANY, "Tutorial")
|
||||
|
||||
# Add a panel so it looks the correct on all platforms
|
||||
panel = wx.Panel(self, wx.ID_ANY)
|
||||
self.btn = btn = wx.Button(panel, label="Start Thread")
|
||||
btn.Bind(wx.EVT_BUTTON, self.onButton)
|
||||
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
sizer.Add(btn, 0, wx.ALL | wx.CENTER, 5)
|
||||
panel.SetSizer(sizer)
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def onButton(self, event):
|
||||
"""
|
||||
Runs the thread
|
||||
"""
|
||||
btn = event.GetEventObject()
|
||||
btn.Disable()
|
||||
|
||||
TestThread()
|
||||
dlg = MyProgressDialog()
|
||||
dlg.ShowModal()
|
||||
|
||||
btn.Enable()
|
||||
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
# Run the program
|
||||
def main():
|
||||
app = wx.App()
|
||||
MyForm().Show()
|
||||
app.MainLoop()
|
||||
@@ -1,99 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: 真实form表单sizer,复杂度适中
|
||||
Desc :
|
||||
"""
|
||||
import wx
|
||||
|
||||
|
||||
class FormFrame(wx.Frame):
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, -1, 'Real World')
|
||||
panel = wx.Panel(self)
|
||||
# 首先创建controls
|
||||
topLbl = wx.StaticText(panel, -1, 'Account Information')
|
||||
topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD))
|
||||
nameLbl = wx.StaticText(panel, -1, 'Name:')
|
||||
name = wx.TextCtrl(panel, -1, '') # 文本输入框
|
||||
addrLbl = wx.StaticText(panel, -1, 'Address:')
|
||||
addr1 = wx.TextCtrl(panel, -1, '')
|
||||
addr2 = wx.TextCtrl(panel, -1, '')
|
||||
cstLbl = wx.StaticText(panel, -1, 'City,State,Zip:')
|
||||
city = wx.TextCtrl(panel, -1, '', size=(150, -1))
|
||||
state = wx.TextCtrl(panel, -1, '', size=(50, -1))
|
||||
zip = wx.TextCtrl(panel, -1, '', size=(70, -1))
|
||||
phoneLbl = wx.StaticText(panel, -1, 'Phone:')
|
||||
phone = wx.TextCtrl(panel, -1, '')
|
||||
emailLbl = wx.StaticText(panel, -1, 'Email:')
|
||||
email = wx.TextCtrl(panel, -1, '')
|
||||
saveBtn = wx.Button(panel, -1, 'Save')
|
||||
cancelBtn = wx.Button(panel, -1, 'Cancel')
|
||||
|
||||
# 下面开始布局
|
||||
# mainSizer是顶级sizer,控制所有部件,使用box sizer
|
||||
# 垂直sizer
|
||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
# boxsizer.Add(btn1, proportion=0, flag=wx.ALL, border=2)
|
||||
mainSizer.Add(topLbl, 0, wx.ALL, 5)
|
||||
mainSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
|
||||
|
||||
# 地址列
|
||||
# addrSizer控制所有地址信息,使用gridbag sizer
|
||||
addrSizer = wx.GridBagSizer(hgap=5, vgap=5)
|
||||
# sizer.Add(bw, pos=(3,0), span=(1,4), flag=wx.EXPAND)
|
||||
addrSizer.Add(nameLbl, pos=(0, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
|
||||
addrSizer.Add(name, pos=(0, 1), flag=wx.EXPAND)
|
||||
addrSizer.Add(addrLbl, pos=(1, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
|
||||
addrSizer.Add(addr1, pos=(1, 1), flag=wx.EXPAND)
|
||||
# 带有空白空间的行
|
||||
addrSizer.Add((10, 10), pos=(2, 0), span=(1, 1), flag=wx.EXPAND) # 一些空白空间
|
||||
addrSizer.Add(addr2, pos=(2, 1), flag=wx.EXPAND)
|
||||
addrSizer.Add(cstLbl, pos=(3, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
|
||||
|
||||
# city,state,zip放到一个嵌套sizer中,使用BoxSizer
|
||||
# 水平嵌套Sizer
|
||||
cstSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
cstSizer.Add(city, 1)
|
||||
cstSizer.Add(state, 0, wx.LEFT | wx.RIGHT, 5)
|
||||
cstSizer.Add(zip)
|
||||
# 把cstSizer加入到addrSizer中
|
||||
addrSizer.Add(cstSizer, pos=(3, 1), span=(1, 1), flag=wx.EXPAND)
|
||||
|
||||
# 电话和电子邮箱
|
||||
addrSizer.Add(phoneLbl, pos=(4, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
|
||||
addrSizer.Add(phone, pos=(4, 1), flag=wx.EXPAND)
|
||||
addrSizer.Add(emailLbl, pos=(5, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
|
||||
addrSizer.Add(email, pos=(5, 1), flag=wx.EXPAND)
|
||||
|
||||
addrSizer.AddGrowableCol(1)
|
||||
# 然后把addrSizer添加到mainSizer中
|
||||
mainSizer.Add(addrSizer, 0, wx.EXPAND | wx.ALL, 10)
|
||||
|
||||
# 按钮放到两边和中间都能伸缩间隔的一行中
|
||||
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btnSizer.Add((20, 20), 1)
|
||||
btnSizer.Add(saveBtn)
|
||||
btnSizer.Add((20, 20), 1)
|
||||
btnSizer.Add(cancelBtn)
|
||||
btnSizer.Add((20, 20), 1)
|
||||
|
||||
mainSizer.Add(btnSizer, 0, wx.EXPAND | wx.BOTTOM, 10)
|
||||
panel.SetSizer(mainSizer)
|
||||
|
||||
# 让框架自适应sizer,如果panel改变大小框架会自动调整尺寸
|
||||
# 同时还能防止框架比panel最小尺寸还小
|
||||
mainSizer.Fit(self)
|
||||
mainSizer.SetSizeHints(self)
|
||||
|
||||
self.Centre()
|
||||
self.Show()
|
||||
|
||||
|
||||
def main():
|
||||
app = wx.App()
|
||||
FormFrame()
|
||||
app.MainLoop()
|
||||
|
||||
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: 显示鼠标的位置
|
||||
Desc :
|
||||
"""
|
||||
import wx
|
||||
__author__ = 'Xiong Neng'
|
||||
|
||||
|
||||
class MyFrame(wx.Frame):
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, -1, "My Frame", size=(300, 300))
|
||||
panel = wx.Panel(self, -1)
|
||||
panel.Bind(wx.EVT_MOTION, self.OnMove)
|
||||
wx.StaticText(panel, -1, 'Pos: ', pos=(40, 10))
|
||||
self.posCtrl = wx.TextCtrl(panel, -1, '', pos=(40, 10))
|
||||
|
||||
def OnMove(self, event):
|
||||
pos = event.GetPosition()
|
||||
self.posCtrl.SetValue('%s, %s' % (pos.x, pos.y))
|
||||
|
||||
|
||||
def main():
|
||||
app = wx.App()
|
||||
frame = MyFrame()
|
||||
frame.Show(True)
|
||||
app.MainLoop()
|
||||
@@ -1,39 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: 显示一张图片
|
||||
Desc :
|
||||
"""
|
||||
__author__ = 'Xiong Neng'
|
||||
import wx
|
||||
import commons.util as util
|
||||
|
||||
|
||||
class MyFrame(wx.Frame):
|
||||
"""Frame class that displays an image"""
|
||||
|
||||
def __init__(self, image, parent=None, id=-1,
|
||||
pos=wx.DefaultPosition,
|
||||
title='Hello, wxPython!'):
|
||||
"""Create a frame instnace and display image"""
|
||||
temp = image.ConvertToBitmap()
|
||||
size = temp.GetWidth(), temp.GetHeight()
|
||||
wx.Frame.__init__(self, parent, id, title, pos, size)
|
||||
self.bmp = wx.StaticBitmap(parent=self, bitmap=temp)
|
||||
|
||||
|
||||
class MyApp(wx.App):
|
||||
"""Application class."""
|
||||
|
||||
def OnInit(self):
|
||||
img = wx.Image(util.resource_path('resources/f22.jpg'), wx.BITMAP_TYPE_JPEG)
|
||||
self.frame = MyFrame(image=img)
|
||||
self.frame.Show(True)
|
||||
self.SetTopWindow(self.frame)
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
app = MyApp()
|
||||
app.MainLoop()
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: 显示文本
|
||||
Desc :
|
||||
"""
|
||||
import wx
|
||||
|
||||
|
||||
class StaticTextFrame(wx.Frame):
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, -1, 'Static Text Example',
|
||||
size=(400, 300))
|
||||
panel = wx.Panel(self, -1)
|
||||
# 这是一个基本的静态文本
|
||||
wx.StaticText(panel, -1, 'This is an example of static text',
|
||||
(100, 10))
|
||||
# 指定了前景色和背景色的静态文本
|
||||
rev = wx.StaticText(panel, -1, 'Static Text With Reversed Colors',
|
||||
(100, 30))
|
||||
rev.SetForegroundColour('white')
|
||||
rev.SetBackgroundColour('black')
|
||||
# 指定居中对齐的的静态文本
|
||||
center = wx.StaticText(panel, -1, 'align center', (100, 50),
|
||||
(160, -1), wx.ALIGN_CENTER)
|
||||
center.SetForegroundColour('white')
|
||||
center.SetBackgroundColour('black')
|
||||
# 指定右对齐的静态文本
|
||||
right = wx.StaticText(panel, -1, 'align right', (100, 70),
|
||||
(160, -1), wx.ALIGN_RIGHT)
|
||||
right.SetForegroundColour('white')
|
||||
right.SetBackgroundColour('black')
|
||||
# 指定新字体的静态文本
|
||||
str = 'You can also change the font.'
|
||||
text = wx.StaticText(panel, -1, str, (20, 100))
|
||||
font = wx.Font(18, wx.DECORATIVE, wx.ITALIC, wx.NORMAL)
|
||||
text.SetFont(font)
|
||||
# 显示多行文本
|
||||
wx.StaticText(panel, -1, 'Your text\ncan be split\n'
|
||||
'over multiple lines\n\neven blank ones', (20, 150))
|
||||
# 显示对齐的多行文本
|
||||
wx.StaticText(panel, -1, 'Multi-line text\ncan also\n'
|
||||
'be right aligned\n\neven with a blank', (220, 150),
|
||||
style=wx.ALIGN_RIGHT)
|
||||
|
||||
|
||||
class TextFrame(wx.Frame):
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, -1, 'Text Entry Example',
|
||||
size=(300, 100))
|
||||
panel = wx.Panel(self, -1)
|
||||
basicLabel = wx.StaticText(panel, -1, 'Basic Control:')
|
||||
basicText = wx.TextCtrl(panel, -1, "I've entered some text!",
|
||||
size=(175, -1))
|
||||
basicText.SetInsertionPoint(0)
|
||||
pwdLabel = wx.StaticText(panel, -1, 'Password:')
|
||||
pwdText = wx.TextCtrl(panel, -1, 'password', size=(175, -1),
|
||||
style=wx.TE_PASSWORD)
|
||||
sizer = wx.FlexGridSizer(cols=2, hgap=6, vgap=6)
|
||||
sizer.AddMany([basicLabel, basicText, pwdLabel, pwdText])
|
||||
panel.SetSizer(sizer)
|
||||
|
||||
|
||||
def main():
|
||||
app = wx.App()
|
||||
# frame = StaticTextFrame()
|
||||
frame = TextFrame()
|
||||
frame.Show()
|
||||
app.MainLoop()
|
||||
@@ -1,264 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: 一个完整的画图程序
|
||||
Desc :
|
||||
"""
|
||||
import wx
|
||||
import commons.util as util
|
||||
|
||||
|
||||
class SketchWindow(wx.Window):
|
||||
def __init__(self, parent, id):
|
||||
wx.Window.__init__(self, parent, id)
|
||||
self.SetBackgroundColour('White')
|
||||
self.color = 'Black'
|
||||
self.thickness = 1
|
||||
# 创建一支笔wx.Pen对象
|
||||
self.pen = wx.Pen(self.color, self.thickness, wx.SOLID)
|
||||
self.lines = []
|
||||
self.curLine = []
|
||||
self.pos = (0, 0)
|
||||
self.InitBuffer()
|
||||
self.Bind(wx.EVT_LEFT_DOWN, self.OnLeftDown)
|
||||
self.Bind(wx.EVT_LEFT_UP, self.OnLeftUp)
|
||||
self.Bind(wx.EVT_MOTION, self.OnMotion)
|
||||
self.Bind(wx.EVT_SIZE, self.OnSize)
|
||||
self.Bind(wx.EVT_IDLE, self.OnIdle)
|
||||
self.Bind(wx.EVT_PAINT, self.OnPaint)
|
||||
|
||||
def InitBuffer(self):
|
||||
size = self.GetClientSize()
|
||||
self.buffer = wx.EmptyBitmap(size.width, size.height)
|
||||
dc = wx.BufferedDC(None, self.buffer)
|
||||
dc.SetBackground(wx.Brush(self.GetBackgroundColour()))
|
||||
dc.Clear()
|
||||
self.DrawLines(dc)
|
||||
self.reInitBuffer = False
|
||||
|
||||
def GetLinesData(self):
|
||||
return self.lines[:]
|
||||
|
||||
def SetLinesData(self, lines):
|
||||
self.lines = lines[:]
|
||||
self.InitBuffer()
|
||||
self.Refresh()
|
||||
|
||||
def OnLeftDown(self, event):
|
||||
self.curLine = []
|
||||
self.pos = event.GetPositionTuple()
|
||||
self.CaptureMouse()
|
||||
|
||||
def OnLeftUp(self, event):
|
||||
if self.HasCapture():
|
||||
self.lines.append((self.color, self.thickness, self.curLine))
|
||||
self.curLine = []
|
||||
self.ReleaseMouse()
|
||||
|
||||
def OnMotion(self, event):
|
||||
if event.Dragging() and event.LeftIsDown():
|
||||
dc = wx.BufferedDC(wx.ClientDC(self), self.buffer)
|
||||
self.drawMotion(dc, event)
|
||||
event.Skip()
|
||||
|
||||
def drawMotion(self, dc, event):
|
||||
dc.SetPen(self.pen)
|
||||
newPos = event.GetPositionTuple()
|
||||
coords = self.pos + newPos
|
||||
self.curLine.append(coords)
|
||||
dc.DrawLine(*coords)
|
||||
self.pos = newPos
|
||||
|
||||
def OnSize(self, event):
|
||||
self.reInitBuffer = True
|
||||
|
||||
def OnIdle(self, event):
|
||||
if self.reInitBuffer:
|
||||
self.InitBuffer()
|
||||
self.Refresh(False)
|
||||
|
||||
def OnPaint(self, event):
|
||||
dc = wx.BufferedPaintDC(self, self.buffer)
|
||||
|
||||
def DrawLines(self, dc):
|
||||
for colour, thickness, line in self.lines:
|
||||
pen = wx.Pen(colour, thickness, wx.SOLID)
|
||||
dc.SetPen(pen)
|
||||
for coords in line:
|
||||
dc.DrawLine(*coords)
|
||||
|
||||
def SetColor(self, color):
|
||||
self.color = color
|
||||
self.pen = wx.Pen(self.color, self.thickness, wx.SOLID)
|
||||
|
||||
def SetThickness(self, num):
|
||||
self.thickness = num
|
||||
self.pen = wx.Pen(self.color, self.thickness, wx.SOLID)
|
||||
|
||||
|
||||
class SketchFrame(wx.Frame):
|
||||
def __init__(self, parent):
|
||||
wx.Frame.__init__(self, parent, -1, 'Sketch Frame',
|
||||
size=(800, 600))
|
||||
self.sketch = SketchWindow(self, -1)
|
||||
self.sketch.Bind(wx.EVT_MOTION, self.OnSketchMotion)
|
||||
self.initStatusBar()
|
||||
self.createMenuBar()
|
||||
self.createToolBar()
|
||||
|
||||
def initStatusBar(self):
|
||||
self.statusbar = self.CreateStatusBar()
|
||||
self.statusbar.SetFieldsCount(3)
|
||||
self.statusbar.SetStatusWidths([-1, -2, -3])
|
||||
|
||||
def OnSketchMotion(self, event):
|
||||
self.statusbar.SetStatusText(
|
||||
"Pos: %s" % str(event.GetPositionTuple()), 0)
|
||||
self.statusbar.SetStatusText(
|
||||
"Current Pts: %s" % len(self.sketch.curLine), 1)
|
||||
self.statusbar.SetStatusText(
|
||||
"Line Count: %s" % len(self.sketch.lines), 2)
|
||||
event.Skip()
|
||||
|
||||
def menuData(self):
|
||||
return [("&File", (
|
||||
("&New", "New Sketch file", self.OnNew),
|
||||
("&Open", "Open sketch file", self.OnOpen),
|
||||
("&Save", "Save sketch file", self.OnSave),
|
||||
("", "", ""),
|
||||
("&Color", (
|
||||
("&Black", "", self.OnColor,
|
||||
wx.ITEM_RADIO),
|
||||
("&Red", "", self.OnColor,
|
||||
wx.ITEM_RADIO),
|
||||
("&Green", "", self.OnColor,
|
||||
wx.ITEM_RADIO),
|
||||
("&Blue", "", self.OnColor,
|
||||
wx.ITEM_RADIO))),
|
||||
("", "", ""),
|
||||
("&Quit", "Quit", self.OnCloseWindow)))]
|
||||
|
||||
def createMenuBar(self):
|
||||
menuBar = wx.MenuBar()
|
||||
for eachMenuData in self.menuData():
|
||||
menuLabel = eachMenuData[0]
|
||||
menuItems = eachMenuData[1]
|
||||
menuBar.Append(self.createMenu(menuItems), menuLabel)
|
||||
self.SetMenuBar(menuBar)
|
||||
|
||||
def createMenu(self, menuData):
|
||||
menu = wx.Menu()
|
||||
for eachItem in menuData:
|
||||
if len(eachItem) == 2:
|
||||
label = eachItem[0]
|
||||
subMenu = self.createMenu(eachItem[1])
|
||||
menu.AppendMenu(wx.NewId(), label, subMenu)
|
||||
else:
|
||||
self.createMenuItem(menu, *eachItem)
|
||||
return menu
|
||||
|
||||
def createMenuItem(self, menu, label, status, handler,
|
||||
kind=wx.ITEM_NORMAL):
|
||||
if not label:
|
||||
menu.AppendSeparator()
|
||||
return
|
||||
menuItem = menu.Append(-1, label, status, kind)
|
||||
self.Bind(wx.EVT_MENU, handler, menuItem)
|
||||
|
||||
def OnNew(self, event):
|
||||
pass
|
||||
|
||||
def OnOpen(self, event):
|
||||
pass
|
||||
|
||||
def OnSave(self, event):
|
||||
pass
|
||||
|
||||
def OnColor(self, event):
|
||||
menubar = self.GetMenuBar()
|
||||
itemId = event.GetId()
|
||||
item = menubar.FindItemById(itemId)
|
||||
color = item.GetLabel()
|
||||
self.sketch.SetColor(color)
|
||||
|
||||
def OnCloseWindow(self, event):
|
||||
self.Destroy()
|
||||
|
||||
def createToolBar(self):
|
||||
toolbar = self.CreateToolBar()
|
||||
for each in self.toolbarData():
|
||||
self.createSimpleTool(toolbar, *each)
|
||||
toolbar.AddSeparator()
|
||||
for each in self.toolbarColorData():
|
||||
self.createColorTool(toolbar, each)
|
||||
toolbar.Realize()
|
||||
|
||||
def createSimpleTool(self, toolbar, label, filename,
|
||||
help, handler):
|
||||
if not label:
|
||||
toolbar.AddSeparator()
|
||||
return
|
||||
bmp = wx.Image(filename,
|
||||
wx.BITMAP_TYPE_BMP).ConvertToBitmap()
|
||||
tool = toolbar.AddSimpleTool(-1, bmp, label, help)
|
||||
self.Bind(wx.EVT_MENU, handler, tool)
|
||||
|
||||
def toolbarData(self):
|
||||
return (("New", util.resource_path("resources/new.bmp")
|
||||
, "Create new sketch", self.OnNew),
|
||||
("", "", "", ""),
|
||||
("Open", util.resource_path("resources/open.bmp")
|
||||
, "Open existing sketch", self.OnOpen),
|
||||
("Save", util.resource_path("resources/save.bmp")
|
||||
, "Save existing sketch", self.OnSave))
|
||||
|
||||
def createColorTool(self, toolbar, color):
|
||||
bmp = self.MakeBitmap(color)
|
||||
newId = wx.NewId()
|
||||
tool = toolbar.AddRadioTool(-1, bmp, shortHelp=color)
|
||||
self.Bind(wx.EVT_MENU, self.OnColor, tool)
|
||||
|
||||
def MakeBitmap(self, color):
|
||||
bmp = wx.EmptyBitmap(16, 15)
|
||||
dc = wx.MemoryDC()
|
||||
dc.SelectObject(bmp)
|
||||
dc.SetBackground(wx.Brush(color))
|
||||
dc.Clear()
|
||||
dc.SelectObject(wx.NullBitmap)
|
||||
return bmp
|
||||
|
||||
def toolbarColorData(self):
|
||||
return ("Black", "Red", "Green", "Blue")
|
||||
|
||||
def OnColor(self, event):
|
||||
menubar = self.GetMenuBar()
|
||||
itemId = event.GetId()
|
||||
item = menubar.FindItemById(itemId)
|
||||
if not item:
|
||||
toolbar = self.GetToolBar()
|
||||
item = toolbar.FindById(itemId)
|
||||
color = item.GetShortHelp()
|
||||
else:
|
||||
color = item.GetLabel()
|
||||
self.sketch.SetColor(color)
|
||||
|
||||
|
||||
class SketchApp(wx.App):
|
||||
def OnInit(self):
|
||||
image = wx.Image(
|
||||
util.resource_path('resources/splash.bmp'), wx.BITMAP_TYPE_BMP)
|
||||
bmp = image.ConvertToBitmap()
|
||||
wx.SplashScreen(bmp, wx.SPLASH_CENTER_ON_SCREEN |
|
||||
wx.SPLASH_TIMEOUT, 1000, None, -1)
|
||||
wx.Yield()
|
||||
import time
|
||||
time.sleep(1)
|
||||
frame = SketchFrame(None)
|
||||
frame.Show()
|
||||
self.SetTopWindow(frame)
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
app = SketchApp()
|
||||
app.MainLoop()
|
||||
@@ -1,168 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: paramiko模块演示
|
||||
https://github.com/paramiko/paramiko/tree/master/demos
|
||||
|
||||
安装python3-pycrypto-windows
|
||||
python3.4版本之前:http://www.voidspace.org.uk/python/modules.shtml#pycrypto
|
||||
python3.4最新版本:https://github.com/axper/python3-pycrypto-windows-installer
|
||||
|
||||
先安装Visual C++ 2010 Express,这个是免费的:
|
||||
http://www.visualstudio.com/zh-cn/downloads/download-visual-studio-vs#DownloadFamilies_4
|
||||
|
||||
安装后可以先试着pip install paramiko看能不能成功,如果还不行就再下载下面的:
|
||||
如果安装上面的最后提示还有个SQL Server 2008 Express Service Pack1没安装成功,那么自己手动去下载安装:
|
||||
http://www.microsoft.com/zh-tw/download/details.aspx?id=25052
|
||||
|
||||
pip install paramiko
|
||||
|
||||
|
||||
"""
|
||||
import paramiko
|
||||
import os
|
||||
from os import listdir
|
||||
from os.path import isfile, join
|
||||
import zipfile
|
||||
import logging
|
||||
|
||||
HOSTNAME = '115.29.145.245' # remote hostname where SSH server is running
|
||||
PORT = 22
|
||||
USERNAME = 'winhong'
|
||||
PASSWORD = 'jianji2014'
|
||||
# RSA_PRIVATE_KEY = r"/home/paramikouser/.ssh/rsa_private_key"
|
||||
|
||||
DIR_LOCAL = r'D:\Wingarden\src\trunk\ling\target\classes\com'
|
||||
DIR_REMOTE_CONFIG = r"/usr/local/apache-tomcat-8.0.15/webapps/ROOT/WEB-INF/classes"
|
||||
DIR_REMOTE = r"/usr/local/apache-tomcat-8.0.15/webapps/ROOT/WEB-INF/classes/com"
|
||||
COMMAND_01 = '/home/winhong/ling01.sh'
|
||||
COMMAND_02 = '/home/winhong/ling02.sh'
|
||||
|
||||
ZIPDIR_SRC = r'D:\Wingarden\src\trunk\ling\target\classes\com'
|
||||
ZIPDIR_DEST = r'D:\Wingarden\src\trunk\ling'
|
||||
ZIPNAME = 'ling.zip'
|
||||
ZIPNAME_CONFIG = 'lingconfig.zip'
|
||||
|
||||
# get host key, if we know one
|
||||
# HOSTKEYTYPE = None
|
||||
# HOSTKEY = None
|
||||
|
||||
_LOGGING = logging.getLogger('ztransfer')
|
||||
|
||||
|
||||
def zipdir(path, zipf):
|
||||
for root, dirs, files in os.walk(path):
|
||||
for myfile in files:
|
||||
zipf.write(os.path.join(root, myfile),
|
||||
arcname=os.path.join(root.split('\com\\', 1)[1], myfile))
|
||||
|
||||
|
||||
def zipdir_config(mypath, zipf):
|
||||
onlyfiles = [f for f in listdir(mypath) if isfile(join(mypath, f))]
|
||||
for myfile in onlyfiles:
|
||||
if myfile.endswith('config.properties'):
|
||||
continue
|
||||
elif myfile.endswith('config.properties.tmp'):
|
||||
zipf.write(os.path.join(mypath, myfile), arcname='config.properties')
|
||||
else:
|
||||
zipf.write(os.path.join(mypath, myfile), arcname=myfile)
|
||||
|
||||
|
||||
def ziputil(zip_dir_src, zip_dir_dest):
|
||||
_LOGGING.info('#ziputil start')
|
||||
# check if exists delete it
|
||||
check_zip_file = os.path.join(zip_dir_dest, ZIPNAME)
|
||||
zip_dir_dest_config = os.path.abspath(os.path.join(zip_dir_dest, '..'))
|
||||
check_zip_file_config = os.path.join(zip_dir_dest_config, ZIPNAME_CONFIG)
|
||||
if os.path.isfile(check_zip_file):
|
||||
os.remove(check_zip_file)
|
||||
if os.path.isfile(check_zip_file_config):
|
||||
os.remove(check_zip_file_config)
|
||||
|
||||
zipf = zipfile.ZipFile(check_zip_file, 'w', zipfile.ZIP_DEFLATED)
|
||||
zipdir(zip_dir_src, zipf)
|
||||
zipf.close()
|
||||
|
||||
zipf_config = zipfile.ZipFile(check_zip_file_config, 'w', zipfile.ZIP_DEFLATED)
|
||||
zipdir_config(os.path.abspath(os.path.join(zip_dir_src, '..')), zipf_config)
|
||||
zipf_config.close()
|
||||
|
||||
_LOGGING.info('#ziputil end')
|
||||
return zip_dir_dest, ZIPNAME, zip_dir_dest_config, ZIPNAME_CONFIG
|
||||
|
||||
|
||||
def transfer_file(hostname_, port_, username_, password_, fdir_, fname_, fdir_config, fname_config):
|
||||
_LOGGING.info('#transfer_file start')
|
||||
local_file = os.path.join(fdir_, fname_)
|
||||
local_file_config = os.path.join(fdir_config, fname_config)
|
||||
try:
|
||||
_LOGGING.info('Establishing SSH connection to: %s:%s' % (hostname_, port_))
|
||||
t = paramiko.Transport((hostname_, port_))
|
||||
t.start_client()
|
||||
|
||||
if not t.is_authenticated():
|
||||
_LOGGING.info('Trying password login...')
|
||||
t.auth_password(username=username_, password=password_)
|
||||
|
||||
sftp = paramiko.SFTPClient.from_transport(t)
|
||||
|
||||
remote_file = DIR_REMOTE + '/' + fname_
|
||||
remote_file_config = DIR_REMOTE_CONFIG + '/' + fname_config
|
||||
try:
|
||||
_LOGGING.info('start transport...')
|
||||
sftp.put(local_file, remote_file)
|
||||
sftp.put(local_file_config, remote_file_config)
|
||||
except:
|
||||
_LOGGING.error('error...')
|
||||
raise
|
||||
t.close()
|
||||
except Exception as e:
|
||||
_LOGGING.error('transfer error...')
|
||||
try:
|
||||
_LOGGING.info('end transport and close it...')
|
||||
t.close()
|
||||
except:
|
||||
pass
|
||||
finally:
|
||||
_LOGGING.info(u'传输完成后删除本地的zip文件...')
|
||||
if os.path.isfile(local_file):
|
||||
os.remove(local_file)
|
||||
if os.path.isfile(local_file_config):
|
||||
os.remove(local_file_config)
|
||||
_LOGGING.info('#transfer_file end')
|
||||
|
||||
|
||||
def exe_command(hostname_, username_, password_, commandpaths_):
|
||||
_LOGGING.info('#exe_command start')
|
||||
ssh = paramiko.SSHClient()
|
||||
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
ssh.connect(hostname_, username=username_, password=password_)
|
||||
# channel = ssh.invoke_shell()
|
||||
# ssh_stdin, ssh_stdout, ssh_stderr = channel.exec_command(commandpath_)
|
||||
for command_ in commandpaths_:
|
||||
commandpath_, issudo = command_
|
||||
ssh_stdin, ssh_stdout, ssh_stderr = ssh.exec_command(commandpath_, get_pty=issudo)
|
||||
for eline in ssh_stdout.readlines():
|
||||
pass
|
||||
# _LOGGING.info('ssh_stdout:%s' % (eline,))
|
||||
for eline in ssh_stderr.readlines():
|
||||
pass
|
||||
_LOGGING.error('ssh_stderr:%s' % (eline,))
|
||||
# Cleanup
|
||||
ssh_stdin.close()
|
||||
ssh_stdout.close()
|
||||
ssh_stderr.close()
|
||||
# channel.close()
|
||||
ssh.close()
|
||||
_LOGGING.info('#exe_command end')
|
||||
return True
|
||||
|
||||
|
||||
def main():
|
||||
# 第一步:zip压缩class文件包和配置文件包
|
||||
ffdir, ffname, cfdir, cfname = ziputil(ZIPDIR_SRC, ZIPDIR_DEST)
|
||||
# 第二步:SSH传输class文件压缩包和配置文件压缩包
|
||||
transfer_file(HOSTNAME, PORT, USERNAME, PASSWORD, ffdir, ffname, cfdir, cfname)
|
||||
# 第四步:执行远程shell脚本,替换配置文件和class文件并重启,注意sudo和非sudo分开执行
|
||||
return exe_command(HOSTNAME, USERNAME, PASSWORD, [(COMMAND_01, True), (COMMAND_02, False)])
|
||||
|
||||
@@ -1,582 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: 小令自动发布工具
|
||||
Desc :
|
||||
"""
|
||||
import wx
|
||||
import wx.html
|
||||
import examples.ztransfer as ztransfer
|
||||
import commons.util as zutil
|
||||
import os
|
||||
import subprocess
|
||||
import logging
|
||||
import time
|
||||
import tempfile
|
||||
import sys
|
||||
from threading import Thread
|
||||
from wx.lib.pubsub import pub
|
||||
import ConfigParser
|
||||
import wx.lib.agw.pyprogress as PP
|
||||
|
||||
HOSTNAME_ = '115.29.145.245' # remote hostname where SSH server is running
|
||||
USERNAME_ = 'winhong'
|
||||
PASSWORD_ = 'jianji2014'
|
||||
TOMAT_REMOTE_ = r"/usr/local/apache-tomcat-8.0.15"
|
||||
# DIR_REMOTE = r"/usr/local/apache-tomcat-8.0.15/webapps/ROOT/WEB-INF/classes/com"
|
||||
COMMAND_01_ = '/home/winhong/ling01.sh'
|
||||
COMMAND_02_ = '/home/winhong/ling02.sh'
|
||||
|
||||
_LOGGING = logging.getLogger('zupload')
|
||||
|
||||
IS_WIN32 = 'win32' in str(sys.platform).lower()
|
||||
|
||||
|
||||
def subprocess_call(*args, **kwargs):
|
||||
# also works for Popen. It creates a new *hidden* window,
|
||||
# so it will work in frozen apps (.exe).
|
||||
if IS_WIN32:
|
||||
_LOGGING.info('subprocess_call==IS_WIN32')
|
||||
startupinfo = subprocess.STARTUPINFO()
|
||||
startupinfo.dwFlags = subprocess.CREATE_NEW_CONSOLE | subprocess.STARTF_USESHOWWINDOW
|
||||
startupinfo.wShowWindow = subprocess.SW_HIDE
|
||||
kwargs['startupinfo'] = startupinfo
|
||||
retcode = subprocess.call(*args, **kwargs)
|
||||
return retcode
|
||||
|
||||
|
||||
def subprocess_popen(*args, **kwargs):
|
||||
# also works for Popen. It creates a new *hidden* window,
|
||||
# so it will work in frozen apps (.exe).
|
||||
if IS_WIN32:
|
||||
_LOGGING.info('subprocess_call==IS_WIN32')
|
||||
startupinfo = subprocess.STARTUPINFO()
|
||||
startupinfo.dwFlags = subprocess.CREATE_NEW_CONSOLE | subprocess.STARTF_USESHOWWINDOW
|
||||
startupinfo.wShowWindow = subprocess.SW_HIDE
|
||||
kwargs['startupinfo'] = startupinfo
|
||||
ppopen = subprocess.Popen(*args, **kwargs)
|
||||
return ppopen
|
||||
|
||||
|
||||
class MyConfig():
|
||||
def __init__(self, hostname=HOSTNAME_, username=USERNAME_, password=PASSWORD_,
|
||||
projdir='', mavendir='', tomcatdir=TOMAT_REMOTE_,
|
||||
command1=COMMAND_01_, command2=COMMAND_02_):
|
||||
self.hostname = hostname
|
||||
self.username = username
|
||||
self.password = password
|
||||
self.projdir = projdir
|
||||
self.mavendir = mavendir
|
||||
self.tomcatdir = tomcatdir
|
||||
self.command1 = command1
|
||||
self.command2 = command2
|
||||
|
||||
|
||||
def saveConfig(myconfig):
|
||||
config_file = zutil.userhome_file('ztool.conf')
|
||||
# check if file exists
|
||||
cf = ConfigParser.ConfigParser()
|
||||
if os.path.isfile(config_file):
|
||||
# update file
|
||||
cf.read(config_file)
|
||||
else:
|
||||
# create file
|
||||
cf.add_section('main')
|
||||
for k, v in vars(myconfig).iteritems():
|
||||
cf.set("main", k, v)
|
||||
with open(config_file, "w") as f:
|
||||
cf.write(f)
|
||||
|
||||
|
||||
def loadConfig():
|
||||
config = MyConfig()
|
||||
userhome = os.path.expanduser('~')
|
||||
config_file = os.path.join(userhome, 'ztool.conf')
|
||||
if os.path.isfile(config_file):
|
||||
cf = ConfigParser.ConfigParser()
|
||||
cf.read(config_file)
|
||||
for k, v in vars(config).iteritems():
|
||||
setattr(config, k, cf.get('main', k))
|
||||
return config
|
||||
|
||||
|
||||
class Ling01(wx.Dialog):
|
||||
text = u'''
|
||||
<html>
|
||||
<body bgcolor="#ACAA60">
|
||||
<center>
|
||||
<table bgcolor="#455481" width="100%" cellspacing="0"
|
||||
cellpadding=”0” border=”1”>
|
||||
<tr>
|
||||
<td align="center"><h1>ling01.sh示例代码</h1></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<p>
|
||||
#!/bin/bash<br><br>
|
||||
|
||||
echo '先停止tomcat...'<br>
|
||||
ps aux |grep tomcat |grep -v 'grep tomcat' |awk '{print $2}'|sudo xargs kill -9<br>
|
||||
wait<br><br>
|
||||
|
||||
echo '成功停止!开始替换class文件'<br>
|
||||
cd /usr/local/apache-tomcat-8.0.15/webapps/ROOT/WEB-INF/classes/com<br>
|
||||
rm -rf winhong/<br>
|
||||
unzip ling.zip<br>
|
||||
wait<br>
|
||||
rm -f ling.zip<br>
|
||||
echo 'class文件解压替换完成,开始替换配置文件'<br>
|
||||
cd ..<br>
|
||||
find . -maxdepth 1 -type f -not -name '*.zip' -print0 | xargs -0 rm<br>
|
||||
unzip lingconfig.zip<br>
|
||||
wait<br>
|
||||
rm -f lingconfig.zip<br>
|
||||
echo '配置文件解压替换完成'<br>
|
||||
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
'''
|
||||
|
||||
def __init__(self, parent):
|
||||
wx.Dialog.__init__(self, parent, -1, u'ling01.sh示例', size=(600, 450))
|
||||
html = wx.html.HtmlWindow(self)
|
||||
html.SetPage(self.text)
|
||||
button = wx.Button(self, wx.ID_OK, u'确定')
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
sizer.Add(html, 1, wx.EXPAND | wx.ALL, 5)
|
||||
sizer.Add(button, 0, wx.ALIGN_CENTER | wx.ALL, 5)
|
||||
self.SetSizer(sizer)
|
||||
self.Layout()
|
||||
|
||||
|
||||
class Ling02(wx.Dialog):
|
||||
text = u'''
|
||||
<html>
|
||||
<body bgcolor="#ACAA60">
|
||||
<center>
|
||||
<table bgcolor="#455481" width="100%" cellspacing="0"
|
||||
cellpadding=”0” border=”1”>
|
||||
<tr>
|
||||
<td align="center"><h1>ling02.sh示例代码</h1></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<p>
|
||||
#!/bin/bash<br><br>
|
||||
|
||||
echo '开始重启tomcat....'<br>
|
||||
/usr/local/apache-tomcat-8.0.15/bin/startup.sh<br>
|
||||
wait<br><br>
|
||||
|
||||
echo '重启成功...'<br>
|
||||
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
'''
|
||||
|
||||
def __init__(self, parent):
|
||||
wx.Dialog.__init__(self, parent, -1, u'ling02.sh示例', size=(600, 400))
|
||||
html = wx.html.HtmlWindow(self)
|
||||
html.SetPage(self.text)
|
||||
button = wx.Button(self, wx.ID_OK, u'确定')
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
sizer.Add(html, 1, wx.EXPAND | wx.ALL, 5)
|
||||
sizer.Add(button, 0, wx.ALIGN_CENTER | wx.ALL, 5)
|
||||
self.SetSizer(sizer)
|
||||
self.Layout()
|
||||
|
||||
|
||||
class SketchGuide(wx.Dialog):
|
||||
text = u'''
|
||||
<html>
|
||||
<body bgcolor="#ACAA60">
|
||||
<center>
|
||||
<table bgcolor="#455481" width="100%" cellspacing="0"
|
||||
cellpadding=”0” border=”1”>
|
||||
<tr>
|
||||
<td align="center"><h1>使用帮助!</h1></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<p>
|
||||
<b>简介:</b>自动编译代码并上传到服务器,然后替换class文件并重启tomcat
|
||||
</p>
|
||||
<p>
|
||||
<b>1.更新代码:</b>请先确保代码源代码已经从svn更新到最新了。
|
||||
</p>
|
||||
<p>
|
||||
<b>2.Tomcat目录</b> 服务器上面Tomcat的根目录
|
||||
</p>
|
||||
<p>
|
||||
<b>3.远程脚本1</b> 使用sudo命令去kill掉tomcat进程(参考ling01.sh)
|
||||
</p>
|
||||
<p>
|
||||
<b>4.远程脚本2</b> 非sudo方式启动tomcat,需要设置sudoers(参考ling02.sh)
|
||||
</p>
|
||||
<p>
|
||||
<b>5.Maven目录(选填)</b> 如果mvn命令还没有添加到系统PATH中就需要填这个。
|
||||
</p>
|
||||
<p>
|
||||
<b>6.配置文件</b> 本地:config.properties,服务器:config.properties.tmp。
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
'''
|
||||
|
||||
def __init__(self, parent):
|
||||
wx.Dialog.__init__(self, parent, -1, 'Use Guide', size=(600, 400))
|
||||
html = wx.html.HtmlWindow(self)
|
||||
html.SetPage(self.text)
|
||||
button = wx.Button(self, wx.ID_OK, u'确定')
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
sizer.Add(html, 1, wx.EXPAND | wx.ALL, 5)
|
||||
sizer.Add(button, 0, wx.ALIGN_CENTER | wx.ALL, 5)
|
||||
self.SetSizer(sizer)
|
||||
self.Layout()
|
||||
|
||||
|
||||
class SketchAbout(wx.Dialog):
|
||||
text = u'''
|
||||
<html>
|
||||
<body bgcolor="#ACAA60">
|
||||
<center>
|
||||
<table bgcolor="#455481" width="100%" cellspacing="0"
|
||||
cellpadding=”0” border=”1”>
|
||||
<tr>
|
||||
<td align="center"><h1>小令发布工具</h1></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td align="center"><h4>Profession Edition 1.0.0</h4></td>
|
||||
</tr>
|
||||
</table>
|
||||
</center>
|
||||
<br/><br/><br/><br/><br/>
|
||||
<p style="text-align: right; margin-top: 100px;">
|
||||
Powered By XiongNeng 2015/01/21
|
||||
</p>
|
||||
</body>
|
||||
</html>
|
||||
'''
|
||||
|
||||
def __init__(self, parent):
|
||||
wx.Dialog.__init__(self, parent, -1, 'About', size=(600, 300))
|
||||
html = wx.html.HtmlWindow(self)
|
||||
html.SetPage(self.text)
|
||||
button = wx.Button(self, wx.ID_OK, u'确定')
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
sizer.Add(html, 1, wx.EXPAND | wx.ALL, 5)
|
||||
sizer.Add(button, 0, wx.ALIGN_CENTER | wx.ALL, 5)
|
||||
self.SetSizer(sizer)
|
||||
self.Layout()
|
||||
|
||||
|
||||
########################################################################
|
||||
class ButtonThread(Thread):
|
||||
"""Button Worker Thread Class."""
|
||||
# ----------------------------------------------------------------------
|
||||
def __init__(self, myframe):
|
||||
"""Init Worker Thread Class."""
|
||||
Thread.__init__(self)
|
||||
self.myframe = myframe
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def run(self):
|
||||
self.myframe.buttonEnd = False
|
||||
self.myframe.buttonResult = False
|
||||
|
||||
# save config
|
||||
hostname = self.myframe.hostname.GetValue()
|
||||
username = self.myframe.username.GetValue()
|
||||
password = self.myframe.password.GetValue()
|
||||
tomcathome = self.myframe.tomcat.GetValue()
|
||||
command1 = self.myframe.command1.GetValue()
|
||||
command2 = self.myframe.command2.GetValue()
|
||||
projdir = self.myframe.proj.GetValue()
|
||||
maven_home = self.myframe.maven.GetValue()
|
||||
myconf = MyConfig(hostname=hostname, username=username, password=password,
|
||||
projdir=projdir, mavendir=maven_home, tomcatdir=tomcathome,
|
||||
command1=command1, command2=command2)
|
||||
# 先更新模块的配置
|
||||
self.myframe.ChangeConfig(myconfig=myconf)
|
||||
# 然后同步到本地配置文件中
|
||||
saveConfig(myconfig=myconf)
|
||||
errmsg = ''
|
||||
try:
|
||||
# 先本地编译
|
||||
if not maven_home:
|
||||
exe_command = 'cd /d %s && mvn clean && mvn compile' % projdir
|
||||
else:
|
||||
mvn_full = os.path.join(maven_home, 'bin', 'mvn')
|
||||
exe_command = 'cd /d %s && %s clean && %s compile' % (projdir, mvn_full, mvn_full)
|
||||
_LOGGING.info('#subprocess exe_command start: %s' % exe_command)
|
||||
# 执行命令,但是捕捉输出
|
||||
# if os.name == 'nt':
|
||||
# _LOGGING.info('os.name==nt')
|
||||
# startupinfo = subprocess.STARTUPINFO()
|
||||
# startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
|
||||
exresult = subprocess_call(exe_command, shell=True)
|
||||
# exresult = subprocess_popen(exe_command, shell=True, stdout=subprocess.PIPE)
|
||||
# out = exresult.stdout.read()
|
||||
# _LOGGING.info(out)
|
||||
_LOGGING.info('#subprocess_call result is %s' % exresult)
|
||||
_LOGGING.info('#subprocess_call exe_command end')
|
||||
if exresult != 0:
|
||||
result = False
|
||||
errmsg = 'execute maven command failure.'
|
||||
else:
|
||||
result = ztransfer.main()
|
||||
except Exception as e:
|
||||
result = False
|
||||
errmsg = e.message
|
||||
self.myframe.buttonEnd = True
|
||||
self.myframe.buttonResult = result
|
||||
self.myframe.buttonMsg = errmsg
|
||||
|
||||
|
||||
class CheckThread(Thread):
|
||||
"""每隔0.5秒检查是否已经完成"""
|
||||
# ----------------------------------------------------------------------
|
||||
def __init__(self, myframe):
|
||||
"""Init Worker Thread Class."""
|
||||
Thread.__init__(self)
|
||||
self.myframe = myframe
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def run(self):
|
||||
"""Run Worker Thread."""
|
||||
# This is the code executing in the new thread.
|
||||
while not self.myframe.buttonEnd:
|
||||
time.sleep(0.5)
|
||||
wx.CallAfter(pub.sendMessage, "update",
|
||||
msg=(self.myframe.buttonEnd, self.myframe.buttonResult,
|
||||
self.myframe.buttonMsg))
|
||||
|
||||
|
||||
########################################################################
|
||||
class MyProgressDialog(wx.Dialog):
|
||||
"""进度条弹出框"""
|
||||
# ----------------------------------------------------------------------
|
||||
def __init__(self):
|
||||
"""Constructor"""
|
||||
wx.Dialog.__init__(self, None, title=u"同步进度条", size=(350, 150))
|
||||
self.count = 0
|
||||
self.progress = wx.Gauge(self, -1, 19, (20, 50), size=(300, 30))
|
||||
self.tips = wx.StaticText(self, -1, u'正在同步,请耐心等待几秒钟...')
|
||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
||||
sizer.Add(self.progress, 0, wx.EXPAND)
|
||||
sizer.Add((20, 20), 0, wx.EXPAND)
|
||||
sizer.Add(self.tips, 0, wx.EXPAND)
|
||||
self.SetSizer(sizer)
|
||||
|
||||
# create a pubsub receiver
|
||||
pub.subscribe(self.updateProgress, "update")
|
||||
|
||||
# ----------------------------------------------------------------------
|
||||
def updateProgress(self, msg):
|
||||
"""更新进度条"""
|
||||
self.count += 1
|
||||
if msg[0]:
|
||||
self.Destroy()
|
||||
if msg[1]:
|
||||
_LOGGING.info('MessageDialog.upload.success!!!')
|
||||
wx.MessageDialog(self, u'上传成功了!',
|
||||
'MessageDialog', wx.ICON_INFORMATION).ShowModal()
|
||||
else:
|
||||
_LOGGING.error('MessageDialog.upload.error!!!')
|
||||
wx.MessageDialog(self, u'上传失败,error:%s!' % msg[2],
|
||||
'MessageDialog', wx.ICON_INFORMATION).ShowModal()
|
||||
elif self.count >= 19:
|
||||
self.count = 1
|
||||
|
||||
self.progress.SetValue(self.count)
|
||||
|
||||
|
||||
class UploadFrame(wx.Frame):
|
||||
def __init__(self):
|
||||
wx.Frame.__init__(self, None, -1, u'小令自动发布工具')
|
||||
ico = wx.Icon(zutil.resource_path('resources/main.ico'), wx.BITMAP_TYPE_ICO)
|
||||
self.SetIcon(ico)
|
||||
|
||||
self.buttonEnd = False
|
||||
self.buttonResult = False
|
||||
self.buttonMsg = ''
|
||||
# 创建一个菜单栏
|
||||
menuBar = wx.MenuBar()
|
||||
|
||||
# 创建几个菜单
|
||||
menu1 = wx.Menu()
|
||||
menuBar.Append(menu1, '&File')
|
||||
menu1.Append(-1, "&Open", 'Open new file')
|
||||
menuItem = menu1.Append(-1, "&Exit", 'Exit System')
|
||||
# 菜单项绑定事件
|
||||
self.Bind(wx.EVT_MENU, self.OnCloseMe, menuItem)
|
||||
|
||||
menu2 = wx.Menu()
|
||||
# 创建菜单项MenuItem
|
||||
menu2.Append(wx.NewId(), '&Copy', 'Copy in status bar')
|
||||
menu2.Append(wx.NewId(), '&Cut', '')
|
||||
menu2.Append(wx.NewId(), '&Paste', '')
|
||||
menu2.AppendSeparator()
|
||||
menu2.Append(wx.NewId(), '&Options', 'Display Options')
|
||||
menuBar.Append(menu2, '&Edit') # 在菜单栏上附上菜单
|
||||
|
||||
menu3 = wx.Menu()
|
||||
menuBar.Append(menu3, '&Help')
|
||||
guideItems = menu3.Append(-1, "&Use Guide", '')
|
||||
ling01Items = menu3.Append(-1, u"&ling01.sh", '')
|
||||
ling02Items = menu3.Append(-1, u"&ling02.sh", '')
|
||||
aboutItem3 = menu3.Append(-1, "&About", '')
|
||||
# 菜单项绑定事件
|
||||
self.Bind(wx.EVT_MENU, self.OnGuide, guideItems)
|
||||
self.Bind(wx.EVT_MENU, self.OnLing01, ling01Items)
|
||||
self.Bind(wx.EVT_MENU, self.OnLing02, ling02Items)
|
||||
self.Bind(wx.EVT_MENU, self.OnAbout, aboutItem3)
|
||||
|
||||
self.SetMenuBar(menuBar) # 在Frame上面附加菜单
|
||||
# ----------------------------分割线----------------------------------
|
||||
# 加载配置文件
|
||||
myconfig = loadConfig()
|
||||
panel = wx.Panel(self)
|
||||
# 首先创建controls
|
||||
topLbl = wx.StaticText(panel, -1, u'================小令自动发布工具===============')
|
||||
topLbl.SetFont(wx.Font(18, wx.SWISS, wx.NORMAL, wx.BOLD))
|
||||
hostLbl = wx.StaticText(panel, -1, u'服务器地址:')
|
||||
self.hostname = wx.TextCtrl(panel, -1, myconfig.hostname)
|
||||
usernameLbl = wx.StaticText(panel, -1, u'登录用户名:')
|
||||
self.username = wx.TextCtrl(panel, -1, myconfig.username)
|
||||
passwordLbl = wx.StaticText(panel, -1, u'密码:')
|
||||
self.password = wx.TextCtrl(panel, -1, myconfig.password, style=wx.TE_PASSWORD)
|
||||
tomcatLbl = wx.StaticText(panel, -1, u'Tomcat目录:')
|
||||
self.tomcat = wx.TextCtrl(panel, -1, myconfig.tomcatdir)
|
||||
command1Lbl = wx.StaticText(panel, -1, u'远程脚本1:')
|
||||
self.command1 = wx.TextCtrl(panel, -1, myconfig.command1)
|
||||
command2Lbl = wx.StaticText(panel, -1, u'远程脚本2:')
|
||||
self.command2 = wx.TextCtrl(panel, -1, myconfig.command2)
|
||||
projLbl = wx.StaticText(panel, -1, u'本地工程目录:')
|
||||
self.proj = wx.TextCtrl(panel, -1, myconfig.projdir)
|
||||
mavenbl = wx.StaticText(panel, -1, u'Maven目录(选填):')
|
||||
self.maven = wx.TextCtrl(panel, -1, myconfig.mavendir)
|
||||
saveBtn = wx.Button(panel, -1, u'开始发布')
|
||||
cancelBtn = wx.Button(panel, -1, u'关闭')
|
||||
|
||||
# 下面开始布局
|
||||
# mainSizer是顶级sizer,控制所有部件,使用box sizer
|
||||
# 垂直sizer
|
||||
mainSizer = wx.BoxSizer(wx.VERTICAL)
|
||||
# boxsizer.Add(btn1, proportion=0, flag=wx.ALL, border=2)
|
||||
mainSizer.Add(topLbl, 0, wx.ALL, 5)
|
||||
mainSizer.Add(wx.StaticLine(panel), 0, wx.EXPAND | wx.TOP | wx.BOTTOM, 5)
|
||||
|
||||
# addrSizer控制所有地址信息,使用gridbag sizer
|
||||
addrSizer = wx.GridBagSizer(hgap=5, vgap=5)
|
||||
# sizer.Add(bw, pos=(3,0), span=(1,4), flag=wx.EXPAND)
|
||||
addrSizer.Add(hostLbl, pos=(0, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
|
||||
addrSizer.Add(self.hostname, pos=(0, 1), flag=wx.EXPAND)
|
||||
|
||||
addrSizer.Add(usernameLbl, pos=(1, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
|
||||
addrSizer.Add(self.username, pos=(1, 1), flag=wx.EXPAND)
|
||||
|
||||
addrSizer.Add(passwordLbl, pos=(2, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
|
||||
addrSizer.Add(self.password, pos=(2, 1), flag=wx.EXPAND)
|
||||
|
||||
addrSizer.Add(tomcatLbl, pos=(3, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
|
||||
addrSizer.Add(self.tomcat, pos=(3, 1), flag=wx.EXPAND)
|
||||
|
||||
addrSizer.Add(command1Lbl, pos=(4, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
|
||||
addrSizer.Add(self.command1, pos=(4, 1), flag=wx.EXPAND)
|
||||
|
||||
addrSizer.Add(command2Lbl, pos=(5, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
|
||||
addrSizer.Add(self.command2, pos=(5, 1), flag=wx.EXPAND)
|
||||
|
||||
addrSizer.Add(projLbl, pos=(6, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
|
||||
addrSizer.Add(self.proj, pos=(6, 1), flag=wx.EXPAND)
|
||||
|
||||
addrSizer.Add(mavenbl, pos=(7, 0), flag=wx.ALIGN_RIGHT | wx.ALIGN_CENTER_VERTICAL)
|
||||
addrSizer.Add(self.maven, pos=(7, 1), flag=wx.EXPAND)
|
||||
|
||||
# 添加几个实际的空白行
|
||||
addrSizer.Add((30, 30), pos=(8, 0), span=(1, 2), flag=wx.EXPAND)
|
||||
|
||||
addrSizer.AddGrowableCol(1)
|
||||
# 然后把addrSizer添加到mainSizer中
|
||||
mainSizer.Add(addrSizer, 0, wx.EXPAND | wx.ALL, 10)
|
||||
|
||||
# 按钮放到两边和中间都能伸缩间隔的一行中
|
||||
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
|
||||
btnSizer.Add((20, 20), 1)
|
||||
btnSizer.Add(saveBtn)
|
||||
btnSizer.Add((20, 20), 1)
|
||||
btnSizer.Add(cancelBtn)
|
||||
btnSizer.Add((20, 20), 1)
|
||||
|
||||
self.Bind(wx.EVT_BUTTON, self.OnUploadMe, saveBtn)
|
||||
self.Bind(wx.EVT_BUTTON, self.OnCloseMe, cancelBtn)
|
||||
|
||||
mainSizer.Add(btnSizer, 0, wx.EXPAND | wx.BOTTOM, 10)
|
||||
panel.SetSizer(mainSizer)
|
||||
|
||||
# 让框架自适应sizer,如果panel改变大小框架会自动调整尺寸
|
||||
# 同时还能防止框架比panel最小尺寸还小
|
||||
mainSizer.Fit(self)
|
||||
mainSizer.SetSizeHints(self)
|
||||
|
||||
self.Centre()
|
||||
self.Show()
|
||||
|
||||
def OnCloseMe(self, event):
|
||||
self.Close(True)
|
||||
|
||||
def OnGuide(self, event):
|
||||
dlg = SketchGuide(self)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
def OnLing01(self, event):
|
||||
dlg = Ling01(self)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
def OnLing02(self, event):
|
||||
dlg = Ling02(self)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
def OnAbout(self, event):
|
||||
dlg = SketchAbout(self)
|
||||
dlg.ShowModal()
|
||||
dlg.Destroy()
|
||||
|
||||
def OnUploadMe(self, event):
|
||||
btn = event.GetEventObject()
|
||||
btn.Disable()
|
||||
|
||||
ButtonThread(self).start()
|
||||
CheckThread(self).start()
|
||||
|
||||
dlg = MyProgressDialog()
|
||||
dlg.ShowModal()
|
||||
|
||||
btn.Enable()
|
||||
|
||||
def ChangeConfig(self, myconfig):
|
||||
ztransfer.HOSTNAME = myconfig.hostname
|
||||
ztransfer.USERNAME = myconfig.username
|
||||
ztransfer.PASSWORD = myconfig.password
|
||||
ztransfer.DIR_LOCAL = os.path.join(myconfig.projdir, 'target', 'classes', 'com')
|
||||
ztransfer.ZIPDIR_SRC = os.path.join(myconfig.projdir, 'target', 'classes', 'com')
|
||||
ztransfer.ZIPDIR_DEST = myconfig.projdir
|
||||
if myconfig.tomcatdir.endswith('/'):
|
||||
myconfig.tomcatdir = myconfig.tomcatdir[:-1]
|
||||
ztransfer.DIR_REMOTE_CONFIG = myconfig.tomcatdir + '/webapps/ROOT/WEB-INF/classes'
|
||||
ztransfer.DIR_REMOTE = myconfig.tomcatdir + '/webapps/ROOT/WEB-INF/classes/com'
|
||||
ztransfer.COMMAND_01 = myconfig.command1
|
||||
ztransfer.COMMAND_02 = myconfig.command2
|
||||
|
||||
|
||||
def main():
|
||||
# app = wx.App(redirect=True, filename=tempfile.TemporaryFile().name)
|
||||
app = wx.App()
|
||||
UploadFrame()
|
||||
app.MainLoop()
|
||||
19
gui/main.py
19
gui/main.py
@@ -1,19 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: sample
|
||||
Desc :
|
||||
"""
|
||||
import examples.zupload as zupload
|
||||
import logging.config
|
||||
import commons.util as cutil
|
||||
import tempfile
|
||||
# logging.basicConfig(level=logging.DEBUG, filename=tempfile.TemporaryFile().name)
|
||||
logging.basicConfig(level=logging.INFO,
|
||||
filename=cutil.userhome_file('ztool.log'),
|
||||
format='%(asctime)s %(message)s')
|
||||
# 采用配置文件
|
||||
# logging.config.fileConfig(cutil.resource_path("resources/logging.conf"))
|
||||
|
||||
if __name__ == '__main__':
|
||||
zupload.main()
|
||||
@@ -1,37 +0,0 @@
|
||||
# -*- mode: python -*-
|
||||
a = Analysis(['main.py'],
|
||||
pathex=['d:\\tmp\\core-wxpython'],
|
||||
hiddenimports=[],
|
||||
hookspath=None,
|
||||
runtime_hooks=None)
|
||||
|
||||
def extra_datas(mydir):
|
||||
def rec_glob(p, files):
|
||||
import os
|
||||
import glob
|
||||
for d in glob.glob(p):
|
||||
if os.path.isfile(d):
|
||||
files.append(d)
|
||||
rec_glob("%s/*" % d, files)
|
||||
files = []
|
||||
rec_glob("%s/*" % mydir, files)
|
||||
extra_datas = []
|
||||
for f in files:
|
||||
extra_datas.append((f, f, 'DATA'))
|
||||
|
||||
return extra_datas
|
||||
|
||||
# append the 'resources' dir
|
||||
a.datas += extra_datas('resources')
|
||||
|
||||
pyz = PYZ(a.pure)
|
||||
exe = EXE(pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
name='main.exe',
|
||||
debug=False,
|
||||
strip=None,
|
||||
upx=True,
|
||||
console=True , icon='d:\\tmp\\main.ico')
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 25 KiB |
@@ -1,20 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo '先停止tomcat...'
|
||||
ps aux |grep tomcat |grep -v 'grep tomcat' |awk '{print $2}'|sudo xargs kill -9
|
||||
wait
|
||||
|
||||
echo '成功停止!开始替换class文件'
|
||||
cd /usr/local/apache-tomcat-8.0.15/webapps/ROOT/WEB-INF/classes/com
|
||||
rm -rf winhong/
|
||||
unzip ling.zip
|
||||
wait
|
||||
rm -f ling.zip
|
||||
echo 'class文件解压替换完成,开始替换配置文件'
|
||||
cd ..
|
||||
find . -maxdepth 1 -type f -not -name '*.zip' -print0 | xargs -0 rm
|
||||
unzip lingconfig.zip
|
||||
wait
|
||||
rm -f lingconfig.zip
|
||||
echo '配置文件解压替换完成'
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
#!/bin/bash
|
||||
|
||||
echo '开始重启tomcat....'
|
||||
/usr/local/apache-tomcat-8.0.15/bin/startup.sh
|
||||
wait
|
||||
|
||||
echo '重启成功...'
|
||||
|
||||
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
[loggers]
|
||||
keys=root
|
||||
|
||||
[handlers]
|
||||
keys=rotateFileHandler
|
||||
|
||||
[formatters]
|
||||
keys=simpleFormatter
|
||||
|
||||
[formatter_simpleFormatter]
|
||||
format=[%(asctime)s](%(levelname)s)%(name)s : %(message)s
|
||||
|
||||
[logger_root]
|
||||
level=DEBUG
|
||||
handlers=rotateFileHandler
|
||||
|
||||
[handler_rotateFileHandler]
|
||||
class=handlers.RotatingFileHandler
|
||||
level=DEBUG
|
||||
formatter=simpleFormatter
|
||||
args=('test.log', 'a', 200000, 9)
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 91 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 383 KiB |
242
make.bat
242
make.bat
@@ -1,242 +0,0 @@
|
||||
@ECHO OFF
|
||||
|
||||
REM Command file for Sphinx documentation
|
||||
|
||||
if "%SPHINXBUILD%" == "" (
|
||||
set SPHINXBUILD=sphinx-build
|
||||
)
|
||||
set BUILDDIR=build
|
||||
set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% source
|
||||
set I18NSPHINXOPTS=%SPHINXOPTS% source
|
||||
if NOT "%PAPER%" == "" (
|
||||
set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
|
||||
set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
|
||||
)
|
||||
|
||||
if "%1" == "" goto help
|
||||
|
||||
if "%1" == "help" (
|
||||
:help
|
||||
echo.Please use `make ^<target^>` where ^<target^> is one of
|
||||
echo. html to make standalone HTML files
|
||||
echo. dirhtml to make HTML files named index.html in directories
|
||||
echo. singlehtml to make a single large HTML file
|
||||
echo. pickle to make pickle files
|
||||
echo. json to make JSON files
|
||||
echo. htmlhelp to make HTML files and a HTML help project
|
||||
echo. qthelp to make HTML files and a qthelp project
|
||||
echo. devhelp to make HTML files and a Devhelp project
|
||||
echo. epub to make an epub
|
||||
echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
|
||||
echo. text to make text files
|
||||
echo. man to make manual pages
|
||||
echo. texinfo to make Texinfo files
|
||||
echo. gettext to make PO message catalogs
|
||||
echo. changes to make an overview over all changed/added/deprecated items
|
||||
echo. xml to make Docutils-native XML files
|
||||
echo. pseudoxml to make pseudoxml-XML files for display purposes
|
||||
echo. linkcheck to check all external links for integrity
|
||||
echo. doctest to run all doctests embedded in the documentation if enabled
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "clean" (
|
||||
for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
|
||||
del /q /s %BUILDDIR%\*
|
||||
goto end
|
||||
)
|
||||
|
||||
|
||||
%SPHINXBUILD% 2> nul
|
||||
if errorlevel 9009 (
|
||||
echo.
|
||||
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
|
||||
echo.installed, then set the SPHINXBUILD environment variable to point
|
||||
echo.to the full path of the 'sphinx-build' executable. Alternatively you
|
||||
echo.may add the Sphinx directory to PATH.
|
||||
echo.
|
||||
echo.If you don't have Sphinx installed, grab it from
|
||||
echo.http://sphinx-doc.org/
|
||||
exit /b 1
|
||||
)
|
||||
|
||||
if "%1" == "html" (
|
||||
%SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/html.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "dirhtml" (
|
||||
%SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "singlehtml" (
|
||||
%SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pickle" (
|
||||
%SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the pickle files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "json" (
|
||||
%SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can process the JSON files.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "htmlhelp" (
|
||||
%SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run HTML Help Workshop with the ^
|
||||
.hhp project file in %BUILDDIR%/htmlhelp.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "qthelp" (
|
||||
%SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; now you can run "qcollectiongenerator" with the ^
|
||||
.qhcp project file in %BUILDDIR%/qthelp, like this:
|
||||
echo.^> qcollectiongenerator %BUILDDIR%\qthelp\python3-cookbook.qhcp
|
||||
echo.To view the help file:
|
||||
echo.^> assistant -collectionFile %BUILDDIR%\qthelp\python3-cookbook.ghc
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "devhelp" (
|
||||
%SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "epub" (
|
||||
%SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The epub file is in %BUILDDIR%/epub.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latex" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latexpdf" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
cd %BUILDDIR%/latex
|
||||
make all-pdf
|
||||
cd %BUILDDIR%/..
|
||||
echo.
|
||||
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "latexpdfja" (
|
||||
%SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
|
||||
cd %BUILDDIR%/latex
|
||||
make all-pdf-ja
|
||||
cd %BUILDDIR%/..
|
||||
echo.
|
||||
echo.Build finished; the PDF files are in %BUILDDIR%/latex.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "text" (
|
||||
%SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The text files are in %BUILDDIR%/text.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "man" (
|
||||
%SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The manual pages are in %BUILDDIR%/man.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "texinfo" (
|
||||
%SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "gettext" (
|
||||
%SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "changes" (
|
||||
%SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.The overview file is in %BUILDDIR%/changes.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "linkcheck" (
|
||||
%SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Link check complete; look for any errors in the above output ^
|
||||
or in %BUILDDIR%/linkcheck/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "doctest" (
|
||||
%SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Testing of doctests in the sources finished, look at the ^
|
||||
results in %BUILDDIR%/doctest/output.txt.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "xml" (
|
||||
%SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The XML files are in %BUILDDIR%/xml.
|
||||
goto end
|
||||
)
|
||||
|
||||
if "%1" == "pseudoxml" (
|
||||
%SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
|
||||
if errorlevel 1 exit /b 1
|
||||
echo.
|
||||
echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
|
||||
goto end
|
||||
)
|
||||
|
||||
:end
|
||||
@@ -1,6 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
这个包中是常用的技术实践!
|
||||
"""
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#!/usr/bin/env python
|
||||
# -*- encoding: utf-8 -*-
|
||||
"""
|
||||
Topic: sample
|
||||
Desc :
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user