示例#1
0
文件: view.py 项目: duniter/sakia
    def __init__(self, parent):
        super().__init__(parent)
        self.setupUi(self)

        tool_menu = QMenu(self.tr("Tools"), self.toolbutton_menu)
        self.toolbutton_menu.setMenu(tool_menu)

        self.action_add_connection = QAction(self.tr("Add a connection"), tool_menu)
        tool_menu.addAction(self.action_add_connection)

        self.action_revoke_uid = QAction(self.tr(ToolbarView._action_revoke_uid_text), self)
        tool_menu.addAction(self.action_revoke_uid)

        self.action_parameters = QAction(self.tr("Settings"), tool_menu)
        tool_menu.addAction(self.action_parameters)

        self.action_plugins = QAction(self.tr("Plugins manager"), tool_menu)
        tool_menu.addAction(self.action_plugins)

        tool_menu.addSeparator()

        about_menu = QMenu(self.tr("About"), tool_menu)
        tool_menu.addMenu(about_menu)

        self.action_about_money = QAction(self.tr("About Money"), about_menu)
        about_menu.addAction(self.action_about_money)

        self.action_about_referentials = QAction(self.tr("About Referentials"), about_menu)
        about_menu.addAction(self.action_about_referentials)

        self.action_about_wot = QAction(self.tr("About Web of Trust"), about_menu)
        about_menu.addAction(self.action_about_wot)

        self.action_about = QAction(self.tr("About Sakia"), about_menu)
        about_menu.addAction(self.action_about)

        self.action_exit = QAction(self.tr("Exit"), tool_menu)
        tool_menu.addAction(self.action_exit)

        self.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Minimum)
        self.setMaximumHeight(60)
        self.button_network.setIconSize(self.button_network.iconSize()*dpi_ratio())
        self.button_contacts.setIconSize(self.button_contacts.iconSize()*dpi_ratio())
        self.button_identity.setIconSize(self.button_identity.iconSize()*dpi_ratio())
        self.button_explore.setIconSize(self.button_explore.iconSize()*dpi_ratio())
        self.toolbutton_menu.setIconSize(self.toolbutton_menu.iconSize()*dpi_ratio())
        self.button_network.setFixedHeight(self.button_network.height()*dpi_ratio()+5*dpi_ratio())
        self.button_contacts.setFixedHeight(self.button_contacts.height()*dpi_ratio()+5*dpi_ratio())
        self.button_identity.setFixedHeight(self.button_identity.height()*dpi_ratio()+5*dpi_ratio())
        self.button_explore.setFixedHeight(self.button_explore.height()*dpi_ratio()+5*dpi_ratio())
        self.toolbutton_menu.setFixedHeight(self.toolbutton_menu.height()*dpi_ratio()+5*dpi_ratio())
示例#2
0
文件: scene.py 项目: duniter/sakia
    def update_path(self, nx_graph, path):
        path_graph_pos = WotScene.path_partial_layout(nx_graph, path, scale=200*dpi_ratio())
        nodes_path = [n for n in nx_graph.nodes(data=True) if n[0] in path[1:]]
        for node in nodes_path:
            v = WotNode(node, path_graph_pos)
            self.addItem(v)

        for edge in nx_graph.edges(data=True):
            if edge[0] in path_graph_pos and edge[1] in path_graph_pos:
                self.addItem(WotEdge(edge[0], edge[1], edge[2], path_graph_pos))
示例#3
0
文件: scene.py 项目: arkryonia/sakia
    def update_path(self, nx_graph, path):
        path_graph_pos = WotScene.path_partial_layout(nx_graph, path, scale=200*dpi_ratio())
        nodes_path = [n for n in nx_graph.nodes(data=True) if n[0] in path[1:]]
        for node in nodes_path:
            v = WotNode(node, path_graph_pos)
            self.addItem(v)

        for edge in nx_graph.edges(data=True):
            if edge[0] in path_graph_pos and edge[1] in path_graph_pos:
                self.addItem(WotEdge(edge[0], edge[1], edge[2], path_graph_pos))
示例#4
0
    def update_wot(self, nx_graph, identity):
        """
        draw community graph

        :param networkx.MultiDiGraph nx_graph: graph to draw
        :param sakia.core.registry.Identity identity: the wot of the identity
        """
        if identity:
            #  clear scene
            self.clear()

            certifiers_graph_pos = WotScene.certifiers_partial_layout(
                nx_graph, identity.pubkey, scale=200 * dpi_ratio())
            certified_graph_pos = WotScene.certified_partial_layout(
                nx_graph, identity.pubkey, scale=200 * dpi_ratio())

            # create networkx graph
            for node in nx_graph.nodes(data=True):
                if node[0] in certifiers_graph_pos:
                    v = WotNode(node, certifiers_graph_pos)
                    self.addItem(v)
                if node[0] in certified_graph_pos:
                    v = WotNode(node, certified_graph_pos)
                    self.addItem(v)

            for edge in nx_graph.edges(data=True):
                if edge[0] in certifiers_graph_pos and edge[
                        1] == identity.pubkey:
                    self.addItem(
                        WotEdge(edge[0], edge[1], edge[2]['attr_dict'],
                                certifiers_graph_pos))
                if edge[0] == identity.pubkey and edge[
                        1] in certified_graph_pos:
                    self.addItem(
                        WotEdge(edge[0], edge[1], edge[2]['attr_dict'],
                                certified_graph_pos))

            self.update()
