Skip to content

Commit 555c997

Browse files
committed
Added mbdevice.getlibpath() for python script
1 parent e21205b commit 555c997

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/server/python/mbserver.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66

77
#from typing import Union
88

9-
from PyQt5.QtCore import QSharedMemory
10-
9+
from os import path
1110
from ctypes import *
1211
import struct
1312

13+
from PyQt5.QtCore import QSharedMemory
14+
1415
from mbconfig import *
1516
import modbus
1617

@@ -1404,6 +1405,7 @@ class _MbDevice:
14041405
"""
14051406
## @cond
14061407
def __init__(self, shmidprefix:str):
1408+
self._libpath = path.dirname(path.abspath(__file__))
14071409
shmid_device = shmidprefix + ".device"
14081410
shmid_python = shmidprefix + ".python"
14091411
shmid_mem0x = shmidprefix + ".mem0x"
@@ -1484,6 +1486,14 @@ def getmemdump(self, offset:int=0, size:int=None)->bytes:
14841486
self._shm.unlock()
14851487
return b
14861488

1489+
def getlibpath(self)->str:
1490+
"""
1491+
@note Since v0.4.4
1492+
1493+
@details Returns absolute path for library folder of mbtools server.
1494+
"""
1495+
return self._libpath
1496+
14871497
def getname(self)->str:
14881498
"""
14891499
@details Returns name of the current device as string.

0 commit comments

Comments
 (0)