(self)
| 747 | self.log("已停止处理") |
| 748 | |
| 749 | def create_tray_icon(self): |
| 750 | width, height = 64, 32 |
| 751 | base_icon = self.create_capsule_icon('grey') |
| 752 | self.icon_image = { |
| 753 | 'processing': self.create_capsule_icon('grey'), |
| 754 | 'success': self.create_capsule_icon('green'), |
| 755 | 'error': self.create_capsule_icon('red'), |
| 756 | } |
| 757 | self.icon = pystray.Icon( |
| 758 | "name", |
| 759 | base_icon, |
| 760 | "PillOCR" |
| 761 | ) |
| 762 | self.icon.menu = self.create_menu() |
| 763 | # hand control of the AppKit run loop back to Tkinter |
| 764 | if platform.system() == "Darwin" and hasattr(self.icon, "run_detached"): |
| 765 | self.icon.run_detached() |
| 766 | else: |
| 767 | threading.Thread(target=self.icon.run, daemon=True).start() |
| 768 | |
| 769 | def create_menu(self): |
| 770 | """创建托盘菜单""" |
no test coverage detected