Skip to content
Snippets Groups Projects
Commit 869f5466 authored by inso's avatar inso
Browse files

Creating contacts from community members list by double clicking + adding...

Creating contacts from community members list by double clicking + adding pubkey verification in account creation
parent c10b7618
Branches
Tags
No related merge requests found
......@@ -140,7 +140,7 @@
<number>5</number>
</property>
<item>
<widget class="QLabel" name="label_fingerprint">
<widget class="QLabel" name="label_info">
<property name="text">
<string/>
</property>
......@@ -149,7 +149,7 @@
<item>
<widget class="QPushButton" name="button_generate">
<property name="text">
<string>Generate a secret key</string>
<string>Show public key</string>
</property>
</widget>
</item>
......@@ -399,6 +399,22 @@
</hint>
</hints>
</connection>
<connection>
<sender>button_generate</sender>
<signal>clicked()</signal>
<receiver>AccountConfigurationDialog</receiver>
<slot>action_show_pubkey()</slot>
<hints>
<hint type="sourcelabel">
<x>290</x>
<y>161</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>118</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>open_process_add_community()</slot>
......@@ -411,5 +427,6 @@
<slot>open_generate_account_key()</slot>
<slot>action_edit_account_key()</slot>
<slot>action_edit_account_name()</slot>
<slot>action_show_pubkey()</slot>
</slots>
</ui>
......@@ -12,12 +12,14 @@ sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'lib')))
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), 'src')))
print(sys.path)
includes = ["sip", "re", "json", "logging", "hashlib", "os", "urllib", "ucoin", "requests"]
includes = ["sip", "re", "json", "logging", "hashlib", "os", "urllib", "ucoinpy", "requests", "nacl", "cffi"]
excludes = []
packages = ["gnupg"]
packages = []
includefiles = []
options = {"path": sys.path,
"includes": includes,
"include_files": includefiles,
"excludes": excludes,
"packages": packages,
}
......@@ -42,7 +44,7 @@ target = Executable(
# creation du setup
setup(
name = "cutecoin",
version = "0.4.1",
version = "0.5",
description = "UCoin client",
author = "Inso",
options = {"build_exe": options},
......
......@@ -8,6 +8,7 @@ import logging
from PyQt5.QtWidgets import QWidget, QErrorMessage
from cutecoin.models.members import MembersListModel
from cutecoin.gen_resources.communityTabWidget_uic import Ui_CommunityTabWidget
from cutecoin.gui.addContactDialog import AddContactDialog
class CommunityTabWidget(QWidget, Ui_CommunityTabWidget):
......@@ -25,6 +26,7 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget):
self.community = community
self.account = account
self.list_community_members.setModel(MembersListModel(community))
self.list_community_members.doubleClicked.connect(self.add_member_as_contact)
if self.account.member_of(self.community):
self.button_membership.setText("Send leaving demand")
self.button_membership.clicked.connect(self.send_membership_leaving)
......@@ -32,6 +34,18 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget):
self.button_membership.setText("Send membership demand")
self.button_membership.clicked.connect(self.send_membership_demand)
def add_member_as_contact(self, index):
members_model = self.list_community_members.model()
members = members_model.members
logging.debug("Members : {0}".format(len(members)))
if index.row() < len(members):
dialog = AddContactDialog(self.account, self)
person = members[index.row()]
dialog.edit_name.setText(person.name)
dialog.edit_pubkey.setText(person.pubkey)
dialog.exec_()
def send_membership_demand(self):
result = self.account.send_membership_in(self.community)
if (result):
......
......@@ -60,14 +60,18 @@ class StepPageKey(Step):
super().__init__(config_dialog)
def is_valid(self):
if len(self.config_dialog.edit_password.text()) < 8:
if len(self.config_dialog.edit_password.text()) < 2:
return False
if len(self.config_dialog.edit_email.text()) < 2:
return False
if len(self.config_dialog.edit_password.text()) < 8:
self.config_dialog.label_info.setText("Warning : password is too short")
if self.config_dialog.edit_password.text() != \
self.config_dialog.edit_password_repeat.text():
self.config_dialog.label_info.setText("Error : passwords are different")
return False
return True
......@@ -173,6 +177,12 @@ class ProcessConfigureAccount(QDialog, Ui_AccountConfigurationDialog):
else:
self.button_next.setEnabled(False)
def action_show_pubkey(self):
salt = self.edit_email.text()
password = self.edit_password.text()
pubkey = SigningKey(salt, password).pubkey
QMessageBox.information(self, "Public key", "These parameters pubkeys are : {0}".format(pubkey))
def action_edit_account_name(self):
if self.step.is_valid():
self.button_next.setEnabled(True)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment