Skip to content

Commit 44d0f87

Browse files
Krishna Tripathidhoomakethu
authored andcommitted
Merged in BEDGE-2726-make-pip-installable-version- (pull request #2)
BEDGE-2726 make pip installable version Approved-by: Sanjay K V <[email protected]>
2 parents cb786d2 + 98d373e commit 44d0f87

File tree

19 files changed

+86
-17
lines changed

19 files changed

+86
-17
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,4 +65,4 @@ target/
6565
*.ini
6666

6767
#JSONFiles
68-
*.json
68+
*.json

MANIFEST.in

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
include requirements
2+
include README.md
3+
include modbus_simulator/assets/*.png
4+
include modbus_simulator/assets/*.ico
5+
include modbus_simulator/templates/*.kv

README.md

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,14 @@ Modbus Simulator with GUI based on modbus-tk
2626
2727
## Running/Testing application
2828
$ ./tools/launcher
29-
29+
30+
or
31+
32+
With Pip
33+
34+
$ pip install modbus_simulator --extra-index-url http://pip.riptidieo.com/simple --trusted-host pip.riptideio.com
35+
$ modubus.simu
36+
`
3037
A GUi should show up if all the requirements are met !!
3138
3239
![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)

modbus_simulator/__init__.py

Whitespace-only changes.

main.py renamed to modbus_simulator/main.py

Lines changed: 22 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,18 @@
1212
from kivy.uix.settings import SettingsWithSidebar
1313
from kivy.uix.listview import ListView, ListItemButton
1414
from kivy.adapters.listadapter import ListAdapter
15-
from utils.modbus import ModbusSimu, BLOCK_TYPES, configure_modbus_logger
16-
from ui.settings import SettingIntegerWithRange
17-
from utils.backgroundJob import BackgroundJob
15+
from modbus_simulator.utils.modbus import ModbusSimu, BLOCK_TYPES, \
16+
configure_modbus_logger
17+
from modbus_simulator.ui.settings import SettingIntegerWithRange
18+
from modbus_simulator.utils.backgroundJob import BackgroundJob
1819
import re
1920
import os
2021
from json import load, dump
2122
from kivy.config import Config
2223
from kivy.lang import Builder
23-
import ui.datamodel
24+
import modbus_simulator.ui.datamodel
25+
from pkg_resources import resource_filename
26+
2427

2528
MAP = {
2629
"coils": "coils",
@@ -29,9 +32,12 @@
2932
'holding registers': 'holding_registers'
3033
}
3134

32-
SLAVES_FILE = 'slaves.json'
35+
settings_icon = resource_filename(__name__, "assets/Control-Panel.png")
36+
app_icon = resource_filename(__name__, "assets/riptideLogo.png")
37+
modbus_template = resource_filename(__name__, "templates/modbussimu.kv")
38+
Builder.load_file(modbus_template)
3339

34-
Builder.load_file("templates/modbussimu.kv")
40+
SLAVES_FILE = resource_filename(__name__, "slaves.json")
3541

3642

3743
class FloatInput(TextInput):
@@ -91,6 +97,9 @@ class Gui(BoxLayout):
9197
data_model_input_registers = ObjectProperty()
9298
data_model_holding_registers = ObjectProperty()
9399

100+
settings = ObjectProperty()
101+
riptide_logo = ObjectProperty()
102+
94103
reset_sim_btn = ObjectProperty()
95104

96105
# Helpers
@@ -114,6 +123,8 @@ class Gui(BoxLayout):
114123
def __init__(self, **kwargs):
115124
super(Gui, self).__init__(**kwargs)
116125
time_interval = kwargs.get("time_interval", 1)
126+
self.settings.icon = settings_icon
127+
self.riptide_logo.app_icon = app_icon
117128
self.config = Config.get_configparser('app')
118129
self.slave_list.adapter.bind(on_selection_change=self.select_slave)
119130
self.data_model_loc.disabled = True
@@ -1042,5 +1053,9 @@ def close_settings(self, *args):
10421053
super(ModbusSimuApp, self).close_settings()
10431054

10441055

1045-
if __name__ == "__main__":
1056+
def run():
10461057
ModbusSimuApp().run()
1058+
1059+
1060+
if __name__ == "__main__":
1061+
run()
Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#:import KivyLexer kivy.extras.highlight.KivyLexer
33
#:import ListItemButton kivy.uix.listview.ListItemButton
44
#:import sla kivy.adapters.listadapter
5+
56
<Separator@Widget>
67
size_hint_y: None
78
thickness: 2
@@ -41,7 +42,10 @@
4142
slave_start_add: slave_start_add
4243
slave_end_add: slave_end_add
4344
action_bar: action_bar
45+
settings: settings
46+
riptide_logo: riptide_logo
4447
reset_sim_btn: reset_simulation
48+
4549
BoxLayout:
4650
padding: '2sp'
4751
canvas:
@@ -291,8 +295,8 @@
291295
ActionView:
292296
use_separator: True
293297
ActionPrevious:
298+
id: riptide_logo
294299
with_previous: False
295-
app_icon: 'assets/riptideLogo.png'
296300
disabled: True
297301
ActionOverflow:
298302
ActionButton:
@@ -303,8 +307,8 @@
303307
text: 'Simulate'
304308
on_release: root.start_stop_simulation(*args)
305309
ActionButton:
310+
id: settings
306311
text: 'settings'
307-
icon: 'assets/Control-Panel.png'
308312
on_release: app.show_settings(*args)
309313

310314

0 commit comments

Comments
 (0)