• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

feeluown / FeelUOwn / 3607006942

pending completion
3607006942

push

github

GitHub
gui: new search page (#627)

155 of 155 new or added lines in 6 files covered. (100.0%)

7619 of 12598 relevant lines covered (60.48%)

0.6 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

62.5
/feeluown/gui/base_renderer.py
1
from abc import abstractmethod
1✔
2
from typing import runtime_checkable, Protocol
1✔
3

4
from feeluown.gui.widgets.tabbar import Tab, TabBar
1✔
5

6

7
class LibraryTabRendererMixin:
1✔
8

9
    def init_tabbar_signal_binding(self):
1✔
10
        for tab_id, signal in self.get_tabid_signal_mapping().items():
×
11
            signal.connect(self.on_tab_id_activated(tab_id))
×
12

13
    def get_tabid_handler_mapping(self):
1✔
14
        return {
×
15
            Tab.songs: self.show_songs,
16
            Tab.albums: self.show_albums,
17
            Tab.artists: self.show_artists,
18
            Tab.playlists: self.show_playlists,
19
            Tab.videos: self.show_videos,
20
        }
21

22
    def get_tabid_signal_mapping(self):
1✔
23
        return {
×
24
            Tab.songs: self.tabbar.show_songs_needed,
25
            Tab.albums: self.tabbar.show_albums_needed,
26
            Tab.artists: self.tabbar.show_artists_needed,
27
            Tab.playlists: self.tabbar.show_playlists_needed,
28
            Tab.videos: self.tabbar.show_videos_needed,
29
        }
30

31
    def render_tabbar(self):
1✔
32
        self.init_tabbar_signal_binding()
×
33

34
        self.tabbar.show()
×
35
        self.tabbar.library_mode()
×
36
        self.tabbar.check(self.tab_id)
×
37

38
    def on_tab_id_activated(self, tab_id):
1✔
39
        def cb():
×
40
            if tab_id != self.tab_id:
×
41
                self.show_by_tab_id(tab_id)
×
42
        return cb
×
43

44
    def show_by_tab_id(self, tab_id):
1✔
45
        raise NotImplementedError
×
46

47

48
class TabBarRendererMixin:
1✔
49
    """
50
    Requirements:
51
    1. the instance MUST has `tabs` attribute
52
    2. the instance MUST implement `render_by_tab_index`
53
    """
54
    def render_tab_bar(self):
1✔
55
        tab_bar = TabBar()
1✔
56
        ui = self._app.ui
1✔
57
        ui.toolbar.add_stacked_widget(tab_bar)
1✔
58
        ui.toolbar.set_top_stacked_widget(tab_bar)
1✔
59
        for tab in self.tabs:
1✔
60
            tab_bar.addTab(tab[0])
1✔
61
        tab_bar.setCurrentIndex(self.tab_index)
1✔
62
        tab_bar.tabBarClicked.connect(self.render_by_tab_index)
1✔
63

64
    def render_by_tab_index(self, tab_index):
1✔
65
        raise NotImplementedError
×
66

67

68
@runtime_checkable
1✔
69
class VFillableBg(Protocol):
1✔
70
    """Protocol for widgets which has vertical fillable background
71

72
    This protocol indicates the background of the widget is transparent. The parent
73
    widget can fill color for the widget.
74

75
    .. versionadded:: 3.8.9
76
    """
77
    @abstractmethod
1✔
78
    def fillable_bg_height(self) -> int:
1✔
79
        raise NotImplementedError
×
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc