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): def show_search_field(self):
if hasattr(self, 'search_field') and self.search_field.isVisible(): if hasattr(self, 'search_field') and self.search_field.isVisible():
return return
if self.profile.get_curr_friend() is None:
return
self.search_field = SearchScreen(self.messages, self.messages.width(), self.messages.parent()) self.search_field = SearchScreen(self.messages, self.messages.width(), self.messages.parent())
x, y = self.messages.x(), self.messages.y() + self.messages.height() - 40 x, y = self.messages.x(), self.messages.y() + self.messages.height() - 40
self.search_field.setGeometry(x, y, self.messages.width(), 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._messages = messages
self.search_text = LineEdit(self) 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 = ClickableLabel(self)
self.search_button.setGeometry(width - 100, 0, 40, 40) self.search_button.setGeometry(width - 160, 0, 40, 40)
pixmap = QtGui.QPixmap() pixmap = QtGui.QPixmap()
pixmap.load(util.curr_directory() + '/images/search.png') pixmap.load(util.curr_directory() + '/images/search.png')
self.search_button.setScaledContents(False) self.search_button.setScaledContents(False)
@ -435,13 +435,17 @@ class SearchScreen(QtGui.QWidget):
self.search_button.setPixmap(pixmap) self.search_button.setPixmap(pixmap)
self.connect(self.search_button, QtCore.SIGNAL('clicked()'), self.search) 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 = 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.clicked.connect(self.prev)
self.prev_button.setText('\u25B2') self.prev_button.setText('\u25B2')
self.next_button = QtGui.QPushButton(self) 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.clicked.connect(self.next)
self.next_button.setText('\u25BC') 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.setGeometry(width - 40, 0, 40, 40)
self.close_button.clicked.connect(self.close) self.close_button.clicked.connect(self.close)
self.close_button.setText('×') self.close_button.setText('×')
font = QtGui.QFont()
font.setPointSize(32)
font.setBold(True)
self.close_button.setFont(font) 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): def search(self):
Profile.get_instance().update() Profile.get_instance().update()
text = self.search_text.text() text = self.search_text.text()

View File

@ -1310,3 +1310,15 @@ QListWidget > QLabel
width: 0px; width: 0px;
height: 0px; height: 0px;
} }
ClickableLabel:focus
{
border-width: 1px;
border-color: #4A4949;
border-style: solid;
}
ClickableLabel:hover
{
background-color: #4A4949;
}