From b75b70af1f2a35c8a05b5e44dada18ffc4a0329b Mon Sep 17 00:00:00 2001
From: Vincent Texier <vit@free.fr>
Date: Fri, 10 Jul 2015 14:10:29 +0200
Subject: [PATCH] Replace tooltype on wot nodes by certification expiration
 date

Withdraw tooltype on arrows
---
 res/i18n/ts/fr_FR.ts          | 38 +++++++++++++++++++++--------------
 src/cutecoin/gui/views/wot.py | 34 ++-----------------------------
 2 files changed, 25 insertions(+), 47 deletions(-)

diff --git a/res/i18n/ts/fr_FR.ts b/res/i18n/ts/fr_FR.ts
index e229c68b..2d7d7a90 100644
--- a/res/i18n/ts/fr_FR.ts
+++ b/res/i18n/ts/fr_FR.ts
@@ -1210,7 +1210,7 @@ Revoking your UID can only success if it is not already validated by the network
         <translation>Sauvegarder</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="339"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="338"/>
         <source>Export</source>
         <translation>Exporter</translation>
     </message>
@@ -1271,32 +1271,32 @@ Revoking your UID can only success if it is not already validated by the network
         </translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="273"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="272"/>
         <source>Edit</source>
         <translation>Editer</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="276"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="275"/>
         <source>Delete</source>
         <translation>Supprimer</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="292"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="291"/>
         <source>CuteCoin {0}</source>
         <translation>CuteCoin {0}</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="317"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="316"/>
         <source>CuteCoin {0} - Account : {1}</source>
         <translation>CuteCoin {0} - Compte : {1}</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="337"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="336"/>
         <source>Export an account</source>
         <translation>Exporter un compte</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="338"/>
+        <location filename="../../../src/cutecoin/gui/mainwindow.py" line="337"/>
         <source>All account files (*.acc)</source>
         <translation>Tout fichier de compte (*.acc)</translation>
     </message>
@@ -1622,7 +1622,7 @@ Revoking your UID can only success if it is not already validated by the network
         <translation type="obsolete">Référentiel par défaut</translation>
     </message>
     <message>
-        <location filename="../../ui/preferences.ui" line="205"/>
+        <location filename="../../ui/preferences.ui" line="201"/>
         <source>Language</source>
         <translation>Langue</translation>
     </message>
@@ -1647,17 +1647,17 @@ Revoking your UID can only success if it is not already validated by the network
         <translation>Activer le mode expert</translation>
     </message>
     <message>
-        <location filename="../../ui/preferences.ui" line="191"/>
+        <location filename="../../ui/preferences.ui" line="187"/>
         <source>Digits after commas </source>
         <translation>Chiffres après la virgule</translation>
     </message>
     <message>
-        <location filename="../../ui/preferences.ui" line="239"/>
+        <location filename="../../ui/preferences.ui" line="235"/>
         <source>Maximize Window at Startup</source>
         <translation>Fenêtre plein écran au démarrage</translation>
     </message>
     <message>
-        <location filename="../../ui/preferences.ui" line="266"/>
+        <location filename="../../ui/preferences.ui" line="262"/>
         <source>Enable notifications</source>
         <translation>Activer les notifications</translation>
     </message>
@@ -1782,6 +1782,14 @@ Souhaitez-vous publier votre clé publique ?</translation>
         <translation></translation>
     </message>
 </context>
+<context>
+    <name>Scene</name>
+    <message>
+        <location filename="../../../src/cutecoin/gui/views/wot.py" line="157"/>
+        <source>Certification expires at {0}</source>
+        <translation>Certification expire le {0}</translation>
+    </message>
+</context>
 <context>
     <name>Toast</name>
     <message>
@@ -2164,22 +2172,22 @@ Veuillez rééssayer plus tard</translation>
 <context>
     <name>WoT.Node</name>
     <message>
-        <location filename="../../../src/cutecoin/gui/views/wot.py" line="288"/>
+        <location filename="../../../src/cutecoin/gui/views/wot.py" line="290"/>
         <source>Informations</source>
         <translation>Informations</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/views/wot.py" line="293"/>
+        <location filename="../../../src/cutecoin/gui/views/wot.py" line="295"/>
         <source>Add as contact</source>
         <translation>Ajouter comme contact</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/views/wot.py" line="298"/>
+        <location filename="../../../src/cutecoin/gui/views/wot.py" line="300"/>
         <source>Send money</source>
         <translation>Envoyer de l&apos;argent</translation>
     </message>
     <message>
-        <location filename="../../../src/cutecoin/gui/views/wot.py" line="303"/>
+        <location filename="../../../src/cutecoin/gui/views/wot.py" line="305"/>
         <source>Certify identity</source>
         <translation>Certifier cette identité</translation>
     </message>
diff --git a/src/cutecoin/gui/views/wot.py b/src/cutecoin/gui/views/wot.py
index 33f58a15..07bc810e 100644
--- a/src/cutecoin/gui/views/wot.py
+++ b/src/cutecoin/gui/views/wot.py
@@ -139,6 +139,7 @@ class Scene(QGraphicsScene):
         for _node in nodes:
             node = self.add_node(_node['node'], (x, y))
             self.add_arc(root_node, node, _node['arc'])
+            node.setToolTip(self.tr("Certification expires at {0}").format(_node['arc']['tooltip']))
             y += 50
 
         # add certifiers of selected node
@@ -153,6 +154,7 @@ class Scene(QGraphicsScene):
             for arc in certifier_node['arcs']:
                 if arc['id'] == selected_id:
                     self.add_arc(node, root_node, arc)
+                    node.setToolTip(self.tr("Certification expires at {0}").format(arc['tooltip']))
             y += 50
 
         self.update()
@@ -357,7 +359,6 @@ class Arc(QGraphicsLineItem):
         self.metadata = metadata
         self.source = source_node
         self.destination = destination_node
-        self.setToolTip(self.metadata['tooltip'])
         self.source.add_arc(self)
 
         self.status = self.metadata['status']
@@ -470,34 +471,3 @@ class Arc(QGraphicsLineItem):
         painter.setBrush(color)
         painter.drawPolygon(QPolygonF([head_point, destination_arrow_p1, destination_arrow_p2]))
 
-    def hoverEnterEvent(self, event: QGraphicsSceneHoverEvent):
-        """
-        Mouse enter on arc zone
-
-        :param event: scene hover event
-        """
-        self.setCursor(Qt.ArrowCursor)
-
-    def shape(self):
-        """
-        Return real shape of the item to detect collision or hover accurately
-
-        :return: QPainterPath
-        """
-        # detection mouse hover on arc path
-        path = QPainterPath()
-        path.addPolygon(QPolygonF([self.line().p1(), self.line().p2()]))
-        #  add handles at the start and end of arc
-        path.addRect(QRectF(
-            self.line().p1().x() - 5,
-            self.line().p1().y() - 5,
-            self.line().p1().x() + 5,
-            self.line().p1().y() + 5
-        ))
-        path.addRect(QRectF(
-            self.line().p2().x() - 5,
-            self.line().p2().y() - 5,
-            self.line().p2().x() + 5,
-            self.line().p2().y() + 5
-        ))
-        return path
-- 
GitLab