Ethscriptions commited on
Commit
516d83c
·
1 Parent(s): aca02b6

Add application file

Browse files
.DS_Store CHANGED
Binary files a/.DS_Store and b/.DS_Store differ
 
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
- title: Eths
3
- emoji: 📚
4
  colorFrom: blue
5
  colorTo: yellow
6
  python_version: 3.9.2
 
1
  ---
2
+ title: eths
3
+ emoji: 🖊️
4
  colorFrom: blue
5
  colorTo: yellow
6
  python_version: 3.9.2
data/.DS_Store CHANGED
Binary files a/data/.DS_Store and b/data/.DS_Store differ
 
data/config.ini ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ [thread_start_state]
2
+ state = 0
data/eths_data.db DELETED
Binary file (8.19 kB)
 
data/ethscriptions_data.db CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:d319025bbf787c48a363a383315652695c208852eb9f1c2521aabdcbf0305eda
3
- size 398127104
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:299ff9699e6f7f4a75763b1cd7fa361c3c2820233f6cfa8f8cfc0f4cdf1c4b6a
3
+ size 399089664
data/name_set.db CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:56d1986c2fb2f863758ebe863f3bb0e1314fa1c171455b88ab2a1ba8fa990d0f
3
- size 1728512
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:117d6852105e8ba3543cc6a39daeef6e66c628999ad5299fe87c367835d3d704
3
+ size 2281472
pages/1_🔍_批量查询铭文状态.py CHANGED
@@ -3,6 +3,9 @@ import re
3
  import os
4
  import sqlite3
5
  import pandas as pd
 
 
 
6
 
7
 
8
  # 获取当前文件目录
@@ -20,14 +23,11 @@ def text_to_hex(text):
20
  return '0x' + ''.join(format(ord(char), '02x') for char in text)
21
 
22
 
23
- def get_name_set_data(set_choose):
24
- global content_set
25
- name_set_cursor.execute(f"SELECT data FROM set_data WHERE name='{set_choose}'")
26
- content_set = f'{name_set_cursor.fetchone()[0]}'
27
-
28
-
29
  st.set_page_config(page_title="EthPen - 批量查询铭文状态", page_icon="🔍", layout='wide', initial_sidebar_state='auto')
30
  st.subheader('🔍 EthPen - 批量查询铭文状态', anchor=False, divider='rainbow')
 
 
 
31
  name_selected_option = st.radio("选择查询的类型:",
32
  ['🔤纯文本', '🪙代币铭文', '🆔.eths', '🆔.eth', '🌲.tree', '🦛.honk', '🔄.etch', '🌐.com', '🥳.club'], index=0,
33
  horizontal=True)
@@ -48,7 +48,7 @@ if name_selected_option == '🪙代币铭文':
48
  token_str_list.append(token_str.replace('@#', str(token_id)))
49
  content_set = '\n'.join(token_str_list)
50
  st.code(token_str_list[0], language="json", line_numbers=False)
51
- content = st.text_area('只需简单输入或粘贴您想查询的铭文列表,或是一篇文章,即可轻松查询所有铭文的状态。', value=content_set)
52
  else:
53
  token_check = False
54
  if name_selected_option == '🆔.eths':
@@ -67,132 +67,57 @@ if name_selected_option == '🥳.club':
67
  check_type = '.club'
68
 
69
  if not token_check:
