context menu translations, bug fixes
This commit is contained in:
parent
b40c0a868b
commit
74d7c67d8c
@ -7,7 +7,7 @@ import profile
|
|||||||
from file_transfers import TOX_FILE_TRANSFER_STATE
|
from file_transfers import TOX_FILE_TRANSFER_STATE
|
||||||
from util import curr_directory, convert_time
|
from util import curr_directory, convert_time
|
||||||
from messages import FILE_TRANSFER_MESSAGE_STATUS
|
from messages import FILE_TRANSFER_MESSAGE_STATUS
|
||||||
from widgets import DataLabel
|
from widgets import DataLabel, create_menu
|
||||||
|
|
||||||
|
|
||||||
class MessageEdit(QtGui.QTextEdit):
|
class MessageEdit(QtGui.QTextEdit):
|
||||||
@ -27,6 +27,11 @@ class MessageEdit(QtGui.QTextEdit):
|
|||||||
self.setFixedHeight(self.document().size().height())
|
self.setFixedHeight(self.document().size().height())
|
||||||
self.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse | QtCore.Qt.LinksAccessibleByMouse)
|
self.setTextInteractionFlags(QtCore.Qt.TextSelectableByMouse | QtCore.Qt.LinksAccessibleByMouse)
|
||||||
|
|
||||||
|
def contextMenuEvent(self, event):
|
||||||
|
menu = create_menu(self.createStandardContextMenu())
|
||||||
|
menu.exec_(event.globalPos())
|
||||||
|
del menu
|
||||||
|
|
||||||
|
|
||||||
class MessageItem(QtGui.QWidget):
|
class MessageItem(QtGui.QWidget):
|
||||||
"""
|
"""
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
from menu import *
|
from menu import *
|
||||||
from profile import *
|
from profile import *
|
||||||
from list_items import *
|
from list_items import *
|
||||||
from widgets import QRightClickButton, RubberBand
|
from widgets import QRightClickButton, RubberBand, create_menu
|
||||||
import plugin_support
|
import plugin_support
|
||||||
|
|
||||||
|
|
||||||
@ -34,6 +34,11 @@ class MessageArea(QtGui.QPlainTextEdit):
|
|||||||
self.timer.start(5000)
|
self.timer.start(5000)
|
||||||
super(MessageArea, self).keyPressEvent(event)
|
super(MessageArea, self).keyPressEvent(event)
|
||||||
|
|
||||||
|
def contextMenuEvent(self, event):
|
||||||
|
menu = create_menu(self.createStandardContextMenu())
|
||||||
|
menu.exec_(event.globalPos())
|
||||||
|
del menu
|
||||||
|
|
||||||
|
|
||||||
class MainWindow(QtGui.QMainWindow):
|
class MainWindow(QtGui.QMainWindow):
|
||||||
|
|
||||||
|
@ -337,6 +337,7 @@ class Profile(Contact, Singleton):
|
|||||||
|
|
||||||
def set_status(self, status):
|
def set_status(self, status):
|
||||||
super(Profile, self).set_status(status)
|
super(Profile, self).set_status(status)
|
||||||
|
if status is not None:
|
||||||
self._tox.self_set_status(status)
|
self._tox.self_set_status(status)
|
||||||
|
|
||||||
def set_name(self, value):
|
def set_name(self, value):
|
||||||
@ -366,6 +367,7 @@ class Profile(Contact, Singleton):
|
|||||||
filter_str = filter_str.lower()
|
filter_str = filter_str.lower()
|
||||||
for index, friend in enumerate(self._friends):
|
for index, friend in enumerate(self._friends):
|
||||||
friend.visibility = (friend.status is not None or not show_online) and (filter_str in friend.name.lower())
|
friend.visibility = (friend.status is not None or not show_online) and (filter_str in friend.name.lower())
|
||||||
|
friend.visibility = friend.visibility or friend.messages
|
||||||
if friend.visibility:
|
if friend.visibility:
|
||||||
self._screen.friends_list.item(index).setSizeHint(QtCore.QSize(250, 70))
|
self._screen.friends_list.item(index).setSizeHint(QtCore.QSize(250, 70))
|
||||||
else:
|
else:
|
||||||
@ -555,6 +557,8 @@ class Profile(Contact, Singleton):
|
|||||||
friend.set_messages(True)
|
friend.set_messages(True)
|
||||||
friend.append_message(
|
friend.append_message(
|
||||||
TextMessage(message.decode('utf-8'), MESSAGE_OWNER['FRIEND'], time.time(), message_type))
|
TextMessage(message.decode('utf-8'), MESSAGE_OWNER['FRIEND'], time.time(), message_type))
|
||||||
|
if not friend.visibility:
|
||||||
|
self.update_filtration()
|
||||||
|
|
||||||
def send_message(self, text):
|
def send_message(self, text):
|
||||||
"""
|
"""
|
||||||
@ -881,7 +885,7 @@ class Profile(Contact, Singleton):
|
|||||||
friend.status = None
|
friend.status = None
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
if hasattr(self, '_stop'):
|
if hasattr(self, '_call'):
|
||||||
self._call.stop()
|
self._call.stop()
|
||||||
del self._call
|
del self._call
|
||||||
|
|
||||||
|
@ -53,3 +53,38 @@ class RubberBand(QtGui.QRubberBand):
|
|||||||
self.painter.setPen(self.pen)
|
self.painter.setPen(self.pen)
|
||||||
self.painter.drawRect(event.rect())
|
self.painter.drawRect(event.rect())
|
||||||
self.painter.end()
|
self.painter.end()
|
||||||
|
|
||||||
|
|
||||||
|
def create_menu(menu):
|
||||||
|
for action in menu.actions():
|
||||||
|
text = action.text()
|
||||||
|
if 'Link Location' in text:
|
||||||
|
text = text.replace('Copy Link Location',
|
||||||
|
QtGui.QApplication.translate("MainWindow", "Copy link location", None,
|
||||||
|
QtGui.QApplication.UnicodeUTF8))
|
||||||
|
elif '&Copy' in text:
|
||||||
|
text = text.replace('&Copy', QtGui.QApplication.translate("MainWindow", "Copy", None,
|
||||||
|
QtGui.QApplication.UnicodeUTF8))
|
||||||
|
elif 'All' in text:
|
||||||
|
text = text.replace('Select All', QtGui.QApplication.translate("MainWindow", "Select all", None,
|
||||||
|
QtGui.QApplication.UnicodeUTF8))
|
||||||
|
elif 'Delete' in text:
|
||||||
|
text = text.replace('Delete', QtGui.QApplication.translate("MainWindow", "Delete", None,
|
||||||
|
QtGui.QApplication.UnicodeUTF8))
|
||||||
|
elif '&Paste' in text:
|
||||||
|
text = text.replace('&Paste', QtGui.QApplication.translate("MainWindow", "Paste", None,
|
||||||
|
QtGui.QApplication.UnicodeUTF8))
|
||||||
|
elif 'Cu&t' in text:
|
||||||
|
text = text.replace('Cu&t', QtGui.QApplication.translate("MainWindow", "Cut", None,
|
||||||
|
QtGui.QApplication.UnicodeUTF8))
|
||||||
|
elif '&Undo' in text:
|
||||||
|
text = text.replace('&Undo', QtGui.QApplication.translate("MainWindow", "Undo", None,
|
||||||
|
QtGui.QApplication.UnicodeUTF8))
|
||||||
|
elif '&Redo' in text:
|
||||||
|
text = text.replace('&Redo', QtGui.QApplication.translate("MainWindow", "Redo", None,
|
||||||
|
QtGui.QApplication.UnicodeUTF8))
|
||||||
|
else:
|
||||||
|
menu.removeAction(action)
|
||||||
|
continue
|
||||||
|
action.setText(text)
|
||||||
|
return menu
|
||||||
|
Loading…
Reference in New Issue
Block a user