(self)
| 1788 | logging.exception("自动清理检查失败") |
| 1789 | |
| 1790 | def __init__(self): |
| 1791 | super().__init__() |
| 1792 | loadUi(working_dir + "/images/main.ui", self) |
| 1793 | |
| 1794 | self._frame() |
| 1795 | self._eventfilter() |
| 1796 | if hasattr(self, "table_files"): |
| 1797 | self.init_table() |
| 1798 | if hasattr(self, "check_select_all"): |
| 1799 | self.check_select_all.stateChanged.connect(self.toggle_select_all) |
| 1800 | self.simplify_home_ui() |
| 1801 | self.doFadeIn() |
| 1802 | self.config_exists = True |
| 1803 | self.thread_list = [] |
| 1804 | self.auto_clean_running = False |
| 1805 | ensure_whitelist_file() |
| 1806 | self.show() |
| 1807 | |
| 1808 | # 判断配置文件是否存在 |
| 1809 | if not os.path.exists(CONFIG_PATH): |
| 1810 | self.setWarninginfo("首次使用,即将自动弹出配置窗口") |
| 1811 | self.config_exists = False |
| 1812 | |
| 1813 | timer = QTimer(self) |
| 1814 | def detect_or_configure(): |
| 1815 | if not self.smart_detect_wechat_path(): |
| 1816 | self.show_config_window() |
| 1817 | |
| 1818 | timer.timeout.connect(detect_or_configure) |
| 1819 | timer.setSingleShot(True) # 只执行一次 |
| 1820 | |
| 1821 | # 设置定时器的时间间隔,这里设置为 1000ms(1秒) |
| 1822 | timer.start(500) |
| 1823 | else: |
| 1824 | # 如果用户在 config.json 开启自动清理,则启动后按周期检查。 |
| 1825 | timer = QTimer(self) |
| 1826 | timer.timeout.connect(self.check_auto_clean_after_start) |
| 1827 | timer.setSingleShot(True) |
| 1828 | timer.start(800) |
| 1829 | |
| 1830 | |
| 1831 | if __name__ == '__main__': |
no test coverage detected