bug fixes, interface settings update, plugins fix

This commit is contained in:
ingvar1995 2016-06-21 17:17:52 +03:00
parent 3936f652e9
commit bde1160562
5 changed files with 36 additions and 15 deletions

View file

@ -27,7 +27,7 @@ class MessageEdit(QtGui.QTextBrowser):
self.setSearchPaths([smileys.SmileyLoader.get_instance().get_smileys_path()])
self.document().setDefaultStyleSheet('a { color: #306EFF; }')
text = self.decoratedText(text)
if message_type == TOX_MESSAGE_TYPE['ACTION']:
if message_type != TOX_MESSAGE_TYPE['NORMAL']:
self.setHtml('<p style="color: #5CB3FF; font: italic; font-size: 20px;" >' + text + '</p>')
else:
self.setHtml(text)
@ -201,6 +201,9 @@ class StatusCircle(QtGui.QWidget):
name = 'offline'
if unread_messages:
name += '_notification'
self.label.setGeometry(QtCore.QRect(0, 0, 32, 32))
else:
self.label.setGeometry(QtCore.QRect(2, 0, 32, 32))
pixmap = QtGui.QPixmap(curr_directory() + '/images/{}.png'.format(name))
self.label.setPixmap(pixmap)
@ -219,9 +222,12 @@ class UnreadMessagesCount(QtGui.QWidget):
font.setBold(True)
self.label.setFont(font)
self.label.setAlignment(QtCore.Qt.AlignVCenter | QtCore.Qt.AlignCenter)
self.label.setStyleSheet('QLabel { color: white; background-color: red; border-radius: 10; }')
color = settings.Settings.get_instance()['unread_color']
self.label.setStyleSheet('QLabel { color: white; background-color: ' + color + '; border-radius: 10; }')
def update(self, messages_count):
color = settings.Settings.get_instance()['unread_color']
self.label.setStyleSheet('QLabel { color: white; background-color: ' + color + '; border-radius: 10; }')
if messages_count:
self.label.setVisible(True)
self.label.setText(str(messages_count))

View file

@ -508,13 +508,12 @@ class InterfaceSettings(CenteredWidget):
def initUI(self):
self.setObjectName("interfaceForm")
self.setMinimumSize(QtCore.QSize(400, 420))
self.setMaximumSize(QtCore.QSize(400, 420))
self.setMinimumSize(QtCore.QSize(400, 450))
self.setMaximumSize(QtCore.QSize(400, 450))
self.label = QtGui.QLabel(self)
self.label.setGeometry(QtCore.QRect(30, 10, 370, 20))
font = QtGui.QFont()
font.setPointSize(16)
font.setWeight(75)
font.setPointSize(14)
font.setBold(True)
self.label.setFont(font)
self.themeSelect = QtGui.QComboBox(self)
@ -564,6 +563,10 @@ class InterfaceSettings(CenteredWidget):
self.messages_font_size.addItems([str(x) for x in range(10, 19)])
self.messages_font_size.setCurrentIndex(settings['message_font_size'] - 10)
self.unread = QtGui.QPushButton(self)
self.unread.setGeometry(QtCore.QRect(30, 380, 340, 40))
self.unread.clicked.connect(self.select_color)
self.retranslateUi()
QtCore.QMetaObject.connectSlotsByName(self)
@ -575,6 +578,16 @@ class InterfaceSettings(CenteredWidget):
self.smiley_pack_label.setText(QtGui.QApplication.translate("interfaceForm", "Smiley pack:", None, QtGui.QApplication.UnicodeUTF8))
self.mirror_mode.setText(QtGui.QApplication.translate("interfaceForm", "Mirror mode", None, QtGui.QApplication.UnicodeUTF8))
self.messages_font_size_label.setText(QtGui.QApplication.translate("interfaceForm", "Messages font size:", None, QtGui.QApplication.UnicodeUTF8))
self.unread.setText(QtGui.QApplication.translate("interfaceForm", "Select unread messages notification color", None, QtGui.QApplication.UnicodeUTF8))
def select_color(self):
col = QtGui.QColorDialog.getColor()
if col.isValid():
settings = Settings.get_instance()
name = col.name()
settings['unread_color'] = name
settings.save()
def closeEvent(self, event):
settings = Settings.get_instance()

View file

@ -125,6 +125,7 @@ class PluginSuperClass(object):
New command. On 'help' this method should provide user list of available commands
:param command: string with command
"""
if command == 'help':
msgbox = QtGui.QMessageBox()
title = QtGui.QApplication.translate("PluginWindow", "List of commands for plugin {}", None, QtGui.QApplication.UnicodeUTF8)
msgbox.setWindowTitle(title.format(self._name))
@ -142,11 +143,11 @@ class PluginSuperClass(object):
app = QtGui.QApplication.instance()
langs = self._settings.supported_languages()
curr_lang = self._settings['language']
if curr_lang in map(lambda x: x[0], langs):
if curr_lang in langs:
if self._translator is not None:
app.removeTranslator(self._translator)
self._translator = QtCore.QTranslator()
lang_path = filter(lambda x: x[0] == curr_lang, langs)[0][1]
lang_path = langs[curr_lang]
self._translator.load(path_to_data(self._short_name) + lang_path)
app.installTranslator(self._translator)

View file

@ -120,7 +120,8 @@ class Settings(Singleton, dict):
'height': 500,
'x': 400,
'y': 400,
'message_font_size': 14
'message_font_size': 14,
'unread_color': 'red'
}
@staticmethod

File diff suppressed because one or more lines are too long