示例#5
0
    def __init__(self, parent):
        super().__init__(parent)
        self.setupUi(self)

        tool_menu = QMenu(self.tr("Tools"), self.toolbutton_menu)
        self.toolbutton_menu.setMenu(tool_menu)

        self.action_add_connection = QAction(self.tr("Add a connection"),
                                             tool_menu)
        tool_menu.addAction(self.action_add_connection)

        self.action_revoke_uid = QAction(
            self.tr(ToolbarView._action_revoke_uid_text), self)
        tool_menu.addAction(self.action_revoke_uid)

        self.action_parameters = QAction(self.tr("Settings"), tool_menu)
        tool_menu.addAction(self.action_parameters)

        self.action_plugins = QAction(self.tr("Plugins manager"), tool_menu)
        tool_menu.addAction(self.action_plugins)

        tool_menu.addSeparator()

        about_menu = QMenu(self.tr("About"), tool_menu)
        tool_menu.addMenu(about_menu)

        self.action_about_money = QAction(self.tr("About Money"), about_menu)
        about_menu.addAction(self.action_about_money)

        self.action_about_referentials = QAction(self.tr("About Referentials"),
                                                 about_menu)
        about_menu.addAction(self.action_about_referentials)

        self.action_about_wot = QAction(self.tr("About Web of Trust"),
                                        about_menu)
        about_menu.addAction(self.action_about_wot)

        self.action_about = QAction(self.tr("About Sakia"), about_menu)
        about_menu.addAction(self.action_about)

        self.action_exit = QAction(self.tr("Exit"), tool_menu)
        tool_menu.addAction(self.action_exit)

        self.setSizePolicy(QSizePolicy.Maximum, QSizePolicy.Minimum)
        self.setMaximumHeight(60)
        self.button_network.setIconSize(self.button_network.iconSize() *
                                        dpi_ratio())
        self.button_contacts.setIconSize(self.button_contacts.iconSize() *
                                         dpi_ratio())
        self.button_identity.setIconSize(self.button_identity.iconSize() *
                                         dpi_ratio())
        self.button_explore.setIconSize(self.button_explore.iconSize() *
                                        dpi_ratio())
        self.toolbutton_menu.setIconSize(self.toolbutton_menu.iconSize() *
                                         dpi_ratio())
        self.button_network.setFixedHeight(self.button_network.height() *
                                           dpi_ratio() + 5 * dpi_ratio())
        self.button_contacts.setFixedHeight(self.button_contacts.height() *
                                            dpi_ratio() + 5 * dpi_ratio())
        self.button_identity.setFixedHeight(self.button_identity.height() *
                                            dpi_ratio() + 5 * dpi_ratio())
        self.button_explore.setFixedHeight(self.button_explore.height() *
                                           dpi_ratio() + 5 * dpi_ratio())
        self.toolbutton_menu.setFixedHeight(self.toolbutton_menu.height() *
                                            dpi_ratio() + 5 * dpi_ratio())
示例#6
0
文件: scene.py 项目: duniter/sakia
    def update_wot(self, nx_graph, identity):
        """
        draw community graph

        :param networkx.MultiDiGraph nx_graph: graph to draw
        :param sakia.core.registry.Identity identity: the wot of the identity
        """
        if identity:
            #  clear scene
            self.clear()

            certifiers_graph_pos = WotScene.certifiers_partial_layout(nx_graph, identity.pubkey, scale=200*dpi_ratio())
            certified_graph_pos = WotScene.certified_partial_layout(nx_graph, identity.pubkey, scale=200*dpi_ratio())

            # create networkx graph
            for node in nx_graph.nodes(data=True):
                if node[0] in certifiers_graph_pos:
                    v = WotNode(node, certifiers_graph_pos)
                    self.addItem(v)
                if node[0] in certified_graph_pos:
                    v = WotNode(node, certified_graph_pos)
                    self.addItem(v)

            for edge in nx_graph.edges(data=True):
                if edge[0] in certifiers_graph_pos and edge[1] == identity.pubkey:
                    self.addItem(WotEdge(edge[0], edge[1], edge[2]['attr_dict'], certifiers_graph_pos))
                if edge[0] == identity.pubkey and edge[1] in certified_graph_pos:
                    self.addItem(WotEdge(edge[0], edge[1], edge[2]['attr_dict'], certified_graph_pos))

            self.update()