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

Structure des models initialisée et idem windowing Qt5

parent 6b307cf1
No related branches found
No related tags found
No related merge requests found
Makefile 0 → 100644
###### EDIT #####################
#Directory with ui and resource files
RESOURCE_DIR = res/ui
#Directory for compiled resources
COMPILED_DIR = src/cutecoin/gen_resources
#UI files to compile
UI_FILES = mainwindow.ui addAccountDialog.ui addCommunityDialog.ui
#Qt resource files to compile
RESOURCES =
#pyuic4 and pyrcc4 binaries
PYUIC = pyuic5
PYRCC = pyrcc5
#################################
# DO NOT EDIT FOLLOWING
COMPILED_UI = $(UI_FILES:%.ui=$(COMPILED_DIR)/%_uic.py)
COMPILED_RESOURCES = $(RESOURCES:%.qrc=$(COMPILED_DIR)/%_rc.py)
all : resources ui
resources : $(COMPILED_RESOURCES)
ui : $(COMPILED_UI)
$(COMPILED_DIR)/%_uic.py : $(RESOURCE_DIR)/%.ui
$(PYUIC) $< -o $@
$(COMPILED_DIR)/%_rc.py : $(RESOURCE_DIR)/%.qrc
$(PYRCC) $< -o $@
clean :
$(RM) $(COMPILED_UI) $(COMPILED_RESOURCES) $(COMPILED_UI:.py=.pyc) $(COMPILED_RESOURCES:.py=.pyc)
\ No newline at end of file
doc/uml/models.png

38.7 KiB

