Skip to content

Commit 801d239

Browse files
committed
BEDGE-2699 - code refactoring
1 parent c29c78a commit 801d239

File tree

19 files changed

+71
-394
lines changed

19 files changed

+71
-394
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ docs/_build/
5959
target/
6060

6161
#PyCharms
62-
*.idea
62+
.idea
6363

6464
#IniFiles
6565
*.ini

LICENSE

Lines changed: 0 additions & 340 deletions
This file was deleted.

README.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,16 @@ Modbus Simulator with GUI based on modbus-tk
1515
- [OSx](https://kivy.org/docs/installation/installation-osx.html)
1616
- [Linux](http://kivy.org/docs/installation/installation-linux.html#ubuntu-11-10-or-newer)
1717
- [Windows](http://kivy.org/docs/installation/installation-windows.html)
18+
2. create virtualenv and install requirements
19+
20+
21+
$ pip install -r requirements
1822

19-
2. install modbus-tk
20-
* On Mac kivy uses its own virtual env ,hence all required modules needs to be installed seperatly [installing modules](http://kivy.org/docs/installation/installation-macosx.html#installing-modules)
21-
- kivy -m pip install modbus-tk
2223
3. [Setup development environment](https://github.com/kivy/kivy/wiki/Setting-Up-Kivy-with-various-popular-IDE's)
2324

2425
## Running/Testing application
25-
$ cd modbus_simulator
26-
$ kivy main.py
26+
$ ./tools/launcher
27+
2728
A GUi should show up if all the requirements are met !!
2829

2930
![Screen Shot 2015-11-01 at 7.25.50 PM.png](https://bitbucket.org/repo/X9byrq/images/4179375251-Screen%20Shot%202015-11-01%20at%207.25.50%20PM.png)
@@ -48,7 +49,7 @@ A GUi should show up if all the requirements are met !!
4849
## Packaging for different OS (Standalone applications)
4950
A standalone application specific to target OS can be created with Kivy package manager
5051

51-
1. [OSX](http://kivy.org/docs/guide/packaging-macosx.html)
52+
1. [OSX](https://kivy.org/docs/guide/packaging-osx.html)
5253
2. [Linux](http://bitstream.io/packaging-and-distributing-a-kivy-application-on-linux.html)
5354
3. [Windows](http://kivy.org/docs/guide/packaging-windows.html)
5455

File renamed without changes.
File renamed without changes.

launcher

Lines changed: 0 additions & 2 deletions
This file was deleted.

main.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -5,21 +5,21 @@
55
import kivy
66
kivy.require('1.4.2')
77
from kivy.app import App
8-
from kivy.properties import ObjectProperty, NumericProperty
8+
from kivy.properties import ObjectProperty
99
from kivy.uix.boxlayout import BoxLayout
1010
from kivy.animation import Animation
11-
from kivy.uix.label import Label
1211
from kivy.uix.textinput import TextInput
13-
from kivy.uix.settings import (Settings, SettingsWithSidebar)
12+
from kivy.uix.settings import SettingsWithSidebar
1413
from kivy.uix.listview import ListView, ListItemButton
1514
from kivy.adapters.listadapter import ListAdapter
16-
import DataModel
17-
from modbus import ModbusSimu, BLOCK_TYPES, configure_modbus_logger
18-
from settings import SettingIntegerWithRange
19-
from backgroundJob import BackgroundJob
15+
from utils.modbus import ModbusSimu, BLOCK_TYPES, configure_modbus_logger
16+
from ui.settings import SettingIntegerWithRange
17+
from utils.backgroundJob import BackgroundJob
2018
import re
2119
import os
2220
from kivy.config import Config
21+
from kivy.lang import Builder
22+
import ui.datamodel
2323

2424
MAP = {
2525
"coils": "coils",
@@ -28,6 +28,8 @@
2828
'holding registers': 'holding_registers'
2929
}
3030

31+
Builder.load_file("templates/modbussimu.kv")
32+
3133

3234
class FloatInput(TextInput):
3335
pat2 = re.compile(r'\d+(?:,\d+)?')
@@ -43,9 +45,9 @@ def insert_text(self, substring, from_undo=False):
4345

4446

4547
class Gui(BoxLayout):
46-
'''
48+
"""
4749
Gui of widgets. This is the root widget of the app.
48-
'''
50+
"""
4951

5052
# ---------------------GUI------------------------ #
5153
# Checkbox to select between tcp/serial
@@ -168,7 +170,6 @@ def data_map(self):
168170
def data_map(self, value):
169171
self._data_map[self.active_server] = value
170172

171-
172173
def _init_coils(self):
173174
time_interval = int(eval(self.config.get("Simulation",
174175
"time interval")))

requirements

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Cython==0.25.2
2+
docutils==0.13.1
3+
Kivy==1.9.1
4+
Kivy-Garden==0.1.4
5+
modbus-tk==0.5.4
6+
pygame==1.9.2
7+
pyglet==1.2.4
8+
Pygments==2.1.3
9+
pyserial==3.1
10+
requests==2.12.4
File renamed without changes.

0 commit comments

Comments
 (0)