diff --git a/README.md b/README.md
index e02dacedb16b2d9481d9e686fe13e029ca010a36..1f3e11c53249016d72c53e5bdc4ca02b4603bc08 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
-
+
@@ -110,7 +110,7 @@ pyminer希望成为一个伟大的开源项目,也希望得到大家的认可
2. 建议新建全新的虚拟环境,尤其是当旧的虚拟环境中存在其他依赖于PyQt/PySide2的程序时。pyminer与这些程序可能发生依赖冲突。
-#### Windows安装
+#### Windows安装 pyminer
```bash
#第一步:下载源代码
@@ -118,7 +118,22 @@ git clone https://gitee.com/py2cn/pyminer.git
#安装依赖 (如果下载太慢,请复制源码目录下的 pip.ini 文件到python安装目录下)
pip install pyminer
#第三步:运行主程序
-python app2.py
+在控制台输入 pyminer 回车,即可打开pyminer
+
+
+```
+
+#### 虚拟环境安装 pyminer
+
+```bash
+#第一步:创建pip虚拟环境
+pip install pipenv
+pipenv --three # 使用当前系统中的python3创建环境
+#第二步:启动当前目录下的虚拟环境
+pipenv shell
+#第三步:为虚拟环境安装pyminer
+pipenv install pyminer -i https://mirrors.cloud.tencent.com/pypi/simple
+
```
@@ -141,24 +156,18 @@ pyminer项目现在的开发目标是,打造初学者友好的Python编程环
作者:pyminer Development Team
-邮箱:team@py2cn.com
+邮箱:team@pyminer.com
欢迎各位开发者大佬加入
-
+
-## 📱 支持我们
-
-

-

