From bc71b8f6ca29602918112c4bd38710149c8e5f01 Mon Sep 17 00:00:00 2001 From: Vincent Texier <vit@free.fr> Date: Fri, 10 Jul 2015 17:00:56 +0200 Subject: [PATCH] move membership buttons from CommunityTab to WalletTab Fix bug when not confirming Leave membership --- res/i18n/ts/fr_FR.ts | 197 ++++++++++++++++++++---------- res/ui/community_tab.ui | 122 ------------------ res/ui/wallets_tab.ui | 119 ++++++++++++++++++ src/cutecoin/gui/community_tab.py | 86 ------------- src/cutecoin/gui/wallets_tab.py | 93 +++++++++++++- 5 files changed, 344 insertions(+), 273 deletions(-) diff --git a/res/i18n/ts/fr_FR.ts b/res/i18n/ts/fr_FR.ts index 2d7d7a90..0e9054f4 100644 --- a/res/i18n/ts/fr_FR.ts +++ b/res/i18n/ts/fr_FR.ts @@ -304,20 +304,20 @@ <message> <location filename="../../ui/community_tab.ui" line="118"/> <source>Quality : </source> - <translation>Qualification : </translation> + <translation type="obsolete">Qualification : </translation> </message> <message> <location filename="../../../src/cutecoin/gui/community_tab.py" line="351"/> <source>Renew membership</source> - <translation>Renouveller le statut de membre</translation> + <translation type="obsolete">Renouveller le statut de membre</translation> </message> <message> <location filename="../../ui/community_tab.ui" line="146"/> <source>Send leaving demand</source> - <translation>Quitter la communauté</translation> + <translation type="obsolete">Quitter la communauté</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/community_tab.py" line="78"/> + <location filename="../../../src/cutecoin/gui/community_tab.py" line="76"/> <source>Membership</source> <translation>Statut de membre</translation> </message> @@ -339,17 +339,17 @@ <message> <location filename="../../../src/cutecoin/gui/community_tab.py" line="226"/> <source>Network error</source> - <translation>Erreur réseau</translation> + <translation type="obsolete">Erreur réseau</translation> </message> <message> <location filename="../../../src/cutecoin/gui/community_tab.py" line="226"/> <source>Couldn't connect to network : {0}</source> - <translation>Impossible de se connecter au réseau : {0}</translation> + <translation type="obsolete">Impossible de se connecter au réseau : {0}</translation> </message> <message> <location filename="../../../src/cutecoin/gui/community_tab.py" line="235"/> <source>Warning</source> - <translation>Attention</translation> + <translation type="obsolete">Attention</translation> </message> <message> <location filename="../../../src/cutecoin/gui/community_tab.py" line="202"/> @@ -374,15 +374,15 @@ <message> <location filename="../../ui/community_tab.ui" line="125"/> <source>Publish UID</source> - <translation>Publier votre UID</translation> + <translation type="obsolete">Publier votre UID</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/community_tab.py" line="60"/> + <location filename="../../../src/cutecoin/gui/community_tab.py" line="59"/> <source>Members</source> <translation>Membres</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/community_tab.py" line="63"/> + <location filename="../../../src/cutecoin/gui/community_tab.py" line="62"/> <source>Direct connections</source> <translation>Connections directes</translation> </message> @@ -396,12 +396,12 @@ Publier votre UID ne peut être annulé.</translation> <message> <location filename="../../../src/cutecoin/gui/community_tab.py" line="220"/> <source>UID Publishing</source> - <translation>Publication de l'UID</translation> + <translation type="obsolete">Publication de l'UID</translation> </message> <message> <location filename="../../../src/cutecoin/gui/community_tab.py" line="220"/> <source>Success publishing your UID</source> - <translation>Succès lors de la publication de votre UID</translation> + <translation type="obsolete">Succès lors de la publication de votre UID</translation> </message> <message> <location filename="../../../src/cutecoin/gui/community_tab.py" line="177"/> @@ -415,66 +415,66 @@ Vous ne pouvez pas envoyer de requête de membre.</translation> <source>Are you sure ? Sending a leaving demand cannot be canceled. The process to join back the community later will have to be done again.</source> - <translation>Êtes vous certain ? + <translation type="obsolete">Êtes vous certain ? Envoyer une demande pour quitter la communauté ne peut être annulée. Le processus pour rejoindre la communauté devrait être refait à zéro.</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/community_tab.py" line="59"/> + <location filename="../../../src/cutecoin/gui/community_tab.py" line="58"/> <source>Web of Trust</source> <translation>Toile de Confiance</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/community_tab.py" line="104"/> + <location filename="../../../src/cutecoin/gui/community_tab.py" line="102"/> <source>Informations</source> <translation>Informations</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/community_tab.py" line="107"/> + <location filename="../../../src/cutecoin/gui/community_tab.py" line="105"/> <source>Add as contact</source> <translation>Ajouter comme contact</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/community_tab.py" line="111"/> + <location filename="../../../src/cutecoin/gui/community_tab.py" line="109"/> <source>Send money</source> <translation>Envoyer de l'argent</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/community_tab.py" line="115"/> + <location filename="../../../src/cutecoin/gui/community_tab.py" line="113"/> <source>Certify identity</source> <translation>Certifier cette identité</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/community_tab.py" line="119"/> + <location filename="../../../src/cutecoin/gui/community_tab.py" line="117"/> <source>View in Web of Trust</source> <translation>Voir dans la Toile de Confiance</translation> </message> <message> <location filename="../../../src/cutecoin/gui/community_tab.py" line="358"/> <source>Send membership demand</source> - <translation>Envoyer une demande de membre</translation> + <translation type="obsolete">Envoyer une demande de membre</translation> </message> <message> <location filename="../../ui/community_tab.ui" line="132"/> <source>Revoke UID</source> - <translation>Révoquer votre UID</translation> + <translation type="obsolete">Révoquer votre UID</translation> </message> <message> <location filename="../../../src/cutecoin/gui/community_tab.py" line="209"/> <source>Are you sure ? Publishing your UID can be canceled by Revoke UID.</source> - <translation>Etes-vous sûr(e) ? Publier votre UID peut être annulé par le bouton Révoquer votre UID.</translation> + <translation type="obsolete">Etes-vous sûr(e) ? Publier votre UID peut être annulé par le bouton Révoquer votre UID.</translation> </message> <message> <location filename="../../../src/cutecoin/gui/community_tab.py" line="223"/> <source>Publish UID error</source> - <translation>Publier votre UID</translation> + <translation type="obsolete">Publier votre UID</translation> </message> <message> <location filename="../../../src/cutecoin/gui/community_tab.py" line="235"/> <source>Are you sure ? Revoking your UID can only success if it is not already validated by the network.</source> - <translation>Etes-vous sûr(e) ? Révoquer votre UID ne peut réussir que s'il n'a pas été déjà validé par le réseau.</translation> + <translation type="obsolete">Etes-vous sûr(e) ? Révoquer votre UID ne peut réussir que s'il n'a pas été déjà validé par le réseau.</translation> </message> <message> <location filename="../../../src/cutecoin/gui/community_tab.py" line="253"/> @@ -492,27 +492,27 @@ Revoking your UID can only success if it is not already validated by the network <translation type="obsolete">Erreur lors de la révocation de votre UID</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/community_tab.py" line="78"/> + <location filename="../../../src/cutecoin/gui/community_tab.py" line="76"/> <source>Success sending Membership demand</source> <translation>Envoi demande à être membre réussie</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/community_tab.py" line="84"/> + <location filename="../../../src/cutecoin/gui/community_tab.py" line="82"/> <source>Revoke</source> <translation>Révocation</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/community_tab.py" line="84"/> + <location filename="../../../src/cutecoin/gui/community_tab.py" line="82"/> <source>Success sending Revoke demand</source> <translation>Envoi demande de révocation réussie</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/community_tab.py" line="90"/> + <location filename="../../../src/cutecoin/gui/community_tab.py" line="88"/> <source>Self Certification</source> <translation>Auto-certification</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/community_tab.py" line="90"/> + <location filename="../../../src/cutecoin/gui/community_tab.py" line="88"/> <source>Success sending Self Certification document</source> <translation>Envoi auto-certification réussie</translation> </message> @@ -581,17 +581,17 @@ Revoking your UID can only success if it is not already validated by the network <translation>Transferts</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/currency_tab.py" line="85"/> + <location filename="../../../src/cutecoin/gui/currency_tab.py" line="81"/> <source>Community</source> <translation>Communauté</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/currency_tab.py" line="81"/> + <location filename="../../../src/cutecoin/gui/currency_tab.py" line="89"/> <source>Informations</source> <translation>Informations</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/currency_tab.py" line="89"/> + <location filename="../../../src/cutecoin/gui/currency_tab.py" line="85"/> <source>Network</source> <translation>Réseau</translation> </message> @@ -2031,20 +2031,40 @@ Veuillez rééssayer plus tard</translation> <translation></translation> </message> <message> - <location filename="../../ui/wallets_tab.ui" line="68"/> + <location filename="../../ui/wallets_tab.ui" line="119"/> <source>Balance</source> <translation>Solde</translation> </message> <message> - <location filename="../../ui/wallets_tab.ui" line="74"/> + <location filename="../../ui/wallets_tab.ui" line="132"/> <source>label_balance</source> <translation></translation> </message> + <message> + <location filename="../../ui/wallets_tab.ui" line="86"/> + <source>Publish UID</source> + <translation>Publier votre UID</translation> + </message> + <message> + <location filename="../../ui/wallets_tab.ui" line="93"/> + <source>Revoke UID</source> + <translation>Révoquer votre UID</translation> + </message> + <message> + <location filename="../../ui/wallets_tab.ui" line="100"/> + <source>Renew membership</source> + <translation>Renouveller le statut de membre</translation> + </message> + <message> + <location filename="../../ui/wallets_tab.ui" line="107"/> + <source>Send leaving demand</source> + <translation>Quitter la communauté</translation> + </message> </context> <context> <name>WalletsTabWidget</name> <message> - <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="82"/> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="86"/> <source> <table cellpadding="5"> <tr><td align="right"><b>{:}</b></td><td>{:}</td></tr> @@ -2055,17 +2075,17 @@ Veuillez rééssayer plus tard</translation> <translation></translation> </message> <message> - <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="82"/> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="86"/> <source>Membership</source> <translation>Statut de membre</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="82"/> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="86"/> <source>Last renewal on {:}, expiration on {:}</source> <translation>Dernier renouvellement le {:}, expire le {:}</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="100"/> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="104"/> <source> <table cellpadding="5"> <tr><td align="right"><b>{:}</b></td><td>{:}</td></tr> @@ -2076,67 +2096,52 @@ Veuillez rééssayer plus tard</translation> <translation></translation> </message> <message> - <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="100"/> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="104"/> <source>Not a member</source> <translation>Non-membre</translation> </message> - <message> - <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="134"/> - <source> - <table cellpadding="5"> - <tr><td align="right"><b>{:}</b></td><td>{:}</td></tr> - <tr><td align="right"><b>{:}</b></td><td>{:}</td></tr> - </table> - </source> - <translation></translation> - </message> <message> <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="118"/> <source>{:} {:} in [{:.2f} - {:}] {:}</source> <translation type="obsolete">{:} {:} compris dans [{:.2f} - {:}] {:}</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="184"/> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="179"/> <source>Rename</source> <translation>Renommer</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="188"/> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="183"/> <source>Copy pubkey to clipboard</source> <translation>Copier la clé publique</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="193"/> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="188"/> <source>Transfer to...</source> <translation>Transférer à...</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="100"/> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="104"/> <source>Your web of trust</source> <translation>Votre toile de confiance</translation> </message> <message> <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="134"/> <source>Your money share </source> - <translation>Votre part de monnaie</translation> - </message> - <message> - <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="134"/> - <source>{:.2f}%</source> - <translation></translation> + <translation type="obsolete">Votre part de monnaie</translation> </message> <message> <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="134"/> <source>Your part </source> - <translation>Votre part</translation> + <translation type="obsolete">Votre part</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="181"/> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="176"/> <source>New Wallet</source> <translation>Nouveau portefeuille</translation> </message> <message> - <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="100"/> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="104"/> <source>Certified by {:} members; Certifier of {:} members</source> <translation>Certifié par {:} membres; Certifieur de {:} membres</translation> </message> @@ -2148,7 +2153,73 @@ Veuillez rééssayer plus tard</translation> <message> <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="134"/> <source>{:} {:} in [{:} ; {:}] {:}</source> - <translation>{:} {:} compris entre [{:} ; {:}] {:}</translation> + <translation type="obsolete">{:} {:} compris entre [{:} ; {:}] {:}</translation> + </message> + <message> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="138"/> + <source><center><b>{:} {:} in [{:} ; {:}] {:}</b></center></source> + <translation><center><b>{:} {:} compris entre [{:} ; {:}] {:}</b></center></translation> + </message> + <message> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="301"/> + <source>Warning</source> + <translation>Attention</translation> + </message> + <message> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="262"/> + <source>Are you sure ? +Sending a leaving demand cannot be canceled. +The process to join back the community later will have to be done again.</source> + <translation>Êtes vous certain ? +Envoyer une demande pour quitter la communauté ne peut être annulée. +Le processus pour rejoindre la communauté devrait être refait à zéro.</translation> + </message> + <message> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="275"/> + <source>Are you sure ? +Publishing your UID can be canceled by Revoke UID.</source> + <translation>Etes-vous sûr(e) ? Publier votre UID peut être annulé par le bouton Révoquer votre UID.</translation> + </message> + <message> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="286"/> + <source>UID Publishing</source> + <translation>Publication de l'UID</translation> + </message> + <message> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="286"/> + <source>Success publishing your UID</source> + <translation>Publication de votre UID réussie</translation> + </message> + <message> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="289"/> + <source>Publish UID error</source> + <translation>Publier votre UID</translation> + </message> + <message> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="292"/> + <source>Network error</source> + <translation>Erreur réseau</translation> + </message> + <message> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="292"/> + <source>Couldn't connect to network : {0}</source> + <translation>Impossible de se connecter au réseau : {0}</translation> + </message> + <message> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="301"/> + <source>Are you sure ? +Revoking your UID can only success if it is not already validated by the network.</source> + <translation>Etes-vous sûr(e) ? Révoquer votre UID ne peut réussir que s'il n'a pas été déjà validé par le réseau.</translation> + </message> + <message> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="317"/> + <source>Renew membership</source> + <translation>Renouveller le statut de membre</translation> + </message> + <message> + <location filename="../../../src/cutecoin/gui/wallets_tab.py" line="324"/> + <source>Send membership demand</source> + <translation>Envoyer une demande de membre</translation> </message> </context> <context> diff --git a/res/ui/community_tab.ui b/res/ui/community_tab.ui index aa2718dd..43eb5750 100644 --- a/res/ui/community_tab.ui +++ b/res/ui/community_tab.ui @@ -91,64 +91,6 @@ </attribute> </widget> </item> - <item> - <layout class="QHBoxLayout" name="horizontalLayout_2"> - <property name="leftMargin"> - <number>0</number> - </property> - <property name="topMargin"> - <number>5</number> - </property> - <item> - <spacer name="horizontalSpacer"> - <property name="orientation"> - <enum>Qt::Horizontal</enum> - </property> - <property name="sizeHint" stdset="0"> - <size> - <width>40</width> - <height>20</height> - </size> - </property> - </spacer> - </item> - <item> - <widget class="QLabel" name="label_quality"> - <property name="text"> - <string>Quality : </string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="button_publish_uid"> - <property name="text"> - <string>Publish UID</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="button_revoke_uid"> - <property name="text"> - <string>Revoke UID</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="button_membership"> - <property name="text"> - <string>Renew membership</string> - </property> - </widget> - </item> - <item> - <widget class="QPushButton" name="button_leaving"> - <property name="text"> - <string>Send leaving demand</string> - </property> - </widget> - </item> - </layout> - </item> </layout> </item> </layout> @@ -161,38 +103,6 @@ <include location="../icons/icons.qrc"/> </resources> <connections> - <connection> - <sender>button_membership</sender> - <signal>clicked()</signal> - <receiver>CommunityTabWidget</receiver> - <slot>send_membership_demand()</slot> - <hints> - <hint type="sourcelabel"> - <x>198</x> - <y>335</y> - </hint> - <hint type="destinationlabel"> - <x>199</x> - <y>149</y> - </hint> - </hints> - </connection> - <connection> - <sender>button_leaving</sender> - <signal>clicked()</signal> - <receiver>CommunityTabWidget</receiver> - <slot>send_membership_leaving()</slot> - <hints> - <hint type="sourcelabel"> - <x>338</x> - <y>335</y> - </hint> - <hint type="destinationlabel"> - <x>199</x> - <y>149</y> - </hint> - </hints> - </connection> <connection> <sender>edit_textsearch</sender> <signal>returnPressed()</signal> @@ -225,38 +135,6 @@ </hint> </hints> </connection> - <connection> - <sender>button_publish_uid</sender> - <signal>clicked()</signal> - <receiver>CommunityTabWidget</receiver> - <slot>publish_uid()</slot> - <hints> - <hint type="sourcelabel"> - <x>123</x> - <y>334</y> - </hint> - <hint type="destinationlabel"> - <x>228</x> - <y>184</y> - </hint> - </hints> - </connection> - <connection> - <sender>button_revoke_uid</sender> - <signal>clicked()</signal> - <receiver>CommunityTabWidget</receiver> - <slot>revoke_uid()</slot> - <hints> - <hint type="sourcelabel"> - <x>750</x> - <y>368</y> - </hint> - <hint type="destinationlabel"> - <x>622</x> - <y>201</y> - </hint> - </hints> - </connection> </connections> <slots> <slot>identity_context_menu(QPoint)</slot> diff --git a/res/ui/wallets_tab.ui b/res/ui/wallets_tab.ui index 28833a41..6454aa26 100644 --- a/res/ui/wallets_tab.ui +++ b/res/ui/wallets_tab.ui @@ -59,6 +59,57 @@ QGroupBox::title { </property> </widget> </item> + <item row="1" column="0"> + <layout class="QHBoxLayout" name="horizontalLayout_2"> + <property name="leftMargin"> + <number>0</number> + </property> + <property name="topMargin"> + <number>5</number> + </property> + <item> + <spacer name="horizontalSpacer"> + <property name="orientation"> + <enum>Qt::Horizontal</enum> + </property> + <property name="sizeHint" stdset="0"> + <size> + <width>40</width> + <height>20</height> + </size> + </property> + </spacer> + </item> + <item> + <widget class="QPushButton" name="button_publish_uid"> + <property name="text"> + <string>Publish UID</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="button_revoke_uid"> + <property name="text"> + <string>Revoke UID</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="button_membership"> + <property name="text"> + <string>Renew membership</string> + </property> + </widget> + </item> + <item> + <widget class="QPushButton" name="button_leaving"> + <property name="text"> + <string>Send leaving demand</string> + </property> + </widget> + </item> + </layout> + </item> </layout> </widget> </item> @@ -141,9 +192,77 @@ QGroupBox::title { </hint> </hints> </connection> + <connection> + <sender>button_publish_uid</sender> + <signal>clicked()</signal> + <receiver>WalletsTab</receiver> + <slot>publish_uid()</slot> + <hints> + <hint type="sourcelabel"> + <x>430</x> + <y>69</y> + </hint> + <hint type="destinationlabel"> + <x>461</x> + <y>459</y> + </hint> + </hints> + </connection> + <connection> + <sender>button_revoke_uid</sender> + <signal>clicked()</signal> + <receiver>WalletsTab</receiver> + <slot>revoke_uid()</slot> + <hints> + <hint type="sourcelabel"> + <x>533</x> + <y>69</y> + </hint> + <hint type="destinationlabel"> + <x>461</x> + <y>459</y> + </hint> + </hints> + </connection> + <connection> + <sender>button_membership</sender> + <signal>clicked()</signal> + <receiver>WalletsTab</receiver> + <slot>send_membership_demand()</slot> + <hints> + <hint type="sourcelabel"> + <x>662</x> + <y>69</y> + </hint> + <hint type="destinationlabel"> + <x>461</x> + <y>459</y> + </hint> + </hints> + </connection> + <connection> + <sender>button_leaving</sender> + <signal>clicked()</signal> + <receiver>WalletsTab</receiver> + <slot>send_membership_leaving()</slot> + <hints> + <hint type="sourcelabel"> + <x>823</x> + <y>69</y> + </hint> + <hint type="destinationlabel"> + <x>461</x> + <y>459</y> + </hint> + </hints> + </connection> </connections> <slots> <slot>wallet_context_menu(QPoint)</slot> <slot>wallet_changed()</slot> + <slot>send_membership_demand()</slot> + <slot>send_membership_leaving()</slot> + <slot>revoke_uid()</slot> + <slot>publish_uid()</slot> </slots> </ui> diff --git a/src/cutecoin/gui/community_tab.py b/src/cutecoin/gui/community_tab.py index ae672340..35b47cf7 100644 --- a/src/cutecoin/gui/community_tab.py +++ b/src/cutecoin/gui/community_tab.py @@ -18,7 +18,6 @@ from .transfer import TransferMoneyDialog from .certification import CertificationDialog from . import toast import asyncio -from ..tools.exceptions import LookupFailureError, NoPeerAvailable from ..core.net.api import bma as qtbma @@ -69,7 +68,6 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget): self.account.membership_broadcasted.connect(self.handle_membership_broadcasted) self.account.revoke_broadcasted.connect(self.handle_revoke_broadcasted) self.account.selfcert_broadcasted.connect(self.handle_selfcert_broadcasted) - self.refresh_quality_buttons() def handle_membership_broadcasted(self): if self.app.preferences['notifications']: @@ -186,63 +184,6 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget): index_wot_tab = self.tabs_information.indexOf(self.wot_tab) self.tabs_information.setCurrentIndex(index_wot_tab) - def send_membership_demand(self): - password = self.password_asker.exec_() - if self.password_asker.result() == QDialog.Rejected: - return - asyncio.async(self.account.send_membership(password, self.community, 'IN')) - - def send_membership_leaving(self): - reply = QMessageBox.warning(self, self.tr("Warning"), - self.tr("""Are you sure ? -Sending a leaving demand cannot be canceled. -The process to join back the community later will have to be done again.""") -.format(self.account.pubkey), QMessageBox.Ok | QMessageBox.Cancel) - if reply == QMessageBox.Ok: - password = self.password_asker.exec_() - if self.password_asker.result() == QDialog.Rejected: - return - - asyncio.async(self.account.send_membership(password, self.community, 'OUT')) - - def publish_uid(self): - reply = QMessageBox.warning(self, self.tr("Warning"), - self.tr("""Are you sure ? -Publishing your UID can be canceled by Revoke UID.""") -.format(self.account.pubkey), QMessageBox.Ok | QMessageBox.Cancel) - if reply == QMessageBox.Ok: - password = self.password_asker.exec_() - if self.password_asker.result() == QDialog.Rejected: - return - - try: - self.account.send_selfcert(password, self.community) - toast.display(self.tr("UID Publishing"), - self.tr("Success publishing your UID")) - except ValueError as e: - QMessageBox.critical(self, self.tr("Publish UID error"), - str(e)) - except NoPeerAvailable as e: - QMessageBox.critical(self, self.tr("Network error"), - self.tr("Couldn't connect to network : {0}").format(e), - QMessageBox.Ok) - # except Exception as e: - # QMessageBox.critical(self, self.tr("Error"), - # "{0}".format(e), - # QMessageBox.Ok) - - def revoke_uid(self): - reply = QMessageBox.warning(self, self.tr("Warning"), - self.tr("""Are you sure ? -Revoking your UID can only success if it is not already validated by the network.""") -.format(self.account.pubkey), QMessageBox.Ok | QMessageBox.Cancel) - if reply == QMessageBox.Ok: - password = self.password_asker.exec_() - if self.password_asker.result() == QDialog.Rejected: - return - - asyncio.async(self.account.revoke(password, self.community)) - @asyncio.coroutine def _execute_search_text(self, text): response = yield from self.community.bma_access.future_request(qtbma.wot.Lookup, {'search': text}) @@ -343,30 +284,3 @@ Revoking your UID can only success if it is not already validated by the network self.table_identities.model().sourceModel().refresh_identities(identities) self.table_identities.resizeColumnsToContents() - def refresh_quality_buttons(self): - try: - if self.account.identity(self.community).published_uid(self.community): - logging.debug("UID Published") - if self.account.identity(self.community).is_member(self.community): - self.button_membership.setText(self.tr("Renew membership")) - self.button_membership.show() - self.button_publish_uid.hide() - self.button_leaving.show() - self.button_revoke_uid.hide() - else: - logging.debug("Not a member") - self.button_membership.setText(self.tr("Send membership demand")) - self.button_membership.show() - self.button_revoke_uid.show() - self.button_leaving.hide() - self.button_publish_uid.hide() - else: - logging.debug("UID not published") - self.button_membership.hide() - self.button_leaving.hide() - self.button_publish_uid.show() - self.button_revoke_uid.hide() - except LookupFailureError: - self.button_membership.hide() - self.button_leaving.hide() - self.button_publish_uid.show() diff --git a/src/cutecoin/gui/wallets_tab.py b/src/cutecoin/gui/wallets_tab.py index ceb6bc81..107d85ed 100644 --- a/src/cutecoin/gui/wallets_tab.py +++ b/src/cutecoin/gui/wallets_tab.py @@ -3,17 +3,20 @@ Created on 15 févr. 2015 @author: inso """ +import asyncio +import logging -from PyQt5.QtWidgets import QWidget, QMenu, QAction, QApplication, QDialog +from PyQt5.QtWidgets import QWidget, QMenu, QAction, QApplication, QDialog, QMessageBox from PyQt5.QtCore import QDateTime, QModelIndex, Qt, QLocale from PyQt5.QtGui import QCursor from ..core.registry import Identity from ..core.wallet import Wallet +from cutecoin.gui import toast from ..gui.password_asker import PasswordAskerDialog from ..models.wallets import WalletsTableModel, WalletsFilterProxyModel from .transfer import TransferMoneyDialog -from ..tools.exceptions import MembershipNotFoundError +from ..tools.exceptions import MembershipNotFoundError, NoPeerAvailable, LookupFailureError from ..gen_resources.wallets_tab_uic import Ui_WalletsTab @@ -45,6 +48,7 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab): def refresh(self): self.refresh_informations_frame() self.refresh_wallets() + self.refresh_quality_buttons() def refresh_wallets(self): # TODO: Using reset model instead of destroy/create @@ -247,3 +251,88 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab): if dialog.exec_() == QDialog.Accepted: currency_tab = self.window().currencies_tabwidget.currentWidget() currency_tab.tab_history.table_history.model().sourceModel().refresh_transfers() + + def send_membership_demand(self): + password = self.password_asker.exec_() + if self.password_asker.result() == QDialog.Rejected: + return + asyncio.async(self.account.send_membership(password, self.community, 'IN')) + + def send_membership_leaving(self): + reply = QMessageBox.warning(self, self.tr("Warning"), + self.tr("""Are you sure ? +Sending a leaving demand cannot be canceled. +The process to join back the community later will have to be done again.""") +.format(self.account.pubkey), QMessageBox.Ok | QMessageBox.Cancel) + if reply == QMessageBox.Ok: + password = self.password_asker.exec_() + if self.password_asker.result() == QDialog.Rejected: + return + + asyncio.async(self.account.send_membership(password, self.community, 'OUT')) + + def publish_uid(self): + reply = QMessageBox.warning(self, self.tr("Warning"), + self.tr("""Are you sure ? +Publishing your UID can be canceled by Revoke UID.""") +.format(self.account.pubkey), QMessageBox.Ok | QMessageBox.Cancel) + if reply == QMessageBox.Ok: + password = self.password_asker.exec_() + if self.password_asker.result() == QDialog.Rejected: + return + + try: + self.account.send_selfcert(password, self.community) + toast.display(self.tr("UID Publishing"), + self.tr("Success publishing your UID")) + except ValueError as e: + QMessageBox.critical(self, self.tr("Publish UID error"), + str(e)) + except NoPeerAvailable as e: + QMessageBox.critical(self, self.tr("Network error"), + self.tr("Couldn't connect to network : {0}").format(e), + QMessageBox.Ok) + # except Exception as e: + # QMessageBox.critical(self, self.tr("Error"), + # "{0}".format(e), + # QMessageBox.Ok) + + def revoke_uid(self): + reply = QMessageBox.warning(self, self.tr("Warning"), + self.tr("""Are you sure ? +Revoking your UID can only success if it is not already validated by the network.""") +.format(self.account.pubkey), QMessageBox.Ok | QMessageBox.Cancel) + if reply == QMessageBox.Ok: + password = self.password_asker.exec_() + if self.password_asker.result() == QDialog.Rejected: + return + + asyncio.async(self.account.revoke(password, self.community)) + + def refresh_quality_buttons(self): + try: + if self.account.identity(self.community).published_uid(self.community): + logging.debug("UID Published") + if self.account.identity(self.community).is_member(self.community): + self.button_membership.setText(self.tr("Renew membership")) + self.button_membership.show() + self.button_publish_uid.hide() + self.button_leaving.show() + self.button_revoke_uid.hide() + else: + logging.debug("Not a member") + self.button_membership.setText(self.tr("Send membership demand")) + self.button_membership.show() + self.button_revoke_uid.show() + self.button_leaving.hide() + self.button_publish_uid.hide() + else: + logging.debug("UID not published") + self.button_membership.hide() + self.button_leaving.hide() + self.button_publish_uid.show() + self.button_revoke_uid.hide() + except LookupFailureError: + self.button_membership.hide() + self.button_leaving.hide() + self.button_publish_uid.show() -- GitLab