ui update for search

This commit is contained in:
ingvar1995 2017-02-12 19:46:53 +03:00
parent de7f3359b8
commit 508db0acea
3 changed files with 33 additions and 8 deletions

View file

@ -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)

View file

@ -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()

View file

@ -1309,4 +1309,16 @@ QListWidget > QLabel
image: none;
width: 0px;
height: 0px;
}
}
ClickableLabel:focus
{
border-width: 1px;
border-color: #4A4949;
border-style: solid;
}
ClickableLabel:hover
{
background-color: #4A4949;
}