|
28 | 28 | from PyQt5.QtCore import pyqtSignal, Qt, QRect, QMargins |
29 | 29 | from PyQt5.QtWidgets import (QApplication, QWidget,QPushButton,QMessageBox,QDesktopWidget,QMainWindow, |
30 | 30 | QVBoxLayout,QHBoxLayout,QGridLayout,QTextEdit,QLabel,QRadioButton,QCheckBox, |
31 | | - QLineEdit,QGroupBox,QSplitter,QFileDialog, QScrollArea, QTabWidget) |
| 31 | + QLineEdit,QGroupBox,QSplitter,QFileDialog, QScrollArea, QTabWidget, QMenu) |
32 | 32 | from PyQt5.QtGui import QIcon,QFont,QTextCursor,QPixmap,QColor |
33 | 33 | import qtawesome as qta # https://github.com/spyder-ide/qtawesome |
34 | 34 | import threading |
@@ -289,11 +289,26 @@ def addTabPanel(tabWidget, name, plugin, connectionWidget = None): |
289 | 289 |
|
290 | 290 | if sys.platform == "win32": |
291 | 291 | ctypes.windll.shell32.SetCurrentProcessExplicitAppUserModelID("comtool") |
| 292 | + elif sys.platform == 'darwin': |
| 293 | + self.macOsAddDockMenu() |
| 294 | + |
292 | 295 | self.resize(800, 500) |
293 | 296 | self.MoveToCenter() |
294 | 297 | self.show() |
295 | 298 | print("config file path:",parameters.configFilePath) |
296 | 299 |
|
| 300 | + def macOsAddDockMenu(self): |
| 301 | + def dumplicateProcess(): |
| 302 | + import multiprocessing |
| 303 | + p = multiprocessing.Process(target=main) |
| 304 | + p.start() |
| 305 | + |
| 306 | + self.dockMenu = QMenu(self) |
| 307 | + self.dockMenu.addAction(_('New Window'), |
| 308 | + dumplicateProcess) |
| 309 | + self.dockMenu.setAsDockMenu() |
| 310 | + self.app.setAttribute(Qt.AA_DontShowIconsInMenus, True) |
| 311 | + |
297 | 312 | def initEvent(self): |
298 | 313 | # menu |
299 | 314 | self.settingsButton.clicked.connect(self.toggleSettings) |
|
0 commit comments