Skip to content

Commit 356d8e4

Browse files
committed
Fixed device selection in ProjectView
1 parent 3331193 commit 356d8e4

File tree

8 files changed

+34
-2
lines changed

8 files changed

+34
-2
lines changed

doc/DoxyfileServer

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -949,7 +949,8 @@ WARN_LOGFILE =
949949
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
950950
# Note: If this tag is empty the current directory is searched.
951951

952-
INPUT = input
952+
INPUT = input \
953+
../src/server/python
953954

954955
# This tag can be used to specify the character encoding of the source files
955956
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses

doc/output/ModbusServer.chm

25.3 KB
Binary file not shown.

doc/output/ModbusServer.qch

64 KB
Binary file not shown.

doc/output/ModbusServer.qhc

12 KB
Binary file not shown.

src/core/gui/project/core_projectui.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ protected Q_SLOTS:
6161
void customContextMenu(const QPoint &pos);
6262
virtual void doubleClick(const QModelIndex &index);
6363
virtual void contextMenu(const QModelIndex &index);
64-
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
64+
virtual void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected);
6565

6666
protected Q_SLOTS:
6767
void setProject(mbCoreProject *project);

src/server/gui/project/server_projectui.cpp

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
#include <project/server_port.h>
3030
#include <project/server_deviceref.h>
3131

32+
#include <gui/server_ui.h>
33+
#include <gui/server_windowmanager.h>
34+
3235
#include "server_projectmodel.h"
3336
#include "server_projectdelegate.h"
3437

@@ -69,3 +72,15 @@ void mbServerProjectUi::contextMenu(const QModelIndex &index)
6972
mbServerPort *d = static_cast<mbServerProjectModel*>(m_model)->port(index);
7073
Q_EMIT portContextMenu(d);
7174
}
75+
76+
void mbServerProjectUi::selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)
77+
{
78+
QModelIndexList ls = selected.indexes();
79+
if (ls.count())
80+
{
81+
mbServerDeviceRef *ref = static_cast<mbServerProjectModel*>(m_model)->deviceRef(ls.first());
82+
if (ref)
83+
mbServer::global()->ui()->windowManager()->setActiveDevice(ref->device());
84+
}
85+
mbCoreProjectUi::selectionChanged(selected, deselected);
86+
}

src/server/gui/project/server_projectui.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ class mbServerProjectUi : public mbCoreProjectUi
5050
protected Q_SLOTS:
5151
void doubleClick(const QModelIndex &index) override;
5252
void contextMenu(const QModelIndex &index) override;
53+
void selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;
5354
};
5455

5556
#endif // SERVER_PROJECTUI_H

src/server/python/mbServer.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
"""@package docstring
2+
Documentation for this module.
3+
4+
More details.
5+
"""
6+
17
import time
28

39
from PyQt5.QtCore import QSystemSemaphore, QSharedMemory
@@ -90,6 +96,10 @@ def setpycycle(self, value):
9096

9197

9298
class _MemoryBlock:
99+
"""Base class for the memory objects mem0x, mem1x, mem3x, mem4x.
100+
101+
More details.
102+
"""
93103
def __init__(self, memid:str, bytecount:int):
94104
shm = QSharedMemory(memid)
95105
res = shm.attach()
@@ -181,6 +191,11 @@ def getbitbytearray(self, bitoffset:int, bitcount:int)->bytearray:
181191
return byarray
182192

183193
def getbitbytes(self, bitoffset:int, bitcount:int)->bytes:
194+
"""
195+
@details Function for creation `ModbusPort` with defined parameters:
196+
@param[in] bitoffset Bit offset (0-based).
197+
@param[in] bitcount Count of bits to read.
198+
"""
184199
return bytes(self.getbitbytearray(bitoffset, bitcount))
185200

186201
def setbitbytes(self, bitoffset:int, bitcount:int, value:bytes)->None:

0 commit comments

Comments
 (0)