diff --git a/res/ui/community_tab.ui b/res/ui/community_tab.ui index 287487dfb05c7e8842ab521e35f189f4f507d9e2..9b0005591abc6fa677cd5f51b48595cbce363e98 100644 --- a/res/ui/community_tab.ui +++ b/res/ui/community_tab.ui @@ -55,9 +55,15 @@ </widget> </item> <item> - <widget class="QPushButton" name="button_search"> + <widget class="QToolButton" name="button_search"> <property name="text"> - <string>Search...</string> + <string>Search</string> + </property> + <property name="popupMode"> + <enum>QToolButton::MenuButtonPopup</enum> + </property> + <property name="toolButtonStyle"> + <enum>Qt::ToolButtonTextBesideIcon</enum> </property> </widget> </item> @@ -177,7 +183,7 @@ <sender>edit_textsearch</sender> <signal>returnPressed()</signal> <receiver>CommunityTabWidget</receiver> - <slot>search()</slot> + <slot>search_text()</slot> <hints> <hint type="sourcelabel"> <x>170</x> @@ -193,10 +199,10 @@ <sender>button_search</sender> <signal>clicked()</signal> <receiver>CommunityTabWidget</receiver> - <slot>search()</slot> + <slot>search_text()</slot> <hints> <hint type="sourcelabel"> - <x>370</x> + <x>371</x> <y>62</y> </hint> <hint type="destinationlabel"> @@ -210,6 +216,6 @@ <slot>identity_context_menu(QPoint)</slot> <slot>send_membership_demand()</slot> <slot>send_membership_leaving()</slot> - <slot>search()</slot> + <slot>search_text()</slot> </slots> </ui> diff --git a/src/cutecoin/gui/community_tab.py b/src/cutecoin/gui/community_tab.py index ef0995bd81d5a023afe190ceee8023d6a9567a51..c26b2bee44ea3c15ffb78cd23b98ea4b6204cdde 100644 --- a/src/cutecoin/gui/community_tab.py +++ b/src/cutecoin/gui/community_tab.py @@ -59,6 +59,12 @@ class CommunityTabWidget(QWidget, Ui_CommunityTabWidget): self.wot_tab = WotTabWidget(app, account, community, password_asker, self) self.tabs_information.addTab(self.wot_tab, QIcon(':/icons/wot_icon'), "WoT") + members_action = QAction(self.tr("Members"), self) + members_action.triggered.connect(self.search_members) + self.button_search.addAction(members_action) + direct_connections = QAction(self.tr("Direct connections"), self) + direct_connections.triggered.connect(self.search_direct_connections) + self.button_search.addAction(direct_connections) self.refresh() def identity_context_menu(self, point): @@ -212,9 +218,9 @@ The process to join back the community later will have to be done again.""") "{0}".format(e), QMessageBox.Ok) - def search(self): + def search_text(self): """ - Search nodes when return is pressed in combobox lineEdit + Search text and display found identities """ text = self.edit_textsearch.text() @@ -227,13 +233,29 @@ The process to join back the community later will have to be done again.""") return False persons = [] - logging.debug(response) for identity in response['results']: persons.append(Person.lookup(identity['pubkey'], self.community)) self.edit_textsearch.clear() self.refresh(persons) + def search_members(self): + """ + Search members of community and display found members + """ + pubkeys = self.community.members_pubkeys() + persons = [] + for p in pubkeys: + persons.append(Person.lookup(p, self.community)) + + self.edit_textsearch.clear() + self.refresh(persons) + + def search_direct_connections(self): + """ + Search members of community and display found members + """ + self.refresh() def refresh(self, persons=None): '''