更新目录结构

This commit is contained in:
Irony 2018-10-28 00:24:47 +08:00
parent b90ea8f364
commit f9d000b1dd
69 changed files with 556 additions and 527 deletions

View file

@ -1,21 +1,19 @@
eclipse.preferences.version=1 eclipse.preferences.version=1
encoding//ActiveX/QAxWidget/\u663E\u793Aword_excel_pdf.py=utf-8 encoding//ActiveX/QAxWidget/\u663E\u793Aword_excel_pdf.py=utf-8
encoding//QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/qrctest1.py=utf-8
encoding//QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/qrctest2.py=utf-8
encoding//QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/res_rc.py=utf-8
encoding//QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/textread.py=utf-8
encoding//\u4E0B\u62C9\u9009\u62E9\u8054\u52A8/ComboBox.py=utf-8 encoding//\u4E0B\u62C9\u9009\u62E9\u8054\u52A8/ComboBox.py=utf-8
encoding//\u4EBA\u8138\u63CF\u70B9\u68C0\u6D4B/OpencvWidget.py=utf-8 encoding//\u4EBA\u8138\u63CF\u70B9\u68C0\u6D4B/OpencvWidget.py=utf-8
encoding//\u4EFFQQ\u8BBE\u7F6E\u9762\u677F/SettingUi.py=utf-8
encoding//\u4EFFQQ\u8BBE\u7F6E\u9762\u677F/Window.py=utf-8
encoding//\u5168\u5C40\u70ED\u952E/HotKey.py=utf-8 encoding//\u5168\u5C40\u70ED\u952E/HotKey.py=utf-8
encoding//\u5176\u5B83/C\u548CC++\u6269\u5C55/py\u8F6Cpyd/pydmod.py=utf-8 encoding//\u5176\u5B83/C\u548CC++\u6269\u5C55/py\u8F6Cpyd/pydmod.py=utf-8
encoding//\u5206\u5272\u7A97\u53E3\u7684\u5206\u5272\u6761\u91CD\u5199/Splitter.py=utf-8 encoding//\u5176\u5B83/QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/qrctest1.py=utf-8
encoding//\u5176\u5B83/QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/qrctest2.py=utf-8
encoding//\u5176\u5B83/QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/res_rc.py=utf-8
encoding//\u5176\u5B83/QRC\u8D44\u6E90\u6587\u4EF6\u4F7F\u7528/textread.py=utf-8
encoding//\u5176\u5B83/\u7A0B\u5E8F\u91CD\u542F/AutoRestart.py=utf-8
encoding//\u5217\u8868/QListView/\u663E\u793A\u81EA\u5B9A\u4E49Widget.py=utf-8 encoding//\u5217\u8868/QListView/\u663E\u793A\u81EA\u5B9A\u4E49Widget.py=utf-8
encoding//\u5217\u8868/QListView/\u663E\u793A\u81EA\u5B9A\u4E49Widget\u5E76\u6392\u5E8F.py=utf-8 encoding//\u5217\u8868/QListView/\u663E\u793A\u81EA\u5B9A\u4E49Widget\u5E76\u6392\u5E8F.py=utf-8
encoding//\u5217\u8868/QListWidget/\u81EA\u5B9A\u4E49\u53EF\u62D6\u62FDItem.py=utf-8 encoding//\u5217\u8868/QListWidget/\u81EA\u5B9A\u4E49\u53EF\u62D6\u62FDItem.py=utf-8
encoding//\u52A8\u753B\u7279\u6548/\u53F3\u952E\u83DC\u5355\u52A8\u753B.py=utf-8 encoding//\u52A8\u753B/\u53F3\u952E\u83DC\u5355\u52A8\u753B.py=utf-8
encoding//\u52A8\u753B\u7279\u6548/\u6DE1\u5165\u6DE1\u51FA.py=utf-8 encoding//\u52A8\u753B/\u6DE1\u5165\u6DE1\u51FA.py=utf-8
encoding//\u53F3\u4E0B\u89D2\u5F39\u51FA\u6846/WindowNotify.py=utf-8 encoding//\u53F3\u4E0B\u89D2\u5F39\u51FA\u6846/WindowNotify.py=utf-8
encoding//\u56FE\u5F62\u89C6\u56FE/ImageView.py=utf-8 encoding//\u56FE\u5F62\u89C6\u56FE/ImageView.py=utf-8
encoding//\u56FE\u5F62\u89C6\u56FE/QGraphicsItem/Item\u62D6\u62FD\u6539\u53D8\u5927\u5C0F.py=utf-8 encoding//\u56FE\u5F62\u89C6\u56FE/QGraphicsItem/Item\u62D6\u62FD\u6539\u53D8\u5927\u5C0F.py=utf-8
@ -44,9 +42,8 @@ encoding//\u56FE\u8868/PyQtChart\u7EC3\u4E60/test/LineChart.py=utf-8
encoding//\u56FE\u8868/PyQtChart\u7EC3\u4E60/test/LineChart\u81EA\u5B9A\u4E49xy\u8F74.py=utf-8 encoding//\u56FE\u8868/PyQtChart\u7EC3\u4E60/test/LineChart\u81EA\u5B9A\u4E49xy\u8F74.py=utf-8
encoding//\u56FE\u8868/PyQtChart\u7EC3\u4E60/test/ToolTip.py=utf-8 encoding//\u56FE\u8868/PyQtChart\u7EC3\u4E60/test/ToolTip.py=utf-8
encoding//\u56FE\u8868/PyQtChart\u7EC3\u4E60/test/ToolTip2.py=utf-8 encoding//\u56FE\u8868/PyQtChart\u7EC3\u4E60/test/ToolTip2.py=utf-8
encoding//\u591A\u7EBF\u7A0B\u4F7F\u7528/inheritQThread.py=utf-8 encoding//\u591A\u9875\u9762/\u4EFFQQ\u8BBE\u7F6E\u9762\u677F/SettingUi.py=utf-8
encoding//\u591A\u7EBF\u7A0B\u4F7F\u7528/moveToThread.py=utf-8 encoding//\u591A\u9875\u9762/\u4EFFQQ\u8BBE\u7F6E\u9762\u677F/Window.py=utf-8
encoding//\u591A\u7EBF\u7A0B\u4F7F\u7528/\u7EBF\u7A0B\u6302\u8D77\u6062\u590D.py=utf-8
encoding//\u5B57\u4F53\u6D4B\u8BD5/FontAwesome.py=utf-8 encoding//\u5B57\u4F53\u6D4B\u8BD5/FontAwesome.py=utf-8
encoding//\u5B57\u4F53\u6D4B\u8BD5/TestFontAwesome.py=utf-8 encoding//\u5B57\u4F53\u6D4B\u8BD5/TestFontAwesome.py=utf-8
encoding//\u5B57\u4F53\u6D4B\u8BD5/TestFontRoboto.py=utf-8 encoding//\u5B57\u4F53\u6D4B\u8BD5/TestFontRoboto.py=utf-8
@ -58,7 +55,7 @@ encoding//\u65E0\u8FB9\u6846\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u7A97\u53E3/Fra
encoding//\u65E0\u8FB9\u6846\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u7A97\u53E3/Test.py=utf-8 encoding//\u65E0\u8FB9\u6846\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u7A97\u53E3/Test.py=utf-8
encoding//\u65E0\u8FB9\u6846\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u7A97\u53E3/win\u65E0\u8FB9\u6846\u8C03\u6574\u5927\u5C0F.py=utf-8 encoding//\u65E0\u8FB9\u6846\u81EA\u5B9A\u4E49\u6807\u9898\u680F\u7A97\u53E3/win\u65E0\u8FB9\u6846\u8C03\u6574\u5927\u5C0F.py=utf-8
encoding//\u6811\u7ED3\u6784/QTreeWidget/Json\u751F\u6210QTreeWidget/Json\u751F\u6210\u6811\u5F62\u7ED3\u6784.py=utf-8 encoding//\u6811\u7ED3\u6784/QTreeWidget/Json\u751F\u6210QTreeWidget/Json\u751F\u6210\u6811\u5F62\u7ED3\u6784.py=utf-8
encoding//\u68A6\u5E7B\u6811/DreamTree.py=utf-8 encoding//\u6D4F\u89C8\u5668/QWebView/\u68A6\u5E7B\u6811/DreamTree.py=utf-8
encoding//\u6D4F\u89C8\u5668\u83B7\u53D6Cookie/WebEngineView.py=utf-8 encoding//\u6D4F\u89C8\u5668\u83B7\u53D6Cookie/WebEngineView.py=utf-8
encoding//\u6D4F\u89C8\u5668\u83B7\u53D6Cookie/WebView.py=utf-8 encoding//\u6D4F\u89C8\u5668\u83B7\u53D6Cookie/WebView.py=utf-8
encoding//\u6D88\u606F\u5BF9\u8BDD\u6846\u5012\u8BA1\u65F6\u5173\u95ED/MessageBox.py=utf-8 encoding//\u6D88\u606F\u5BF9\u8BDD\u6846\u5012\u8BA1\u65F6\u5173\u95ED/MessageBox.py=utf-8
@ -89,12 +86,6 @@ encoding//\u754C\u9762\u7F8E\u5316/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761/Progress
encoding//\u754C\u9762\u7F8E\u5316/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761/TestWidget.py=utf-8 encoding//\u754C\u9762\u7F8E\u5316/\u6C34\u6CE2\u7EB9\u8FDB\u5EA6\u6761/TestWidget.py=utf-8
encoding//\u754C\u9762\u7F8E\u5316/\u8FB9\u6846\u52A8\u753B\u9634\u5F71/AnimationShadowEffect.py=utf-8 encoding//\u754C\u9762\u7F8E\u5316/\u8FB9\u6846\u52A8\u753B\u9634\u5F71/AnimationShadowEffect.py=utf-8
encoding//\u754C\u9762\u7F8E\u5316/\u8FB9\u6846\u52A8\u753B\u9634\u5F71/Test.py=utf-8 encoding//\u754C\u9762\u7F8E\u5316/\u8FB9\u6846\u52A8\u753B\u9634\u5F71/Test.py=utf-8
encoding//\u7A0B\u5E8F\u91CD\u542F/AutoRestart.py=utf-8
encoding//\u7A97\u53E3\u914D\u5408\u5F02\u6B65Http/AsyncioUiClient.py=utf-8
encoding//\u7A97\u53E3\u91CD\u542F/RestartMainWindow.py=utf-8
encoding//\u7B80\u5355\u7684\u7A97\u53E3\u8D34\u8FB9\u9690\u85CF/WeltHideWindow.py=utf-8
encoding//\u7F51\u7EDC\u64CD\u4F5C/TcpSocket/\u63A7\u5236\u5C0F\u8F66/ControlCar.py=utf-8
encoding//\u7F51\u7EDC\u64CD\u4F5C/TcpSocket/\u63A7\u5236\u5C0F\u8F66/server.py=utf-8
encoding//\u817E\u8BAF\u89C6\u9891\u70ED\u64AD\u5217\u8868/TencentMovieHotPlay.py=utf-8 encoding//\u817E\u8BAF\u89C6\u9891\u70ED\u64AD\u5217\u8868/TencentMovieHotPlay.py=utf-8
encoding//\u817E\u8BAF\u89C6\u9891\u70ED\u64AD\u5217\u8868/TencentMovieHotPlay_Flow.py=utf-8 encoding//\u817E\u8BAF\u89C6\u9891\u70ED\u64AD\u5217\u8868/TencentMovieHotPlay_Flow.py=utf-8
encoding//\u817E\u8BAF\u89C6\u9891\u70ED\u64AD\u5217\u8868/TencentMovieHotPlay_ListWidget.py=utf-8 encoding//\u817E\u8BAF\u89C6\u9891\u70ED\u64AD\u5217\u8868/TencentMovieHotPlay_ListWidget.py=utf-8
@ -109,4 +100,3 @@ encoding//\u81EA\u5B9A\u4E49import/main.py=utf-8
encoding//\u81EA\u5B9A\u4E49import/src/test.py=utf-8 encoding//\u81EA\u5B9A\u4E49import/src/test.py=utf-8
encoding//\u81EA\u5B9A\u4E49\u5C5E\u6027\u6D4B\u8BD5/\u81EA\u5B9A\u4E49\u5C5E\u6027\u6D4B\u8BD5.py=utf-8 encoding//\u81EA\u5B9A\u4E49\u5C5E\u6027\u6D4B\u8BD5/\u81EA\u5B9A\u4E49\u5C5E\u6027\u6D4B\u8BD5.py=utf-8
encoding//\u83DC\u5355/\u83DC\u5355\u591A\u9009\u4E0D\u5173\u95ED.py=utf-8 encoding//\u83DC\u5355/\u83DC\u5355\u591A\u9009\u4E0D\u5173\u95ED.py=utf-8
encoding//\u8868\u683C\u590D\u5236/TableView.py=utf-8

