7 Module implementing a toolbar manager class. |
7 Module implementing a toolbar manager class. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt4.QtCore import QObject, QByteArray, QDataStream, QIODevice |
10 from PyQt4.QtCore import QObject, QByteArray, QDataStream, QIODevice |
11 from PyQt4.QtGui import QToolBar |
11 from PyQt4.QtGui import QToolBar |
|
12 |
|
13 import Utilities |
12 |
14 |
13 |
15 |
14 class E5ToolBarManager(QObject): |
16 class E5ToolBarManager(QObject): |
15 """ |
17 """ |
16 Class implementing a toolbar manager. |
18 Class implementing a toolbar manager. |
508 if tmarker != E5ToolBarManager.ToolBarMarker: |
510 if tmarker != E5ToolBarManager.ToolBarMarker: |
509 return False |
511 return False |
510 |
512 |
511 toolBarCount = stream.readUInt16() |
513 toolBarCount = stream.readUInt16() |
512 for i in range(toolBarCount): |
514 for i in range(toolBarCount): |
513 objectName = stream.readString().decode() |
515 objectName = Utilities.readStringFromStream(stream) |
514 actionCount = stream.readUInt16() |
516 actionCount = stream.readUInt16() |
515 actions = [] |
517 actions = [] |
516 for j in range(actionCount): |
518 for j in range(actionCount): |
517 actionName = stream.readString().decode() |
519 actionName = Utilities.readStringFromStream(stream) |
518 if actionName: |
520 if actionName: |
519 action = self.__findAction(actionName) |
521 action = self.__findAction(actionName) |
520 if action is not None: |
522 if action is not None: |
521 actions.append(action) |
523 actions.append(action) |
522 else: |
524 else: |
531 |
533 |
532 oldCustomToolBars = self.__customToolBars[:] |
534 oldCustomToolBars = self.__customToolBars[:] |
533 |
535 |
534 toolBarCount = stream.readUInt16() |
536 toolBarCount = stream.readUInt16() |
535 for i in range(toolBarCount): |
537 for i in range(toolBarCount): |
536 objectName = stream.readString().decode() |
538 objectName = Utilities.readStringFromStream(stream) |
537 toolBarTitle = stream.readString().decode() |
539 toolBarTitle = Utilities.readStringFromStream(stream) |
538 actionCount = stream.readUInt16() |
540 actionCount = stream.readUInt16() |
539 actions = [] |
541 actions = [] |
540 for j in range(actionCount): |
542 for j in range(actionCount): |
541 actionName = stream.readString().decode() |
543 actionName = Utilities.readStringFromStream(stream) |
542 if actionName: |
544 if actionName: |
543 action = self.__findAction(actionName) |
545 action = self.__findAction(actionName) |
544 if action is not None: |
546 if action is not None: |
545 actions.append(action) |
547 actions.append(action) |
546 else: |
548 else: |