Skip to content

Commit

Permalink
Merge pull request #3942 from devos50/explain_tokens
Browse files Browse the repository at this point in the history
Explaning bandwidth tokens in the GUI
  • Loading branch information
xoriole committed Oct 5, 2018
2 parents f26a7e3 + fcf8853 commit d1a4a08
Show file tree
Hide file tree
Showing 5 changed files with 351 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Tribler/Core/Modules/wallet/tc_wallet.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from twisted.internet.task import LoopingCall


MEGA_DIV = 1024 * 1024
MEGA_DIV = 1024.0 * 1024.0
MIN_TRANSACTION_SIZE = 1024 * 1024


Expand Down Expand Up @@ -72,7 +72,7 @@ def get_bandwidth_tokens(self, peer=None):

def get_balance(self):
return succeed({
'available': self.get_bandwidth_tokens() / MEGA_DIV,
'available': int(self.get_bandwidth_tokens() / MEGA_DIV),
'pending': 0,
'currency': self.get_identifier(),
'precision': self.precision()
Expand Down
22 changes: 22 additions & 0 deletions TriblerGUI/dialogs/trustexplanationdialog.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
from PyQt5 import uic
from PyQt5.QtWidgets import QSizePolicy

from TriblerGUI.dialogs.dialogcontainer import DialogContainer
from TriblerGUI.utilities import get_ui_file_path


class TrustExplanationDialog(DialogContainer):

def __init__(self, parent):
DialogContainer.__init__(self, parent)

uic.loadUi(get_ui_file_path('trustexplanation.ui'), self.dialog_widget)

self.dialog_widget.setSizePolicy(QSizePolicy.Fixed, QSizePolicy.Expanding)
self.dialog_widget.close_button.clicked.connect(self.close_dialog)

self.update_window()

def update_window(self):
self.dialog_widget.adjustSize()
self.on_main_window_resize()
47 changes: 41 additions & 6 deletions TriblerGUI/qt_resources/mainwindow.ui
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ background-color: #e67300;
<item>
<widget class="QStackedWidget" name="stackedWidget">
<property name="currentIndex">
<number>2</number>
<number>12</number>
</property>
<widget class="HomePage" name="home_page">
<layout class="QVBoxLayout" name="verticalLayout">
Expand Down Expand Up @@ -5063,7 +5063,7 @@ border-top: 1px solid #555;
<rect>
<x>0</x>
<y>0</y>
<width>661</width>
<width>300</width>
<height>610</height>
</rect>
</property>
Expand Down Expand Up @@ -9371,7 +9371,7 @@ border-top: 1px solid #555;
<item>
<widget class="QLabel" name="subscribed_channels_header_label">
<property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
<horstretch>0</horstretch>
<verstretch>0</verstretch>
</sizepolicy>
Expand All @@ -9393,20 +9393,55 @@ border-top: 1px solid #555;
background-color: transparent;
font-size: 20px;
font-weight: bold;
margin: 10px;</string>
margin: 10px;
margin-right: 4px;
margin-top: 9px;</string>
</property>
<property name="text">
<string>Trust statistics</string>
</property>
</widget>
</item>
<item>
<widget class="QToolButton" name="trust_explain_button">
<property name="minimumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="maximumSize">
<size>
<width>20</width>
<height>20</height>
</size>
</property>
<property name="font">
<font>
<pointsize>14</pointsize>
</font>
</property>
<property name="cursor">
<cursorShape>PointingHandCursor</cursorShape>
</property>
<property name="styleSheet">
<string notr="true">border: 1px solid white;
color: white;
border-radius: 10px;
</string>
</property>
<property name="text">
<string>i</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_69">
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
<property name="sizeType">
<enum>QSizePolicy::Fixed</enum>
<enum>QSizePolicy::Expanding</enum>
</property>
<property name="sizeHint" stdset="0">
<size>
Expand Down Expand Up @@ -9479,7 +9514,7 @@ border-top: 1px solid #555;
<string notr="true">padding-left: 10px; padding-right: 10px;</string>
</property>
<property name="text">
<string>You can build trust by contributing to the Tribler network. This is done by exchanging data anonymously or by letting Tribler run idle.</string>
<string>You can build trust by contributing bandwidth to the Tribler network. This is done by letting Tribler run idle, or by mining tokens.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
Expand Down

0 comments on commit d1a4a08

Please sign in to comment.