File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -75,13 +75,24 @@ def change_text(com_box, current_text):
7575 com_box .setCurrentText ('List<%s>' % current_text )
7676
7777
78+ def change_background_color (com_box , current_text ):
79+ if current_text == '' :
80+ com_box .setStyleSheet ("background-color:rgb(220,20,60)" )
81+ elif current_text == 'Object' :
82+ com_box .setStyleSheet ("background-color:rgb(255,246,143)" )
83+ else :
84+ com_box .setStyleSheet ("" )
85+
86+
7887# 生成字段类型下拉框
7988def get_type_combobox (line ):
8089 com_box = QtWidgets .QComboBox ()
8190 com_box .setEditable (True )
8291 obj_type = int (line [- 1 ]) if line [- 1 ].isdigit () else 0
8392 global last_list_com_box
8493
94+ com_box .currentTextChanged .connect (partial (change_background_color , com_box ))
95+
8596 if last_list_com_box is not None :
8697 com_box .currentTextChanged .connect (partial (change_text , last_list_com_box ))
8798 last_list_com_box = None
@@ -102,6 +113,8 @@ def get_type_combobox(line):
102113 # 将该list字段的编辑框临时保存,用于与下一个字段的类型绑定
103114 last_list_com_box = com_box
104115
116+ # 为text至不合法的输入框设置颜色
117+ change_background_color (com_box , com_box .currentText ())
105118 return com_box
106119
107120
Load Diff This file was deleted.
Original file line number Diff line number Diff line change @@ -120,7 +120,7 @@ def add_param_to_code(code, param):
120120 tcode = check_level_type (t )
121121
122122 if tcode == 2 :
123- code = code .replace (': $%s' % n , ': ${%s != null?\' \" $%s \" \' :\' null\' }' % (n , n ))
123+ code = code .replace (': $%s' % n , ': ${%s != null?\' ${JSON.encode(%s)} \' :\' null\' }' % (n , n ))
124124
125125 # dict类型处理,只需要修改construction中的输出方式
126126 elif tcode == 4 :
You can’t perform that action at this time.
0 commit comments