Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to Pyqt6 to fit M1/M2 #11

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions lewansoul-lx16a-terminal/lewansoul_lx16a_terminal.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@

import sys

from PyQt5.QtCore import Qt, QTimer, QThread, pyqtSignal
from PyQt5.QtWidgets import (QWidget, QApplication, QDialog, QMessageBox, QListWidgetItem)
from PyQt5.uic import loadUi as _loadUi
from PyQt6.QtCore import Qt, QTimer, QThread, pyqtSignal
from PyQt6.QtWidgets import (QWidget, QApplication, QDialog, QMessageBox, QListWidgetItem)
from PyQt6.uic import loadUi as _loadUi

from collections import namedtuple
import pkg_resources
Expand Down Expand Up @@ -407,7 +407,7 @@ def scanFinished():

def servoFound(servoId):
item = QListWidgetItem('Servo ID=%s' % servoId)
item.setData(Qt.UserRole, servoId)
item.setData(Qt.ItemDataRole.UserRole, servoId)
self.servoList.addItem(item)

if not self._servoScanThread:
Expand All @@ -425,7 +425,7 @@ def servoFound(servoId):
def _on_servo_selected(self, item):
servo_id = None
if item is not None:
servo_id = item.data(Qt.UserRole)
servo_id = item.data(Qt.ItemDataRole.UserRole)

if servo_id:
self.servo = self.controller.servo(servo_id)
Expand Down Expand Up @@ -490,23 +490,23 @@ def _configure_servo_id(self):

dialog = ConfigureIdDialog()
dialog.servoId = self.servo.get_servo_id()
if dialog.exec_():
if dialog.exec():
self.logger.info('Setting servo ID to %d' % dialog.servoId)
self.servo.set_servo_id(dialog.servoId)
self.servo = self.controller.servo(dialog.servoId)
self.servoIdLabel.setText(str(dialog.servoId))
item = self.servoList.currentItem()
if item is not None:
item.setText('Servo ID=%d' % dialog.servoId)
item.setData(Qt.UserRole, dialog.servoId)
item.setData(Qt.ItemDataRole.UserRole, dialog.servoId)

def _configure_position_limits(self):
if not self.servo:
return

dialog = ConfigurePositionLimitsDialog()
dialog.minPosition, dialog.maxPosition = self.servo.get_position_limits()
if dialog.exec_():
if dialog.exec():
self.logger.info('Setting position limits to %d..%d' % (dialog.minPosition, dialog.maxPosition))
self.servo.set_position_limits(dialog.minPosition, dialog.maxPosition)
self.positionLimits.setText('%d .. %d' % (dialog.minPosition, dialog.maxPosition))
Expand All @@ -517,7 +517,7 @@ def _configure_voltage_limits(self):

dialog = ConfigureVoltageLimitsDialog()
dialog.minVoltage, dialog.maxVoltage = self.servo.get_voltage_limits()
if dialog.exec_():
if dialog.exec():
self.logger.info('Setting voltage limits to %d..%d' % (dialog.minVoltage, dialog.maxVoltage))
self.servo.set_voltage_limits(dialog.minVoltage, dialog.maxVoltage)
self.voltageLimits.setText('%d .. %d' % (dialog.minVoltage, dialog.maxVoltage))
Expand All @@ -528,7 +528,7 @@ def _configure_max_temperature(self):

dialog = ConfigureMaxTemperatureDialog()
dialog.maxTemperature = self.servo.get_max_temperature_limit()
if dialog.exec_():
if dialog.exec():
self.logger.info('Setting max temperature limit to %d' % (dialog.maxTemperature))
self.servo.set_max_temperature_limit(dialog.maxTemperature)
self.maxTemperature.setText(str(dialog.maxTemperature))
Expand All @@ -540,7 +540,7 @@ def _configure_position_offset(self):
dialog = ConfigurePositionOffsetDialog(self.servo)
old_position_offset = self.servo.get_position_offset()
dialog.positionOffset = old_position_offset
if dialog.exec_():
if dialog.exec():
self.logger.info('Setting position offset limit to %d' % (dialog.positionOffset))
self.servo.set_position_offset(dialog.positionOffset)
self.servo.save_position_offset()
Expand Down Expand Up @@ -688,7 +688,7 @@ def main():
logging.basicConfig(level=logging.DEBUG)
app = QApplication(sys.argv)
terminal = Terminal()
sys.exit(app.exec_())
sys.exit(app.exec())


if __name__ == '__main__':
Expand Down
2 changes: 1 addition & 1 deletion lewansoul-lx16a-terminal/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ def find_files(directory, pattern, recursive=True):
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
],
install_requires=['lewansoul_lx16a', 'pyserial', 'PyQt5'],
install_requires=['lewansoul_lx16a', 'pyserial', 'PyQt6'],
)
2 changes: 1 addition & 1 deletion lewansoul-lx16a/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
'Programming Language :: Python :: Implementation :: CPython',
'Programming Language :: Python :: Implementation :: PyPy',
],
install_requires=['pyserial'],
install_requires=['pyserial==3.3'],
)