View file

@ -15,6 +15,8 @@
## 菜单 ## 菜单
1. [菜单多选不关闭](菜单/菜单多选不关闭.py)
## 列表 ## 列表
### 1、[QListWidget](列表/QListWidget) ### 1、[QListWidget](列表/QListWidget)
@ -26,7 +28,7 @@
1. [自定义Widget](列表/QListView/显示自定义Widget.py) 1. [自定义Widget](列表/QListView/显示自定义Widget.py)
2. [自定义Widget并排序](列表/QListView/显示自定义Widget并排序.py) 2. [自定义Widget并排序](列表/QListView/显示自定义Widget并排序.py)
## 树 ## 树结构
### 1、[QTreeWidget](树结构/QTreeWidget) ### 1、[QTreeWidget](树结构/QTreeWidget)
@ -36,6 +38,12 @@
## 表格 ## 表格
### 1、[QTableWidget](表格/QTableWidget)
### 2、[QTreeView](表格/QTableView)
1. [表格内容复制](表格/QTableView/表格内容复制.py)
## 级联 ## 级联
## 日期 ## 日期
@ -50,18 +58,42 @@
## 窗口 ## 窗口
1. [窗口重启](窗口/窗口重启.py)
2. [分割窗口的分割条重写](窗口/分割窗口的分割条重写.py)
3. [简单的窗口贴边隐藏](窗口/简单的窗口贴边隐藏.py)
## 多页面 ## 多页面
## 多线程 ## 多线程
### 1、[线程挂起恢复](多线程/线程挂起恢复)
## 美化 ## 美化
## 动画
1. [淡入淡出](动画/淡入淡出.py)
2. [右键菜单动画](动画/右键菜单动画.py)
## 图表 ## 图表
## 网络 ## 网络
### 1、[窗口配合异步Http](网络/窗口配合异步Http)
### 2、[控制小车](网络/控制小车)
## 浏览器 ## 浏览器
### 1、[QWebView](浏览器/QWebView)
1. [梦幻树](浏览器/QWebView/梦幻树)
### 2、[QWebEngineView](浏览器/QWebEngineView)
## 图形视图 ## 图形视图
## 其它 ## 其它
@ -72,6 +104,14 @@
2. [使用pyx和c++](其它/C和C++扩展/pyx和c++) 2. [使用pyx和c++](其它/C和C++扩展/pyx和c++)
3. [python转pyd](其它/C和C++扩展/py转pyd) 3. [python转pyd](其它/C和C++扩展/py转pyd)
### 2、[QRC资源文件使用](其它/QRC资源文件使用)
### 3、[程序重启](其它/程序重启)
### 4、[单实例应用](其它/单实例应用)
### 5、[调用截图dll(只能用32位)](其它/调用截图dll(只能用32位))
### I、 项目型 ### I、 项目型
[Qt皮肤生成器 - 持续更新中](https://github.com/892768447/QtSkin) [Qt皮肤生成器 - 持续更新中](https://github.com/892768447/QtSkin)

View file

Before

Width:  |  Height:  |  Size: 6.5 KiB

After

Width:  |  Height:  |  Size: 6.5 KiB

View file

Before

Width:  |  Height:  |  Size: 5.6 KiB

After

Width:  |  Height:  |  Size: 5.6 KiB

View file

Before

Width:  |  Height:  |  Size: 951 KiB

After

Width:  |  Height:  |  Size: 951 KiB

View file

@ -1,11 +0,0 @@
# 分割窗口的分割条重绘
原理在于QSplitter在创建分割条的时候会调用createHandle函数
于是通过重新写createHandle返回自己的QSplitterHandle类
并通过QSplitterHandle的paintEvent实现绘制其它形状
重写mousePressEvent和mouseMoveEvent来实现鼠标的其它事件
## 截图
![截图](ScreenShot/1.gif)

View file

Before

Width:  |  Height:  |  Size: 630 KiB

After

Width:  |  Height:  |  Size: 630 KiB

View file

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 78 KiB

View file

@ -1,16 +1,16 @@
# 简单的子线程例子 # 简单的子线程例子
使用继承QThread和moveToThread两种方式 使用继承QThread和moveToThread两种方式
# 注意,这里只是简单演示,在应用这些代码时要小心 # 注意,这里只是简单演示,在应用这些代码时要小心
## 线程的挂起与恢复 ## 线程的挂起与恢复
这里使用windows的api实现主要用到SuspendThread和ResumeThread函数 这里使用windows的api实现主要用到SuspendThread和ResumeThread函数
利用ctypes.windll.kernel32.OpenThread(win32con.PROCESS_ALL_ACCESS, False, int(QThread.currentThreadId())) 利用ctypes.windll.kernel32.OpenThread(win32con.PROCESS_ALL_ACCESS, False, int(QThread.currentThreadId()))
得到线程的句柄,然后就可以通过上面的两个函数对其进行挂起与恢复 得到线程的句柄,然后就可以通过上面的两个函数对其进行挂起与恢复
ctypes.windll.kernel32.TerminateThread终止线程不推荐 ctypes.windll.kernel32.TerminateThread终止线程不推荐
## 截图 ## 截图
![截图](ScreenShot/1.gif) ![截图](ScreenShot/1.gif)

View file

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

View file

Before

Width:  |  Height:  |  Size: 400 KiB

After

Width:  |  Height:  |  Size: 400 KiB

View file

Before

Width:  |  Height:  |  Size: 1.5 MiB

After

Width:  |  Height:  |  Size: 1.5 MiB

View file

@ -1,14 +1,34 @@
# 简单的窗口贴边隐藏 # 重启窗口Widget
## 大概思路 # 截图
- 1.思路是当窗口进入左边,顶部,右边一半时,此时判断窗口的坐标 ![截图](ScreenShot/窗口重启.gif)
- 2.如果窗口的x坐标小于0 则需要隐藏到左边
- 3.如果窗口的y坐标小于0 则需要隐藏到顶部
- 4.如果窗口的x坐标大于屏幕宽度-窗口宽度/2 则需要隐藏到右边
# 分割窗口的分割条重绘
## 事件
- 1.mousePressEvent鼠标按下事件主要记录按下的坐标 原理在于QSplitter在创建分割条的时候会调用createHandle函数
- 1.mouseMoveEvent鼠标移动事件用于移动窗口
- 1.mouseReleaseEvent鼠标弹起事件用于判断是否需要隐藏窗口 于是通过重新写createHandle返回自己的QSplitterHandle类
- 1.enterEvent鼠标进入事件用于窗口隐藏后是否需要暂时显示预览
- 1.leaveEvent鼠标离开事件用于窗口暂时显示后自动隐藏效果 并通过QSplitterHandle的paintEvent实现绘制其它形状
重写mousePressEvent和mouseMoveEvent来实现鼠标的其它事件
## 截图
![截图](ScreenShot/分割窗口的分割条重写.gif)
# 简单的窗口贴边隐藏
## 大概思路
- 1.思路是当窗口进入左边,顶部,右边一半时,此时判断窗口的坐标
- 2.如果窗口的x坐标小于0 则需要隐藏到左边
- 3.如果窗口的y坐标小于0 则需要隐藏到顶部
- 4.如果窗口的x坐标大于屏幕宽度-窗口宽度/2 则需要隐藏到右边
## 事件
- 1.mousePressEvent鼠标按下事件主要记录按下的坐标
- 1.mouseMoveEvent鼠标移动事件用于移动窗口
- 1.mouseReleaseEvent鼠标弹起事件用于判断是否需要隐藏窗口
- 1.enterEvent鼠标进入事件用于窗口隐藏后是否需要暂时显示预览
- 1.leaveEvent鼠标离开事件用于窗口暂时显示后自动隐藏效果

View file

Before

Width:  |  Height:  |  Size: 80 KiB

After

Width:  |  Height:  |  Size: 80 KiB

View file

Before

Width:  |  Height:  |  Size: 74 KiB

After

Width:  |  Height:  |  Size: 74 KiB

View file

@ -1,62 +1,62 @@
#!/usr/bin/env python #!/usr/bin/env python
# -*- coding: utf-8 -*- # -*- coding: utf-8 -*-
''' '''
Created on 2018年1月17日 Created on 2018年1月17日
@author: Irony."[讽刺] @author: Irony."[讽刺]
@site: http://alyl.vip, http://orzorz.vip, https://coding.net/u/892768447, https://github.com/892768447 @site: http://alyl.vip, http://orzorz.vip, https://coding.net/u/892768447, https://github.com/892768447
@email: 892768447@qq.com @email: 892768447@qq.com
@file: RestartMainWindow @file: RestartMainWindow
@description: @description:
''' '''
from PyQt5.QtCore import pyqtSignal from PyQt5.QtCore import pyqtSignal
from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton, QLineEdit,\ from PyQt5.QtWidgets import QWidget, QVBoxLayout, QLabel, QPushButton, QLineEdit,\
QMessageBox QMessageBox
__Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com" __Author__ = "By: Irony.\"[讽刺]\nQQ: 892768447\nEmail: 892768447@qq.com"
__Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]" __Copyright__ = "Copyright (c) 2018 Irony.\"[讽刺]"
__Version__ = "Version 1.0" __Version__ = "Version 1.0"
class RestartMainWindow(QWidget): class RestartMainWindow(QWidget):
restarted = pyqtSignal(QWidget, str) restarted = pyqtSignal(QWidget, str)
_Self = None # 很重要,保留窗口引用 _Self = None # 很重要,保留窗口引用
def __init__(self, path, *args, **kwargs): def __init__(self, path, *args, **kwargs):
super(RestartMainWindow, self).__init__(*args, **kwargs) super(RestartMainWindow, self).__init__(*args, **kwargs)
RestartMainWindow._Self = self RestartMainWindow._Self = self
layout = QVBoxLayout(self) layout = QVBoxLayout(self)
layout.addWidget(QLabel("当前工作目录:" + path, self)) layout.addWidget(QLabel("当前工作目录:" + path, self))
self.dirEdit = QLineEdit( self.dirEdit = QLineEdit(
self, placeholderText="请输入要切换的目录", returnPressed=self.onChangeDir) self, placeholderText="请输入要切换的目录", returnPressed=self.onChangeDir)
layout.addWidget(self.dirEdit) layout.addWidget(self.dirEdit)
layout.addWidget(QPushButton( layout.addWidget(QPushButton(
"点我切换工作目录", self, clicked=self.onChangeDir)) "点我切换工作目录", self, clicked=self.onChangeDir))
self.restarted.connect(RestartMainWindow.onRestart) self.restarted.connect(RestartMainWindow.onRestart)
def onChangeDir(self): def onChangeDir(self):
path = self.dirEdit.text().strip() path = self.dirEdit.text().strip()
if path and QMessageBox.question(self, "提示", "确认要切换到{0}目录吗?".format(path)) == QMessageBox.Yes: if path and QMessageBox.question(self, "提示", "确认要切换到{0}目录吗?".format(path)) == QMessageBox.Yes:
self.hide() # 先隐藏 self.hide() # 先隐藏
self.restarted.emit(self, path) self.restarted.emit(self, path)
else: else:
self.dirEdit.setFocus() self.dirEdit.setFocus()
@classmethod @classmethod
def onRestart(cls, widget, path): def onRestart(cls, widget, path):
w = RestartMainWindow(path) w = RestartMainWindow(path)
w.show() w.show()
widget.close() widget.close()
widget.deleteLater() widget.deleteLater()
del widget del widget
if __name__ == "__main__": if __name__ == "__main__":
import sys import sys
from PyQt5.QtWidgets import QApplication from PyQt5.QtWidgets import QApplication
app = QApplication(sys.argv) app = QApplication(sys.argv)
w = RestartMainWindow("test") w = RestartMainWindow("test")
w.show() w.show()
sys.exit(app.exec_()) sys.exit(app.exec_())

