Skip to content

Commit 55756fd

Browse files
committed
High sierra fix for serial ports
1 parent 5b88143 commit 55756fd

File tree

5 files changed

+24
-4
lines changed

5 files changed

+24
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,4 @@ target/
6666

6767
#JSONFiles
6868
*.json
69+
/.venv

modbus_simulator/templates/modbussimu.kv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -298,6 +298,7 @@
298298
id: riptide_logo
299299
with_previous: False
300300
disabled: True
301+
title: ' v1.0.0'
301302
ActionOverflow:
302303
ActionButton:
303304
id: reset_simulation

modbus_simulator/ui/gui.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,24 @@
1717
from modbus_simulator.utils.backgroundJob import BackgroundJob
1818
import re
1919
import os
20-
import click
20+
import platform
2121

2222
from json import load, dump
2323
from kivy.config import Config
2424
from kivy.lang import Builder
25-
import modbus_simulator.ui.datamodel
25+
import modbus_simulator.ui.datamodel #noqa
2626
from pkg_resources import resource_filename
2727
from serial.serialutil import SerialException
28+
29+
IS_DARWIN = platform.system().lower() == "darwin"
30+
OSX_SIERRA = 10.12
31+
if IS_DARWIN:
32+
MAC_VERSION = float(platform.mac_ver()[0])
33+
else:
34+
MAC_VERSION = 0
35+
36+
DEFAULT_SERIAL_PORT = '/dev/ptyp0' if MAC_VERSION <= OSX_SIERRA else '/dev/ttyp0'
37+
2838
if USE_PYMODBUS:
2939
from modbus_simulator.utils.pymodbus_server import ModbusSimu
3040
else:
@@ -363,7 +373,7 @@ def update_serial_connection_info(self, checkbox, value):
363373
if value:
364374
self.interface_settings.current = checkbox
365375
if self.last_active_port['serial'] == "":
366-
self.last_active_port['serial'] = '/dev/ptyp0'
376+
self.last_active_port['serial'] = DEFAULT_SERIAL_PORT
367377
self.port.text = self.last_active_port['serial']
368378
self._restore()
369379
else:

modbus_simulator/version.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
"""
2+
Copyright (c) 2017 Riptide IO, Inc. All Rights Reserved.
3+
4+
"""
5+
from __future__ import absolute_import, unicode_literals
6+
7+
__VERSION__ = "1.0.0"

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from setuptools import setup, find_packages
2+
from modbus_simulator.version import __VERSION__
23

34

45
def install_requires():
@@ -17,7 +18,7 @@ def readme():
1718
setup(
1819
name="modbus_simulator",
1920
url="https://bitbucket.org/riptideio/modbus-simulator",
20-
version="1.0",
21+
version=__VERSION__,
2122
description="Modbus Simulator using modbus_tk and kivy",
2223
long_description=readme(),
2324
keywords="Modbus Simulator",

0 commit comments

Comments
 (0)