Update: Refactor to absolute imports, fix QPS limits, and enhance Gitea sync with SQLite support
This commit is contained in:
@@ -74,6 +74,36 @@ class ProgressReporter:
|
||||
pass
|
||||
|
||||
|
||||
class ToolTip:
|
||||
"""给组件添加悬停提示"""
|
||||
def __init__(self, widget, text):
|
||||
self.widget = widget
|
||||
self.text = text
|
||||
self.tip_window = None
|
||||
self.widget.bind("<Enter>", self.show_tip)
|
||||
self.widget.bind("<Leave>", self.hide_tip)
|
||||
|
||||
def show_tip(self, event=None):
|
||||
if self.tip_window or not self.text:
|
||||
return
|
||||
x, y, _cx, cy = self.widget.bbox("insert")
|
||||
x = x + self.widget.winfo_rootx() + 27
|
||||
y = y + cy + self.widget.winfo_rooty() + 27
|
||||
self.tip_window = tw = tk.Toplevel(self.widget)
|
||||
tw.wm_overrideredirect(1)
|
||||
tw.wm_geometry("+%d+%d" % (x, y))
|
||||
label = tk.Label(tw, text=self.text, justify=tk.LEFT,
|
||||
background="#ffffe0", relief=tk.SOLID, borderwidth=1,
|
||||
font=("tahoma", "8", "normal"), padx=4, pady=2)
|
||||
label.pack(ipadx=1)
|
||||
|
||||
def hide_tip(self, event=None):
|
||||
tw = self.tip_window
|
||||
self.tip_window = None
|
||||
if tw:
|
||||
tw.destroy()
|
||||
|
||||
|
||||
def create_collapsible_frame(parent, title, initial_state=True):
|
||||
"""创建可折叠的面板"""
|
||||
frame = tk.Frame(parent)
|
||||
|
||||
Reference in New Issue
Block a user