diff --git a/res/icons/AUTHORS b/res/icons/AUTHORS index 70558bcefd85e65c8941c5da297abbfaf73ccb81..701840e29eb80d91e0847f992f5c19f87b7ca972 100644 --- a/res/icons/AUTHORS +++ b/res/icons/AUTHORS @@ -18,4 +18,9 @@ noun_62146_cc.svg : Created by Sergey Krivoy noun_2149_cc.svg : Created by Anand A Nair noun_152997_cc.svg : Created by Pedro Ivo Hudson noun_139613_cc.svg : Created by Aha-Soft -noun_19900_cc.svg : Created by by Stefan Parnarov \ No newline at end of file +noun_19900_cc.svg : Created by by Stefan Parnarov +noun_178785_cc.svg : by Jevgeni Striganov +noun_41979_cc.svg : by by hunotika +noun_155533_cc.svg : by anbileru adaleru +noun_155520_cc.svg : by anbileru adaleru +noun_155540_cc.svg : by anbileru adaleru \ No newline at end of file diff --git a/res/icons/icons.qrc b/res/icons/icons.qrc index 8630228d34743d848b05f4e42544695df434ae20..1af72a7c804fbb92b62d948d1fdbea1fdbea3d5b 100644 --- a/res/icons/icons.qrc +++ b/res/icons/icons.qrc @@ -1,5 +1,8 @@ <RCC> <qresource prefix="icons"> + <file alias="payment_icon">noun_178785_cc.svg</file> + <file alias="renew_membership">noun_155533_cc.svg</file> + <file alias="certification_icon">noun_41979_cc.svg</file> <file alias="logout">noun_19900_cc.svg</file> <file alias="add_community">noun_139613_cc.svg</file> <file alias="connect_icon">noun_152997_cc.svg</file> diff --git a/res/ui/community_view.ui b/res/ui/community_view.ui index 18889b02c27f5dd4435566e75454ea189633adb8..d5c0078d2188f388ef359f68f470daa4e2a0a814 100644 --- a/res/ui/community_view.ui +++ b/res/ui/community_view.ui @@ -6,8 +6,8 @@ <rect> <x>0</x> <y>0</y> - <width>400</width> - <height>300</height> + <width>532</width> + <height>313</height> </rect> </property> <property name="windowTitle"> @@ -35,8 +35,14 @@ <string/> </property> <property name="icon"> - <iconset> - <normaloff>../icons/iconmonstr-home-icon.svg</normaloff>../icons/iconmonstr-home-icon.svg</iconset> + <iconset resource="../icons/icons.qrc"> + <normaloff>:/icons/home_icon</normaloff>:/icons/home_icon</iconset> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> </property> </widget> </item> @@ -52,6 +58,16 @@ <property name="text"> <string>Send money</string> </property> + <property name="icon"> + <iconset resource="../icons/icons.qrc"> + <normaloff>:/icons/payment_icon</normaloff>:/icons/payment_icon</iconset> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> </widget> </item> <item> @@ -59,6 +75,16 @@ <property name="text"> <string>Certification</string> </property> + <property name="icon"> + <iconset resource="../icons/icons.qrc"> + <normaloff>:/icons/certification_icon</normaloff>:/icons/certification_icon</iconset> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> </widget> </item> <item> @@ -66,6 +92,16 @@ <property name="text"> <string>Renew membership</string> </property> + <property name="icon"> + <iconset resource="../icons/icons.qrc"> + <normaloff>:/icons/renew_membership</normaloff>:/icons/renew_membership</iconset> + </property> + <property name="iconSize"> + <size> + <width>32</width> + <height>32</height> + </size> + </property> </widget> </item> </layout> @@ -76,6 +112,8 @@ </item> </layout> </widget> - <resources/> + <resources> + <include location="../icons/icons.qrc"/> + </resources> <connections/> </ui> diff --git a/res/ui/wallets_tab.ui b/res/ui/wallets_tab.ui index cef471bfba54f06dc89fb6eaa1b6d7ee03a642d8..16b4dd1c96d212b9773b06a202151676c417af27 100644 --- a/res/ui/wallets_tab.ui +++ b/res/ui/wallets_tab.ui @@ -29,91 +29,6 @@ QGroupBox::title { </property> <layout class="QGridLayout" name="gridLayout"> <item row="0" column="0"> - <widget class="QGroupBox" name="groupBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Preferred" vsizetype="Preferred"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="styleSheet"> - <string notr="true"/> - </property> - <property name="title"> - <string>Account</string> - </property> - <property name="flat"> - <bool>true</bool> - </property> - <layout class="QGridLayout" name="gridLayout_2"> - <item row="0" column="0"> - <widget class="QLabel" name="label_general"> - <property name="text"> - <string>label_general</string> - </property> - <property name="textFormat"> - <enum>Qt::RichText</enum> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </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> - <item row="1" column="0"> <widget class="QGroupBox" name="groupBox_2"> <property name="title"> <string>Balance</string> @@ -149,7 +64,7 @@ QGroupBox::title { </layout> </widget> </item> - <item row="2" column="0"> + <item row="1" column="0"> <widget class="QTableView" name="table_wallets"> <property name="sizePolicy"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred"> @@ -202,70 +117,6 @@ 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> diff --git a/src/cutecoin/gui/community_view.py b/src/cutecoin/gui/community_view.py index 61ab15dc5ff1ed6f1cd42c7e1941e4f511a9739e..ffba895d12ffe2b3618194a10e38501e8cacbc61 100644 --- a/src/cutecoin/gui/community_view.py +++ b/src/cutecoin/gui/community_view.py @@ -6,7 +6,7 @@ Created on 2 févr. 2014 import time import logging -from PyQt5.QtWidgets import QWidget, QMessageBox +from PyQt5.QtWidgets import QWidget, QMessageBox, QDialog from PyQt5.QtCore import QModelIndex, pyqtSlot, QDateTime, QLocale, QEvent from PyQt5.QtGui import QIcon @@ -23,6 +23,7 @@ from ..tools.exceptions import MembershipNotFoundError, NoPeerAvailable from ..core.registry import IdentitiesRegistry from ..gen_resources.community_view_uic import Ui_CommunityWidget + class CommunityWidget(QWidget, Ui_CommunityWidget): """ @@ -194,6 +195,43 @@ class CommunityWidget(QWidget, Ui_CommunityWidget): []) self.tab_history.refresh_balance() + 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 handle_membership_broadcasted(self): + if self.app.preferences['notifications']: + toast.display(self.tr("Membership"), self.tr("Success sending Membership demand")) + else: + QMessageBox.information(self, self.tr("Membership"), self.tr("Success sending Membership demand")) + + def handle_revoke_broadcasted(self): + if self.app.preferences['notifications']: + toast.display(self.tr("Revoke"), self.tr("Success sending Revoke demand")) + else: + QMessageBox.information(self, self.tr("Revoke"), self.tr("Success sending Revoke demand")) + + def handle_selfcert_broadcasted(self): + if self.app.preferences['notifications']: + toast.display(self.tr("Self Certification"), self.tr("Success sending Self Certification document")) + else: + QMessageBox.information(self.tr("Self Certification"), self.tr("Success sending Self Certification document")) + def changeEvent(self, event): """ Intercepte LanguageChange event to translate UI diff --git a/src/cutecoin/gui/homescreen.py b/src/cutecoin/gui/homescreen.py index 0d00fed7cce928ee4e1fbb01486bc241128d8dbb..9598570b51f7b281b8ca4c63ff26f049bff9a349 100644 --- a/src/cutecoin/gui/homescreen.py +++ b/src/cutecoin/gui/homescreen.py @@ -30,10 +30,11 @@ class FrameCommunities(QFrame): for i in reversed(range(self.grid_layout.count())): self.grid_layout.itemAt(i).widget().setParent(None) - for c in app.current_account.communities: - community_tile = CommunityTile(self, app, c) - community_tile.clicked.connect(self.click_on_tile) - self.layout().addWidget(community_tile) + if app.current_account: + for c in app.current_account.communities: + community_tile = CommunityTile(self, app, c) + community_tile.clicked.connect(self.click_on_tile) + self.layout().addWidget(community_tile) @pyqtSlot() def click_on_tile(self): @@ -58,11 +59,11 @@ class HomeScreenWidget(QWidget, Ui_HomescreenWidget): self.layout().addWidget(self.frame_communities) def refresh(self): + self.frame_communities.refresh(self.app) if self.app.current_account: self.frame_connected.show() self.label_connected.setText(self.tr("Connected as {0}".format(self.app.current_account.name))) self.frame_disconnected.hide() - self.frame_communities.refresh(self.app) else: self.frame_disconnected.show() self.frame_connected.hide() diff --git a/src/cutecoin/gui/identities_tab.py b/src/cutecoin/gui/identities_tab.py index 991c2aac6748aec46491d520e2aa1eb4af3682ad..f951ae5fec0065f9cc666f2e1eff1428c1cf6775 100644 --- a/src/cutecoin/gui/identities_tab.py +++ b/src/cutecoin/gui/identities_tab.py @@ -61,11 +61,7 @@ class IdentitiesTabWidget(QWidget, Ui_IdentitiesTab): def change_account(self, account): self.account = account - if self.account is not None: - 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) - else: + if self.account is None: self.community = None def change_community(self, community): @@ -73,24 +69,6 @@ class IdentitiesTabWidget(QWidget, Ui_IdentitiesTab): self.table_identities.model().change_community(community) self.account.identity(self.community).inner_data_changed.connect(self.handle_account_identity_change) - def handle_membership_broadcasted(self): - if self.app.preferences['notifications']: - toast.display(self.tr("Membership"), self.tr("Success sending Membership demand")) - else: - QMessageBox.information(self, self.tr("Membership"), self.tr("Success sending Membership demand")) - - def handle_revoke_broadcasted(self): - if self.app.preferences['notifications']: - toast.display(self.tr("Revoke"), self.tr("Success sending Revoke demand")) - else: - QMessageBox.information(self, self.tr("Revoke"), self.tr("Success sending Revoke demand")) - - def handle_selfcert_broadcasted(self): - if self.app.preferences['notifications']: - toast.display(self.tr("Self Certification"), self.tr("Success sending Self Certification document")) - else: - QMessageBox.information(self.tr("Self Certification"), self.tr("Success sending Self Certification document")) - def identity_context_menu(self, point): index = self.table_identities.indexAt(point) model = self.table_identities.model() diff --git a/src/cutecoin/gui/mainwindow.py b/src/cutecoin/gui/mainwindow.py index 6c9e0187bebf779843a6060310823996e95a28e1..d15d5147ddcba63ad982cba8c3e1941283523d79 100644 --- a/src/cutecoin/gui/mainwindow.py +++ b/src/cutecoin/gui/mainwindow.py @@ -73,6 +73,8 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.centralWidget().layout().addWidget(self.homescreen) self.community_view = CommunityWidget(self.app, self.status_label) + self.community_view.button_certification.clicked.connect(self.open_certification_dialog) + self.community_view.button_send_money.clicked.connect(self.open_transfer_money_dialog) self.centralWidget().layout().addWidget(self.community_view) def startup(self): @@ -137,12 +139,12 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.refresh() def open_transfer_money_dialog(self): - dialog = TransferMoneyDialog(self.app, self.app.current_account, + dialog = TransferMoneyDialog(self.app, + self.app.current_account, self.password_asker) dialog.accepted.connect(self.refresh_wallets) if dialog.exec_() == QDialog.Accepted: - currency_tab = self.community_view - currency_tab.tab_history.table_history.model().sourceModel().refresh_transfers() + self.community_view.tab_history.table_history.model().sourceModel().refresh_transfers() def open_certification_dialog(self): dialog = CertificationDialog(self.app.current_account, diff --git a/src/cutecoin/gui/wallets_tab.py b/src/cutecoin/gui/wallets_tab.py index a87f080ceb56c6cf7f249ac47856a36a56c00d58..ef418735777b5cdedb706cc275b652df011e9b29 100644 --- a/src/cutecoin/gui/wallets_tab.py +++ b/src/cutecoin/gui/wallets_tab.py @@ -154,25 +154,6 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab): 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 ?