View file

@ -22,7 +22,7 @@ class WeltHideWindow(QWidget):
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super(WeltHideWindow, self).__init__(*args, **kwargs) super(WeltHideWindow, self).__init__(*args, **kwargs)
self.setWindowFlag(Qt.FramelessWindowHint, True) self.setWindowFlags(self.windowFlags() | Qt.FramelessWindowHint)
self.resize(800, 600) self.resize(800, 600)
self._width = QApplication.desktop().availableGeometry(self).width() self._width = QApplication.desktop().availableGeometry(self).width()
layout = QVBoxLayout(self) layout = QVBoxLayout(self)

View file

@ -1,4 +0,0 @@
# 重启窗口Widget
# 截图
![截图](ScreenShot/1.gif)

View file

@ -1,26 +1,26 @@
# 通过TCP连接树莓派控制小车的简单例子 # 通过TCP连接树莓派控制小车的简单例子
需求: 需求:
- 通过TCP连接到树莓派控制小车前后左右 - 通过TCP连接到树莓派控制小车前后左右
- 前进0-100 发送命令为F:2 - 前进0-100 发送命令为F:2
- 后退0-100 发送命令为B:2 - 后退0-100 发送命令为B:2
- 向左32-42 发送命令为L:2 - 向左32-42 发送命令为L:2
- 向右42-52 发送命令为R:2 - 向右42-52 发送命令为R:2
注意: 注意:
- 这里只用了UI文件做界面并没有转换为python代码 - 这里只用了UI文件做界面并没有转换为python代码
- server.py只是做个本地echo服务器用来测试命令是否正常依赖tornado库可以通过pip install tornado来安装 - server.py只是做个本地echo服务器用来测试命令是否正常依赖tornado库可以通过pip install tornado来安装
- 另外需要做粘包处理,以(\n作为粘包符 - 另外需要做粘包处理,以(\n作为粘包符
- 由于wifi能力不行,发送图片要尽量小 - 由于wifi能力不行,发送图片要尽量小
说明: 说明:
- QTcpSocket.connected 服务连接成功后触发该信号 - QTcpSocket.connected 服务连接成功后触发该信号
- QTcpSocket.disconnected 服务器丢失连接触发该信号 - QTcpSocket.disconnected 服务器丢失连接触发该信号
- QTcpSocket.readyRead 服务器返回数据触发该信号 - QTcpSocket.readyRead 服务器返回数据触发该信号
- QTcpSocket.error 连接报错触发该信号(连接超时、服务器断开等等) - QTcpSocket.error 连接报错触发该信号(连接超时、服务器断开等等)
## 截图 ## 截图
![截图](ScreenShot/1.png) ![截图](ScreenShot/1.png)

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

@ -1,362 +1,362 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0"> <ui version="4.0">
<class>Car</class> <class>Car</class>
<widget class="QWidget" name="Car"> <widget class="QWidget" name="Car">
<property name="geometry"> <property name="geometry">
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>800</width> <width>800</width>
<height>600</height> <height>600</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
<string>小车</string> <string>小车</string>
</property> </property>
<layout class="QHBoxLayout" name="horizontalLayout"> <layout class="QHBoxLayout" name="horizontalLayout">
<item> <item>
<widget class="QWidget" name="widget_2" native="true"> <widget class="QWidget" name="widget_2" native="true">
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<property name="spacing"> <property name="spacing">
<number>0</number> <number>0</number>
</property> </property>
<item> <item>
<widget class="QLabel" name="qlabel"> <widget class="QLabel" name="qlabel">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>400</height> <height>400</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>TextLabel</string> <string>TextLabel</string>
</property> </property>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QTextBrowser" name="browserResult"> <widget class="QTextBrowser" name="browserResult">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>200</height> <height>200</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>16777215</width> <width>16777215</width>
<height>200</height> <height>200</height>
</size> </size>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
<item> <item>
<widget class="QWidget" name="widget" native="true"> <widget class="QWidget" name="widget" native="true">
<property name="enabled"> <property name="enabled">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>400</width> <width>400</width>
<height>400</height> <height>400</height>
</size> </size>
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="4" column="3"> <item row="4" column="3">
<widget class="QLCDNumber" name="lcdNumber_2"> <widget class="QLCDNumber" name="lcdNumber_2">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>80</width>
<height>50</height> <height>50</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>80</width> <width>80</width>
<height>50</height> <height>50</height>
</size> </size>
</property> </property>
<property name="segmentStyle"> <property name="segmentStyle">
<enum>QLCDNumber::Flat</enum> <enum>QLCDNumber::Flat</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="2"> <item row="3" column="2">
<widget class="QLCDNumber" name="lcdNumber_3"> <widget class="QLCDNumber" name="lcdNumber_3">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>80</width>
<height>50</height> <height>50</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>80</width> <width>80</width>
<height>50</height> <height>50</height>
</size> </size>
</property> </property>
<property name="segmentStyle"> <property name="segmentStyle">
<enum>QLCDNumber::Flat</enum> <enum>QLCDNumber::Flat</enum>
</property> </property>
<property name="value" stdset="0"> <property name="value" stdset="0">
<double>32.000000000000000</double> <double>32.000000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="3"> <item row="2" column="3">
<widget class="QLCDNumber" name="lcdNumber"> <widget class="QLCDNumber" name="lcdNumber">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>80</width>
<height>50</height> <height>50</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>80</width> <width>80</width>
<height>50</height> <height>50</height>
</size> </size>
</property> </property>
<property name="segmentStyle"> <property name="segmentStyle">
<enum>QLCDNumber::Flat</enum> <enum>QLCDNumber::Flat</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="2" column="5"> <item row="2" column="5">
<widget class="QSlider" name="sliderRight"> <widget class="QSlider" name="sliderRight">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>30</height> <height>30</height>
</size> </size>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>42</number> <number>42</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>52</number> <number>52</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>2</number> <number>2</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="tickPosition"> <property name="tickPosition">
<enum>QSlider::TicksBelow</enum> <enum>QSlider::TicksBelow</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="0" column="3"> <item row="0" column="3">
<widget class="QLabel" name="label"> <widget class="QLabel" name="label">
<property name="text"> <property name="text">
<string>前</string> <string>前</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="0"> <item row="3" column="0">
<widget class="QLabel" name="label_3"> <widget class="QLabel" name="label_3">
<property name="text"> <property name="text">
<string>左</string> <string>左</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="6" column="3"> <item row="6" column="3">
<widget class="QLabel" name="label_2"> <widget class="QLabel" name="label_2">
<property name="text"> <property name="text">
<string>后</string> <string>后</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="7"> <item row="3" column="7">
<widget class="QLabel" name="label_4"> <widget class="QLabel" name="label_4">
<property name="text"> <property name="text">
<string>右</string> <string>右</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="3" colspan="2"> <item row="1" column="3" colspan="2">
<widget class="QSlider" name="sliderForward"> <widget class="QSlider" name="sliderForward">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>30</width> <width>30</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>100</number> <number>100</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="tickPosition"> <property name="tickPosition">
<enum>QSlider::TicksAbove</enum> <enum>QSlider::TicksAbove</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="1" column="2"> <item row="1" column="2">
<widget class="QPushButton" name="buttonConnect"> <widget class="QPushButton" name="buttonConnect">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>40</height> <height>40</height>
</size> </size>
</property> </property>
<property name="text"> <property name="text">
<string>连接服务器</string> <string>连接服务器</string>
</property> </property>
</widget> </widget>
</item> </item>
<item row="3" column="5"> <item row="3" column="5">
<widget class="QLCDNumber" name="lcdNumber_4"> <widget class="QLCDNumber" name="lcdNumber_4">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>80</width> <width>80</width>
<height>50</height> <height>50</height>
</size> </size>
</property> </property>
<property name="maximumSize"> <property name="maximumSize">
<size> <size>
<width>80</width> <width>80</width>
<height>50</height> <height>50</height>
</size> </size>
</property> </property>
<property name="segmentStyle"> <property name="segmentStyle">
<enum>QLCDNumber::Flat</enum> <enum>QLCDNumber::Flat</enum>
</property> </property>
<property name="value" stdset="0"> <property name="value" stdset="0">
<double>32.000000000000000</double> <double>32.000000000000000</double>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="2"> <item row="4" column="2">
<widget class="QSlider" name="sliderLeft"> <widget class="QSlider" name="sliderLeft">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>0</width> <width>0</width>
<height>30</height> <height>30</height>
</size> </size>
</property> </property>
<property name="minimum"> <property name="minimum">
<number>32</number> <number>32</number>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>42</number> <number>42</number>
</property> </property>
<property name="pageStep"> <property name="pageStep">
<number>2</number> <number>2</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Horizontal</enum> <enum>Qt::Horizontal</enum>
</property> </property>
<property name="invertedAppearance"> <property name="invertedAppearance">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="invertedControls"> <property name="invertedControls">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="tickPosition"> <property name="tickPosition">
<enum>QSlider::TicksBelow</enum> <enum>QSlider::TicksBelow</enum>
</property> </property>
</widget> </widget>
</item> </item>
<item row="4" column="4"> <item row="4" column="4">
<widget class="QSlider" name="sliderBackward"> <widget class="QSlider" name="sliderBackward">
<property name="minimumSize"> <property name="minimumSize">
<size> <size>
<width>30</width> <width>30</width>
<height>0</height> <height>0</height>
</size> </size>
</property> </property>
<property name="maximum"> <property name="maximum">
<number>100</number> <number>100</number>
</property> </property>
<property name="orientation"> <property name="orientation">
<enum>Qt::Vertical</enum> <enum>Qt::Vertical</enum>
</property> </property>
<property name="invertedAppearance"> <property name="invertedAppearance">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="invertedControls"> <property name="invertedControls">
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="tickPosition"> <property name="tickPosition">
<enum>QSlider::TicksBelow</enum> <enum>QSlider::TicksBelow</enum>
</property> </property>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
</item> </item>
</layout> </layout>
</widget> </widget>
<resources/> <resources/>
<connections> <connections>
<connection> <connection>
<sender>sliderLeft</sender> <sender>sliderLeft</sender>
<signal>valueChanged(int)</signal> <signal>valueChanged(int)</signal>
<receiver>lcdNumber_3</receiver> <receiver>lcdNumber_3</receiver>
<slot>display(int)</slot> <slot>display(int)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>51</x> <x>51</x>
<y>305</y> <y>305</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>262</x> <x>262</x>
<y>308</y> <y>308</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>sliderRight</sender> <sender>sliderRight</sender>
<signal>valueChanged(int)</signal> <signal>valueChanged(int)</signal>
<receiver>lcdNumber_4</receiver> <receiver>lcdNumber_4</receiver>
<slot>display(int)</slot> <slot>display(int)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>529</x> <x>529</x>
<y>315</y> <y>315</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>436</x> <x>436</x>
<y>304</y> <y>304</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>sliderForward</sender> <sender>sliderForward</sender>
<signal>valueChanged(int)</signal> <signal>valueChanged(int)</signal>
<receiver>lcdNumber</receiver> <receiver>lcdNumber</receiver>
<slot>display(int)</slot> <slot>display(int)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>325</x> <x>325</x>
<y>119</y> <y>119</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>357</x> <x>357</x>
<y>247</y> <y>247</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection> <connection>
<sender>sliderBackward</sender> <sender>sliderBackward</sender>
<signal>valueChanged(int)</signal> <signal>valueChanged(int)</signal>
<receiver>lcdNumber_2</receiver> <receiver>lcdNumber_2</receiver>
<slot>display(int)</slot> <slot>display(int)</slot>
<hints> <hints>
<hint type="sourcelabel"> <hint type="sourcelabel">
<x>310</x> <x>310</x>
<y>421</y> <y>421</y>
</hint> </hint>
<hint type="destinationlabel"> <hint type="destinationlabel">
<x>327</x> <x>327</x>
<y>379</y> <y>379</y>
</hint> </hint>
</hints> </hints>
</connection> </connection>
</connections> </connections>
</ui> </ui>

View file

Before

Width:  |  Height:  |  Size: 3.2 MiB

After

Width:  |  Height:  |  Size: 3.2 MiB

View file

@ -1,5 +0,0 @@
# QTcpSocket
### [Python3.4.4 or Python3.5][PyQt5]
### [1.控制小车](控制小车/)

View file

@ -0,0 +1,6 @@
# 表格控件案例
1. [表格内容复制](表格内容复制.py)
![截图1](ScreenShot/1.png)![截图2](ScreenShot/2.png)

View file

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View file

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View file

@ -1,7 +0,0 @@
# 表格复制
### [Python3.4.4 or Python3.5][PyQt5]
# 截图
![截图1](ScreenShot/1.png)
![截图2](ScreenShot/2.png)