minor fixes - context menu
This commit is contained in:
parent
c6192de9dd
commit
e21a9355e7
2 changed files with 9 additions and 11 deletions
|
@ -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 text'), lambda: main_screen.export_history(number))
|
||||||
.with_action(util_ui.tr('Export as HTML'), lambda: main_screen.export_history(number, False))
|
.with_action(util_ui.tr('Export as HTML'), lambda: main_screen.export_history(number, False))
|
||||||
).build()
|
).build()
|
||||||
|
|
||||||
return history_menu
|
return history_menu
|
||||||
|
|
||||||
def _generate_copy_menu(self, main_screen):
|
def _generate_copy_menu(self, main_screen):
|
||||||
|
@ -134,11 +135,11 @@ class FriendMenuGenerator(BaseContactMenuGenerator):
|
||||||
plugins_menu = (plugins_menu_builder
|
plugins_menu = (plugins_menu_builder
|
||||||
.with_name(util_ui.tr('Plugins'))
|
.with_name(util_ui.tr('Plugins'))
|
||||||
.with_actions(plugins_actions)
|
.with_actions(plugins_actions)
|
||||||
)
|
).build()
|
||||||
|
|
||||||
return plugins_menu
|
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()
|
chats = contacts_manager.get_group_chats()
|
||||||
if not len(chats) or self._contact.status is None:
|
if not len(chats) or self._contact.status is None:
|
||||||
return None
|
return None
|
||||||
|
|
|
@ -574,19 +574,16 @@ class MainWindow(QtWidgets.QMainWindow):
|
||||||
# -----------------------------------------------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
def friend_right_click(self, pos):
|
def friend_right_click(self, pos):
|
||||||
# TODO: move to contact?
|
|
||||||
item = self.friends_list.itemAt(pos)
|
item = self.friends_list.itemAt(pos)
|
||||||
number = self.friends_list.indexFromItem(item).row()
|
number = self.friends_list.indexFromItem(item).row()
|
||||||
contact = self._contacts_manager.get_contact(number)
|
contact = self._contacts_manager.get_contact(number)
|
||||||
if contact is None:
|
if contact is None or item is None:
|
||||||
return
|
return
|
||||||
if item is not None:
|
generator = contact.get_context_menu_generator()
|
||||||
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,
|
parent_position = self.friends_list.mapToGlobal(QtCore.QPoint(0, 0))
|
||||||
self._settings, number)
|
self.listMenu.move(parent_position + pos)
|
||||||
parent_position = self.friends_list.mapToGlobal(QtCore.QPoint(0, 0))
|
self.listMenu.show()
|
||||||
self.listMenu.move(parent_position + pos)
|
|
||||||
self.listMenu.show()
|
|
||||||
|
|
||||||
def show_note(self, friend):
|
def show_note(self, friend):
|
||||||
note = self._settings['notes'][friend.tox_id] if friend.tox_id in self._settings['notes'] else ''
|
note = self._settings['notes'][friend.tox_id] if friend.tox_id in self._settings['notes'] else ''
|
||||||
|
|
Loading…
Reference in a new issue