diff --git a/src/cutecoin/core/money/relative.py b/src/cutecoin/core/money/relative.py index 5cf9d8a760baada5e8b96211abecd6573190dde4..15cde10ef7bf7bf7193c7f1fa1784bd0819bad98 100644 --- a/src/cutecoin/core/money/relative.py +++ b/src/cutecoin/core/money/relative.py @@ -35,7 +35,7 @@ class Relative(): if dividend > 0: return self.amount / float(dividend) else: - return 0 + return self.amount @asyncio.coroutine def differential(self): @@ -48,7 +48,7 @@ class Relative(): prefix_index = 0 prefix = "" - while int(scientific_value) == 0: + while int(scientific_value) == 0 and scientific_value > 0.0: if prefix_index > 3: scientific_value *= 1000 else: diff --git a/src/cutecoin/gui/community_view.py b/src/cutecoin/gui/community_view.py index b012c3abef3a54417bd155014e2ff8ed26f690ca..1296420062882761a753b2b8262c4c337a10bb08 100644 --- a/src/cutecoin/gui/community_view.py +++ b/src/cutecoin/gui/community_view.py @@ -236,10 +236,7 @@ class CommunityWidget(QWidget, Ui_CommunityWidget): def referential_changed(self): if self.community and self.tab_history.table_history.model(): - self.tab_history.table_history.model().dataChanged.emit( - QModelIndex(), - QModelIndex(), - []) + self.tab_history.table_history.model().sourceModel().refresh_transfers() self.tab_history.refresh_balance() def send_membership_demand(self): diff --git a/src/cutecoin/gui/homescreen.py b/src/cutecoin/gui/homescreen.py index d20dff1485b0534e828e762a54857fbc4050523f..85f21a1671999dc048c77dea6bfd764be1cb4474 100644 --- a/src/cutecoin/gui/homescreen.py +++ b/src/cutecoin/gui/homescreen.py @@ -22,19 +22,25 @@ class FrameCommunities(QFrame): self.grid_layout.setAlignment(Qt.AlignLeft | Qt.AlignTop) self.setFrameShape(QFrame.StyledPanel) self.setFrameShadow(QFrame.Raised) + self.tiles = [] def sizeHint(self): return self.parentWidget().size() def refresh(self, app): - for i in reversed(range(self.grid_layout.count())): - self.grid_layout.itemAt(i).widget().setParent(None) - + for t in self.tiles: + t.setParent(None) + self.tiles = [] if app.current_account: for c in app.current_account.communities: community_tile = CommunityTile(self, app, c) community_tile.clicked.connect(self.click_on_tile) self.layout().addWidget(community_tile) + self.tiles.append(community_tile) + + def refresh_content(self): + for t in self.tiles: + t.refresh() @pyqtSlot() def click_on_tile(self): @@ -69,6 +75,9 @@ class HomeScreenWidget(QWidget, Ui_HomescreenWidget): self.frame_disconnected.show() self.frame_connected.hide() + def referential_changed(self): + self.frame_communities.refresh_content() + def showEvent(self, QShowEvent): """ diff --git a/src/cutecoin/gui/mainwindow.py b/src/cutecoin/gui/mainwindow.py index de83ba5a54f5b4f0c19ff00fc6174f9ebf13a8eb..9a716c1698c91c0ecde31ac74afb6842cabdee7e 100644 --- a/src/cutecoin/gui/mainwindow.py +++ b/src/cutecoin/gui/mainwindow.py @@ -127,6 +127,7 @@ class MainWindow(QMainWindow, Ui_MainWindow): self.app.current_account.set_display_referential(index) if self.community_view: self.community_view.referential_changed() + self.homescreen.referential_changed() @pyqtSlot() def update_time(self):