From 508db0acea26970fc10b90a5243e8486877e3b3b Mon Sep 17 00:00:00 2001 From: ingvar1995 Date: Sun, 12 Feb 2017 19:46:53 +0300 Subject: [PATCH] ui update for search --- toxygen/mainscreen.py | 2 ++ toxygen/mainscreen_widgets.py | 25 ++++++++++++++++++------- toxygen/styles/style.qss | 14 +++++++++++++- 3 files changed, 33 insertions(+), 8 deletions(-) diff --git a/toxygen/mainscreen.py b/toxygen/mainscreen.py index 04a0318..c9bee9a 100644 --- a/toxygen/mainscreen.py +++ b/toxygen/mainscreen.py @@ -705,6 +705,8 @@ class MainWindow(QtGui.QMainWindow, Singleton): def show_search_field(self): if hasattr(self, 'search_field') and self.search_field.isVisible(): return + if self.profile.get_curr_friend() is None: + return self.search_field = SearchScreen(self.messages, self.messages.width(), self.messages.parent()) x, y = self.messages.x(), self.messages.y() + self.messages.height() - 40 self.search_field.setGeometry(x, y, self.messages.width(), 40) diff --git a/toxygen/mainscreen_widgets.py b/toxygen/mainscreen_widgets.py index 6fbfdad..6ad086c 100644 --- a/toxygen/mainscreen_widgets.py +++ b/toxygen/mainscreen_widgets.py @@ -424,10 +424,10 @@ class SearchScreen(QtGui.QWidget): self._messages = messages self.search_text = LineEdit(self) - self.search_text.setGeometry(0, 0, width - 100, 40) + self.search_text.setGeometry(0, 0, width - 160, 40) self.search_button = ClickableLabel(self) - self.search_button.setGeometry(width - 100, 0, 40, 40) + self.search_button.setGeometry(width - 160, 0, 40, 40) pixmap = QtGui.QPixmap() pixmap.load(util.curr_directory() + '/images/search.png') self.search_button.setScaledContents(False) @@ -435,13 +435,17 @@ class SearchScreen(QtGui.QWidget): self.search_button.setPixmap(pixmap) self.connect(self.search_button, QtCore.SIGNAL('clicked()'), self.search) + font = QtGui.QFont() + font.setPointSize(32) + font.setBold(True) + self.prev_button = QtGui.QPushButton(self) - self.prev_button.setGeometry(width - 60, 0, 20, 20) + self.prev_button.setGeometry(width - 120, 0, 40, 40) self.prev_button.clicked.connect(self.prev) self.prev_button.setText('\u25B2') self.next_button = QtGui.QPushButton(self) - self.next_button.setGeometry(width - 60, 20, 20, 20) + self.next_button.setGeometry(width - 80, 0, 40, 40) self.next_button.clicked.connect(self.next) self.next_button.setText('\u25BC') @@ -449,11 +453,18 @@ class SearchScreen(QtGui.QWidget): self.close_button.setGeometry(width - 40, 0, 40, 40) self.close_button.clicked.connect(self.close) self.close_button.setText('×') - font = QtGui.QFont() - font.setPointSize(32) - font.setBold(True) self.close_button.setFont(font) + font.setPointSize(18) + self.next_button.setFont(font) + self.prev_button.setFont(font) + + self.retranslateUi() + + def retranslateUi(self): + self.search_text.setPlaceholderText(QtGui.QApplication.translate("MainWindow", "Search", None, + QtGui.QApplication.UnicodeUTF8)) + def search(self): Profile.get_instance().update() text = self.search_text.text() diff --git a/toxygen/styles/style.qss b/toxygen/styles/style.qss index f2b212b..0216f23 100644 --- a/toxygen/styles/style.qss +++ b/toxygen/styles/style.qss @@ -1309,4 +1309,16 @@ QListWidget > QLabel image: none; width: 0px; height: 0px; -} \ No newline at end of file +} + +ClickableLabel:focus +{ + border-width: 1px; + border-color: #4A4949; + border-style: solid; +} + +ClickableLabel:hover +{ + background-color: #4A4949; +}