Skip to content

Commit 66bf538

Browse files
committed
更新README使用方法
1 parent 322c544 commit 66bf538

File tree

3 files changed

+27
-5
lines changed

3 files changed

+27
-5
lines changed

README.md

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,20 @@
11
# JSONFormat4Flutter
22
受zzz40500/GsonFormat启发,将JSONObject格式的String解析成dart语言的实体类
33

4-
用法:
4+
## 基本操作:
5+
56
![](https://github.com/debuggerx01/JSONFormat4Flutter/blob/master/Example/json.gif?raw=true)
67

7-
## MAC使用方法
8+
9+
## 简易运行方式:
10+
[Release](https://github.com/debuggerx01/JSONFormat4Flutter/releases) 页面中,选择下载对应平台最新的二进制文件后——
11+
#### linux:
12+
在程序目录打开终端后执行:sudo chmod u+x Formater_linux && ./Formater_linux
13+
#### mac:
14+
在程序目录打开终端后执行:sudo chmod u+x Formater_mac && ./Formater_mac
15+
#### windows:
16+
直接双击运行 Formater_win.exe
17+
## 源码运行(以MAC为例)
818
没有python运行环境的用户需要先安装python
919

1020
mac中可以使用如下命令安装
@@ -18,6 +28,8 @@ brew 可以参考下面的链接
1828

1929
https://brew.sh/index_zh-cn
2030

31+
32+
2133
运行库的时候会可能会提示
2234
```
2335
Traceback (most recent call last):
@@ -34,5 +46,14 @@ ModuleNotFoundError: No module named 'PyQt5'
3446
`pip3 install pyperclip`
3547
等待安装完成
3648

49+
``(注:brew安装最新版python3可能会出现ssl模块丢失导致pip3无法正常使用,此时也可以考虑直接在python官网下载pkg包方式安装python)``
50+
3751
后面使用就是在命令行敲入
3852
`python3 formater.py`
53+
54+
## 已知问题
55+
+ mac下从文本框复制出的文字直接粘贴到 idea/android studio 中报错 " lllegal character '65279' "
56+
```
57+
参考 [issue1](https://github.com/debuggerx01/JSONFormat4Flutter/issues/1) ,如下图,使用5.7.1及之前版本的pyqt5
58+
```
59+
![](https://github.com/debuggerx01/JSONFormat4Flutter/blob/master/Example/pyqt571.png?raw=true)

formater.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
from mainwindow import *
99
from tools import *
1010

11+
# 第三方库 用于解决跨平台的复制粘贴和复制的文本带bom问题
12+
import pyperclip
13+
1114
# 定义显示的json格式化字符串的缩进量为4个空格
1215
indent = ' '
1316

@@ -199,8 +202,6 @@ def init_event():
199202

200203

201204
def copy_left_text():
202-
## 第三方库 用于解决跨平台的复制粘贴和复制的文本带bom问题
203-
import pyperclip
204205
text = ui.te_json.toPlainText()
205206
pyperclip.copy(text)
206207
pass

tools.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@
77
import json
88
from PyQt5.QtWidgets import QLabel, QComboBox, QMessageBox
99

10-
# 验证json字符串是否合法
1110
from template_code import get_top_code_dict, get_list_code_loop
1211

1312
msg_box_ui = None
1413

1514

15+
# 验证json字符串是否合法
1616
def is_json(myjson):
1717
try:
1818
json.loads(myjson)

0 commit comments

Comments
 (0)