Skip to content

Commit 1a56fef

Browse files
committed
High sierra fix for serial ports
1 parent c46f19a commit 1a56fef

File tree

5 files changed

+25
-4
lines changed

5 files changed

+25
-4
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,4 @@ instructions
7171
read
7272
.vscode/
7373

74+
.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: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
from setuptools import setup, find_packages
22
from setuptools.command.install import install
33
import sys
4+
from modbus_simulator.version import __VERSION__
5+
46

57
def install_requires():
68
with open('requirements') as reqs:
@@ -17,8 +19,8 @@ def readme():
1719
setup(
1820
name="modbus_simulator",
1921
url="https://github.com/riptideio/modbus-simulator.git",
20-
version="1.0",
2122
description="Modbus Simulator uing Kivy, Pymodbus, Modbus-tk",
23+
version=__VERSION__,
2224
long_description=readme(),
2325
keywords="Modbus Simulator",
2426
author="riptideio",

0 commit comments

Comments
 (0)