70
- options = ["⌨️直接输入", "🔥热门", "🔢数字", "🖊️Emoji", "🔤字母", "📛名字", "💡其他", "📃导入文件"]
71
-
72
- name_set = st.radio("选择系列(生成器):", options, index=0, disabled=token_check, horizontal=True)
73
-
74
- if name_set:
75
- if name_set == "⌨️直接输入":
76
- content_set = ''
77
- if name_set == "🔥热门":
78
- hot_options = ["数字 1K", "稀有 4D", "数字 10K", "数字 100K"]
79
- hot_name_set = st.radio("热门系列", hot_options, index=0, disabled=token_check, horizontal=True, label_visibility="collapsed")
80
- if hot_name_set == '数字 1K':
81
- get_name_set_data(hot_name_set)
82
- if hot_name_set == '稀有 4D':
83
- get_name_set_data(hot_name_set)
84
- if hot_name_set == '数字 10K':
85
- get_name_set_data(hot_name_set)
86
- if hot_name_set == '数字 100K':
87
- get_name_set_data(hot_name_set)
88
-
89
- if name_set == "🔢数字":
90
- digit_options = ["数字 1K", "稀有 4D", "数字 10K", "数字 100K"]
91
- digit_name_set = st.radio("数字系列", digit_options, index=0, disabled=token_check, horizontal=True, label_visibility="collapsed")
92
- if digit_name_set == '数字 1K':
93
- get_name_set_data(digit_name_set)
94
- if digit_name_set == '稀有 4D':
95
- get_name_set_data(digit_name_set)
96
- if digit_name_set == '数字 10K':
97
- get_name_set_data(digit_name_set)
98
- if digit_name_set == '数字 100K':
99
- get_name_set_data(digit_name_set)
100
-
101
- if name_set == "🖊️Emoji":
102
- emoji_options = ["单个 Emoji", "Emoji 笑脸和人", "Emoji 动物和自然", "Emoji 食物和饮料", "Emoji 活动",
103
- "Emoji 旅行和地点", "Emoji 物体", "Emoji 符号", "Emoji 旗帜", "Emoji99", "Emoji1K", "Emoji10K"]
104
- emoji_name_set = st.radio("emoji系列", emoji_options, index=0, disabled=token_check, horizontal=True, label_visibility="collapsed")
105
- if emoji_name_set == '单个 Emoji':
106
- get_name_set_data(emoji_name_set)
107
- if emoji_name_set == 'Emoji 笑脸和人':
108
- get_name_set_data(emoji_name_set)
109
- if emoji_name_set == 'Emoji 动物和自然':
110
- get_name_set_data(emoji_name_set)
111
- if emoji_name_set == 'Emoji 食物和饮料':
112
- get_name_set_data(emoji_name_set)
113
- if emoji_name_set == 'Emoji 活动':
114
- get_name_set_data(emoji_name_set)
115
- if emoji_name_set == 'Emoji 旅行和地点':
116
- get_name_set_data(emoji_name_set)
117
- if emoji_name_set == 'Emoji 物体':
118
- get_name_set_data(emoji_name_set)
119
- if emoji_name_set == 'Emoji 符号':
120
- get_name_set_data(emoji_name_set)
121
- if emoji_name_set == 'Emoji 旗帜':
122
- get_name_set_data(emoji_name_set)
123
- if emoji_name_set == 'Emoji99':
124
- get_name_set_data(emoji_name_set)
125
- if emoji_name_set == 'Emoji1K':
126
- get_name_set_data(emoji_name_set)
127
- if emoji_name_set == 'Emoji10K':
128
- get_name_set_data(emoji_name_set)
129
- if name_set == "🔤字母":
130
- letter_options = ["四字母单词", "五字母单词", "助记词", "英语名词"]
131
- letter_name_set = st.radio("字母系列", letter_options, index=0, disabled=token_check, horizontal=True, label_visibility="collapsed")
132
- if letter_name_set == '四字母单词':
133
- get_name_set_data(letter_name_set)
134
- if letter_name_set == '五字母单词':
135
- get_name_set_data(letter_name_set)
136
- if letter_name_set == '助记词':
137
- get_name_set_data(letter_name_set)
138
- if letter_name_set == '英语名词':
139
- get_name_set_data(letter_name_set)
140
- if name_set == "📛名字":
141
- full_name_options = ["全球姓氏", "全球名字", "百家姓", "美国姓氏", "美国男名", "美国女名", "宝可梦第一世代", "宝可梦",
142
- "哈利波特", "星球大战", "魔力宝贝", "我的世界"]
143
- full_name_set = st.radio("名字系列", full_name_options, index=0, disabled=token_check, horizontal=True, label_visibility="collapsed")
144
- if full_name_set == '全球姓氏':
145
- get_name_set_data(full_name_set)
146
- if full_name_set == '全球名字':
147
- get_name_set_data(full_name_set)
148
- if full_name_set == '百家姓':
149
- get_name_set_data(full_name_set)
150
- if full_name_set == '美国姓氏':
151
- get_name_set_data(full_name_set)
152
- if full_name_set == '美国男名':
153
- get_name_set_data(full_name_set)
154
- if full_name_set == '美国女名':
155
- get_name_set_data(full_name_set)
156
- if full_name_set == '宝可梦第一世代':
157
- get_name_set_data(full_name_set)
158
- if full_name_set == '宝可梦':
159
- get_name_set_data(full_name_set)
160
- if full_name_set == '哈利波特':
161
- get_name_set_data(full_name_set)
162
- if full_name_set == '星球大战':
163
- get_name_set_data(full_name_set)
164
- if full_name_set == '魔力宝贝':
165
- get_name_set_data(full_name_set)
166
- if full_name_set == '我的世界':
167
- get_name_set_data(full_name_set)
168
- if name_set == "💡其他":
169
- other_name_options = ["汉字", "24H 计时"]
170
- other_name_set = st.radio("其他系列", other_name_options, index=0, disabled=token_check, horizontal=True, label_visibility="collapsed")
171
- if other_name_set == '汉字':
172
- get_name_set_data(other_name_set)
173
- if other_name_set == '24H 计时':
174
- get_name_set_data(other_name_set)
175
- if name_set == "📃导入文件":
176
- uploaded_file = st.file_uploader("上传文件", type=['txt', 'csv', 'xlsx'])
177
-
178
- if uploaded_file is not None:
179
- if uploaded_file.type not in ['text/plain', 'text/csv', 'application/vnd.ms-excel']:
180
- st.error('文件类型不支持')
181
- else:
182
- # 读取上传的文件内容
183
- uploaded_file_contents = uploaded_file.read().decode('utf-8')
184
-
185
- # 将文件内容分割成列表,使用空格、换行符和逗号作为分隔符
186
- separators = [' ', '\n', ',']
187
- uploaded_file_contents_list = re.split('|'.join(map(re.escape, separators)), uploaded_file_contents)
188
-
189
- # 在这里,file_contents_list 包含了分割后的文本元素
190
- # 去除重复元素,将列表转换为集合,然后再转回列表
191
- uploaded_unique_contents_list = list(set(uploaded_file_contents_list))
192
- content_set = ' '.join(uploaded_unique_contents_list)
193
 
194
  if not token_check:
195
- if st.checkbox(f'自定义前后缀'):
 
196
  col1, col2 = st.columns(2)
197
  with col1:
198
  custom_prefix = st.text_input("自定义前缀")
@@ -206,7 +131,8 @@ if not token_check:
206
  custom_prefix, custom_suffix = '', ''
207
 
208
  if not token_check:
209
- if st.checkbox(f'过滤器'):
 
210
  col1, col2, col3, col4, col5, col6 = st.columns(6)
211
  with col1:
212
  start_with = st.text_input("以*开头", key='过滤器(可选)1')
@@ -246,14 +172,17 @@ if not token_check:
246
  content_set = ' '.join(filtered_list)
247
 
248
  if not token_check:
249
- content = st.text_area('只需简单输入或粘贴您想查询的铭文列表,或是一篇文章,即可轻松查询所有铭文的状态。', value=content_set)
 
250
 
251
- if st.checkbox('隐藏已题写'):
 
252
  hide_inscribed = True
253
  else:
254
  hide_inscribed = False
255
 
256
  if st.button('🔎 查询', key='🔎 查询'):
 
257
  all_items = []
258
  names = []
259
  if token_check:
@@ -284,7 +213,8 @@ if st.button('🔎 查询', key='🔎 查询'):
284
  ethscriptions_conn = sqlite3.connect(ethscrptions_db_file)
285
 
286
  ethscriptions_cursor = ethscriptions_conn.cursor()
287
-
 
288
  result = []
289
  for index in range(len(names)):
290
  ethscriptions_cursor.execute("SELECT * FROM data WHERE data=?", (all_items[index],))
@@ -292,13 +222,15 @@ if st.button('🔎 查询', key='🔎 查询'):
292
  if hide_inscribed:
293
  if not row:
294
  result.append({"铭文": names[index], "状态": "未题写", "十六进制数据": all_items[index]})
 
295
  else:
296
  if row:
297
  result.append({"铭文": names[index], "状态": "已题写", "十六进制数据": all_items[index]})
298
  else:
299
  result.append({"铭文": names[index], "状态": "未题写", "十六进制数据": all_items[index]})
300
-
301
- if result == []:
 
302
  st.markdown(f'## ☹️ 你来迟了~')
303
  else:
304
  # 将结果转换为Pandas DataFrame
@@ -308,11 +240,10 @@ if st.button('🔎 查询', key='🔎 查询'):
308
  csv_export = result_df.to_csv(index=False, encoding='utf-8')
309
  # Add a download button for the DataFrame
310
  st.download_button(
311
- label="下载搜索结果",
312
  data=csv_export,
313
  file_name="ethpen_result_data.csv",
314
  mime="text/csv"
315
  )
316
 
317
 
318
-
 
3
  import os
4
  import sqlite3
5
  import pandas as pd
6
+ import time
7
+ import matplotlib.pyplot as plt
8
+ import random
9
 
10
 
11
  # 获取当前文件目录
 
23
  return '0x' + ''.join(format(ord(char), '02x') for char in text)
24
 
25
 
 
 
 
 
 
 
26
  st.set_page_config(page_title="EthPen - 批量查询铭文状态", page_icon="🔍", layout='wide', initial_sidebar_state='auto')
27
  st.subheader('🔍 EthPen - 批量查询铭文状态', anchor=False, divider='rainbow')
28
+
29
+ st.write("<style>div.row-widget.stRadio > div{background-color:white;border: 1px solid #e6e9ef;border-radius:8px;padding:10px;box-shadow: 2px 2px 10px #e6e9ef;}</style>", unsafe_allow_html=True)
30
+
31
  name_selected_option = st.radio("选择查询的类型:",
32
  ['🔤纯文本', '🪙代币铭文', '🆔.eths', '🆔.eth', '🌲.tree', '🦛.honk', '🔄.etch', '🌐.com', '🥳.club'], index=0,
33
  horizontal=True)
 
48
  token_str_list.append(token_str.replace('@#', str(token_id)))
49
  content_set = '\n'.join(token_str_list)
50
  st.code(token_str_list[0], language="json", line_numbers=False)
51
+ content = st.text_area('铭文列表:', value=content_set)
52
  else:
53
  token_check = False
54
  if name_selected_option == '🆔.eths':
 
67
  check_type = '.club'
68
 
69
  if not token_check:
70
+ # 执行SQL查询,获取所有表名
71
+ name_set_cursor.execute("SELECT name FROM sqlite_master WHERE type='table'")
72
+ # 检索查询结果
73
+ tables = name_set_cursor.fetchall()
74
+ name_srt_tables_options = []
75
+ name_srt_tables_options.append('⌨️ 直接输入')
76
+ for table in tables:
77
+ name_srt_tables_options.append(table[0])
78
+ name_srt_tables_options.append('📃 导入文件')
79
+ name_set_table = st.radio("选择系列:", name_srt_tables_options, index=0, disabled=token_check, horizontal=True)
80
+ if name_set_table and name_set_table != '⌨️ 直接输入' and name_set_table != '📃 导入文件':
81
+ name_set_tables_name_options = []
82
+ # 执行SQL查询,获取指定表的所有 'name' 列的值
83
+ name_set_cursor.execute(f"SELECT name FROM {name_set_table}")
84
+ # 检索查询结果
85
+ names = name_set_cursor.fetchall()
86
+ # 打印所有 'name' 列的值
87
+ for name in names:
88
+ name_set_tables_name_options.append(name[0])
89
+ name_set_tables_name_options.sort()
90
+ name_set_table_name = st.radio("系列", name_set_tables_name_options, index=0, disabled=token_check, horizontal=True,
91
+ label_visibility="collapsed")
92
+ if name_set_table_name:
93
+ # 执行SQL查询,获取指定表的 'name' 和 'data' 列的值
94
+ name_set_cursor.execute(f"SELECT data FROM {name_set_table} WHERE name='{name_set_table_name}'")
95
+ # 检索查询结果
96
+ all_data = name_set_cursor.fetchall()
97
+ content_set = f'{all_data[0][0]}'
98
+ if name_set_table == "⌨️ 直接输入":
99
+ content_set = ''
100
+ if name_set_table == "📃 导入文件":
101
+ uploaded_file = st.file_uploader("上传文件", type=['txt', 'csv', 'xlsx'])
102
+ if uploaded_file is not None:
103
+ if uploaded_file.type not in ['text/plain', 'text/csv', 'application/vnd.ms-excel']:
104
+ st.error('文件类型不支持')
105
+ else:
106
+ # 读取上传的文件内容
107
+ uploaded_file_contents = uploaded_file.read().decode('utf-8')
108
+
109
+ # 将文件内容分割成列表,使用空格、换行符和逗号作为分隔符
110
+ separators = [' ', '\n', ',']
111
+ uploaded_file_contents_list = re.split('|'.join(map(re.escape, separators)), uploaded_file_contents)
112
+
113
+ # 在这里,file_contents_list 包含了分割后的文本元素
114
+ # 去除重复元素,将列表转换为集合,然后再转回列表
115
+ uploaded_unique_contents_list = list(set(uploaded_file_contents_list))
116
+ content_set = ' '.join(uploaded_unique_contents_list)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
 
118
  if not token_check:
119
+ custom_suffix = st.toggle('自定义前后缀')
120
+ if custom_suffix:
121
  col1, col2 = st.columns(2)
122
  with col1:
123
  custom_prefix = st.text_input("自定义前缀")
 
131
  custom_prefix, custom_suffix = '', ''
132
 
133
  if not token_check:
134
+ filter = st.toggle('过滤器')
135
+ if filter:
136
  col1, col2, col3, col4, col5, col6 = st.columns(6)
137
  with col1:
138
  start_with = st.text_input("以*开头", key='过滤器(可选)1')
 
172
  content_set = ' '.join(filtered_list)
173
 
174
  if not token_check:
175
+ content = st.text_area('铭文列表:', value=content_set)
176
+
177
 
178
+ hide_inscribed = st.toggle('隐藏已题写')
179
+ if hide_inscribed:
180
  hide_inscribed = True
181
  else:
182
  hide_inscribed = False
183
 
184
  if st.button('🔎 查询', key='🔎 查询'):
185
+ st.markdown(f'## 📄 查询结果')
186
  all_items = []
187
  names = []
188
  if token_check:
 
213
  ethscriptions_conn = sqlite3.connect(ethscrptions_db_file)
214
 
215
  ethscriptions_cursor = ethscriptions_conn.cursor()
216
+ names_total = len(names)
217
+ name_not_yet_total = 0
218
  result = []
219
  for index in range(len(names)):
220
  ethscriptions_cursor.execute("SELECT * FROM data WHERE data=?", (all_items[index],))
 
222
  if hide_inscribed:
223
  if not row:
224
  result.append({"铭文": names[index], "状态": "未题写", "十六进制数据": all_items[index]})
225
+ name_not_yet_total += 1
226
  else:
227
  if row:
228
  result.append({"铭文": names[index], "状态": "已题写", "十六进制数据": all_items[index]})
229
  else:
230
  result.append({"铭文": names[index], "状态": "未题写", "十六进制数据": all_items[index]})
231
+ name_not_yet_total += 1
232
+ st.progress(name_not_yet_total / names_total, f'题写进度({name_not_yet_total / names_total * 100:.0f}%):')
233
+ if not result:
234
  st.markdown(f'## ☹️ 你来迟了~')
235
  else:
236
  # 将结果转换为Pandas DataFrame
 
240
  csv_export = result_df.to_csv(index=False, encoding='utf-8')
241
  # Add a download button for the DataFrame
242
  st.download_button(
243
+ label="下载搜索结果",
244
  data=csv_export,
245
  file_name="ethpen_result_data.csv",
246
  mime="text/csv"
247
  )
248
 
249
 
 
pages/4_💹️_铭文数据分析.py CHANGED
@@ -7,6 +7,7 @@ import time
7
  from datetime import datetime, timezone
8
  import threading
9
  import base64
 
10
 
11
  # 使用你的Ethereum节点的RPC地址
12
  w3 = Web3(Web3.HTTPProvider("https://mainnet.infura.io/v3/9bbc614b8a1d49d59869e97d0ee3bf61"))
@@ -17,6 +18,8 @@ parent_dir = os.path.dirname(current_dir)
17
  # 构造数据库文件路径
18
  eths_db_file = os.path.join(parent_dir, 'data', 'eths_data.db')
19
  ethscrptions_db_file = os.path.join(parent_dir, 'data', 'ethscriptions_data.db')
 
 
20
 
21
  ethscriptions_con = sqlite3.connect(ethscrptions_db_file)
22
  ethscriptions_cur = ethscriptions_con.cursor()
@@ -185,8 +188,11 @@ if eths_data:
185
  eths_stakers = st.metric(label='ETHS TVL', value=f'${eths_data[0][8]:,.0f}')
186
 
187
 
188
- # index_status = st.empty()
189
- # # st.markdown(f'*EthPen Ethscriptions Index Status: {processed_block}/{latest_block_number}*')
 
 
 
190
  ethscriptions_cur.execute("SELECT block_number FROM process_blocks")
191
  index_result = ethscriptions_cur.fetchone()
192
  index_processed_block = index_result[0]
@@ -207,25 +213,24 @@ if download:
207
  mime='application/octet-stream'
208
  )
209
 
210
- # 查询state列的值
211
- ethscriptions_cur.execute("SELECT state FROM thread_start_state")
212
- state_value = ethscriptions_cur.fetchone()[0]
213
- if state_value == "0":
214
- # 修改状态值
215
- new_state = "1"
216
- ethscriptions_cur.execute("UPDATE thread_start_state SET state = ?", (new_state,))
217
- ethscriptions_con.commit()
218
- ethscriptions_con.close()
219
- # index_status_thread = threading.Thread(target=get_index_status, args=(index_status,))
220
  eths_thread = threading.Thread(target=get_eths_data)
221
  ethscriptions_thread = threading.Thread(target=get_ethscriptions_data)
222
 
223
  # 启动线程
224
- # index_status_thread.start()
225
  eths_thread.start()
226
  ethscriptions_thread.start()
227
 
228
  # 等待线程结束
229
  eths_thread.join()
230
  ethscriptions_thread.join()
231
- # index_status_thread.join()
 
 
7
  from datetime import datetime, timezone
8
  import threading
9
  import base64
10
+ import configparser
11
 
12
  # 使用你的Ethereum节点的RPC地址
13
  w3 = Web3(Web3.HTTPProvider("https://mainnet.infura.io/v3/9bbc614b8a1d49d59869e97d0ee3bf61"))
 
