Skip to content

Commit 1f287ac

Browse files
committed
update package name and README
1 parent 0bcccb0 commit 1f287ac

File tree

6 files changed

+46
-42
lines changed

6 files changed

+46
-42
lines changed

README.md

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
- 创建: 2014-12-09
66
- 修改: 2015-03-04 将模块名称从 hhlc 改为 xlc。
77

8-
# 安装
8+
# 1. 安装
99

1010
第一次使用时,必须先进行安装以保证依赖库存在。可以使用下面的方式调用 pip 来安装依赖库:
1111

@@ -20,15 +20,14 @@ Windows 系统,若 pip 命令不可用,可使用下面的命令:
2020
../client/requirements.txt
2121
http://192.168.18.18/project/1201/tool/requirements.txt
2222

23-
# 使用
23+
# 2. 使用
2424

25-
## 作为库使用
25+
## 2.1 转换配置文件
2626

27-
### 引用 xlc 库
27+
调用方式如下:
2828

2929
import xlc
30-
31-
### 参数说明
30+
xlc.call(xls, export, templ, command, ptype)
3231

3332
- xls
3433
Excel 文件和配置文件目录
@@ -41,11 +40,10 @@ Excel 文件和配置文件目录
4140
- ptype
4241
指定转换配置文件的类型, 如 all/csv/lua
4342

44-
xlc.main(xls, export, command, ptype)
4543

4644
### 转换所有配置文件到export路径
4745

48-
xlc.main(
46+
xlc.call(
4947
"D:\\works\\hhl\\projects\\config\\xls",
5048
"D:\\works\\hhl\\projects\\config\\export",
5149
"D:\\works\\hhl\\projects\\config\\templates",
@@ -55,7 +53,7 @@ Excel 文件和配置文件目录
5553

5654
### 转换指定的一个或多个配置文件到export路径
5755

58-
xlc.main(
56+
xlc.call(
5957
"D:\\works\\hhl\\projects\\config\\xls",
6058
"D:\\works\\hhl\\projects\\config\\export",
6159
"D:\\works\\hhl\\projects\\config\\templates",
@@ -65,10 +63,29 @@ Excel 文件和配置文件目录
6563

6664
### 转换指定类型的配置文件, 并指定导出路径
6765

68-
xlc.main(
66+
xlc.call(
6967
"D:\\works\\hhl\\projects\\config\\xls",
7068
"D:\\works\\hhl\\projects\\config\\export",
7169
"D:\\works\\hhl\\projects\\config\\templates",
7270
["hero", "skill"],
7371
"lua"
7472
)
73+
74+
## 2.3 转换技能配置文件(与 ET 工具配合使用)
75+
76+
调用方式如下:
77+
78+
import xlc.etc
79+
xlc.etc.call(heroPath, sszPath, exportPath)
80+
81+
- heroPath ET 工具使用的英雄 JSON 配置文件路径
82+
- sszPath ET 工具使用的其他 JSON 配置
83+
- exportPath 导出的配置文件路径
84+
85+
范例代码:
86+
87+
xlc.etc.call(
88+
"D:\\works\\hhl\\projects\\resource\\art",
89+
"D:\\works\\hhl\\projects\\resource\\art\\ssz",
90+
"D:\\works\\hhl\\projects\\resource\\skill"
91+
)

xlc/__init__.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
# Creation 2014-09-26
44

55
import os
6-
from zrong.base import getFiles
7-
from hhlc.conf import Parser, ParseError
8-
import hhlc.dirconf as dirconf
6+
from zrong.base import get_files
7+
from xlc.conf import Parser, ParseError
8+
import xlc.dirconf as dirconf
99

1010

1111
# 排除非模块文件
@@ -46,7 +46,7 @@ def call(xls, export, tmpl, command=[], ptype="all"):
4646
elif ptype == "csv":
4747
dirconf.updateCsvPath(export)
4848

49-
files = filter(excludeFiles, getFiles(dirconf.xls_path, ["py"]))
49+
files = filter(excludeFiles, get_files(dirconf.xls_path, ["py"]))
5050

5151
if isinstance(command, list) and len(command) != 0:
5252
files = get_theModule(files, command) # + ".py"
@@ -62,18 +62,3 @@ def callEtc(heroPath, sszPath, exportPath):
6262
import hhlc.etc as etc
6363
# import etc
6464
etc.call(heroPath, sszPath, exportPath)
65-
66-
if __name__ == '__main__':
67-
callDt(
68-
"D:\\works\\hhl\\projects\\config\\xls",
69-
"D:\\works\\hhl\\projects\\client\\src\\conf",
70-
"D:\\works\\hhl\\projects\\config\\templates",
71-
["skill"],
72-
"lua")
73-
74-
# callEtc(
75-
# "D:\\works\\hhl\\projects\\resource\\art",
76-
# "D:\\works\\hhl\\projects\\resource\\art\\ssz",
77-
# "D:\\works\\hhl\\projects\\resource\\skill"
78-
# )
79-

xlc/conf.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@
44

55
import os
66
import xlrd
7-
from zrong.base import getFiles, readFile
8-
from hhlc.tocsv import Tocsv
9-
from hhlc.tolua import Tolua
10-
import hhlc.dirconf as dirconf
7+
from zrong.base import (read_file)
8+
from xlc.tocsv import Tocsv
9+
from xlc.tolua import Tolua
10+
import xlc.dirconf as dirconf
1111

1212

1313
class ParseError(Exception):
@@ -34,7 +34,7 @@ def parseModules(self, files):
3434
for path in files:
3535
print("parse file: " + os.path.basename(path))
3636

37-
self.module = self.sheetCheck(eval(readFile(path)))
37+
self.module = self.sheetCheck(eval(read_file(path)))
3838

3939
for sheet in self.module.get("sheets"):
4040
self.parseSheet(sheet)
@@ -100,4 +100,4 @@ def readXls(self, sheet):
100100

101101
__data = [__table.row_values(i) for i in range(nrows)]
102102

103-
return __data
103+
return __data

xlc/etc.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@
33
# etc = effect tool convertor
44
# Author zm
55
# Creation 2014-09-26
6-
# Modification zrong 2015-01-09
6+
# Modification zrong 2015-03-04
77

88
import re
99
import os
1010
import json
11+
from zrong import slog
1112
from zrong.base import (write_file, read_file, get_files, slog)
1213

1314

xlc/tocsv.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
import os
66
import csv
7-
from hhlc.base import Tobase, Totype
8-
import hhlc.dirconf as dirconf
7+
from xlc.base import Tobase, Totype
8+
import xlc.dirconf as dirconf
99

1010

1111
class Tocsv(Tobase):

xlc/tolua.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
11
# parseLua.py
22
# Author zm
33
# Creation 2014-09-29
4+
# Modification 2015-03-04 zrong
45

56
import os
6-
from zrong.base import writeByTempl
7-
from hhlc.base import Tobase, Totype
8-
import hhlc.dirconf as dirconf
7+
from zrong.base import write_by_templ
8+
from xlc.base import Tobase, Totype
9+
import xlc.dirconf as dirconf
910

1011

1112
class Tolua(Tobase):
@@ -151,7 +152,7 @@ def _createFile(self, str, true_name):
151152

152153
self.chkDirPath(filePath)
153154

154-
writeByTempl(
155+
write_by_templ(
155156
os.path.join(dirconf.temp_path, "%s.lua" %
156157
self.getPlanKey("template", "default")),
157158
filePath,

0 commit comments

Comments
 (0)