diff --git a/README.md b/README.md index 29f2768719c2dc58a984eadab5a4757193ad6f2e..1635eaa5a0e91a20d3e5247164c53cfbd58bf0f3 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,6 @@ + + + cutecoin ======== @@ -41,7 +44,7 @@ Qt Client for [Ucoin](http://www.ucoin.io) project. * The executable is generated in "build" folder, named "cutecoin" ### How to download latest release - * Go to the [current release](https://github.com/ucoin-io/cutecoin/releases/tag/0.9.1) + * Go to the [current release](https://github.com/ucoin-io/cutecoin/releases/tag/0.9.2) * Download the package corresponding to your operating system * Unzip and start "cutecoin" :) * Join our beta community by contacting us on ucoin forums : forum.ucoin.io diff --git a/cutecoin.png b/cutecoin.png new file mode 100644 index 0000000000000000000000000000000000000000..b87448ae39a60683e2aeec4c255ec284f657a9b4 Binary files /dev/null and b/cutecoin.png differ diff --git a/res/ui/mainwindow.ui b/res/ui/mainwindow.ui index b13f53a19eb23c77d9342aeea03e5b49f50269cc..fa2f0717b4d466866f50abbf77e767c13efdeea4 100644 --- a/res/ui/mainwindow.ui +++ b/res/ui/mainwindow.ui @@ -13,10 +13,6 @@ <property name="windowTitle"> <string notr="true">CuteCoin</string> </property> - <property name="windowIcon"> - <iconset resource="../icons/icons.qrc"> - <normaloff>:/icons/cutecoin_logo</normaloff>:/icons/cutecoin_logo</iconset> - </property> <widget class="QWidget" name="centralwidget"> <layout class="QVBoxLayout" name="verticalLayout_6"> <item> diff --git a/res/ui/transactions_tab.ui b/res/ui/transactions_tab.ui index f9b6d6edaf525443e7363a74e165a359ffa37d40..bbeeff8a682ddbd3c4afbef19959c90b727c9d01 100644 --- a/res/ui/transactions_tab.ui +++ b/res/ui/transactions_tab.ui @@ -74,6 +74,16 @@ </item> </layout> </item> + <item> + <widget class="QProgressBar" name="progressbar"> + <property name="maximum"> + <number>0</number> + </property> + <property name="value"> + <number>-1</number> + </property> + </widget> + </item> <item> <widget class="QTableView" name="table_history"> <property name="contextMenuPolicy"> diff --git a/src/cutecoin/__init__.py b/src/cutecoin/__init__.py index 15d06a58407740e20faf870a3e898afcece4a42e..684173bd8f9c8eabbacb5248c5454a08e57dd4a2 100644 --- a/src/cutecoin/__init__.py +++ b/src/cutecoin/__init__.py @@ -1,2 +1,2 @@ -__version_info__ = ('0', '9', '1') +__version_info__ = ('0', '9', '2') __version__ = '.'.join(__version_info__) diff --git a/src/cutecoin/core/account.py b/src/cutecoin/core/account.py index 95c7ef9d6fbbf33b34e9616941809d6b1f321b81..c0cf310bf1be96f13c5b24358db33a4431d9ccf9 100644 --- a/src/cutecoin/core/account.py +++ b/src/cutecoin/core/account.py @@ -184,7 +184,7 @@ class Account(QObject): for w in self.wallets: w.refresh_progressed.connect(progressing, type=Qt.DirectConnection) for c in self.communities: - w.refresh_cache(c, []) + w.init_cache(c) loaded_wallets = loaded_wallets + 1 def set_display_referential(self, index): diff --git a/src/cutecoin/core/app.py b/src/cutecoin/core/app.py index 07cae11146629c3484b07cb0be8cd67f1f771b18..0eb1060864f1756076356190d4bd772d4b0fff63 100644 --- a/src/cutecoin/core/app.py +++ b/src/cutecoin/core/app.py @@ -369,11 +369,11 @@ class Application(QObject): date = datetime.datetime.strptime(r['published_at'], "%Y-%m-%dT%H:%M:%SZ") if latest_date < date: latest = r - latest_version = tuple(latest["tag_name"].split(".")) + latest_version = latest["tag_name"] version = (__version__ == latest_version, latest_version, latest["html_url"]) logging.debug("Found version : {0}".format(latest_version)) - if version != self.available_version: - self.available_version = version + logging.debug("Current version : {0}".format(__version__)) + self.available_version = version self.version_requested.emit() diff --git a/src/cutecoin/core/wallet.py b/src/cutecoin/core/wallet.py index 6064f39536bf65f5da8da655acd92718fc96f223..95ed4af3486bacd928fc8e1d22406844489b1ddf 100644 --- a/src/cutecoin/core/wallet.py +++ b/src/cutecoin/core/wallet.py @@ -10,7 +10,7 @@ from ucoinpy.documents.block import Block from ucoinpy.documents.transaction import InputSource, OutputSource, Transaction from ucoinpy.key import SigningKey -from ..tools.exceptions import NotEnoughMoneyError, NoPeerAvailable, PersonNotFoundError +from ..tools.exceptions import NotEnoughMoneyError, Error, NoPeerAvailable, PersonNotFoundError from .transfer import Transfer, Received from .person import Person @@ -21,12 +21,20 @@ import logging class Cache(): def __init__(self, wallet): - self.latest_block = 0 + self._latest_block = 0 self.wallet = wallet self._transfers = [] self.available_sources = [] + @property + def latest_block(self): + return self._latest_block + + @latest_block.setter + def latest_block(self, value): + self._latest_block = value + def load_from_json(self, data): self._transfers = [] @@ -160,6 +168,7 @@ class Cache(): current_block + 1)) parsed_blocks = [n for n in parsed_blocks if n in with_tx['result']['blocks']] + logging.debug(parsed_blocks) self.wallet.refresh_progressed.emit(self.latest_block, current_block) for block_number in parsed_blocks: @@ -169,6 +178,7 @@ class Cache(): if current_block > self.latest_block: self.available_sources = self.wallet.sources(community) + self.latest_block = current_block for transfer in awaiting: transfer.check_refused(current_block) @@ -176,8 +186,6 @@ class Cache(): except NoPeerAvailable: return - self.latest_block = current_block - class Wallet(QObject): ''' @@ -252,15 +260,22 @@ class Wallet(QObject): data[currency] = self.caches[currency].jsonify() return data - def refresh_cache(self, community, received_list): + def init_cache(self, community): ''' - Refresh the cache of this wallet for the specified community. + Init the cache of this wallet for the specified community. :param community: The community to refresh its cache ''' if community.currency not in self.caches: self.caches[community.currency] = Cache(self) - self.caches[community.currency].refresh(community, received_list) + + def refresh_cache(self, community): + ''' + Refresh the cache of this wallet for the specified community. + + :param community: The community to refresh its cache + ''' + self.caches[community.currency].refresh(community) def check_password(self, salt, password): ''' diff --git a/src/cutecoin/gui/currency_tab.py b/src/cutecoin/gui/currency_tab.py index 966a3d2412c022d38be434de0d7fe36c9ca36f79..7f090c6386bcc8fe1d9eade0101cc8b2826fa289 100644 --- a/src/cutecoin/gui/currency_tab.py +++ b/src/cutecoin/gui/currency_tab.py @@ -144,6 +144,7 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget): @param: block_number: The number of the block mined ''' logging.debug("Refresh block") + self.tab_history.progressbar.show() self.app.monitor.blockchain_watcher(self.community).thread().start() self.app.monitor.persons_watcher(self.community).thread().start() self.refresh_status() @@ -159,6 +160,9 @@ class CurrencyTabWidget(QWidget, Ui_CurrencyTabWidget): if self.tab_history.table_history.model(): self.tab_history.table_history.model().sourceModel().refresh_transfers() + self.tab_history.progressbar.hide() + self.refresh_status() + @pyqtSlot() def refresh_status(self): ''' diff --git a/src/cutecoin/gui/mainwindow.py b/src/cutecoin/gui/mainwindow.py index faa70e907d855b9cfdfdc7f0b65a19f70c9d84ca..d3ad012c35c3d45d5adb901c8d8ae9b2525d3868 100644 --- a/src/cutecoin/gui/mainwindow.py +++ b/src/cutecoin/gui/mainwindow.py @@ -10,7 +10,7 @@ from PyQt5.QtWidgets import QMainWindow, QAction, QFileDialog, QProgressBar, \ QMessageBox, QLabel, QComboBox, QDialog, QApplication from PyQt5.QtCore import QSignalMapper, QObject, QThread, \ pyqtSlot, pyqtSignal, QDate, QDateTime, QTimer, QUrl, Qt -from PyQt5.QtGui import QIcon, QDesktopServices +from PyQt5.QtGui import QIcon, QDesktopServices, QPixmap from .process_cfg_account import ProcessConfigureAccount from .transfer import TransferMoneyDialog @@ -62,6 +62,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): # Set up the user interface from Designer. super().__init__() self.setupUi(self) + QApplication.setWindowIcon(QIcon(":/icons/cutecoin_logo")) self.app = app """:type: cutecoin.core.app.Application""" self.password_asker = None diff --git a/src/cutecoin/gui/transactions_tab.py b/src/cutecoin/gui/transactions_tab.py index 84144fd6074603cbc7cbb6eb4fa7586be3b0fcaa..2692d8b781659e9d03bbac965ed4690b47cf0159 100644 --- a/src/cutecoin/gui/transactions_tab.py +++ b/src/cutecoin/gui/transactions_tab.py @@ -34,6 +34,7 @@ class TransactionsTabWidget(QWidget, Ui_transactionsTabWidget): self.community = community self.password_asker = password_asker self.currency_tab = currency_tab + self.progressbar.hide() self.refresh() def refresh(self): @@ -196,8 +197,12 @@ QMessageBox.Ok | QMessageBox.Cancel) def dates_changed(self): logging.debug("Changed dates") if self.table_history.model(): - ts_from = self.date_from.dateTime().toTime_t() - ts_to = self.date_to.dateTime().toTime_t() + qdate_from = self.date_from + qdate_from.setTime(QTime(0, 0, 0)) + qdate_to = self.date_to + qdate_to.setTime(QTime(0, 0, 0)) + ts_from = qdate_from.dateTime().toTime_t() + ts_to = qdate_to.dateTime().toTime_t() self.table_history.model().set_period(ts_from, ts_to) diff --git a/src/cutecoin/models/txhistory.py b/src/cutecoin/models/txhistory.py index 3f1456ebb14b029b67e861d36eb674ef48f6c22d..511aa594a70fbff56c6fc8510d054e09192a1941 100644 --- a/src/cutecoin/models/txhistory.py +++ b/src/cutecoin/models/txhistory.py @@ -8,7 +8,8 @@ import datetime import logging from ..core.transfer import Transfer, Received from PyQt5.QtCore import QAbstractTableModel, Qt, QVariant, QSortFilterProxyModel, \ - QDateTime, QLocale + QDateTime, QLocale, QModelIndex + from PyQt5.QtGui import QFont, QColor @@ -19,7 +20,6 @@ class TxFilterProxyModel(QSortFilterProxyModel): self.account = None self.ts_from = ts_from self.ts_to = ts_to - #Â total by column self.payments = 0 self.deposits = 0