18
  # 构造数据库文件路径
19
  eths_db_file = os.path.join(parent_dir, 'data', 'eths_data.db')
20
  ethscrptions_db_file = os.path.join(parent_dir, 'data', 'ethscriptions_data.db')
21
+ config_ini_file = os.path.join(parent_dir, 'data', 'config.ini')
22
+
23
 
24
  ethscriptions_con = sqlite3.connect(ethscrptions_db_file)
25
  ethscriptions_cur = ethscriptions_con.cursor()
 
188
  eths_stakers = st.metric(label='ETHS TVL', value=f'${eths_data[0][8]:,.0f}')
189
 
190
 
191
+ # with st.expander('🆕新铭文题写', expanded=True):
192
+ #
193
+ #
194
+
195
+
196
  ethscriptions_cur.execute("SELECT block_number FROM process_blocks")
197
  index_result = ethscriptions_cur.fetchone()
198
  index_processed_block = index_result[0]
 
213
  mime='application/octet-stream'
214
  )
215
 
216
+ config = configparser.ConfigParser()
217
+ config.read(config_ini_file)
218
+ thread_start_state_value = config['thread_start_state']['state']
219
+ if thread_start_state_value == '0':
220
+ print('线程未启动。')
221
+ config['thread_start_state']['state'] = '1'
222
+ with open(config_ini_file, 'w') as configfile:
223
+ config.write(configfile)
224
+
 
225
  eths_thread = threading.Thread(target=get_eths_data)
226
  ethscriptions_thread = threading.Thread(target=get_ethscriptions_data)
227
 
228
  # 启动线程
 
229
  eths_thread.start()
230
  ethscriptions_thread.start()
231
 
232
  # 等待线程结束
233
  eths_thread.join()
234
  ethscriptions_thread.join()
235
+ else:
236
+ print('线程已经启动。')
🖊️EthPen-以太之笔.py CHANGED
@@ -1126,7 +1126,7 @@ def get_eths_staking():
1126
  return {} # 返回一个空字典作为默认值
1127
 
1128
 
1129
- st.set_page_config(page_title="EthPen - 以太之笔", page_icon="🖊", layout='wide', initial_sidebar_state='auto')
1130
 
1131
  # 首页
1132
  st.markdown(
@@ -1263,48 +1263,59 @@ if search_rune_expander.button('🔍 查询', key='批量查询铭文'):
1263
  table_data.drop(columns=['sort_helper'], inplace=True)
1264
 
1265
  # 定义样式和生成带有专门类名的HTML表格
1266
- table_style = """
1267
- <style>
1268
- .styled_table {
1269
- width: 100%;
1270
- border-collapse: collapse;
1271
- border-radius: 8px;
1272
- overflow: hidden; /* Ensures border-radius applies to table */
1273
- }
1274
- .styled_table th, .styled_table td {
1275
- border: 1px solid #ddd;
1276
- padding: 8px;
1277
- text-align: left;
1278
- }
1279
- .styled_table th {
1280
- background-color: #f2f2f2;
1281
- color: black;
1282
- }
1283
- .styled_table tr:hover {
1284
- background-color: #f5f5f5;
1285
- }
1286
- .styled_table td[status="已题写"] {
1287
- background-color: #f2dede; /* Reddish */
1288
- }
1289
- .styled_table td[status="未题写"] {
1290
- background-color: #dff0d8; /* Greenish */
1291
- }
1292
- </style>
1293
- """
1294
- search_rune_expander.markdown(table_style, unsafe_allow_html=True)
1295
- table_html = table_data.to_html(index=False, classes='styled_table', border=0, escape=False,
1296
- formatters=dict(状态=lambda x: f'<td status="{x}">{x}</td>'))
1297
-
1298
- # 生成HTML表格但不为状态列添加特殊格式
1299
- table_html = table_data.to_html(index=False, classes='styled_table', border=0, escape=False)
1300
-
1301
- # 使用字符串替换为状态列添加特定属性
1302
- table_html = table_html.replace('<td>已题写</td>', '<td status="已题写">已题写</td>')
1303
- table_html = table_html.replace('<td>未题写</td>', '<td status="未题写">未题写</td>')
1304
-
1305
- # 使用st.write输出带样式的HTML表格
1306
- search_rune_expander.write(table_html, unsafe_allow_html=True)
1307
- search_rune_expander.markdown('')
 
 
 
 
 
 
 
 
 
 
 
1308
 
1309
  # 题写铭文页面
1310
  create_rune_expander.markdown("##### 文本转换到十六进制")
 
1126
  return {} # 返回一个空字典作为默认值
1127
 
1128
 
1129
+ st.set_page_config(page_title="EthPen - 以太之笔", page_icon="🖊", layout='wide', initial_sidebar_state='collapsed')
1130
 
1131
  # 首页
1132
  st.markdown(
 
1263
  table_data.drop(columns=['sort_helper'], inplace=True)
1264
 
1265
  # 定义样式和生成带有专门类名的HTML表格
1266
+ # table_style = """
1267
+ # <style>
1268
+ # .styled_table {
1269
+ # width: 100%;
1270
+ # border-collapse: collapse;
1271
+ # border-radius: 8px;
1272
+ # overflow: hidden; /* Ensures border-radius applies to table */
1273
+ # }
1274
+ # .styled_table th, .styled_table td {
1275
+ # border: 1px solid #ddd;
1276
+ # padding: 8px;
1277
+ # text-align: left;
1278
+ # }
1279
+ # .styled_table th {
1280
+ # background-color: #f2f2f2;
1281
+ # color: black;
1282
+ # }
1283
+ # .styled_table tr:hover {
1284
+ # background-color: #f5f5f5;
1285
+ # }
1286
+ # .styled_table td[status="已题写"] {
1287
+ # background-color: #f2dede; /* Reddish */
1288
+ # }
1289
+ # .styled_table td[status="未题写"] {
1290
+ # background-color: #dff0d8; /* Greenish */
1291
+ # }
1292
+ # </style>
1293
+ # """
1294
+ # search_rune_expander.markdown(table_style, unsafe_allow_html=True)
1295
+ # table_html = table_data.to_html(index=False, classes='styled_table', border=0, escape=False,
1296
+ # formatters=dict(状态=lambda x: f'<td status="{x}">{x}</td>'))
1297
+ #
1298
+ # # 生成HTML表格但不为状态列添加特殊格式
1299
+ # table_html = table_data.to_html(index=False, classes='styled_table', border=0, escape=False)
1300
+ #
1301
+ # # 使用字符串替换为状态列添加特定属性
1302
+ # table_html = table_html.replace('<td>已题写</td>', '<td status="已题写">已题写</td>')
1303
+ # table_html = table_html.replace('<td>未题写</td>', '<td status="未题写">未题写</td>')
1304
+ #
1305
+ # # 使用st.write输出带样式的HTML表格
1306
+ # search_rune_expander.write(table_html, unsafe_allow_html=True)
1307
+ # search_rune_expander.markdown('')
1308
+ result_df = pd.DataFrame(table_data)
1309
+ search_rune_expander.dataframe(result_df, use_container_width=True, hide_index=True)
1310
+ # Convert DataFrame to CSV with proper encoding
1311
+ csv_export = result_df.to_csv(index=False, encoding='utf-8')
1312
+ # Add a download button for the DataFrame
1313
+ search_rune_expander.download_button(
1314
+ label="下载搜索结果",
1315
+ data=csv_export,
1316
+ file_name="ethpen_result_data.csv",
1317
+ mime="text/csv"
1318
+ )
1319
 
1320
  # 题写铭文页面
1321
  create_rune_expander.markdown("##### 文本转换到十六进制")