@@ 20-54 (lines=35) @@ | ||
17 | class MediaLibrary(QWidget): |
|
18 | """Contains all of the user configurable options related to the media library.""" |
|
19 | ||
20 | def __init__(self, parent=None): |
|
21 | """Initialize a page of options to be shown in the preferences dialog.""" |
|
22 | super(MediaLibrary, self).__init__(parent) |
|
23 | ||
24 | self.user_config_file = os.path.join(AppDirs('mosaic', 'Mandeep').user_config_dir, |
|
25 | 'settings.toml') |
|
26 | ||
27 | with open(self.user_config_file) as conffile: |
|
28 | config = toml.load(conffile) |
|
29 | ||
30 | media_library_config = QGroupBox("Media Library Configuration") |
|
31 | ||
32 | self.media_library_label = QLabel('Media Library', self) |
|
33 | self.media_library_line = QLineEdit() |
|
34 | self.media_library_line.setReadOnly(True) |
|
35 | self.media_library_button = QPushButton('Select Path') |
|
36 | ||
37 | self.media_library_button.clicked.connect(lambda: self.select_media_library(config)) |
|
38 | ||
39 | media_library_layout = QVBoxLayout() |
|
40 | ||
41 | media_library_config_layout = QHBoxLayout() |
|
42 | media_library_config_layout.addWidget(self.media_library_label) |
|
43 | media_library_config_layout.addWidget(self.media_library_line) |
|
44 | media_library_config_layout.addWidget(self.media_library_button) |
|
45 | ||
46 | media_library_layout.addLayout(media_library_config_layout) |
|
47 | ||
48 | media_library_config.setLayout(media_library_layout) |
|
49 | ||
50 | main_layout = QVBoxLayout() |
|
51 | main_layout.addWidget(media_library_config) |
|
52 | main_layout.addStretch(1) |
|
53 | self.setLayout(main_layout) |
|
54 | ||
55 | self.media_library_settings(config) |
|
56 | ||
57 | def select_media_library(self, config): |
|
@@ 86-115 (lines=30) @@ | ||
83 | class Playback(QWidget): |
|
84 | """Contains all of the user configurable options related to media playback.""" |
|
85 | ||
86 | def __init__(self, parent=None): |
|
87 | """Initiate the abstract widget that is displayed in the preferences dialog.""" |
|
88 | super(Playback, self).__init__(parent) |
|
89 | self.user_config_file = os.path.join(AppDirs('mosaic', 'Mandeep').user_config_dir, |
|
90 | 'settings.toml') |
|
91 | ||
92 | with open(self.user_config_file) as conffile: |
|
93 | config = toml.load(conffile) |
|
94 | ||
95 | playback_config = QGroupBox('Playback Configuration') |
|
96 | playback_config_layout = QVBoxLayout() |
|
97 | playback_config_layout.setAlignment(Qt.AlignTop) |
|
98 | ||
99 | self.cover_art_playback = QCheckBox('Cover Art Playback') |
|
100 | self.playlist_save_checkbox = QCheckBox('Save Playlist on Close') |
|
101 | ||
102 | playback_config_layout.addWidget(self.cover_art_playback) |
|
103 | playback_config_layout.addWidget(self.playlist_save_checkbox) |
|
104 | ||
105 | playback_config.setLayout(playback_config_layout) |
|
106 | ||
107 | main_layout = QVBoxLayout() |
|
108 | main_layout.addWidget(playback_config) |
|
109 | ||
110 | self.setLayout(main_layout) |
|
111 | ||
112 | self.check_playback_setting(config) |
|
113 | self.check_playlist_save(config) |
|
114 | self.cover_art_playback.clicked.connect(lambda: self.cover_art_playback_setting(config)) |
|
115 | self.playlist_save_checkbox.clicked.connect(lambda: self.playlist_save_setting(config)) |
|
116 | ||
117 | def cover_art_playback_setting(self, config): |
|
118 | """Change the cover art playback behavior of the music player. |