Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c0552edaf3 | ||
|
|
a830b6b27f | ||
|
|
39fc6b0602 | ||
|
|
a2e29b06fd |
@@ -6,7 +6,17 @@
|
|||||||
"Bash(pip install:*)",
|
"Bash(pip install:*)",
|
||||||
"Bash(python:*)",
|
"Bash(python:*)",
|
||||||
"Bash(git init:*)",
|
"Bash(git init:*)",
|
||||||
"Bash(git add:*)"
|
"Bash(git add:*)",
|
||||||
|
"Bash(cat:*)",
|
||||||
|
"Bash(git commit:*)",
|
||||||
|
"Bash(git push:*)",
|
||||||
|
"Bash(ls:*)",
|
||||||
|
"Bash(git tag:*)",
|
||||||
|
"Bash(pyinstaller:*)",
|
||||||
|
"Bash(open:*)",
|
||||||
|
"Bash(osascript:*)",
|
||||||
|
"Bash(killall:*)",
|
||||||
|
"Bash(git fetch:*)"
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
5
.gitignore
vendored
5
.gitignore
vendored
@@ -24,3 +24,8 @@ Thumbs.db
|
|||||||
|
|
||||||
# Application specific
|
# Application specific
|
||||||
*.pyc
|
*.pyc
|
||||||
|
|
||||||
|
# PyInstaller
|
||||||
|
build/
|
||||||
|
dist/
|
||||||
|
*.spec.bak
|
||||||
|
|||||||
90
MSMD.spec
Normal file
90
MSMD.spec
Normal file
@@ -0,0 +1,90 @@
|
|||||||
|
# -*- mode: python ; coding: utf-8 -*-
|
||||||
|
|
||||||
|
import sys
|
||||||
|
from pathlib import Path
|
||||||
|
|
||||||
|
block_cipher = None
|
||||||
|
|
||||||
|
# Collect data files (config and icons)
|
||||||
|
datas = [
|
||||||
|
('config.ini', '.'),
|
||||||
|
]
|
||||||
|
|
||||||
|
# Add icon files if they exist
|
||||||
|
for icon in ['MSMD32.png', 'refresh.png', 'settings.png']:
|
||||||
|
if Path(icon).exists():
|
||||||
|
datas.append((icon, '.'))
|
||||||
|
|
||||||
|
a = Analysis(
|
||||||
|
['MSMD_multiLevel.py'],
|
||||||
|
pathex=[],
|
||||||
|
binaries=[],
|
||||||
|
datas=datas,
|
||||||
|
hiddenimports=[
|
||||||
|
'PyQt5',
|
||||||
|
'PyQt5.QtCore',
|
||||||
|
'PyQt5.QtGui',
|
||||||
|
'PyQt5.QtWidgets',
|
||||||
|
'serial',
|
||||||
|
'serial.tools.list_ports',
|
||||||
|
'pyautogui',
|
||||||
|
'pyaudio',
|
||||||
|
'wave',
|
||||||
|
],
|
||||||
|
hookspath=[],
|
||||||
|
hooksconfig={},
|
||||||
|
runtime_hooks=[],
|
||||||
|
excludes=[],
|
||||||
|
win_no_prefer_redirects=False,
|
||||||
|
win_private_assemblies=False,
|
||||||
|
cipher=block_cipher,
|
||||||
|
noarchive=False,
|
||||||
|
)
|
||||||
|
|
||||||
|
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
||||||
|
|
||||||
|
exe = EXE(
|
||||||
|
pyz,
|
||||||
|
a.scripts,
|
||||||
|
[],
|
||||||
|
exclude_binaries=True,
|
||||||
|
name='MSMD',
|
||||||
|
debug=False,
|
||||||
|
bootloader_ignore_signals=False,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
console=False, # No console window on launch
|
||||||
|
disable_windowed_traceback=False,
|
||||||
|
argv_emulation=False,
|
||||||
|
target_arch=None,
|
||||||
|
codesign_identity=None,
|
||||||
|
entitlements_file=None,
|
||||||
|
)
|
||||||
|
|
||||||
|
coll = COLLECT(
|
||||||
|
exe,
|
||||||
|
a.binaries,
|
||||||
|
a.zipfiles,
|
||||||
|
a.datas,
|
||||||
|
strip=False,
|
||||||
|
upx=True,
|
||||||
|
upx_exclude=[],
|
||||||
|
name='MSMD',
|
||||||
|
)
|
||||||
|
|
||||||
|
# macOS App Bundle
|
||||||
|
app = BUNDLE(
|
||||||
|
coll,
|
||||||
|
name='MSMD.app',
|
||||||
|
icon=None, # Set to 'MSMD.icns' if you have a macOS icon file
|
||||||
|
bundle_identifier='com.msmd.player',
|
||||||
|
info_plist={
|
||||||
|
'NSPrincipalClass': 'NSApplication',
|
||||||
|
'NSHighResolutionCapable': 'True',
|
||||||
|
'CFBundleShortVersionString': '1.2.4',
|
||||||
|
'CFBundleVersion': '1.2.4',
|
||||||
|
'CFBundleName': 'MSMD Player',
|
||||||
|
'CFBundleDisplayName': 'MSMD Player',
|
||||||
|
'LSMinimumSystemVersion': '10.13.0',
|
||||||
|
},
|
||||||
|
)
|
||||||
@@ -20,6 +20,7 @@ Version History:
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import time
|
import time
|
||||||
|
from pathlib import Path
|
||||||
from PyQt5.QtWidgets import (QApplication, QWidget, QLineEdit, QFileDialog,
|
from PyQt5.QtWidgets import (QApplication, QWidget, QLineEdit, QFileDialog,
|
||||||
QPushButton, QLabel, QHBoxLayout, QVBoxLayout, QMessageBox, QStackedLayout,
|
QPushButton, QLabel, QHBoxLayout, QVBoxLayout, QMessageBox, QStackedLayout,
|
||||||
QGraphicsScene, QGraphicsView, QDesktopWidget, QGraphicsEllipseItem,
|
QGraphicsScene, QGraphicsView, QDesktopWidget, QGraphicsEllipseItem,
|
||||||
@@ -40,6 +41,38 @@ import pyaudio
|
|||||||
import wave
|
import wave
|
||||||
import glob
|
import glob
|
||||||
|
|
||||||
|
def getUserConfigDir():
|
||||||
|
"""Get the platform-specific user configuration directory."""
|
||||||
|
if sys.platform == 'darwin': # macOS
|
||||||
|
config_dir = Path.home() / 'Library' / 'Application Support' / 'MSMD'
|
||||||
|
elif sys.platform == 'win32': # Windows
|
||||||
|
config_dir = Path(os.environ.get('APPDATA', Path.home())) / 'MSMD'
|
||||||
|
else: # Linux and others
|
||||||
|
config_dir = Path.home() / '.config' / 'MSMD'
|
||||||
|
|
||||||
|
# Create directory if it doesn't exist
|
||||||
|
config_dir.mkdir(parents=True, exist_ok=True)
|
||||||
|
return config_dir
|
||||||
|
|
||||||
|
def getConfigFilePath():
|
||||||
|
"""Get the full path to the config file in the user directory."""
|
||||||
|
return getUserConfigDir() / 'config.ini'
|
||||||
|
|
||||||
|
def createDefaultConfig():
|
||||||
|
"""Create a default config.ini file if it doesn't exist."""
|
||||||
|
config_path = getConfigFilePath()
|
||||||
|
if not config_path.exists():
|
||||||
|
default_config = """[robot]
|
||||||
|
upgradetrigger = hotspot
|
||||||
|
upgrademode = both
|
||||||
|
minpowertomove = 55
|
||||||
|
maxpowertomove = 95
|
||||||
|
showReferenceCreator = 0
|
||||||
|
"""
|
||||||
|
config_path.write_text(default_config)
|
||||||
|
print(f'Created default config at: {config_path}')
|
||||||
|
return config_path
|
||||||
|
|
||||||
textToScanCodeTable = {}
|
textToScanCodeTable = {}
|
||||||
def buildScanCodeTranslationTable (hotSpotDict):
|
def buildScanCodeTranslationTable (hotSpotDict):
|
||||||
for imageName,metadata in hotSpotDict.items():
|
for imageName,metadata in hotSpotDict.items():
|
||||||
@@ -75,6 +108,14 @@ class GraphicsView(QGraphicsView):
|
|||||||
textFromCode = 'enter'
|
textFromCode = 'enter'
|
||||||
elif code == 16777217:
|
elif code == 16777217:
|
||||||
textFromCode = 'tab'
|
textFromCode = 'tab'
|
||||||
|
elif code == 16777219:
|
||||||
|
textFromCode = 'backspace'
|
||||||
|
elif code == 16777223:
|
||||||
|
textFromCode = 'delete'
|
||||||
|
elif code == 16777216:
|
||||||
|
textFromCode = 'esc'
|
||||||
|
elif code == 32:
|
||||||
|
textFromCode = 'space'
|
||||||
else:
|
else:
|
||||||
textFromCode = chr(code)
|
textFromCode = chr(code)
|
||||||
except :
|
except :
|
||||||
@@ -97,9 +138,15 @@ class GraphicsView(QGraphicsView):
|
|||||||
if(pressedModifiers & Qt.AltModifier):
|
if(pressedModifiers & Qt.AltModifier):
|
||||||
modifierTextList.append('alt')
|
modifierTextList.append('alt')
|
||||||
if(pressedModifiers & Qt.ControlModifier):
|
if(pressedModifiers & Qt.ControlModifier):
|
||||||
|
if sys.platform == 'darwin': # macOS
|
||||||
modifierTextList.append('cmd') # on the mac this is the command key
|
modifierTextList.append('cmd') # on the mac this is the command key
|
||||||
|
else: # Linux and Windows
|
||||||
|
modifierTextList.append('ctrl')
|
||||||
if(pressedModifiers & Qt.MetaModifier):
|
if(pressedModifiers & Qt.MetaModifier):
|
||||||
modifierTextList.append('ctrl')# on the mac this is the control key
|
if sys.platform == 'darwin': # macOS
|
||||||
|
modifierTextList.append('ctrl') # on the mac this is the control key
|
||||||
|
else: # Linux and Windows
|
||||||
|
modifierTextList.append('win')
|
||||||
|
|
||||||
return modifierTextList
|
return modifierTextList
|
||||||
|
|
||||||
@@ -142,14 +189,22 @@ class App(QWidget):
|
|||||||
self.portRefreshButton = QPushButton(self)
|
self.portRefreshButton = QPushButton(self)
|
||||||
self.portRefreshButton.setToolTip('Press to detect port of connected base station')
|
self.portRefreshButton.setToolTip('Press to detect port of connected base station')
|
||||||
self.portRefreshButton.clicked.connect(self.refreshPorts)
|
self.portRefreshButton.clicked.connect(self.refreshPorts)
|
||||||
|
if os.path.exists('refresh.png'):
|
||||||
self.portRefreshButton.setIcon(QIcon('refresh.png'))
|
self.portRefreshButton.setIcon(QIcon('refresh.png'))
|
||||||
self.portRefreshButton.setFixedWidth(24)
|
self.portRefreshButton.setFixedWidth(24)
|
||||||
|
else:
|
||||||
|
self.portRefreshButton.setText('⟳')
|
||||||
|
self.portRefreshButton.setFixedWidth(30)
|
||||||
|
|
||||||
self.settingsButton = QPushButton()
|
self.settingsButton = QPushButton()
|
||||||
self.settingsButton.setToolTip('Open the Settings Dialog')
|
self.settingsButton.setToolTip('Open the Settings Dialog')
|
||||||
|
self.settingsButton.clicked.connect(self.openSettings)
|
||||||
|
if os.path.exists('settings.png'):
|
||||||
self.settingsButton.setIcon(QIcon('settings.png'))
|
self.settingsButton.setIcon(QIcon('settings.png'))
|
||||||
self.settingsButton.setMaximumWidth(24)
|
self.settingsButton.setMaximumWidth(24)
|
||||||
self.settingsButton.clicked.connect(self.openSettings)
|
else:
|
||||||
|
self.settingsButton.setText('⚙')
|
||||||
|
self.settingsButton.setMaximumWidth(30)
|
||||||
|
|
||||||
self.connected = False
|
self.connected = False
|
||||||
self.refreshPorts()
|
self.refreshPorts()
|
||||||
@@ -236,6 +291,7 @@ class App(QWidget):
|
|||||||
self.setLayout(self.stackedLayout)
|
self.setLayout(self.stackedLayout)
|
||||||
self.setWindowTitle(self.title)
|
self.setWindowTitle(self.title)
|
||||||
self.setGeometry(self.left, self.top, self.width, self.height)
|
self.setGeometry(self.left, self.top, self.width, self.height)
|
||||||
|
if os.path.exists('MSMD32.png'):
|
||||||
self.setWindowIcon(QIcon('MSMD32.png'))
|
self.setWindowIcon(QIcon('MSMD32.png'))
|
||||||
self.cleanupEvent.connect(self.cleanupStuff)
|
self.cleanupEvent.connect(self.cleanupStuff)
|
||||||
self.show()
|
self.show()
|
||||||
@@ -243,23 +299,28 @@ class App(QWidget):
|
|||||||
|
|
||||||
|
|
||||||
def readConfig(self):
|
def readConfig(self):
|
||||||
|
# Create default config if it doesn't exist
|
||||||
|
config_path = createDefaultConfig()
|
||||||
|
self.configFilePath = str(config_path)
|
||||||
|
|
||||||
self.config = configparser.ConfigParser()
|
self.config = configparser.ConfigParser()
|
||||||
fileCheck = self.config.read('config.ini')
|
fileCheck = self.config.read(self.configFilePath)
|
||||||
if(fileCheck == []):
|
if(fileCheck == []):
|
||||||
QMessageBox.critical(self, 'Config Error!', 'config.ini was not found', QMessageBox.Ok)
|
QMessageBox.critical(self, 'Config Error!', f'config.ini was not found at {self.configFilePath}', QMessageBox.Ok)
|
||||||
self.robotSettings = self.config['robot']
|
self.robotSettings = self.config['robot']
|
||||||
self.upgradeTrigger = self.robotSettings['upgradeTrigger']
|
self.upgradeTrigger = self.robotSettings['upgradeTrigger']
|
||||||
self.upgradeMode = self.robotSettings['upgradeMode']
|
self.upgradeMode = self.robotSettings['upgradeMode']
|
||||||
self.minPowerToMove = self.robotSettings['minPowerToMove']
|
self.minPowerToMove = self.robotSettings['minPowerToMove']
|
||||||
self.maxPowerToMove = self.robotSettings['maxPowerToMove']
|
self.maxPowerToMove = self.robotSettings['maxPowerToMove']
|
||||||
self.showReferenceCreator = int(self.robotSettings.get('showReferenceCreator', '1'))
|
self.showReferenceCreator = int(self.robotSettings.get('showReferenceCreator', '0'))
|
||||||
|
|
||||||
def writeConfig(self):
|
def writeConfig(self):
|
||||||
self.robotSettings['upgradeTrigger'] = self.upgradeTrigger
|
self.robotSettings['upgradeTrigger'] = self.upgradeTrigger
|
||||||
self.robotSettings['upgradeMode'] = self.upgradeMode
|
self.robotSettings['upgradeMode'] = self.upgradeMode
|
||||||
self.robotSettings['minPowerToMove'] = self.minPowerToMove
|
self.robotSettings['minPowerToMove'] = self.minPowerToMove
|
||||||
self.robotSettings['maxPowerToMove'] = self.maxPowerToMove
|
self.robotSettings['maxPowerToMove'] = self.maxPowerToMove
|
||||||
with open('config.ini', 'w') as configFile:
|
self.robotSettings['showReferenceCreator'] = str(self.showReferenceCreator)
|
||||||
|
with open(self.configFilePath, 'w') as configFile:
|
||||||
self.config.write(configFile)
|
self.config.write(configFile)
|
||||||
|
|
||||||
def openSettings(self):
|
def openSettings(self):
|
||||||
@@ -285,7 +346,11 @@ class App(QWidget):
|
|||||||
self.upgradeMode = newSettings['upgradeMode']
|
self.upgradeMode = newSettings['upgradeMode']
|
||||||
self.minPowerToMove = newSettings['minPowerToMove']
|
self.minPowerToMove = newSettings['minPowerToMove']
|
||||||
self.maxPowerToMove = newSettings['maxPowerToMove']
|
self.maxPowerToMove = newSettings['maxPowerToMove']
|
||||||
|
self.showReferenceCreator = int(newSettings['showReferenceCreator'])
|
||||||
self.writeConfig()
|
self.writeConfig()
|
||||||
|
# Update reference creator button visibility if it exists
|
||||||
|
if hasattr(self, 'referenceCreator'):
|
||||||
|
self.referenceCreator.setVisible(self.showReferenceCreator == 1)
|
||||||
else:
|
else:
|
||||||
print ('ERROR - Unknown message returned from Settings.py Window!')
|
print ('ERROR - Unknown message returned from Settings.py Window!')
|
||||||
self.setDisabled(False)
|
self.setDisabled(False)
|
||||||
@@ -578,11 +643,15 @@ class App(QWidget):
|
|||||||
if(pressedModifiers & Qt.AltModifier):
|
if(pressedModifiers & Qt.AltModifier):
|
||||||
modifierTextList.append('alt')
|
modifierTextList.append('alt')
|
||||||
if(pressedModifiers & Qt.ControlModifier):
|
if(pressedModifiers & Qt.ControlModifier):
|
||||||
#modifierTextList.append('ctrl')
|
if sys.platform == 'darwin': # macOS
|
||||||
modifierTextList.append('cmd') # on the mac this is the command key
|
modifierTextList.append('cmd') # on the mac this is the command key
|
||||||
|
else: # Linux and Windows
|
||||||
|
modifierTextList.append('ctrl')
|
||||||
if(pressedModifiers & Qt.MetaModifier):
|
if(pressedModifiers & Qt.MetaModifier):
|
||||||
modifierTextList.append('ctrl')# on the mac this is the control key
|
if sys.platform == 'darwin': # macOS
|
||||||
#modifierTextList.append('win')
|
modifierTextList.append('ctrl') # on the mac this is the control key
|
||||||
|
else: # Linux and Windows
|
||||||
|
modifierTextList.append('win')
|
||||||
return set(modifierTextList) == set(self.currentInputModifiers)
|
return set(modifierTextList) == set(self.currentInputModifiers)
|
||||||
|
|
||||||
def simplifyModifierList(self, modifierList):
|
def simplifyModifierList(self, modifierList):
|
||||||
|
|||||||
184
README.md
184
README.md
@@ -151,7 +151,30 @@ Add sound effects by placing WAV files named `sound0.wav`, `sound1.wav`, etc., i
|
|||||||
|
|
||||||
## Configuration
|
## Configuration
|
||||||
|
|
||||||
Edit `config.ini` to customize robot behavior:
|
MSMD Player stores its configuration in a platform-specific user directory:
|
||||||
|
|
||||||
|
- **macOS**: `~/Library/Application Support/MSMD/config.ini`
|
||||||
|
- **Windows**: `%APPDATA%\MSMD\config.ini`
|
||||||
|
- **Linux**: `~/.config/MSMD/config.ini`
|
||||||
|
|
||||||
|
A default configuration file is automatically created on first run.
|
||||||
|
|
||||||
|
### Changing Settings
|
||||||
|
|
||||||
|
**Option 1: Settings Dialog (Recommended)**
|
||||||
|
|
||||||
|
Click the Settings button (gear icon) in the main window to open the Settings dialog. All configuration options can be changed through the UI:
|
||||||
|
- Upgrade Trigger (Hotspot or Level)
|
||||||
|
- Upgrade Mode (Both, Left, Right, or Distance)
|
||||||
|
- Minimum Power to Move (0-255)
|
||||||
|
- Maximum Power to Move (0-255)
|
||||||
|
- Show Reference Creator checkbox
|
||||||
|
|
||||||
|
Changes are saved immediately when you click "Set".
|
||||||
|
|
||||||
|
**Option 2: Manual Edit**
|
||||||
|
|
||||||
|
You can also manually edit the `config.ini` file:
|
||||||
|
|
||||||
```ini
|
```ini
|
||||||
[robot]
|
[robot]
|
||||||
@@ -162,6 +185,8 @@ maxpowertomove = 95 # Maximum power (0-255)
|
|||||||
showReferenceCreator = 0 # Show reference creator button (0 or 1)
|
showReferenceCreator = 0 # Show reference creator button (0 or 1)
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Restart the application for manual changes to take effect.
|
||||||
|
|
||||||
### Configuration Options
|
### Configuration Options
|
||||||
|
|
||||||
- **upgradetrigger**: When to upgrade robot power
|
- **upgradetrigger**: When to upgrade robot power
|
||||||
@@ -187,6 +212,157 @@ MSMD Player can communicate with robot base stations via serial connection:
|
|||||||
- Supports multiple base stations simultaneously
|
- Supports multiple base stations simultaneously
|
||||||
- Works without hardware (displays "BaseStation not connected" messages)
|
- Works without hardware (displays "BaseStation not connected" messages)
|
||||||
|
|
||||||
|
## Building Standalone Applications
|
||||||
|
|
||||||
|
You can create standalone executables for macOS, Windows, and Linux that don't require Python or any dependencies to be installed. These builds use PyInstaller to bundle everything into a single application.
|
||||||
|
|
||||||
|
### Prerequisites
|
||||||
|
|
||||||
|
**All Platforms:**
|
||||||
|
- Python 3.8 or higher
|
||||||
|
- Virtual environment with all dependencies installed (see Installation section)
|
||||||
|
- PyInstaller (install with `pip install pyinstaller`)
|
||||||
|
|
||||||
|
**Platform-Specific:**
|
||||||
|
- **macOS**: PyAudio requires PortAudio (`brew install portaudio`)
|
||||||
|
- **Windows**: No additional requirements
|
||||||
|
- **Linux**: PyAudio may require PortAudio development files (`sudo apt-get install portaudio19-dev` on Ubuntu/Debian)
|
||||||
|
|
||||||
|
**Important**: You must build on the target platform. You cannot build a Windows .exe on macOS, or vice versa.
|
||||||
|
|
||||||
|
### Build Instructions
|
||||||
|
|
||||||
|
#### macOS
|
||||||
|
|
||||||
|
1. **Activate your virtual environment:**
|
||||||
|
```bash
|
||||||
|
source venv/bin/activate
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Install PyInstaller:**
|
||||||
|
```bash
|
||||||
|
pip install pyinstaller
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Build the application:**
|
||||||
|
```bash
|
||||||
|
pyinstaller MSMD.spec --clean
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Find your application:**
|
||||||
|
- Location: `dist/MSMD.app`
|
||||||
|
- Size: ~92 MB
|
||||||
|
- Double-click to run, or drag to Applications folder
|
||||||
|
|
||||||
|
5. **Distribution:**
|
||||||
|
- Compress the .app: `cd dist && zip -r MSMD-macOS.zip MSMD.app`
|
||||||
|
- Share the .zip file with users
|
||||||
|
- Users may see "unidentified developer" warning on first launch (right-click → Open to bypass)
|
||||||
|
|
||||||
|
#### Windows
|
||||||
|
|
||||||
|
1. **Activate your virtual environment:**
|
||||||
|
```cmd
|
||||||
|
venv\Scripts\activate
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Install PyInstaller:**
|
||||||
|
```cmd
|
||||||
|
pip install pyinstaller
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Build the application:**
|
||||||
|
```cmd
|
||||||
|
pyinstaller MSMD.spec --clean
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Find your application:**
|
||||||
|
- Location: `dist\MSMD\MSMD.exe`
|
||||||
|
- Size: ~100-150 MB
|
||||||
|
- Double-click to run
|
||||||
|
|
||||||
|
5. **Distribution:**
|
||||||
|
- Compress the entire `dist\MSMD` folder as a .zip file
|
||||||
|
- Share with users
|
||||||
|
- Windows Defender may flag it initially (common with PyInstaller apps)
|
||||||
|
|
||||||
|
#### Linux
|
||||||
|
|
||||||
|
1. **Activate your virtual environment:**
|
||||||
|
```bash
|
||||||
|
source venv/bin/activate
|
||||||
|
```
|
||||||
|
|
||||||
|
2. **Install PyInstaller:**
|
||||||
|
```bash
|
||||||
|
pip install pyinstaller
|
||||||
|
```
|
||||||
|
|
||||||
|
3. **Build the application:**
|
||||||
|
```bash
|
||||||
|
pyinstaller MSMD.spec --clean
|
||||||
|
```
|
||||||
|
|
||||||
|
4. **Find your application:**
|
||||||
|
- Location: `dist/MSMD/MSMD`
|
||||||
|
- Size: ~100-150 MB
|
||||||
|
- Run from terminal: `./dist/MSMD/MSMD`
|
||||||
|
- Or make desktop launcher
|
||||||
|
|
||||||
|
5. **Distribution:**
|
||||||
|
- Compress the `dist/MSMD` folder: `cd dist && tar -czf MSMD-linux.tar.gz MSMD/`
|
||||||
|
- Share the .tar.gz file
|
||||||
|
- Users need to extract and run: `chmod +x MSMD && ./MSMD`
|
||||||
|
|
||||||
|
### The MSMD.spec File
|
||||||
|
|
||||||
|
The `MSMD.spec` file configures the PyInstaller build process. It:
|
||||||
|
- Bundles `config.ini` and icon files (if present)
|
||||||
|
- Includes all Python dependencies
|
||||||
|
- Creates platform-appropriate executables
|
||||||
|
- On macOS, creates a proper .app bundle with Info.plist
|
||||||
|
|
||||||
|
### Build Troubleshooting
|
||||||
|
|
||||||
|
#### "Module not found" errors during build
|
||||||
|
- Ensure all dependencies are installed: `pip install -r requirements.txt`
|
||||||
|
- Try adding missing modules to `hiddenimports` in MSMD.spec
|
||||||
|
|
||||||
|
#### Large file size
|
||||||
|
- Normal for PyInstaller builds (~90-150 MB)
|
||||||
|
- Includes Python runtime + PyQt5 + all dependencies
|
||||||
|
- Use UPX compression (enabled by default in MSMD.spec)
|
||||||
|
|
||||||
|
#### Application won't launch
|
||||||
|
- **macOS**: Right-click → Open (to bypass Gatekeeper)
|
||||||
|
- **Windows**: Check Windows Defender logs, add exception if needed
|
||||||
|
- **Linux**: Ensure executable permission: `chmod +x MSMD`
|
||||||
|
- Check that `config.ini` exists in the same directory as the executable
|
||||||
|
|
||||||
|
#### "Config.ini not found" in standalone app
|
||||||
|
- Verify `config.ini` is in the project root before building
|
||||||
|
- Check the `datas` section in MSMD.spec includes config.ini
|
||||||
|
|
||||||
|
#### Missing icons
|
||||||
|
- Icons (MSMD32.png, refresh.png, settings.png) are optional
|
||||||
|
- App will work without them but buttons won't show icons
|
||||||
|
- Add PNG files to project root before building
|
||||||
|
|
||||||
|
### Code Signing (Optional)
|
||||||
|
|
||||||
|
For professional distribution:
|
||||||
|
|
||||||
|
- **macOS**: Use `codesign` and Apple Developer account
|
||||||
|
- **Windows**: Use SignTool with code signing certificate
|
||||||
|
- **Linux**: Not typically required
|
||||||
|
|
||||||
|
### Build Artifacts
|
||||||
|
|
||||||
|
After building, you'll find:
|
||||||
|
- `dist/` - Contains the final application
|
||||||
|
- `build/` - Temporary build files (can be deleted)
|
||||||
|
- `*.spec` - Build configuration (keep in repository)
|
||||||
|
|
||||||
## Version History
|
## Version History
|
||||||
|
|
||||||
- **1.2.4**: Updated to be compatible with all screen sizes
|
- **1.2.4**: Updated to be compatible with all screen sizes
|
||||||
@@ -210,7 +386,11 @@ See project repository for license information.
|
|||||||
## Troubleshooting
|
## Troubleshooting
|
||||||
|
|
||||||
### "Config.ini was not found"
|
### "Config.ini was not found"
|
||||||
Create a `config.ini` file in the project root using the configuration template above.
|
This error should not occur as the config file is created automatically on first run. If you see this error:
|
||||||
|
- Check that the application has write permissions to the user config directory
|
||||||
|
- On macOS: `~/Library/Application Support/MSMD/`
|
||||||
|
- On Windows: `%APPDATA%\MSMD\`
|
||||||
|
- On Linux: `~/.config/MSMD/`
|
||||||
|
|
||||||
### "hotspots.json does not exist"
|
### "hotspots.json does not exist"
|
||||||
Ensure your content folder contains a valid `hotspots.json` file with entries for each image.
|
Ensure your content folder contains a valid `hotspots.json` file with entries for each image.
|
||||||
|
|||||||
17
Settings.py
17
Settings.py
@@ -7,7 +7,7 @@ Created on Fri Apr 20 18:11:20 2018
|
|||||||
|
|
||||||
from PyQt5.QtCore import Qt, pyqtSignal
|
from PyQt5.QtCore import Qt, pyqtSignal
|
||||||
from PyQt5.QtGui import QIcon
|
from PyQt5.QtGui import QIcon
|
||||||
from PyQt5.QtWidgets import (QHBoxLayout, QVBoxLayout, QGridLayout, QComboBox, QLabel, QSpinBox, QGroupBox, QPushButton, QWidget, QFrame, QSpacerItem, QSizePolicy)
|
from PyQt5.QtWidgets import (QHBoxLayout, QVBoxLayout, QGridLayout, QComboBox, QLabel, QSpinBox, QGroupBox, QPushButton, QWidget, QFrame, QSpacerItem, QSizePolicy, QCheckBox)
|
||||||
|
|
||||||
class QHLine(QFrame):
|
class QHLine(QFrame):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
@@ -25,6 +25,8 @@ class Settings(QWidget):
|
|||||||
self.__UserAbort = True
|
self.__UserAbort = True
|
||||||
|
|
||||||
#-----Widget Settings-----
|
#-----Widget Settings-----
|
||||||
|
import os
|
||||||
|
if os.path.exists('MSMD32.png'):
|
||||||
self.setWindowIcon(QIcon('MSMD32.png'))
|
self.setWindowIcon(QIcon('MSMD32.png'))
|
||||||
self.setWindowTitle('MSMD Settings')
|
self.setWindowTitle('MSMD Settings')
|
||||||
|
|
||||||
@@ -77,6 +79,10 @@ class Settings(QWidget):
|
|||||||
self.MaxPower.setFixedWidth(60)
|
self.MaxPower.setFixedWidth(60)
|
||||||
self.MaxPower.setValue(int(SettingsIn['maxPowerToMove']))
|
self.MaxPower.setValue(int(SettingsIn['maxPowerToMove']))
|
||||||
|
|
||||||
|
self.ShowReferenceCreator = QCheckBox()
|
||||||
|
self.ShowReferenceCreator.setToolTip('Show the "Create Reference" button in the main window')
|
||||||
|
self.ShowReferenceCreator.setChecked(int(SettingsIn.get('showReferenceCreator', '0')) == 1)
|
||||||
|
|
||||||
SetButton = QPushButton()
|
SetButton = QPushButton()
|
||||||
SetButton.setToolTip('Use the current settings')
|
SetButton.setToolTip('Use the current settings')
|
||||||
SetButton.setText('Set')
|
SetButton.setText('Set')
|
||||||
@@ -116,11 +122,17 @@ class Settings(QWidget):
|
|||||||
hlayout1.addWidget(UpgradeFrame)
|
hlayout1.addWidget(UpgradeFrame)
|
||||||
hlayout1.addWidget(SpeedFrame)
|
hlayout1.addWidget(SpeedFrame)
|
||||||
|
|
||||||
|
hlayoutRefCreator = QHBoxLayout()
|
||||||
|
hlayoutRefCreator.addWidget(QLabel('Show Reference Creator:'))
|
||||||
|
hlayoutRefCreator.addWidget(self.ShowReferenceCreator)
|
||||||
|
hlayoutRefCreator.addStretch(1)
|
||||||
|
|
||||||
hlayout2.addStretch(1)
|
hlayout2.addStretch(1)
|
||||||
hlayout2.addWidget(SetButton)
|
hlayout2.addWidget(SetButton)
|
||||||
hlayout2.addWidget(CancelButton)
|
hlayout2.addWidget(CancelButton)
|
||||||
|
|
||||||
vlayout3.addLayout(hlayout1)
|
vlayout3.addLayout(hlayout1)
|
||||||
|
vlayout3.addLayout(hlayoutRefCreator)
|
||||||
vlayout3.addStretch(1)
|
vlayout3.addStretch(1)
|
||||||
vlayout3.addWidget(QHLine())
|
vlayout3.addWidget(QHLine())
|
||||||
vlayout3.addLayout(hlayout2)
|
vlayout3.addLayout(hlayout2)
|
||||||
@@ -131,7 +143,8 @@ class Settings(QWidget):
|
|||||||
out = {'upgradeTrigger': str(self.UpgradeTrigger.currentText()).lower(),
|
out = {'upgradeTrigger': str(self.UpgradeTrigger.currentText()).lower(),
|
||||||
'upgradeMode': str(self.UpgradeMode.currentText()).lower(),
|
'upgradeMode': str(self.UpgradeMode.currentText()).lower(),
|
||||||
'minPowerToMove': str(self.MinPower.value()),
|
'minPowerToMove': str(self.MinPower.value()),
|
||||||
'maxPowerToMove': str(self.MaxPower.value())}
|
'maxPowerToMove': str(self.MaxPower.value()),
|
||||||
|
'showReferenceCreator': '1' if self.ShowReferenceCreator.isChecked() else '0'}
|
||||||
return(out)
|
return(out)
|
||||||
|
|
||||||
#==============================================================================
|
#==============================================================================
|
||||||
|
|||||||
Reference in New Issue
Block a user