-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
17 changed files
with
347 additions
and
78 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
{ | ||
"files.watcherExclude": { | ||
"**/.git/objects/**": true, | ||
"**/.git/subtree-cache/**": true, | ||
"**/.hg/store/**": true, | ||
"**/.dart_tool": true, | ||
".flatpak/**": true, | ||
"_build/**": true | ||
}, | ||
"mesonbuild.configureOnOpen": false, | ||
"mesonbuild.buildFolder": "_build", | ||
"search.followSymlinks": false, | ||
"[python]": { | ||
"editor.defaultFormatter": "ms-python.black-formatter", | ||
"editor.formatOnSave": true, | ||
"editor.codeActionsOnSave": { | ||
"source.organizeImports": "explicit" | ||
}, | ||
"editor.rulers": [88], | ||
}, | ||
"isort.args":["--profile", "black"], | ||
"python.analysis.diagnosticSeverityOverrides": { | ||
"reportMissingModuleSource": "none" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from pathlib import Path | ||
|
||
from gi.repository import Gio, Adw # type: ignore | ||
|
||
APP_ID: str | ||
VERSION: str | ||
PREFIX: str | ||
|
||
config_dir: Path | ||
cache_dir: Path | ||
|
||
schema: Gio.Settings | ||
state_schema: Gio.Settings | ||
|
||
app: Adw.Application | ||
win: Adw.ApplicationWindow |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
from gi.repository import Adw, Gtk # type: ignore | ||
|
||
from chronograph import shared | ||
|
||
|
||
@Gtk.Template(resource_path=shared.PREFIX + "/gtk/ui/BoxDialog.ui") | ||
class BoxDialog(Adw.Dialog): | ||
"""Dialog with lines of `Adw.ActionRow(s)` with provided content | ||
Parameters | ||
---------- | ||
label : str | ||
Label of the dialog | ||
lines_content : tuple | ||
titles and subtitles of `Adw.ActionRow(s)`. Like `(("1st Title", "1st subtitle"), ("2nd title", "2nd subtitle"), ...)` | ||
GTK Objects | ||
---------- | ||
:: | ||
diaglog_title_label : Gtk.Label -> Label of the dialog | ||
props_list : Gtk.ListBox -> ListBox with `Adw.ActionRow(s)` with provided data | ||
""" | ||
|
||
__gtype_name__ = "BoxDialog" | ||
|
||
dialog_title_label: Gtk.Label = Gtk.Template.Child() | ||
props_list: Gtk.ListBox = Gtk.Template.Child() | ||
|
||
def __init__(self, label: str, lines_content: tuple) -> None: | ||
super().__init__() | ||
|
||
for entry in lines_content: | ||
self.props_list.append( | ||
Adw.ActionRow( | ||
title=entry[0], subtitle=entry[1], css_classes=["property"] | ||
) | ||
) | ||
|
||
self.dialog_title_label.set_label(label) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import os | ||
from pathlib import Path | ||
from typing import Union | ||
|
||
from gi.repository import GLib # type: ignore | ||
|
||
from chronograph import shared | ||
from chronograph.ui.SongCard import SongCard | ||
from chronograph.utils.file_mutagen_id3 import FileID3 | ||
from chronograph.utils.file_mutagen_vorbis import FileVorbis | ||
|
||
|
||
def dir_parser(path: str, *_args) -> None: | ||
"""Parses directory and creates `SongCard` instances for files in directory of formats `ogg`, `flac`, `mp3` and `wav` | ||
Parameters | ||
---------- | ||
path : str | ||
Path to directory to parse | ||
""" | ||
shared.win.library.remove_all() | ||
path = path + "/" | ||
mutagen_files = [] | ||
for file in os.listdir(path): | ||
if not os.path.isdir(path + file): | ||
if Path(file).suffix in (".ogg", ".flac"): | ||
mutagen_files.append(FileVorbis(path + file)) | ||
elif Path(file).suffix in (".mp3", ".wav"): | ||
mutagen_files.append(FileID3(path + file)) | ||
|
||
for file in mutagen_files: | ||
GLib.idle_add(songcard_idle, file) | ||
shared.win.library_scrolled_window.set_child(shared.win.library) | ||
# NOTE: This should be implemented in ALL parsers functions | ||
# for child in shared.win.library: | ||
# child.set_focusable(False) | ||
|
||
|
||
def songcard_idle(file: Union[FileID3, FileVorbis]) -> None: | ||
"""Appends new `SongCard` instance to `ChronographWindow.library` | ||
Parameters | ||
---------- | ||
file : Union[FileID3, FileVorbis] | ||
File of song | ||
""" | ||
song_card = SongCard(file) | ||
shared.win.library.append(song_card) | ||
song_card.get_parent().set_focusable(False) |
Oops, something went wrong.