Skip to content

Commit

Permalink
clean code
Browse files Browse the repository at this point in the history
  • Loading branch information
cosven committed Nov 30, 2024
1 parent df9409c commit 5b58900
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions feeluown/gui/components/menu.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import logging
from typing import Optional, TYPE_CHECKING

from PyQt5.QtCore import Qt, QPoint
from PyQt5.QtCore import Qt

from feeluown.excs import ProviderIOError
from feeluown.utils.aio import run_fn, run_afn
Expand Down Expand Up @@ -75,6 +75,7 @@ async def goto_song_album(song):
def show_similar_resource(self, song):
from feeluown.gui.components.search import SearchResultView

# TODO: add a close button, and rename it to ClosableSearchResultView
class SearchResultViewWithEsc(SearchResultView):
def keyPressEvent(self, event):
if event.key() == Qt.Key_Escape:
Expand All @@ -100,10 +101,7 @@ def keyPressEvent(self, event):
x = self._app.ui.sidebar.width()
y = self._app.height() - height - self._app.ui.player_bar.height()

# Set the size using resize() and position using move()
view.resize(width, height)
pos = self._app.mapToGlobal(QPoint(0, 0))
view.move(pos.x() + x, pos.y() + y)
view.setGeometry(x, y, width, height)
view.show()
view.raise_()

Expand Down

0 comments on commit 5b58900

Please sign in to comment.