menu fixes, inlines update, stickers pack

This commit is contained in:
ingvar1995 2016-06-20 23:25:35 +03:00
parent fa5b77fd2d
commit 3936f652e9
7 changed files with 29 additions and 28 deletions

View file

@ -435,29 +435,29 @@ class InlineImageItem(QtGui.QScrollArea):
self._full_size = not self._resize_needed self._full_size = not self._resize_needed
if not self._resize_needed: if not self._resize_needed:
self._image_label.setPixmap(self._pixmap) self._image_label.setPixmap(self._pixmap)
self.resize(QtCore.QSize(self._max_size + 5, self._pixmap.height())) self.resize(QtCore.QSize(self._max_size + 5, self._pixmap.height() + 5))
self._image_label.setGeometry(5, 0, self._max_size + 5, self._pixmap.height()) self._image_label.setGeometry(5, 0, self._pixmap.width(), self._pixmap.height())
else: else:
pixmap = self._pixmap.scaled(self._max_size, self._max_size, QtCore.Qt.KeepAspectRatio) pixmap = self._pixmap.scaled(self._max_size, self._max_size, QtCore.Qt.KeepAspectRatio)
self._image_label.setPixmap(pixmap) self._image_label.setPixmap(pixmap)
self.resize(QtCore.QSize(self._max_size, pixmap.height())) self.resize(QtCore.QSize(self._max_size + 5, pixmap.height()))
self._image_label.setGeometry(5, 0, self._max_size + 5, pixmap.height()) self._image_label.setGeometry(5, 0, self._max_size + 5, pixmap.height())
self._elem.setSizeHint(QtCore.QSize(self.width(), self.height())) self._elem.setSizeHint(QtCore.QSize(self.width(), self.height()))
def mouseReleaseEvent(self, event): def mouseReleaseEvent(self, event):
if event.button() == QtCore.Qt.LeftButton and self._resize_needed: if event.button() == QtCore.Qt.LeftButton and self._resize_needed: # scale inline
if self._full_size: if self._full_size:
pixmap = self._pixmap.scaled(self._max_size, self._max_size, QtCore.Qt.KeepAspectRatio) pixmap = self._pixmap.scaled(self._max_size, self._max_size, QtCore.Qt.KeepAspectRatio)
self._image_label.setPixmap(pixmap) self._image_label.setPixmap(pixmap)
self.resize(QtCore.QSize(self._max_size, pixmap.height())) self.resize(QtCore.QSize(self._max_size, pixmap.height()))
self._image_label.setGeometry(5, 0, self._max_size + 5, pixmap.height()) self._image_label.setGeometry(5, 0, pixmap.width(), pixmap.height())
else: else:
self._image_label.setPixmap(self._pixmap) self._image_label.setPixmap(self._pixmap)
self.resize(QtCore.QSize(self._max_size, self._pixmap.height() + 15)) self.resize(QtCore.QSize(self._max_size, self._pixmap.height() + 17))
self._image_label.setGeometry(5, 0, self._pixmap.width(), self._pixmap.height() + 15) self._image_label.setGeometry(5, 0, self._pixmap.width(), self._pixmap.height())
self._full_size = not self._full_size self._full_size = not self._full_size
self._elem.setSizeHint(QtCore.QSize(self.width(), self.height())) self._elem.setSizeHint(QtCore.QSize(self.width(), self.height()))
elif event.button() == QtCore.Qt.RightButton: elif event.button() == QtCore.Qt.RightButton: # save inline
directory = QtGui.QFileDialog.getExistingDirectory(self, directory = QtGui.QFileDialog.getExistingDirectory(self,
QtGui.QApplication.translate("MainWindow", QtGui.QApplication.translate("MainWindow",
'Choose folder', None, 'Choose folder', None,

View file

@ -286,17 +286,19 @@ class StickerWindow(QtGui.QWidget):
def __init__(self, parent): def __init__(self, parent):
super(StickerWindow, self).__init__() super(StickerWindow, self).__init__()
self.setWindowFlags(QtCore.Qt.FramelessWindowHint) self.setWindowFlags(QtCore.Qt.FramelessWindowHint)
self.setMaximumSize(150, 200) self.setMaximumSize(250, 200)
self.setMinimumSize(150, 200) self.setMinimumSize(250, 200)
self.list = QtGui.QListWidget(self) self.list = QtGui.QListWidget(self)
self.list.setGeometry(QtCore.QRect(0, 0, 150, 200)) self.list.setGeometry(QtCore.QRect(0, 0, 250, 200))
self.arr = smileys.sticker_loader() self.arr = smileys.sticker_loader()
for sticker in self.arr: for sticker in self.arr:
item = StickerItem(sticker) item = StickerItem(sticker)
elem = QtGui.QListWidgetItem() elem = QtGui.QListWidgetItem()
elem.setSizeHint(QtCore.QSize(150, item.height())) elem.setSizeHint(QtCore.QSize(250, item.height()))
self.list.addItem(elem) self.list.addItem(elem)
self.list.setItemWidget(elem, item) self.list.setItemWidget(elem, item)
self.list.setVerticalScrollMode(QtGui.QAbstractItemView.ScrollPerPixel)
self.list.setSpacing(3)
self.list.clicked.connect(self.click) self.list.clicked.connect(self.click)
self.parent = parent self.parent = parent

View file

@ -39,7 +39,7 @@ class AddContact(CenteredWidget):
font.setPointSize(10) font.setPointSize(10)
font.setWeight(30) font.setWeight(30)
self.error_label.setFont(font) self.error_label.setFont(font)
self.error_label.setStyleSheet("QLabel { color: red; }") self.error_label.setStyleSheet("QLabel { color: #BC1C1C; }")
self.label.setObjectName("label") self.label.setObjectName("label")
self.message_edit = QtGui.QTextEdit(self) self.message_edit = QtGui.QTextEdit(self)
self.message_edit.setGeometry(QtCore.QRect(50, 110, 471, 151)) self.message_edit.setGeometry(QtCore.QRect(50, 110, 471, 151))
@ -145,12 +145,12 @@ class ProfileSettings(CenteredWidget):
self.set_password.setGeometry(QtCore.QRect(40, 470, 300, 30)) self.set_password.setGeometry(QtCore.QRect(40, 470, 300, 30))
self.set_password.clicked.connect(self.new_password) self.set_password.clicked.connect(self.new_password)
self.not_match = QtGui.QLabel(self) self.not_match = QtGui.QLabel(self)
self.not_match.setGeometry(QtCore.QRect(340, 420, 300, 30)) self.not_match.setGeometry(QtCore.QRect(350, 420, 300, 30))
self.not_match.setVisible(False) self.not_match.setVisible(False)
self.not_match.setStyleSheet('QLabel { color: #F70D1A; }') self.not_match.setStyleSheet('QLabel { color: #BC1C1C; }')
self.warning = QtGui.QLabel(self) self.warning = QtGui.QLabel(self)
self.warning.setGeometry(QtCore.QRect(40, 510, 500, 30)) self.warning.setGeometry(QtCore.QRect(40, 510, 500, 30))
self.warning.setStyleSheet('QLabel { color: #F70D1A; }') self.warning.setStyleSheet('QLabel { color: #BC1C1C; }')
self.default = QtGui.QPushButton(self) self.default = QtGui.QPushButton(self)
self.default.setGeometry(QtCore.QRect(40, 550, 620, 30)) self.default.setGeometry(QtCore.QRect(40, 550, 620, 30))
path, name = Settings.get_auto_profile() path, name = Settings.get_auto_profile()
@ -310,7 +310,7 @@ class NetworkSettings(CenteredWidget):
self.http.setChecked(settings['proxy_type'] == 1) self.http.setChecked(settings['proxy_type'] == 1)
self.warning = QtGui.QLabel(self) self.warning = QtGui.QLabel(self)
self.warning.setGeometry(QtCore.QRect(5, 270, 290, 60)) self.warning.setGeometry(QtCore.QRect(5, 270, 290, 60))
self.warning.setStyleSheet('QLabel { color: #F70D1A; }') self.warning.setStyleSheet('QLabel { color: #BC1C1C; }')
self.retranslateUi() self.retranslateUi()
self.proxy.stateChanged.connect(lambda x: self.activate()) self.proxy.stateChanged.connect(lambda x: self.activate())
self.activate() self.activate()
@ -508,18 +508,17 @@ class InterfaceSettings(CenteredWidget):
def initUI(self): def initUI(self):
self.setObjectName("interfaceForm") self.setObjectName("interfaceForm")
self.setMinimumSize(QtCore.QSize(300, 420)) self.setMinimumSize(QtCore.QSize(400, 420))
self.setMaximumSize(QtCore.QSize(300, 420)) self.setMaximumSize(QtCore.QSize(400, 420))
self.setBaseSize(QtCore.QSize(300, 420))
self.label = QtGui.QLabel(self) self.label = QtGui.QLabel(self)
self.label.setGeometry(QtCore.QRect(30, 10, 100, 20)) self.label.setGeometry(QtCore.QRect(30, 10, 370, 20))
font = QtGui.QFont() font = QtGui.QFont()
font.setPointSize(16) font.setPointSize(16)
font.setWeight(75) font.setWeight(75)
font.setBold(True) font.setBold(True)
self.label.setFont(font) self.label.setFont(font)
self.themeSelect = QtGui.QComboBox(self) self.themeSelect = QtGui.QComboBox(self)
self.themeSelect.setGeometry(QtCore.QRect(30, 40, 160, 30)) self.themeSelect.setGeometry(QtCore.QRect(30, 40, 120, 30))
list_of_themes = ['dark'] list_of_themes = ['dark']
self.themeSelect.addItems(list_of_themes) self.themeSelect.addItems(list_of_themes)
settings = Settings.get_instance() settings = Settings.get_instance()
@ -530,23 +529,23 @@ class InterfaceSettings(CenteredWidget):
index = 0 index = 0
self.themeSelect.setCurrentIndex(index) self.themeSelect.setCurrentIndex(index)
self.lang_choose = QtGui.QComboBox(self) self.lang_choose = QtGui.QComboBox(self)
self.lang_choose.setGeometry(QtCore.QRect(30, 110, 160, 30)) self.lang_choose.setGeometry(QtCore.QRect(30, 110, 120, 30))
supported = Settings.supported_languages() supported = Settings.supported_languages()
for key in supported: for key in supported:
self.lang_choose.insertItem(0, key) self.lang_choose.insertItem(0, key)
if settings['language'] == key: if settings['language'] == key:
self.lang_choose.setCurrentIndex(0) self.lang_choose.setCurrentIndex(0)
self.lang = QtGui.QLabel(self) self.lang = QtGui.QLabel(self)
self.lang.setGeometry(QtCore.QRect(30, 80, 121, 20)) self.lang.setGeometry(QtCore.QRect(30, 80, 370, 20))
self.lang.setFont(font) self.lang.setFont(font)
self.mirror_mode = QtGui.QCheckBox(self) self.mirror_mode = QtGui.QCheckBox(self)
self.mirror_mode.setGeometry(QtCore.QRect(30, 160, 120, 20)) self.mirror_mode.setGeometry(QtCore.QRect(30, 160, 370, 20))
self.mirror_mode.setChecked(settings['mirror_mode']) self.mirror_mode.setChecked(settings['mirror_mode'])
self.smileys = QtGui.QCheckBox(self) self.smileys = QtGui.QCheckBox(self)
self.smileys.setGeometry(QtCore.QRect(30, 190, 120, 20)) self.smileys.setGeometry(QtCore.QRect(30, 190, 120, 20))
self.smileys.setChecked(settings['smileys']) self.smileys.setChecked(settings['smileys'])
self.smiley_pack_label = QtGui.QLabel(self) self.smiley_pack_label = QtGui.QLabel(self)
self.smiley_pack_label.setGeometry(QtCore.QRect(30, 230, 120, 20)) self.smiley_pack_label.setGeometry(QtCore.QRect(30, 230, 370, 20))
self.smiley_pack_label.setFont(font) self.smiley_pack_label.setFont(font)
self.smiley_pack = QtGui.QComboBox(self) self.smiley_pack = QtGui.QComboBox(self)
self.smiley_pack.setGeometry(QtCore.QRect(30, 260, 160, 30)) self.smiley_pack.setGeometry(QtCore.QRect(30, 260, 160, 30))
@ -558,7 +557,7 @@ class InterfaceSettings(CenteredWidget):
ind = sm.get_packs_list().index('default') ind = sm.get_packs_list().index('default')
self.smiley_pack.setCurrentIndex(ind) self.smiley_pack.setCurrentIndex(ind)
self.messages_font_size_label = QtGui.QLabel(self) self.messages_font_size_label = QtGui.QLabel(self)
self.messages_font_size_label.setGeometry(QtCore.QRect(30, 300, 270, 20)) self.messages_font_size_label.setGeometry(QtCore.QRect(30, 300, 370, 20))
self.messages_font_size_label.setFont(font) self.messages_font_size_label.setFont(font)
self.messages_font_size = QtGui.QComboBox(self) self.messages_font_size = QtGui.QComboBox(self)
self.messages_font_size.setGeometry(QtCore.QRect(30, 330, 160, 30)) self.messages_font_size.setGeometry(QtCore.QRect(30, 330, 160, 30))

View file

@ -85,6 +85,6 @@ def sticker_loader():
for key in keys: for key in keys:
path = d + key + '/' path = d + key + '/'
files = filter(lambda f: f.endswith('.png'), os.listdir(path)) files = filter(lambda f: f.endswith('.png'), os.listdir(path))
files = map(lambda f: path + f, files) files = map(lambda f: unicode(path + f), files)
result.extend(files) result.extend(files)
return result return result

BIN
src/stickers/tox/black.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.1 KiB

BIN
src/stickers/tox/red.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

BIN
src/stickers/tox/white.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.3 KiB