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

Merge branch 'dev' into translations

parents a87e9cb9 892ccedd
Branches
Tags
No related merge requests found
Showing
with 1976 additions and 661 deletions
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.1"
x="0px"
y="0px"
viewBox="0 0 100 125"
enable-background="new 0 0 100 100"
xml:space="preserve"
id="svg2"
inkscape:version="0.91 r13725"
sodipodi:docname="noun_62146_cc.svg"><metadata
id="metadata26"><rdf:RDF><cc:Work
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /></cc:Work></rdf:RDF></metadata><defs
id="defs24" /><sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="709"
id="namedview22"
showgrid="false"
inkscape:zoom="1.888"
inkscape:cx="50"
inkscape:cy="39.907766"
inkscape:window-x="-2"
inkscape:window-y="0"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" /><g
id="g4"
transform="matrix(1.1447278,0,0,1.1447278,-8.4204046,3.5272159)"><rect
x="31"
y="32.5"
width="41"
height="4"
id="rect6" /></g><g
id="g8"
transform="matrix(1.1447278,0,0,1.1447278,-8.4204046,3.5272159)"><rect
x="48"
y="82.5"
width="9"
height="17.5"
id="rect10" /></g><path
d="m 37.368709,4.8871525 0,33.5542625 4.578911,0 0,-33.5542625 -4.578911,0 z m 3.451355,7.0824315 -2.324943,0 0,-5.5805485 2.324943,0 0,5.5805485 z"
id="path12"
inkscape:connector-curvature="0" /><path
d="m 60.263266,4.8871525 0,33.5542625 4.578911,0 0,-33.5542625 -4.578911,0 z m 3.451354,7.0824315 -2.324942,0 0,-5.5805485 2.324942,0 0,5.5805485 z"
id="path14"
inkscape:connector-curvature="0" /><path
d="m 27.066159,43.020326 0,30.907652 12.019642,21.749829 24.039285,0 L 74,73.927978 l 0,-30.907652 -46.933841,0 z m 40.065474,32.05238 -34.341835,0 0,-2.289456 34.341835,0 0,2.289456 z"
id="path16"
inkscape:connector-curvature="0" /></svg>
\ No newline at end of file
...@@ -75,7 +75,31 @@ ...@@ -75,7 +75,31 @@
</layout> </layout>
</item> </item>
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"/> <layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="topMargin">
<number>6</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_checknode">
<property name="text">
<string>Check node connectivity</string>
</property>
</widget>
</item>
</layout>
</item> </item>
<item> <item>
<spacer name="verticalSpacer"> <spacer name="verticalSpacer">
......
...@@ -29,9 +29,6 @@ ...@@ -29,9 +29,6 @@
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QTabWidget" name="tabs_account"> <widget class="QTabWidget" name="tabs_account">
<property name="enabled">
<bool>false</bool>
</property>
<property name="currentIndex"> <property name="currentIndex">
<number>-1</number> <number>-1</number>
</property> </property>
......
...@@ -16,6 +16,43 @@ ...@@ -16,6 +16,43 @@
<layout class="QVBoxLayout" name="verticalLayout_2"> <layout class="QVBoxLayout" name="verticalLayout_2">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QHBoxLayout" name="horizontalLayout_2">
<property name="topMargin">
<number>6</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_manual_refresh">
<property name="text">
<string/>
</property>
<property name="icon">
<iconset resource="../icons/icons.qrc">
<normaloff>:/icons/refresh_icon</normaloff>:/icons/refresh_icon</iconset>
</property>
<property name="iconSize">
<size>
<width>16</width>
<height>16</height>
</size>
</property>
</widget>
</item>
</layout>
</item>
<item> <item>
<widget class="QTableView" name="table_network"> <widget class="QTableView" name="table_network">
<property name="contextMenuPolicy"> <property name="contextMenuPolicy">
...@@ -48,7 +85,9 @@ ...@@ -48,7 +85,9 @@
</item> </item>
</layout> </layout>
</widget> </widget>
<resources/> <resources>
<include location="../icons/icons.qrc"/>
</resources>
<connections> <connections>
<connection> <connection>
<sender>table_network</sender> <sender>table_network</sender>
...@@ -66,8 +105,25 @@ ...@@ -66,8 +105,25 @@
</hint> </hint>
</hints> </hints>
</connection> </connection>
<connection>
<sender>button_manual_refresh</sender>
<signal>clicked()</signal>
<receiver>NetworkTabWidget</receiver>
<slot>manual_nodes_refresh()</slot>
<hints>
<hint type="sourcelabel">
<x>373</x>
<y>28</y>
</hint>
<hint type="destinationlabel">
<x>199</x>
<y>149</y>
</hint>
</hints>
</connection>
</connections> </connections>
<slots> <slots>
<slot>node_context_menu()</slot> <slot>node_context_menu()</slot>
<slot>manual_nodes_refresh()</slot>
</slots> </slots>
</ui> </ui>
This diff is collapsed.
from .community import Community
from .wallet import Wallet
from .account import Account
from .app import Application
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
''' """
Created on 7 févr. 2014 Created on 7 févr. 2014
@author: inso @author: inso
''' """
import logging import logging
from logging import FileHandler from logging import FileHandler
......
This diff is collapsed.
from .node import Node
from .network import Network
\ No newline at end of file
__all__ = ['api']
from PyQt5.QtNetwork import QNetworkRequest
from PyQt5.QtCore import QUrl, QUrlQuery
import logging
logger = logging.getLogger("ucoin")
PROTOCOL_VERSION = "1"
class ConnectionHandler(object):
"""Helper class used by other API classes to ease passing server connection information."""
def __init__(self, network_manager, server, port):
"""
Arguments:
- `server`: server hostname
- `port`: port number
"""
self.network_manager = network_manager
self.server = server
self.port = port
def __str__(self):
return 'connection info: %s:%d' % (self.server, self.port)
class API(object):
"""APIRequest is a class used as an interface. The intermediate derivated classes are the modules and the leaf classes are the API requests."""
def __init__(self, conn_handler, module):
"""
Asks a module in order to create the url used then by derivated classes.
Arguments:
- `module`: module name
- `connection_handler`: connection handler
"""
self.module = module
self.conn_handler = conn_handler
self.headers = {}
def reverse_url(self, path):
"""
Reverses the url using self.url and path given in parameter.
Arguments:
- `path`: the request path
"""
server, port = self.conn_handler.server, self.conn_handler.port
url = 'http://%s:%d/%s' % (server, port, self.module)
return url + path
def get(self, **kwargs):
"""wrapper of overloaded __get__ method."""
return self.__get__(**kwargs)
def post(self, **kwargs):
"""wrapper of overloaded __post__ method."""
logger.debug('do some work with')
data = self.__post__(**kwargs)
logger.debug('and send back')
return data
def __get__(self, **kwargs):
"""interface purpose for GET request"""
pass
def __post__(self, **kwargs):
"""interface purpose for POST request"""
pass
def requests_get(self, path, **kwargs):
"""
Requests GET wrapper in order to use API parameters.
Arguments:
- `path`: the request path
"""
query = QUrlQuery()
for k,v in kwargs.items():
query.addQueryItem(k, v);
url = QUrl(self.reverse_url(path))
url.setQuery(query)
request = QNetworkRequest(url)
logging.debug(url.toString())
reply = self.conn_handler.network_manager.get(request)
return reply
def requests_post(self, path, **kwargs):
"""
Requests POST wrapper in order to use API parameters.
Arguments:
- `path`: the request path
"""
if 'self_' in kwargs:
kwargs['self'] = kwargs.pop('self_')
logging.debug("POST : {0}".format(kwargs))
post_data = QUrlQuery()
for k,v in kwargs.items():
post_data.addQueryItem(k.replace("+", "%2b"), v.replace("+", "%2b"))
url = QUrl(self.reverse_url(path))
url.setQuery(post_data)
request = QNetworkRequest(url)
request.setHeader(QNetworkRequest.ContentTypeHeader,
"application/x-www-form-urlencoded")
reply = self.conn_handler.network_manager.post(request,
post_data.toString(QUrl.FullyEncoded).encode('utf-8'))
logging.debug(url.toString(QUrl.FullyEncoded))
return reply
from . import network, blockchain, tx, wot, ud, node
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# Authors:
# Caner Candan <caner@candan.fr>, http://caner.candan.fr
#
from .. import API, logging
logger = logging.getLogger("ucoin/network")
class Network(API):
def __init__(self, conn_handler, module='network'):
super(Network, self).__init__(conn_handler, module)
class Peering(Network):
"""GET peering information about a peer."""
def __get__(self, **kwargs):
return self.requests_get('/peering', **kwargs)
from . import peering
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment