minor fixes - context menu

This commit is contained in:
ingvar1995 2018-05-11 22:02:03 +03:00
parent c6192de9dd
commit e21a9355e7
2 changed files with 9 additions and 11 deletions

View File

@ -110,6 +110,7 @@ class FriendMenuGenerator(BaseContactMenuGenerator):
.with_action(util_ui.tr('Export as text'), lambda: main_screen.export_history(number))
.with_action(util_ui.tr('Export as HTML'), lambda: main_screen.export_history(number, False))
).build()
return history_menu
def _generate_copy_menu(self, main_screen):
@ -134,11 +135,11 @@ class FriendMenuGenerator(BaseContactMenuGenerator):
plugins_menu = (plugins_menu_builder
.with_name(util_ui.tr('Plugins'))
.with_actions(plugins_actions)
)
).build()
return plugins_menu
def _generate_groups_menu(self, contacts_manager):
def _generate_groups_menu(self, contacts_manager): # TODO: fix
chats = contacts_manager.get_group_chats()
if not len(chats) or self._contact.status is None:
return None

View File

@ -574,16 +574,13 @@ class MainWindow(QtWidgets.QMainWindow):
# -----------------------------------------------------------------------------------------------------------------
def friend_right_click(self, pos):
# TODO: move to contact?
item = self.friends_list.itemAt(pos)
number = self.friends_list.indexFromItem(item).row()
contact = self._contacts_manager.get_contact(number)
if contact is None:
if contact is None or item is None:
return
if item is not None:
generator = contact.get_context_menu_generator()
self.listMenu = generator.generate(self._plugins_loader, self._contacts_manager, self,
self._settings, number)
self.listMenu = generator.generate(self._plugins_loader, self._contacts_manager, self, self._settings, number)
parent_position = self.friends_list.mapToGlobal(QtCore.QPoint(0, 0))
self.listMenu.move(parent_position + pos)
self.listMenu.show()