Skip to content

Commit c9ba6c4

Browse files
committed
refactor(FB_win.py): 优化文本和输入框排版
1 parent db89f4f commit c9ba6c4

1 file changed

Lines changed: 13 additions & 27 deletions

File tree

facebook/FB_win.py

Lines changed: 13 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -106,63 +106,49 @@ def initUI(self):
106106
form_layout = QVBoxLayout()
107107
form_layout.setSpacing(16)
108108

109-
def add_row(label_text, widget):
110-
row = QVBoxLayout()
111-
row.setSpacing(6)
112-
lbl = QLabel(label_text)
113-
lbl.setFont(QFont("微軟雅黑", 10))
114-
row.addWidget(lbl)
115-
row.addWidget(widget)
116-
form_layout.addLayout(row)
117-
118-
# 设备编号单独一行
109+
# 设备编号单独一行 - 水平布局
110+
device_row = QHBoxLayout()
111+
device_label = QLabel("設備編號*:")
112+
device_label.setFont(QFont("微軟雅黑", 10))
119113
self.device_input = QLineEdit()
120114
self.device_input.setText("000")
121115
self.device_input.setPlaceholderText("請輸入設備編號")
122-
add_row("設備編號*:", self.device_input)
116+
device_row.addWidget(device_label)
117+
device_row.addWidget(self.device_input, 1)
118+
form_layout.addLayout(device_row)
123119

124120
# 搜索数量、爬取数量、爬取类型在一行
125121
row_layout = QHBoxLayout()
126122
row_layout.setSpacing(16)
127123

128124
# 搜索数量
129-
search_count_layout = QVBoxLayout()
130-
search_count_layout.setSpacing(6)
131125
search_count_label = QLabel("搜索數量:")
132126
search_count_label.setFont(QFont("微軟雅黑", 10))
133127
self.search_count_input = QLineEdit()
134128
self.search_count_input.setText("10")
135129
self.search_count_input.setPlaceholderText("例如: 100")
136-
search_count_layout.addWidget(search_count_label)
137-
search_count_layout.addWidget(self.search_count_input)
130+
row_layout.addWidget(search_count_label)
131+
row_layout.addWidget(self.search_count_input, 1)
138132

139133
# 爬取数量
140-
crawl_count_layout = QVBoxLayout()
141-
crawl_count_layout.setSpacing(6)
142134
crawl_count_label = QLabel("爬取數量:")
143135
crawl_count_label.setFont(QFont("微軟雅黑", 10))
144136
self.crawl_count_input = QLineEdit()
145137
self.crawl_count_input.setText("2025")
146138
self.crawl_count_input.setPlaceholderText("例如: 50")
147-
crawl_count_layout.addWidget(crawl_count_label)
148-
crawl_count_layout.addWidget(self.crawl_count_input)
139+
row_layout.addWidget(crawl_count_label)
140+
row_layout.addWidget(self.crawl_count_input, 1)
149141

150142
# 下拉框
151-
combo_layout = QVBoxLayout()
152-
combo_layout.setSpacing(6)
153143
combo_label = QLabel("爬取類型:")
154144
combo_label.setFont(QFont("微軟雅黑", 10))
155145
self.combo_box = QComboBox()
156146
self.combo_box.addItem("社團")
157147
self.combo_box.addItem("粉絲專頁")
158-
combo_layout.addWidget(combo_label)
159-
combo_layout.addWidget(self.combo_box)
160148
# 连接下拉框变化信号
161149
self.combo_box.currentTextChanged.connect(self.update_address_placeholder)
162-
163-
row_layout.addLayout(search_count_layout)
164-
row_layout.addLayout(crawl_count_layout)
165-
row_layout.addLayout(combo_layout)
150+
row_layout.addWidget(combo_label)
151+
row_layout.addWidget(self.combo_box, 1)
166152

167153
form_layout.addLayout(row_layout)
168154
content_layout.addLayout(form_layout)

0 commit comments

Comments
 (0)