Skip to content

Commit

Permalink
v1.0.2
Browse files Browse the repository at this point in the history
修复了开机自动启动event列表数据不显示的问题
  • Loading branch information
cxlhyx committed Jul 5, 2024
1 parent a295b95 commit a158280
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 8 deletions.
13 changes: 7 additions & 6 deletions Main.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
os.path.dirname(sys.executable), "Lib", "site-packages", "PyQt5", "Qt", "plugins"
)
os.environ["QT_QPA_PLATFORM_PLUGIN_PATH"] = plugin_path
# 设置为exe即将存储的目录路径或克隆下来的项目路径
directory = "D:\college\Project\StickyNotes"
Startup.create_bat_file(directory)


class Main(QMainWindow): # type: ignore
Expand All @@ -18,7 +21,7 @@ def __init__(self):
self.setWindowTitle("Sticky Notes")
self.is_on_top = False # 是否置顶
self.is_startup = Startup.is_in_startup(
"D:\college\Project\StickyNotes\StickyNotes.exe"
directory + "\StickyNotes.bat"
) # 是否开机启动
self.colored_dates = [] # 选中item的日期
self.item = None # 选中的item
Expand Down Expand Up @@ -186,18 +189,16 @@ def handle_right_click(self, event):
self.is_on_top = not self.is_on_top # Toggle the state
elif action == action3:
if self.is_startup:
Startup.remove_from_startup(
"D:\college\Project\StickyNotes\StickyNotes.exe"
)
Startup.remove_from_startup(directory + "\StickyNotes.bat")
else:
Startup.add_to_startup("D:\college\Project\StickyNotes\StickyNotes.exe")
Startup.add_to_startup(directory + "\StickyNotes.bat")
self.is_startup = not self.is_startup # Toggle the state
elif action == action4:
self.msg_window = QWidget()
self.msg_window.setWindowTitle("About")
self.msg_window.setWindowFlags(Qt.Drawer)
self.layout = QVBoxLayout()
self.label = QLabel("版本: 1.0.1\n作者: cxlhyx")
self.label = QLabel("版本: 1.0.2\n作者: cxlhyx")
self.layout.addWidget(self.label)
self.msg_window.setLayout(self.layout)
self.msg_window.show()
Expand Down
11 changes: 9 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
- 📫 How to reach me ...
- [README 目录(持续更新中) 各种错误处理、爬虫实战及模板、百度智能云人脸识别、计算机视觉深度学习CNN图像识别与分类、PaddlePaddle自然语言处理知识图谱、GitHub、运维...](https://blog.csdn.net/muaamua/article/details/134426428?spm=1001.2014.3001.5502)
- WeChat:1297767084
- Email:cxlhyx1297767084@gmail.com
- GitHub:[https://github.com/cxlhyx](https://github.com/cxlhyx)
![在这里插入图片描述](/qrcode.jpg)
- 😄 Pronouns: ...
Expand Down Expand Up @@ -71,12 +72,18 @@ python Main.py

对于每个文件可以用**双引号**也可以不用,对于多个文件中间需要用"; "隔开(**英文分号和空格**),最后一个文件时不能再用"; "。

- 小Bug:重新开机自动启动时,event列表数据不显示,**重启一下程序**就好了,将尽快修复。
- 建议不要直接使用项目的exe,以免bug。先修改Main.py中第8行的directory = "D:\college\Project\StickyNotes",改为exe即将存储的路径或直接改为项目克隆的路径,接着在克隆下来的目录下使用以下命令即可编译生成exe文件。StickyNotes.exe 将被生成在 dist 目录中。PyInstaller 还会创建 build 目录和 MyApp.spec 文件。build 目录包含构建过程中使用的中间文件,而 .spec 文件是构建过程的配置文件。如果不希望保留 build 目录和 .spec 文件,可以手动删除它们。
```
pip install pyinstaller
pyinstaller -F -w --name StickyNotes Main.py
```

## release

v1.0.0:2024-06-29 基础功能

v1.0.1:2024-06-29 新增打开多个文件的功能


v1.0.2: 2024-07-05 修复了开机自动启动event列表数据不显示的问题

## 欢迎微信、邮箱、GitHub提出建议或问题
12 changes: 12 additions & 0 deletions Startup.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,18 @@ def is_in_startup(file_path=""):
print(f"Failed to check registry: {e}")
return False

def create_bat_file(directory):
# 定义批处理文件中需要包含的命令
bat_commands = [
"cd " + directory,
directory[0:2],
'start "" "StickyNotes.exe"',
"exit",
]
with open(directory + "\StickyNotes.bat", "w") as bat_file:
for command in bat_commands:
bat_file.write(command + "\n")


if __name__ == "__main__":
# Pass the script path to the function
Expand Down
4 changes: 4 additions & 0 deletions StickyNotes.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
cd D:\college\Project\StickyNotes
D:
start "" "StickyNotes.exe"
exit
Binary file modified StickyNotes.exe
Binary file not shown.
Binary file modified __pycache__/Startup.cpython-39.pyc
Binary file not shown.

0 comments on commit a158280

Please sign in to comment.