-
-
## 🚥 许可说明
本项目遵循LGPL许可证。
@@ -168,11 +177,11 @@ pyminer项目现在的开发目标是,打造初学者友好的Python编程环
## 📸 预览截图
基本界面
-
+
代码提示
-
+
绘图
-
+
diff --git a/pyminer/__main__.py b/pyminer/__main__.py
new file mode 100644
index 0000000000000000000000000000000000000000..7f16ed1f974311916d80fb51ea5d8ff257c4591c
--- /dev/null
+++ b/pyminer/__main__.py
@@ -0,0 +1,5 @@
+from app2 import main
+
+
+if __name__ == '__main__':
+ main()
\ No newline at end of file
diff --git a/pyminer/app2.py b/pyminer/app2.py
index bb3d125845a9406568aa3699d106fc12a3743303..0d1717df3c4973707136a920617a1195ad44c238 100644
--- a/pyminer/app2.py
+++ b/pyminer/app2.py
@@ -17,8 +17,11 @@ import time
import traceback
from multiprocessing import shared_memory
+
sys.path.append(os.path.dirname(__file__))
-sys.path.append(os.path.join(os.path.dirname(__file__), "resources"))
+
+import utils
+sys.path.append(utils.get_resources_dir())
# 异常处理设置
cgitb.enable(format='text')
@@ -51,17 +54,15 @@ sys.excepthook.handle = exception_handler
import PySide2
-dirname = os.path.dirname(PySide2.__file__)
-plugin_path = os.path.join(dirname, 'plugins', 'platforms')
-os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = plugin_path
+os.environ['QT_QPA_PLATFORM_PLUGIN_PATH'] = utils.get_pysideplugins_directory()
os.environ['QT_API'] = 'pyside2'
os.environ['PYQTGRAPH_QT_LIB'] = 'PySide2'
os.environ['FORCE_QT_API'] = "1"
from typing import List, Callable, Tuple, ClassVar, Optional
from PySide2.QtCore import Signal, QTimer, Qt, QCoreApplication
-from PySide2.QtGui import QCloseEvent, QTextCursor, QResizeEvent, QMoveEvent, QFont, QIcon, QPixmap
+from PySide2.QtGui import QCloseEvent, QCursor, QTextCursor, QResizeEvent, QMoveEvent, QFont, QIcon, QPixmap
from PySide2.QtWidgets import QApplication, QMessageBox, QSplashScreen, QStatusBar, QDialog, QVBoxLayout, QProgressBar
import pmgwidgets
@@ -78,7 +79,7 @@ from features.ui.widgets.controlpanel import PMPageExt
from features.ui.pmwidgets import BaseMainWindow
from features.io.exceptions import PMExceptions
from features.pluginsmanager.pluginsmanager import MarketplaceForm
-import utils
+
from load_modules import load_translator, load_fonts
from pmgui import PMToolBarHome, LogOutputConsole
@@ -143,6 +144,7 @@ class MainWindow(BaseMainWindow):
extensions: 如果指定,则仅加载指定的插件,否则加载全部插件
"""
super().__init__(parent)
+ self.setWindowFlags(Qt.FramelessWindowHint)
self.extension_names = extensions # 需要加载的插件名称
# settings = Settings()
t00 = time.time()
@@ -233,6 +235,27 @@ class MainWindow(BaseMainWindow):
self.dock_widgets[k].widget().closeEvent(a0)
super().closeEvent(a0)
+ def mousePressEvent(self, event):
+ if event.button()==Qt.LeftButton:
+ self.m_flag=True
+ self.m_Position=event.globalPos()-self.pos()
+ event.accept()
+ self.setCursor(QCursor(Qt.OpenHandCursor))
+
+ def mouseMoveEvent(self, QMouseEvent):
+ if Qt.LeftButton and self.m_flag:
+ self.move(QMouseEvent.globalPos()-self.m_Position)
+ QMouseEvent.accept()
+
+ def mouseReleaseEvent(self, QMouseEvent):
+ self.m_flag=False
+ self.setCursor(QCursor(Qt.ArrowCursor))
+
+ def mouseDoubleClickEvent(self, event):
+ self.window_maximum()
+ event.accept() # 接受事件,禁止传到父控件
+
+
def moveEvent(self, a0: 'QMoveEvent') -> None:
self.window_geometry_changed_signal.emit()
@@ -353,7 +376,7 @@ class MainWindow(BaseMainWindow):
def login_form_display(self):
"""
显示"登录"窗口
- Displays the "Quick Action" window
+ Displays the "Login In" window
"""
shared_memo = shared_memory.SharedMemory(name="sharedMemory") # 通过name找到共享内存token
buff = shared_memo.buf
diff --git a/pyminer/utils/__init__.py b/pyminer/utils/__init__.py
index e565842a138c14906a24c2fbd9532c3551eb9b73..3e96dcc296d872feccada1ef639909ed893d1163 100644
--- a/pyminer/utils/__init__.py
+++ b/pyminer/utils/__init__.py
@@ -9,13 +9,15 @@ from .debug import *
from .environ import (
get_python_version,
get_python_modules_directory,
- getPySideModulesDirectory,
- getScriptsPath,
- getDesignerPath
+ get_pysidemodules_directory,
+ get_pysideplugins_directory,
+ get_scripts_path,
+ get_designer_path
)
from .io import *
from .path import (
get_root_dir,
+ get_resources_dir,
get_user_dir,
get_desktop_dir,
get_documents_dir,
diff --git a/pyminer/utils/environ.py b/pyminer/utils/environ.py
index c2ee544ad1d1c23c16ff87a1d3b01f2e525f268d..3283d683c5eecd74b1e2e98bb4dde3909d2ffca3 100644
--- a/pyminer/utils/environ.py
+++ b/pyminer/utils/environ.py
@@ -25,11 +25,11 @@ def get_python_modules_directory():
return distutils.sysconfig.get_python_lib(True)
-def getPySideModulesDirectory(version=2):
+def get_pysidemodules_directory(version=2):
"""
- Function to determine the path to PyQt5 modules directory.
+ Function to determine the path to PySide2 modules directory.
- @return path to the PyQt5 modules directory (string)
+ @return path to the PySide2 modules directory (string)
"""
import distutils.sysconfig
@@ -39,8 +39,21 @@ def getPySideModulesDirectory(version=2):
return ""
+def get_pysideplugins_directory(version=2):
+ """
+ Function to determine the path to PySide2 plugins directory.
+
+ @return path to the PySide2 plugins directory (string)
+ """
+ import distutils.sysconfig
+ dirname = get_pysidemodules_directory()
+ PySidePath = os.path.join(dirname, 'plugins', 'platforms')
+ if os.path.exists(PySidePath):
+ return PySidePath
+
+ return ""
-def getScriptsPath(version=2):
+def get_scripts_path(version=2):
"""
Module function to get the path of the PySide tools.
@@ -68,7 +81,7 @@ def getScriptsPath(version=2):
return path
-def getDesignerPath(version=2):
+def get_designer_path(version=2):
"""
Module function to get the path of the Qt binaries.
diff --git a/pyminer/utils/path.py b/pyminer/utils/path.py
index fc36a9629392bd27afbace3600a46a9eae2b431f..ea08738597ef637974d8cd69d146daf53df9ba43 100644
--- a/pyminer/utils/path.py
+++ b/pyminer/utils/path.py
@@ -19,6 +19,15 @@ def get_root_dir() -> str:
path = os.path.dirname(os.path.dirname(__file__))
return path
+def get_resources_dir() -> str:
+ """
+ 获取根路径。
+ Returns:
+
+ """
+ path = os.path.join(get_root_dir(),'resources')
+ return path
+
def get_user_dir() -> str:
"""
diff --git a/pyminer/utils/platform.py b/pyminer/utils/platform.py
index d050ee1173b6350df8ecb5db34ec53310ce1b865..bd1f96255dfd8eac69f3a72350dd73944a28061a 100644
--- a/pyminer/utils/platform.py
+++ b/pyminer/utils/platform.py
@@ -37,7 +37,7 @@ def is_kde_desktop():
@return flag indicating a KDE desktop
@rtype bool
"""
- if not isLinuxPlatform():
+ if not is_linux_platform():
return False
isKDE = False
@@ -62,7 +62,7 @@ def is_gnome_desktop():
@return flag indicating a Gnome desktop
@rtype bool
"""
- if not isLinuxPlatform():
+ if not is_linux_platform():
return False
isGnome = False