diff --git a/src/sakia/gui/graphs/base/__init__.py b/src/sakia/gui/graphs/base/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/sakia/gui/graphs/base/controller.py b/src/sakia/gui/graphs/base/controller.py new file mode 100644 index 0000000000000000000000000000000000000000..b849958a8bf236391d4ff49be2e5934cb7c03dcc --- /dev/null +++ b/src/sakia/gui/graphs/base/controller.py @@ -0,0 +1,76 @@ +from ...component.controller import ComponentController +from PyQt5.QtCore import pyqtSlot +from PyQt5.QtGui import QCursor +from sakia.tools.decorators import asyncify, once_at_a_time +from .view import BaseGraphView +from .model import BaseGraphModel +from ...widgets.context_menu import ContextMenu + + +class BaseGraphController(ComponentController): + """ + The homescreen view + """ + + def __init__(self, parent, view, model, password_asker): + """ + Constructor of the homescreen component + + :param sakia.gui.homescreen.view.HomeScreenView: the view + :param sakia.gui.homescreen.model.HomeScreenModel model: the model + """ + super().__init__(parent, view, model) + self.password_asker = password_asker + + def set_scene(self, scene): + """ + Set the scene and connects the signals + :param sakia.gui.views.scenes.base_scene.BaseScene scene: the scene + :return: + """ + # add scene events + scene.node_context_menu_requested.connect(self.node_context_menu) + scene.node_clicked.connect(self.handle_node_click) + + @pyqtSlot(str, dict) + def handle_node_click(self, pubkey, metadata): + identity = self.model.get_identity_from_data(metadata, pubkey) + self.draw_graph(identity) + + async def draw_graph(self, identity): + """ + Draw community graph centered on the identity + + :param sakia.core.registry.Identity identity: Graph node identity + """ + raise NotImplementedError("draw_graph not implemented") + + @once_at_a_time + @asyncify + async def reset(self, checked=False): + """ + Reset graph scene to wallet identity + """ + raise NotImplementedError("reset not implemented") + + @once_at_a_time + @asyncify + def refresh(self): + """ + Refresh graph scene to current metadata + """ + raise NotImplementedError("refresh not implemented") + + @asyncify + async def node_context_menu(self, pubkey): + """ + Open the node context menu + :param str pubkey: the pubkey of the node to open + """ + identity = await self.model.get_identity(pubkey) + menu = ContextMenu.from_data(self.view, self.model.app, self.model.account, self.model.community, self.password_asker, + (identity,)) + menu.view_identity_in_wot.connect(self.draw_graph) + + # Show the context menu. + menu.qmenu.popup(QCursor.pos()) diff --git a/src/sakia/gui/views/edges/base_edge.py b/src/sakia/gui/graphs/base/edge.py similarity index 100% rename from src/sakia/gui/views/edges/base_edge.py rename to src/sakia/gui/graphs/base/edge.py diff --git a/src/sakia/gui/graphs/graph_tab.py b/src/sakia/gui/graphs/base/graph_tab.py similarity index 71% rename from src/sakia/gui/graphs/graph_tab.py rename to src/sakia/gui/graphs/base/graph_tab.py index d308245b821fb6a43169b3780b0204436cc7c47a..9879cfb65c114babe56a74ae85b93902e29e77b8 100644 --- a/src/sakia/gui/graphs/graph_tab.py +++ b/src/sakia/gui/graphs/base/graph_tab.py @@ -30,15 +30,6 @@ class GraphTabWidget(QObject): self.app = app - def set_scene(self, scene): - """ - Set the scene and connects the signals - :param sakia.gui.views.scenes.base_scene.BaseScene scene: the scene - :return: - """ - # add scene events - scene.node_context_menu_requested.connect(self.node_context_menu) - scene.node_clicked.connect(self.handle_node_click) @once_at_a_time @asyncify @@ -120,63 +111,4 @@ class GraphTabWidget(QObject): ) ) - @pyqtSlot(str, dict) - def handle_node_click(self, pubkey, metadata): - self.draw_graph( - self.app.identities_registry.from_handled_data( - metadata['text'], - pubkey, - None, - BlockchainState.VALIDATED, - self.community - ) - ) - - @once_at_a_time - @asyncify - async def draw_graph(self, identity): - """ - Draw community graph centered on the identity - - :param sakia.core.registry.Identity identity: Graph node identity - """ - pass - - @once_at_a_time - @asyncify - async def reset(self, checked=False): - """ - Reset graph scene to wallet identity - """ - pass - - def refresh(self): - """ - Refresh graph scene to current metadata - """ - pass - - @asyncify - async def node_context_menu(self, pubkey): - """ - Open the node context menu - :param str pubkey: the pubkey of the node to open - """ - identity = await self.app.identities_registry.future_find(pubkey, self.community) - menu = ContextMenu.from_data(self.widget, self.app, self.account, self.community, self.password_asker, - (identity,)) - menu.view_identity_in_wot.connect(self.draw_graph) - # Show the context menu. - menu.qmenu.popup(QCursor.pos()) - - def changeEvent(self, event): - """ - Intercepte LanguageChange event to translate UI - :param QEvent QEvent: Event - :return: - """ - if event.type() == QEvent.LanguageChange: - self.retranslateUi(self) - self.refresh() - return super().changeEvent(event) diff --git a/src/sakia/gui/graphs/base/model.py b/src/sakia/gui/graphs/base/model.py new file mode 100644 index 0000000000000000000000000000000000000000..aa9bb0877b83c7ec53159284e11985d2d399b9d0 --- /dev/null +++ b/src/sakia/gui/graphs/base/model.py @@ -0,0 +1,31 @@ +from sakia.gui.component.model import ComponentModel +from sakia.core.registry import BlockchainState + + +class BaseGraphModel(ComponentModel): + """ + The model of Navigation component + """ + + def __init__(self, parent, app, account, community): + super().__init__(parent) + self.app = app + self.account = account + self.community = community + + async def get_identity(self, pubkey): + """ + Get identity from pubkey + :param str pubkey: Identity pubkey + :rtype: sakia.core.registry.Identity + """ + return await self.app.identities_registry.future_find(pubkey, self.community) + + def get_identity_from_data(self, metadata, pubkey): + return self.app.identities_registry.from_handled_data( + metadata['text'], + pubkey, + None, + BlockchainState.VALIDATED, + self.community + ) diff --git a/src/sakia/gui/views/nodes/base_node.py b/src/sakia/gui/graphs/base/node.py similarity index 100% rename from src/sakia/gui/views/nodes/base_node.py rename to src/sakia/gui/graphs/base/node.py diff --git a/src/sakia/gui/views/scenes/base_scene.py b/src/sakia/gui/graphs/base/scene.py similarity index 100% rename from src/sakia/gui/views/scenes/base_scene.py rename to src/sakia/gui/graphs/base/scene.py diff --git a/src/sakia/gui/graphs/base/view.py b/src/sakia/gui/graphs/base/view.py new file mode 100644 index 0000000000000000000000000000000000000000..4358c5e7c787dd617dc69170e6a8d9196f54ed1a --- /dev/null +++ b/src/sakia/gui/graphs/base/view.py @@ -0,0 +1,25 @@ +from PyQt5.QtWidgets import QWidget +from PyQt5.QtCore import QEvent + + +class BaseGraphView(QWidget): + """ + Base graph view + """ + + def __init__(self, parent): + """ + Constructor + """ + super().__init__(parent) + + def changeEvent(self, event): + """ + Intercepte LanguageChange event to translate UI + :param QEvent QEvent: Event + :return: + """ + if event.type() == QEvent.LanguageChange: + self.retranslateUi(self) + self.refresh() + return super().changeEvent(event) \ No newline at end of file diff --git a/src/sakia/gui/views/__init__.py b/src/sakia/gui/graphs/views/__init__.py similarity index 100% rename from src/sakia/gui/views/__init__.py rename to src/sakia/gui/graphs/views/__init__.py diff --git a/src/sakia/gui/views/edges/__init__.py b/src/sakia/gui/graphs/views/edges/__init__.py similarity index 100% rename from src/sakia/gui/views/edges/__init__.py rename to src/sakia/gui/graphs/views/edges/__init__.py diff --git a/src/sakia/gui/views/edges/explorer_edge.py b/src/sakia/gui/graphs/views/edges/explorer_edge.py similarity index 100% rename from src/sakia/gui/views/edges/explorer_edge.py rename to src/sakia/gui/graphs/views/edges/explorer_edge.py diff --git a/src/sakia/gui/views/explorer.py b/src/sakia/gui/graphs/views/explorer.py similarity index 100% rename from src/sakia/gui/views/explorer.py rename to src/sakia/gui/graphs/views/explorer.py diff --git a/src/sakia/gui/views/nodes/__init__.py b/src/sakia/gui/graphs/views/nodes/__init__.py similarity index 100% rename from src/sakia/gui/views/nodes/__init__.py rename to src/sakia/gui/graphs/views/nodes/__init__.py diff --git a/src/sakia/gui/views/nodes/explorer_node.py b/src/sakia/gui/graphs/views/nodes/explorer_node.py similarity index 100% rename from src/sakia/gui/views/nodes/explorer_node.py rename to src/sakia/gui/graphs/views/nodes/explorer_node.py diff --git a/src/sakia/gui/views/scenes/__init__.py b/src/sakia/gui/graphs/views/scenes/__init__.py similarity index 100% rename from src/sakia/gui/views/scenes/__init__.py rename to src/sakia/gui/graphs/views/scenes/__init__.py diff --git a/src/sakia/gui/views/scenes/explorer_scene.py b/src/sakia/gui/graphs/views/scenes/explorer_scene.py similarity index 100% rename from src/sakia/gui/views/scenes/explorer_scene.py rename to src/sakia/gui/graphs/views/scenes/explorer_scene.py diff --git a/src/sakia/gui/graphs/wot/__init__.py b/src/sakia/gui/graphs/wot/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/src/sakia/gui/graphs/wot/controller.py b/src/sakia/gui/graphs/wot/controller.py new file mode 100644 index 0000000000000000000000000000000000000000..a1aceca66ce42684d89a63224644faa0c67d9a1a --- /dev/null +++ b/src/sakia/gui/graphs/wot/controller.py @@ -0,0 +1,69 @@ +from ..base.controller import BaseGraphController +from sakia.tools.decorators import asyncify, once_at_a_time +from .view import WotView +from .model import WotModel + + +class WotController(BaseGraphController): + """ + The homescreen view + """ + + def __init__(self, parent, view, model, password_asker=None): + """ + Constructor of the homescreen component + + :param sakia.gui.homescreen.view.HomeScreenView: the view + :param sakia.gui.homescreen.model.HomeScreenModel model: the model + """ + super().__init__(parent, view, model, password_asker) + self.set_scene(view.scene()) + self.reset() + + @classmethod + def create(cls, parent, app, **kwargs): + account = kwargs['account'] + community = kwargs['community'] + + view = WotView(parent.view) + model = WotModel(None, app, account, community) + wot = cls(parent, view, model) + model.setParent(wot) + return wot + + @property + def view(self) -> WotView: + return self._view + + @property + def model(self) -> WotModel: + return self._model + + async def draw_graph(self, identity): + """ + Draw community graph centered on the identity + + :param sakia.core.registry.Identity identity: Center identity + """ + await self.model.set_identity(identity) + self.refresh() + + @once_at_a_time + @asyncify + async def refresh(self): + """ + Refresh graph scene to current metadata + """ + nx_graph = await self.model.get_nx_graph() + self.view.display_wot(nx_graph, self.model.identity) + path = await self.model.get_shortest_path() + if path: + self.view.display_path(nx_graph, path) + + @once_at_a_time + @asyncify + async def reset(self, checked=False): + """ + Reset graph scene to wallet identity + """ + await self.draw_graph(None) diff --git a/src/sakia/gui/views/edges/wot_edge.py b/src/sakia/gui/graphs/wot/edge.py similarity index 99% rename from src/sakia/gui/views/edges/wot_edge.py rename to src/sakia/gui/graphs/wot/edge.py index 50fcf150c949e89e3f2d468606fdc16c63eb9da7..3af111bb8906833a9255a1da32595b8c63dc307a 100644 --- a/src/sakia/gui/views/edges/wot_edge.py +++ b/src/sakia/gui/graphs/wot/edge.py @@ -2,7 +2,7 @@ from PyQt5.QtCore import Qt, QRectF, QLineF, QPointF, QSizeF, \ qFuzzyCompare from PyQt5.QtGui import QColor, QPen, QPolygonF import math -from .base_edge import BaseEdge +from ..base.edge import BaseEdge from ....core.graph.constants import EdgeStatus diff --git a/src/sakia/gui/views/wot.py b/src/sakia/gui/graphs/wot/graphics_view.py similarity index 95% rename from src/sakia/gui/views/wot.py rename to src/sakia/gui/graphs/wot/graphics_view.py index 056962d84469f4000daec002861fac40f9066ad9..95aaae1bde9224aad4539dc1b6d311de9bc1a0c7 100644 --- a/src/sakia/gui/views/wot.py +++ b/src/sakia/gui/graphs/wot/graphics_view.py @@ -1,10 +1,10 @@ from PyQt5.QtCore import Qt from PyQt5.QtGui import QPainter, QWheelEvent from PyQt5.QtWidgets import QGraphicsView -from .scenes import WotScene +from .scene import WotScene -class WotView(QGraphicsView): +class WotGraphicsView(QGraphicsView): def __init__(self, parent=None): """ Create View to display scene diff --git a/src/sakia/gui/graphs/wot/model.py b/src/sakia/gui/graphs/wot/model.py new file mode 100644 index 0000000000000000000000000000000000000000..56981afc610d674bf5ab35ab793ea24013cd5ad8 --- /dev/null +++ b/src/sakia/gui/graphs/wot/model.py @@ -0,0 +1,51 @@ +from ..base.model import BaseGraphModel +from sakia.core.graph import WoTGraph + + +class WotModel(BaseGraphModel): + """ + The model of Navigation component + """ + + def __init__(self, parent, app, account, community): + super().__init__(parent, app, account, community) + self.app = app + self.account = account + self.community = community + self.wot_graph = WoTGraph(self.app, self.community) + self.identity = None + + async def set_identity(self, identity=None): + """ + Change current identity + If identity is None, it defaults to account identity + :param sakia.core.registry.Identity identity: the new identity to show + :return: + """ + identity_account = await self.account.identity(self.community) + if identity: + self.identity = identity + else: + self.identity = identity_account + + # create empty graph instance + await self.wot_graph.initialize(self.identity, identity_account) + + async def get_nx_graph(self): + """ + Get nx graph of current identity wot graph + :rtype: sakia.core.registry.Identity + """ + return self.wot_graph.nx_graph + + async def get_shortest_path(self): + """ + Get shortest path between current identity and account + :rtype: list[str] + """ + identity_account = await self.account.identity(self.community) + # if selected member is not the account member... + if self.identity.pubkey != identity_account.pubkey: + path = await self.wot_graph.get_shortest_path_to_identity(self.identity, identity_account) + return path + return [] diff --git a/src/sakia/gui/views/nodes/wot_node.py b/src/sakia/gui/graphs/wot/node.py similarity index 98% rename from src/sakia/gui/views/nodes/wot_node.py rename to src/sakia/gui/graphs/wot/node.py index ef7ba7dc1e0c43b631b05c28d032dbf0228cd646..53278ed45ba2d6dfbab3d73941396cb999abf2a2 100644 --- a/src/sakia/gui/views/nodes/wot_node.py +++ b/src/sakia/gui/graphs/wot/node.py @@ -2,7 +2,7 @@ from PyQt5.QtWidgets import QGraphicsSimpleTextItem from PyQt5.QtCore import Qt, QPointF from PyQt5.QtGui import QTransform, QColor, QPen, QBrush, QRadialGradient from ....core.graph.constants import NodeStatus -from .base_node import BaseNode +from ..base.node import BaseNode class WotNode(BaseNode): diff --git a/src/sakia/gui/views/scenes/wot_scene.py b/src/sakia/gui/graphs/wot/scene.py similarity index 98% rename from src/sakia/gui/views/scenes/wot_scene.py rename to src/sakia/gui/graphs/wot/scene.py index 743a044b537cdee0acda72a0a1ffe3394aa5ead8..d8c67d4597faa3254d86a5b3b810104131627e28 100644 --- a/src/sakia/gui/views/scenes/wot_scene.py +++ b/src/sakia/gui/graphs/wot/scene.py @@ -2,10 +2,10 @@ import networkx from PyQt5.QtCore import QPoint, pyqtSignal from PyQt5.QtWidgets import QGraphicsScene -from ..edges import WotEdge -from ..nodes import WotNode +from .edge import WotEdge +from .node import WotNode -from .base_scene import BaseScene +from ..base.scene import BaseScene class WotScene(BaseScene): diff --git a/src/sakia/gui/graphs/wot/view.py b/src/sakia/gui/graphs/wot/view.py new file mode 100644 index 0000000000000000000000000000000000000000..1aca74f77f9c16b5915da9c855e5ee28648c1108 --- /dev/null +++ b/src/sakia/gui/graphs/wot/view.py @@ -0,0 +1,42 @@ +from PyQt5.QtCore import QEvent +from ..base.view import BaseGraphView +from .wot_tab_uic import Ui_WotWidget + + +class WotView(BaseGraphView, Ui_WotWidget): + """ + Wot graph view + """ + + def __init__(self, parent): + """ + Constructor + """ + super().__init__(parent) + self.setupUi(self) + + def scene(self): + """ + Get the scene of the underlying graphics view + :return: + """ + return self.graphics_view.scene() + + def display_wot(self, nx_graph, identity): + """ + Display given wot around given identity + :param nx_graph: + :param identity: + :return: + """ + # draw graph in qt scene + self.graphics_view.scene().update_wot(nx_graph, identity) + + def display_path(self, nx_graph, path): + """ + Display given path + :param nx_graph: + :param path: + :return: + """ + self.ui.graphicsView.scene().update_path(nx_graph, path) diff --git a/res/ui/wot_tab.ui b/src/sakia/gui/graphs/wot/wot_tab.ui similarity index 79% rename from res/ui/wot_tab.ui rename to src/sakia/gui/graphs/wot/wot_tab.ui index d71654c11480961021b3679b84a89243a1b1e3b2..22ee6350fc0fbfb0f85e32d4b46891bd1702bbc8 100644 --- a/res/ui/wot_tab.ui +++ b/src/sakia/gui/graphs/wot/wot_tab.ui @@ -1,7 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> - <class>WotTabWidget</class> - <widget class="QWidget" name="WotTabWidget"> + <class>WotWidget</class> + <widget class="QWidget" name="WotWidget"> <property name="geometry"> <rect> <x>0</x> @@ -15,7 +15,7 @@ </property> <layout class="QGridLayout" name="gridLayout"> <item row="1" column="0" colspan="2"> - <widget class="WotView" name="graphicsView"> + <widget class="WotGraphicsView" name="graphics_view"> <property name="viewportUpdateMode"> <enum>QGraphicsView::BoundingRectViewportUpdate</enum> </property> @@ -28,9 +28,9 @@ </widget> <customwidgets> <customwidget> - <class>WotView</class> + <class>WotGraphicsView</class> <extends>QGraphicsView</extends> - <header>sakia.gui.views.wot</header> + <header>sakia.gui.graphs.wot.graphics_view</header> </customwidget> <customwidget> <class>SearchUserWidget</class> @@ -40,7 +40,7 @@ </customwidget> </customwidgets> <resources> - <include location="../icons/icons.qrc"/> + <include location="../../../../../res/icons/icons.qrc"/> </resources> <connections/> <slots> diff --git a/src/sakia/gui/graphs/wot_tab.py b/src/sakia/gui/graphs/wot_tab.py deleted file mode 100644 index 6ee4ff1213a3a040ba7dc822ff5dc3eecd8b00a5..0000000000000000000000000000000000000000 --- a/src/sakia/gui/graphs/wot_tab.py +++ /dev/null @@ -1,145 +0,0 @@ -import logging -import asyncio - -from PyQt5.QtCore import QEvent, pyqtSignal, QT_TRANSLATE_NOOP, QObject -from PyQt5.QtWidgets import QWidget -from ...tools.decorators import asyncify, once_at_a_time, cancel_once_task -from ...core.graph import WoTGraph -from ...presentation.wot_tab_uic import Ui_WotTabWidget -from ...gui.widgets.busy import Busy -from .graph_tab import GraphTabWidget - - -class WotTabWidget(GraphTabWidget): - - money_sent = pyqtSignal() - - def __init__(self, app, account=None, community=None, password_asker=None, widget=QWidget, view=Ui_WotTabWidget): - """ - :param sakia.core.app.Application app: Application instance - :param sakia.core.app.Application app: Application instance - :param sakia.core.Account account: The account displayed in the widget - :param sakia.core.Community community: The community displayed in the widget - :param sakia.gui.Password_Asker: password_asker: The widget to ask for passwords - :param class widget: The class of the PyQt5 widget used for this tab - :param class view: The class of the UI View for this tab - """ - super().__init__(app, account, community, password_asker, widget) - # construct from qtDesigner - self.ui = view() - self.ui.setupUi(self.widget) - - self.ui.search_user_widget.init(app) - self.widget.installEventFilter(self) - self.busy = Busy(self.ui.graphicsView) - self.busy.hide() - - self.set_scene(self.ui.graphicsView.scene()) - - self.account = account - self.community = community - self.password_asker = password_asker - self.app = app - self.draw_task = None - - self.ui.search_user_widget.identity_selected.connect(self.draw_graph) - self.ui.search_user_widget.reset.connect(self.reset) - - # create node metadata from account - self._current_identity = None - - def cancel_once_tasks(self): - cancel_once_task(self, self.draw_graph) - cancel_once_task(self, self.refresh_informations_frame) - cancel_once_task(self, self.reset) - - def change_account(self, account, password_asker): - self.cancel_once_tasks() - self.ui.search_user_widget.change_account(account) - self.account = account - self.password_asker = password_asker - - def change_community(self, community): - self.cancel_once_tasks() - self.ui.search_user_widget.change_community(community) - self._auto_refresh(community) - self.community = community - self.reset() - - def _auto_refresh(self, new_community): - if self.community: - try: - self.community.network.new_block_mined.disconnect(self.refresh) - except TypeError as e: - if "connected" in str(e): - logging.debug("new block mined not connected") - if self.app.preferences["auto_refresh"]: - if new_community: - new_community.network.new_block_mined.connect(self.refresh) - elif self.community: - self.community.network.new_block_mined.connect(self.refresh) - - @once_at_a_time - @asyncify - async def draw_graph(self, identity): - """ - Draw community graph centered on the identity - - :param sakia.core.registry.Identity identity: Center identity - """ - logging.debug("Draw graph - " + identity.uid) - self.busy.show() - - if self.community: - identity_account = await self.account.identity(self.community) - - # create empty graph instance - graph = WoTGraph(self.app, self.community) - await graph.initialize(identity, identity_account) - # draw graph in qt scene - self.ui.graphicsView.scene().update_wot(graph.nx_graph, identity) - - # if selected member is not the account member... - if identity.pubkey != identity_account.pubkey: - # add path from selected member to account member - path = await graph.get_shortest_path_to_identity(identity, identity_account) - if path: - self.ui.graphicsView.scene().update_path(graph.nx_graph, path) - self.busy.hide() - - @once_at_a_time - @asyncify - async def reset(self, checked=False): - """ - Reset graph scene to wallet identity - """ - if self.account and self.community: - identity = await self.account.identity(self.community) - self.draw_graph(identity) - - def refresh(self): - """ - Refresh graph scene to current metadata - """ - if self._current_identity: - self.draw_graph(self._current_identity) - else: - self.reset() - - def eventFilter(self, source, event): - if event.type() == QEvent.Resize: - self.busy.resize(event.size()) - self.widget.resizeEvent(event) - return self.widget.eventFilter(source, event) - - def changeEvent(self, event): - """ - Intercepte LanguageChange event to translate UI - :param QEvent QEvent: Event - :return: - """ - if event.type() == QEvent.LanguageChange: - self.retranslateUi(self) - self._auto_refresh(None) - self.refresh() - return super(WotTabWidget, self).changeEvent(event) diff --git a/src/sakia/gui/homescreen/controller.py b/src/sakia/gui/homescreen/controller.py index 1a4b12977f40f1c049ad7b0605f6679c3f366e1c..7f1dfdd9b2d25ed03de0cb4ec66b3ad6acc488ce 100644 --- a/src/sakia/gui/homescreen/controller.py +++ b/src/sakia/gui/homescreen/controller.py @@ -5,15 +5,15 @@ from .model import HomeScreenModel class HomeScreenController(ComponentController): """ - The navigation panel + The homescreen view """ def __init__(self, parent, view, model): """ - Constructor of the navigation component + Constructor of the homescreen component - :param PyQt5.QtWidgets.QWidget presentation: the presentation - :param sakia.gui.navigation.model.NavigationModel model: the model + :param sakia.gui.homescreen.view.HomeScreenView: the view + :param sakia.gui.homescreen.model.HomeScreenModel model: the model """ super().__init__(parent, view, model) diff --git a/src/sakia/gui/navigation/controller.py b/src/sakia/gui/navigation/controller.py index 3f4544381af965fb1867234a78b2d213aa7d062f..c09825c3981ce28d8cecaa742a6481a2465abdd2 100644 --- a/src/sakia/gui/navigation/controller.py +++ b/src/sakia/gui/navigation/controller.py @@ -6,6 +6,7 @@ from ..homescreen.controller import HomeScreenController from ..network.controller import NetworkController from ..identities.controller import IdentitiesController from ..informations.controller import InformationsController +from ..graphs.wot.controller import WotController class NavigationController(ComponentController): @@ -26,7 +27,8 @@ class NavigationController(ComponentController): 'HomeScreen': HomeScreenController, 'Network': NetworkController, 'Identities': IdentitiesController, - 'Informations': InformationsController + 'Informations': InformationsController, + 'Wot': WotController } @classmethod diff --git a/src/sakia/gui/navigation/model.py b/src/sakia/gui/navigation/model.py index 3d2d531372f83fe954dd097801c3bf2a7902e844..0d59fe1d7f31a609b6074e6275fc42ccbca10c8b 100644 --- a/src/sakia/gui/navigation/model.py +++ b/src/sakia/gui/navigation/model.py @@ -61,6 +61,14 @@ class NavigationModel(ComponentModel): 'community': c, 'account': self.app.current_account } + }, + { + 'node': { + 'title': self.tr('Web of Trust'), + 'component': "Wot", + 'community': c, + 'account': self.app.current_account + } } ] })