Skip to content
Snippets Groups Projects
Commit 2552cd22 authored by inso's avatar inso
Browse files

Adding icons in community view and fix signals/slots

parent 77735481
No related branches found
No related tags found
No related merge requests found
...@@ -19,3 +19,8 @@ noun_2149_cc.svg : Created by Anand A Nair ...@@ -19,3 +19,8 @@ noun_2149_cc.svg : Created by Anand A Nair
noun_152997_cc.svg : Created by Pedro Ivo Hudson noun_152997_cc.svg : Created by Pedro Ivo Hudson
noun_139613_cc.svg : Created by Aha-Soft noun_139613_cc.svg : Created by Aha-Soft
noun_19900_cc.svg : Created by by Stefan Parnarov 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
<RCC> <RCC>
<qresource prefix="icons"> <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="logout">noun_19900_cc.svg</file>
<file alias="add_community">noun_139613_cc.svg</file> <file alias="add_community">noun_139613_cc.svg</file>
<file alias="connect_icon">noun_152997_cc.svg</file> <file alias="connect_icon">noun_152997_cc.svg</file>
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
<rect> <rect>
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>400</width> <width>532</width>
<height>300</height> <height>313</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">
...@@ -35,8 +35,14 @@ ...@@ -35,8 +35,14 @@
<string/> <string/>
</property> </property>
<property name="icon"> <property name="icon">
<iconset> <iconset resource="../icons/icons.qrc">
<normaloff>../icons/iconmonstr-home-icon.svg</normaloff>../icons/iconmonstr-home-icon.svg</iconset> <normaloff>:/icons/home_icon</normaloff>:/icons/home_icon</iconset>
</property>
<property name="iconSize">
<size>
<width>32</width>
<height>32</height>
</size>
</property> </property>
</widget> </widget>
</item> </item>
...@@ -52,6 +58,16 @@ ...@@ -52,6 +58,16 @@
<property name="text"> <property name="text">
<string>Send money</string> <string>Send money</string>
</property> </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> </widget>
</item> </item>
<item> <item>
...@@ -59,6 +75,16 @@ ...@@ -59,6 +75,16 @@
<property name="text"> <property name="text">
<string>Certification</string> <string>Certification</string>
</property> </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> </widget>
</item> </item>
<item> <item>
...@@ -66,6 +92,16 @@ ...@@ -66,6 +92,16 @@
<property name="text"> <property name="text">
<string>Renew membership</string> <string>Renew membership</string>
</property> </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> </widget>
</item> </item>
</layout> </layout>
...@@ -76,6 +112,8 @@ ...@@ -76,6 +112,8 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<resources/> <resources>
<include location="../icons/icons.qrc"/>
</resources>
<connections/> <connections/>
</ui> </ui>
...@@ -29,91 +29,6 @@ QGroupBox::title { ...@@ -29,91 +29,6 @@ QGroupBox::title {
</property> </property>
<layout class="QGridLayout" name="gridLayout"> <layout class="QGridLayout" name="gridLayout">
<item row="0" column="0"> <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"> <widget class="QGroupBox" name="groupBox_2">
<property name="title"> <property name="title">
<string>Balance</string> <string>Balance</string>
...@@ -149,7 +64,7 @@ QGroupBox::title { ...@@ -149,7 +64,7 @@ QGroupBox::title {
</layout> </layout>
</widget> </widget>
</item> </item>
<item row="2" column="0"> <item row="1" column="0">
<widget class="QTableView" name="table_wallets"> <widget class="QTableView" name="table_wallets">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
...@@ -202,70 +117,6 @@ QGroupBox::title { ...@@ -202,70 +117,6 @@ QGroupBox::title {
</hint> </hint>
</hints> </hints>
</connection> </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> </connections>
<slots> <slots>
<slot>wallet_context_menu(QPoint)</slot> <slot>wallet_context_menu(QPoint)</slot>
......
...@@ -6,7 +6,7 @@ Created on 2 févr. 2014 ...@@ -6,7 +6,7 @@ Created on 2 févr. 2014
import time import time
import logging 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.QtCore import QModelIndex, pyqtSlot, QDateTime, QLocale, QEvent
from PyQt5.QtGui import QIcon from PyQt5.QtGui import QIcon
...@@ -23,6 +23,7 @@ from ..tools.exceptions import MembershipNotFoundError, NoPeerAvailable ...@@ -23,6 +23,7 @@ from ..tools.exceptions import MembershipNotFoundError, NoPeerAvailable
from ..core.registry import IdentitiesRegistry from ..core.registry import IdentitiesRegistry
from ..gen_resources.community_view_uic import Ui_CommunityWidget from ..gen_resources.community_view_uic import Ui_CommunityWidget
class CommunityWidget(QWidget, Ui_CommunityWidget): class CommunityWidget(QWidget, Ui_CommunityWidget):
""" """
...@@ -194,6 +195,43 @@ class CommunityWidget(QWidget, Ui_CommunityWidget): ...@@ -194,6 +195,43 @@ class CommunityWidget(QWidget, Ui_CommunityWidget):
[]) [])
self.tab_history.refresh_balance() 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): def changeEvent(self, event):
""" """
Intercepte LanguageChange event to translate UI Intercepte LanguageChange event to translate UI
......
...@@ -30,6 +30,7 @@ class FrameCommunities(QFrame): ...@@ -30,6 +30,7 @@ class FrameCommunities(QFrame):
for i in reversed(range(self.grid_layout.count())): for i in reversed(range(self.grid_layout.count())):
self.grid_layout.itemAt(i).widget().setParent(None) self.grid_layout.itemAt(i).widget().setParent(None)
if app.current_account:
for c in app.current_account.communities: for c in app.current_account.communities:
community_tile = CommunityTile(self, app, c) community_tile = CommunityTile(self, app, c)
community_tile.clicked.connect(self.click_on_tile) community_tile.clicked.connect(self.click_on_tile)
...@@ -58,11 +59,11 @@ class HomeScreenWidget(QWidget, Ui_HomescreenWidget): ...@@ -58,11 +59,11 @@ class HomeScreenWidget(QWidget, Ui_HomescreenWidget):
self.layout().addWidget(self.frame_communities) self.layout().addWidget(self.frame_communities)
def refresh(self): def refresh(self):
self.frame_communities.refresh(self.app)
if self.app.current_account: if self.app.current_account:
self.frame_connected.show() self.frame_connected.show()
self.label_connected.setText(self.tr("Connected as {0}".format(self.app.current_account.name))) self.label_connected.setText(self.tr("Connected as {0}".format(self.app.current_account.name)))
self.frame_disconnected.hide() self.frame_disconnected.hide()
self.frame_communities.refresh(self.app)
else: else:
self.frame_disconnected.show() self.frame_disconnected.show()
self.frame_connected.hide() self.frame_connected.hide()
......
...@@ -61,11 +61,7 @@ class IdentitiesTabWidget(QWidget, Ui_IdentitiesTab): ...@@ -61,11 +61,7 @@ class IdentitiesTabWidget(QWidget, Ui_IdentitiesTab):
def change_account(self, account): def change_account(self, account):
self.account = account self.account = account
if self.account is not None: if self.account is 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:
self.community = None self.community = None
def change_community(self, community): def change_community(self, community):
...@@ -73,24 +69,6 @@ class IdentitiesTabWidget(QWidget, Ui_IdentitiesTab): ...@@ -73,24 +69,6 @@ class IdentitiesTabWidget(QWidget, Ui_IdentitiesTab):
self.table_identities.model().change_community(community) self.table_identities.model().change_community(community)
self.account.identity(self.community).inner_data_changed.connect(self.handle_account_identity_change) 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): def identity_context_menu(self, point):
index = self.table_identities.indexAt(point) index = self.table_identities.indexAt(point)
model = self.table_identities.model() model = self.table_identities.model()
......
...@@ -73,6 +73,8 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -73,6 +73,8 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.centralWidget().layout().addWidget(self.homescreen) self.centralWidget().layout().addWidget(self.homescreen)
self.community_view = CommunityWidget(self.app, self.status_label) 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) self.centralWidget().layout().addWidget(self.community_view)
def startup(self): def startup(self):
...@@ -137,12 +139,12 @@ class MainWindow(QMainWindow, Ui_MainWindow): ...@@ -137,12 +139,12 @@ class MainWindow(QMainWindow, Ui_MainWindow):
self.refresh() self.refresh()
def open_transfer_money_dialog(self): 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) self.password_asker)
dialog.accepted.connect(self.refresh_wallets) dialog.accepted.connect(self.refresh_wallets)
if dialog.exec_() == QDialog.Accepted: if dialog.exec_() == QDialog.Accepted:
currency_tab = self.community_view self.community_view.tab_history.table_history.model().sourceModel().refresh_transfers()
currency_tab.tab_history.table_history.model().sourceModel().refresh_transfers()
def open_certification_dialog(self): def open_certification_dialog(self):
dialog = CertificationDialog(self.app.current_account, dialog = CertificationDialog(self.app.current_account,
......
...@@ -154,25 +154,6 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab): ...@@ -154,25 +154,6 @@ class WalletsTabWidget(QWidget, Ui_WalletsTab):
currency_tab = self.window().currencies_tabwidget.currentWidget() currency_tab = self.window().currencies_tabwidget.currentWidget()
currency_tab.tab_history.table_history.model().sourceModel().refresh_transfers() 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): def publish_uid(self):
reply = QMessageBox.warning(self, self.tr("Warning"), reply = QMessageBox.warning(self, self.tr("Warning"),
self.tr("""Are you sure ? self.tr("""Are you sure ?
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment