Skip to content
Snippets Groups Projects
Commit 5d7aa492 authored by inso's avatar inso
Browse files

Added actions to the search button to look for members or direct connections

parent c90fd8c4
Branches
Tags
No related merge requests found
......@@ -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>
......@@ -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):
'''
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment