|
|
|
|
@ -158,13 +158,9 @@ class WordRibbon(QFrame):
|
|
|
|
|
font_layout.addWidget(self.font_size_combo)
|
|
|
|
|
|
|
|
|
|
self.bold_btn = self.create_toggle_button("B", "bold")
|
|
|
|
|
self.bold_btn.clicked.connect(self.on_bold_clicked)
|
|
|
|
|
self.italic_btn = self.create_toggle_button("I", "italic")
|
|
|
|
|
self.italic_btn.clicked.connect(self.on_italic_clicked)
|
|
|
|
|
self.underline_btn = self.create_toggle_button("U", "underline")
|
|
|
|
|
self.underline_btn.clicked.connect(self.on_underline_clicked)
|
|
|
|
|
self.color_btn = self.create_color_button("A", "color")
|
|
|
|
|
self.color_btn.clicked.connect(self.on_color_clicked)
|
|
|
|
|
|
|
|
|
|
font_layout.addWidget(self.bold_btn)
|
|
|
|
|
font_layout.addWidget(self.italic_btn)
|
|
|
|
|
@ -192,6 +188,26 @@ class WordRibbon(QFrame):
|
|
|
|
|
self.init_style_preview_group()
|
|
|
|
|
self.add_separator()
|
|
|
|
|
|
|
|
|
|
# ---------- 快速样式组 ----------
|
|
|
|
|
quick_style_group, quick_style_layout = self.create_ribbon_group("快速样式")
|
|
|
|
|
|
|
|
|
|
# 创建样式按钮
|
|
|
|
|
self.heading1_btn = self.create_style_button("标题1")
|
|
|
|
|
self.heading2_btn = self.create_style_button("标题2")
|
|
|
|
|
self.heading3_btn = self.create_style_button("标题3")
|
|
|
|
|
self.heading4_btn = self.create_style_button("标题4")
|
|
|
|
|
self.body_text_btn = self.create_style_button("正文")
|
|
|
|
|
|
|
|
|
|
# 添加到布局
|
|
|
|
|
quick_style_layout.addWidget(self.heading1_btn)
|
|
|
|
|
quick_style_layout.addWidget(self.heading2_btn)
|
|
|
|
|
quick_style_layout.addWidget(self.heading3_btn)
|
|
|
|
|
quick_style_layout.addWidget(self.heading4_btn)
|
|
|
|
|
quick_style_layout.addWidget(self.body_text_btn)
|
|
|
|
|
quick_style_layout.addStretch()
|
|
|
|
|
layout.addWidget(quick_style_group)
|
|
|
|
|
self.add_separator()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# ---------- 编辑组 ----------
|
|
|
|
|
@ -221,57 +237,7 @@ class WordRibbon(QFrame):
|
|
|
|
|
"""字体大小变化处理"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def on_bold_clicked(self):
|
|
|
|
|
"""粗体按钮点击处理"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def on_italic_clicked(self):
|
|
|
|
|
"""斜体按钮点击处理"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def on_underline_clicked(self):
|
|
|
|
|
"""下划线按钮点击处理"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def on_color_clicked(self):
|
|
|
|
|
"""字体颜色按钮点击处理"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def on_heading1_clicked(self):
|
|
|
|
|
"""一级标题按钮点击处理"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def on_heading2_clicked(self):
|
|
|
|
|
"""二级标题按钮点击处理"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def on_heading3_clicked(self):
|
|
|
|
|
"""三级标题按钮点击处理"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def on_heading4_clicked(self):
|
|
|
|
|
"""四级标题按钮点击处理"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def on_body_text_clicked(self):
|
|
|
|
|
"""正文按钮点击处理"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def on_align_left_clicked(self):
|
|
|
|
|
"""左对齐按钮点击处理"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def on_align_center_clicked(self):
|
|
|
|
|
"""居中对齐按钮点击处理"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def on_align_right_clicked(self):
|
|
|
|
|
"""右对齐按钮点击处理"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
def on_align_justify_clicked(self):
|
|
|
|
|
"""两端对齐按钮点击处理"""
|
|
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def init_style_preview_group(self):
|
|
|
|
|
"""加入 Word 风格的样式预览区域"""
|
|
|
|
|
@ -750,7 +716,6 @@ class WordRibbon(QFrame):
|
|
|
|
|
|
|
|
|
|
# 刷新按钮
|
|
|
|
|
self.refresh_weather_btn = QPushButton("🔄 刷新")
|
|
|
|
|
self.refresh_weather_btn.clicked.connect(self.on_refresh_weather)
|
|
|
|
|
self.refresh_weather_btn.setFixedSize(60, 30) # 增大刷新按钮尺寸
|
|
|
|
|
self.refresh_weather_btn.setStyleSheet("QPushButton { font-size: 11px; padding: 5px; }")
|
|
|
|
|
self.refresh_weather_btn.setToolTip("刷新天气")
|
|
|
|
|
@ -805,7 +770,6 @@ class WordRibbon(QFrame):
|
|
|
|
|
|
|
|
|
|
# 刷新按钮
|
|
|
|
|
self.refresh_quote_btn = QPushButton("刷新箴言")
|
|
|
|
|
self.refresh_quote_btn.clicked.connect(self.on_refresh_quote)
|
|
|
|
|
self.refresh_quote_btn.setFixedSize(80, 25)
|
|
|
|
|
|
|
|
|
|
# 添加到第一行布局
|
|
|
|
|
|