@startuml
class Account {
pgpkey
}
Account --> "0..*" Community : is a member of
Account --> "0..*" Node : trusts
Account --> "0..*" Node : send transactions with
Account --> "*" Transaction : send
Account --> "*" Transaction : receive
Account --> "0..*" Wallet : owns
class Community {
}
Community "1" -- "1" Currency : uses
Community "1" --> "1..*" Node : known nodes
class Node {
address
port
auth
}
Node --> "1" Community
class Transaction {
value
currency
sender
receiver
}
class Wallet {
currency
coins
}
@enduml
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>Dialog</class>
<widget class="QDialog" name="Dialog">
<class>AddAccountDialog</class>
<widget class="QDialog" name="AddAccountDialog">
<property name="geometry">
<rect>
<x>0</x>
......@@ -11,7 +11,10 @@
</rect>
</property>
<property name="windowTitle">
<string>Dialog</string>
<string>Add an account</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
......@@ -56,10 +59,28 @@
<property name="title">
<string>Communities membership</string>
</property>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTableView" name="communitiesTable"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QPushButton" name="addCommunity">
<property name="text">
<string>Add a community</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeCommunity">
<property name="text">
<string>Remove selected community</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
......@@ -80,7 +101,7 @@
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>Dialog</receiver>
<receiver>AddAccountDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
......@@ -96,7 +117,7 @@
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>Dialog</receiver>
<receiver>AddAccountDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
......@@ -109,5 +130,24 @@
</hint>
</hints>
</connection>
<connection>
<sender>addCommunity</sender>
<signal>clicked()</signal>
<receiver>AddAccountDialog</receiver>
<slot>openAddCommunityDialog()</slot>
<hints>
<hint type="sourcelabel">
<x>109</x>
<y>237</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>149</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>openAddCommunityDialog()</slot>
</slots>
</ui>
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>AddCommunityDialog</class>
<widget class="QDialog" name="AddCommunityDialog">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>400</width>
<height>300</height>
</rect>
</property>
<property name="windowTitle">
<string>Add a community</string>
</property>
<property name="modal">
<bool>true</bool>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QGroupBox" name="groupBox_2">
<property name="title">
<string>Communities nodes</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout_3">
<item>
<widget class="QTableView" name="communitiesTable"/>
</item>
<item>
<layout class="QHBoxLayout" name="horizontalLayout_3">
<item>
<widget class="QLineEdit" name="lineEdit">
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>Server</string>
</property>
</widget>
</item>
<item>
<widget class="QLineEdit" name="lineEdit_2">
<property name="text">
<string/>
</property>
<property name="placeholderText">
<string>Port</string>
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBox">
<property name="text">
<string>Auth</string>
</property>
</widget>
</item>
<item>
<widget class="QPushButton" name="removeCommunity">
<property name="text">
<string>Add</string>
</property>
</widget>
</item>
</layout>
</item>
</layout>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="standardButtons">
<set>QDialogButtonBox::Cancel|QDialogButtonBox::Ok</set>
</property>
</widget>
</item>
</layout>
</widget>
<resources/>
<connections>
<connection>
<sender>buttonBox</sender>
<signal>accepted()</signal>
<receiver>AddCommunityDialog</receiver>
<slot>accept()</slot>
<hints>
<hint type="sourcelabel">
<x>248</x>
<y>254</y>
</hint>
<hint type="destinationlabel">
<x>157</x>
<y>274</y>
</hint>
</hints>
</connection>
<connection>
<sender>buttonBox</sender>
<signal>rejected()</signal>
<receiver>AddCommunityDialog</receiver>
<slot>reject()</slot>
<hints>
<hint type="sourcelabel">
<x>316</x>
<y>260</y>
</hint>
<hint type="destinationlabel">
<x>286</x>
<y>274</y>
</hint>
</hints>
</connection>
</connections>
</ui>
......@@ -152,8 +152,7 @@
<string>Account</string>
</property>
<addaction name="actionChange_account"/>
<addaction name="actionManage_accounts"/>
<addaction name="actionConfigure_trustable_nodes"/>
<addaction name="actionAdd_account"/>
</widget>
<widget class="QMenu" name="menuEdit">
<property name="title">
......@@ -216,7 +215,32 @@
<string>Remove contact</string>
</property>
</action>
<action name="actionAdd_account">
<property name="text">
<string>Add account</string>
</property>
</action>
</widget>
<resources/>
<connections/>
<connections>
<connection>
<sender>actionAdd_account</sender>
<signal>triggered()</signal>
<receiver>MainWindow</receiver>
<slot>openAddAccountDialog()</slot>
<hints>
<hint type="sourcelabel">
<x>-1</x>
<y>-1</y>
</hint>
<hint type="destinationlabel">
<x>225</x>
<y>199</y>
</hint>
</hints>
</connection>
</connections>
<slots>
<slot>openAddAccountDialog()</slot>
</slots>
</ui>
......@@ -10,7 +10,6 @@ from cutecoin.models.account import Account
if __name__ == '__main__':
app = QApplication(sys.argv)
acc = Account()
window = MainWindow()
window.show()
sys.exit(app.exec_())
......
'''
Created on 2 févr. 2014
@author: inso
'''
from cutecoin.gen_resources.addAccountDialog_uic import Ui_AddAccountDialog
from PyQt5.QtWidgets import QDialog
from cutecoin.gui.addCommunityDialog import AddCommunityDialog
class AddAccountDialog(QDialog, Ui_AddAccountDialog):
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
# Set up the user interface from Designer.
super(AddAccountDialog, self).__init__()
self.setupUi(self)
print("stiio")
def openAddCommunityDialog(self):
dialog = AddCommunityDialog()
dialog.show()
'''
Created on 2 févr. 2014
@author: inso
'''
from cutecoin.gen_resources.addCommunityDialog_uic import Ui_AddCommunityDialog
from PyQt5.QtWidgets import QDialog
class AddCommunityDialog(QDialog, Ui_AddCommunityDialog):
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
super(AddCommunityDialog, self).__init__()
self.setupUi(self)
......@@ -5,7 +5,7 @@ Created on 1 févr. 2014
'''
from cutecoin.gen_resources.mainwindow_uic import Ui_MainWindow
from PyQt5.QtWidgets import QMainWindow
from cutecoin.gui.addAccountDialog import AddAccountDialog
class MainWindow(QMainWindow, Ui_MainWindow):
'''
......@@ -20,3 +20,9 @@ class MainWindow(QMainWindow, Ui_MainWindow):
# Set up the user interface from Designer.
super(MainWindow, self).__init__()
self.setupUi(self)
def openAddAccountDialog(self):
dialog = AddAccountDialog()
print("shoow")
dialog.show()
print("shoow2")
\ No newline at end of file
......@@ -11,12 +11,18 @@ class Account(object):
classdocs
'''
def __init__(self):
def __init__(self, pgpKey, name, communities):
'''
Constructor
'''
self.pgpKey = pgpKey
self.name = name
self.communities = communities
self.transactionNodes = []
self.trustableNodes = []
self.wallets = []
self.receivedTransactions = []
self.sentTransactions = []
def addTransactionNode(self, node):
self.transactionNodes.append(node)
......
'''
Created on 2 févr. 2014
@author: inso
'''
class Coin(object):
'''
classdocs
'''
def __init__(self, number):
'''
Constructor
'''
self.number = number
......@@ -4,13 +4,56 @@ Created on 1 févr. 2014
@author: inso
'''
class communityModel(object):
import ucoinpy as ucoin
class Community(object):
'''
classdocs
'''
def __init__(self, params):
def __init__(self, mainNode, currency):
'''
Constructor
'''
self.knowNodes = []
self.knowNodes.append(mainNode)
def members(self):
'''
Listing members of a community
'''
# TODO : Try connecting with nodes of the list
# if the first fails
# Maybe create a method
ucoin.settings['server'] = self.knowNodes[0].address
ucoin.settings['port'] = self.knowNodes[0].port
ucoin.settings['auth'] = self.knowNodes[0].auth
members = ucoin.hdc.amendments.view.Members( ucoin.hdc.amendments.Current )
return members
class CommunitiesManager(object):
'''
classdocs
'''
def __init__(self):
'''
Constructor
'''
self.communities = []
def getCommunity(self, currency):
for com in self.communities:
if com.currency == currency:
return com
def addCommunity(self, node):
ucoin.settings['server'] = node.address
ucoin.settings['port'] = node.port
ucoin.settings['auth'] = node.auth
currentAmendment = ucoin.hdc.amendments.Current.get(self)
currency = currentAmendment['currency']
self.communities.append(Community(node), currency)
......@@ -4,13 +4,17 @@ Created on 1 févr. 2014
@author: inso
'''
class TransactionModel(object):
class Transaction(object):
'''
classdocs
'''
def __init__(self, params):
def __init__(self, value, sender, receiver, currency):
'''
Constructor
'''
self.value = value
self.sender = sender
self.receiver = receiver
self.currency = currency
......@@ -4,13 +4,16 @@ Created on 1 févr. 2014
@author: inso
'''
class WalletModel(object):
class Wallet(object):
'''
classdocs
'''
def __init__(self, params):
def __init__(self, currency):
'''
Constructor
'''
self.initialValue = 0
self.coins = []
self.currency = currency
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment