增加打包配置
parent
acb4d0c396
commit
ca9dc3e394
|
@ -0,0 +1,12 @@
|
||||||
|
Package: sonist
|
||||||
|
Version: 1.0.0
|
||||||
|
Section: X11
|
||||||
|
Architecture: all
|
||||||
|
Author: Yutent
|
||||||
|
Maintainer: Yutent <yutent.io@gmail.com>
|
||||||
|
Depends: gir1.2-gtk-3.0, python-mutagen
|
||||||
|
Priority: optional
|
||||||
|
Installed-Size: 5644
|
||||||
|
Homepage: https://github.com/app-cat/sonist-gtk
|
||||||
|
Description: Sonist - 基于mpd后端的音乐播放器.
|
||||||
|
高颜值且轻量的 MPD GUI客户端.
|
|
@ -1,10 +1,11 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import gi
|
import gi, sys
|
||||||
|
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
|
from gi.repository import Gtk, GdkPixbuf
|
||||||
|
|
||||||
from gi.repository import Gtk
|
from assets import image_dict
|
||||||
|
|
||||||
|
|
||||||
class AboutWindow(Gtk.AboutDialog):
|
class AboutWindow(Gtk.AboutDialog):
|
||||||
|
@ -14,7 +15,11 @@ class AboutWindow(Gtk.AboutDialog):
|
||||||
self.set_keep_above(True)
|
self.set_keep_above(True)
|
||||||
|
|
||||||
self.set_program_name('Sonist Gtk')
|
self.set_program_name('Sonist Gtk')
|
||||||
self.set_logo_icon_name('google-chrome')
|
if sys.platform == 'linux':
|
||||||
|
self.set_logo_icon_name('sonist')
|
||||||
|
else:
|
||||||
|
self.set_logo(GdkPixbuf.Pixbuf.new_from_file(image_dict['sonist']))
|
||||||
|
|
||||||
self.set_license_type(Gtk.License.MIT_X11)
|
self.set_license_type(Gtk.License.MIT_X11)
|
||||||
self.set_version('0.1.0')
|
self.set_version('0.1.0')
|
||||||
self.set_website('https://github.com/app-cat/sonist-gtk')
|
self.set_website('https://github.com/app-cat/sonist-gtk')
|
||||||
|
|
|
@ -6,9 +6,8 @@ import os
|
||||||
lib_dir = os.getenv('SONIST_LIB_DIR') or ''
|
lib_dir = os.getenv('SONIST_LIB_DIR') or ''
|
||||||
|
|
||||||
image_dict = {
|
image_dict = {
|
||||||
"album": f"{lib_dir}/usr/share/sonist/album.png",
|
"sonist": f"{lib_dir}/usr/share/sonist/sonist.png",
|
||||||
"all": f"{lib_dir}/usr/share/sonist/all.png",
|
"all": f"{lib_dir}/usr/share/sonist/all.png",
|
||||||
"avatar": f"{lib_dir}/usr/share/sonist/avatar.jpg",
|
|
||||||
"disk": f"{lib_dir}/usr/share/sonist/disk.png",
|
"disk": f"{lib_dir}/usr/share/sonist/disk.png",
|
||||||
"handler": f"{lib_dir}/usr/share/sonist/handler.png",
|
"handler": f"{lib_dir}/usr/share/sonist/handler.png",
|
||||||
"handler_a": f"{lib_dir}/usr/share/sonist/handler_a.png",
|
"handler_a": f"{lib_dir}/usr/share/sonist/handler_a.png",
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import gi, sys, os, threading, time, re, json
|
import gi, sys, os, re, json
|
||||||
# import dbus
|
|
||||||
# import dbus.service, dbus.mainloop.glib
|
|
||||||
from pprint import pprint as print
|
|
||||||
|
|
||||||
|
|
||||||
gi.require_version('Gtk', '3.0')
|
gi.require_version('Gtk', '3.0')
|
||||||
|
|
||||||
from gi.repository import Gtk
|
from gi.repository import Gtk
|
||||||
|
|
||||||
from utils import run_async
|
from utils import run_async
|
||||||
|
@ -17,7 +12,7 @@ from about_app import AboutWindow
|
||||||
from preferences import PreferencesWindow
|
from preferences import PreferencesWindow
|
||||||
from mpd import MPDClient
|
from mpd import MPDClient
|
||||||
|
|
||||||
app_id = 'fun.wkit.sonist'
|
APP_ID = 'fun.wkit.sonist'
|
||||||
home_dir = os.getenv('HOME')
|
home_dir = os.getenv('HOME')
|
||||||
|
|
||||||
|
|
||||||
|
@ -36,7 +31,7 @@ def get_music_dir():
|
||||||
class Application(Gtk.Application):
|
class Application(Gtk.Application):
|
||||||
|
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
Gtk.Application.__init__(self, application_id = app_id)
|
Gtk.Application.__init__(self, application_id = APP_ID)
|
||||||
|
|
||||||
self.music_dir = get_music_dir()
|
self.music_dir = get_music_dir()
|
||||||
self.album_cache_dir = f"{home_dir}/.cache/sonist/album"
|
self.album_cache_dir = f"{home_dir}/.cache/sonist/album"
|
||||||
|
@ -102,33 +97,10 @@ class Application(Gtk.Application):
|
||||||
def quit_all(self):
|
def quit_all(self):
|
||||||
self.remove_window(self.window)
|
self.remove_window(self.window)
|
||||||
|
|
||||||
""" class ApplicationService(dbus.service.Object):
|
|
||||||
def __init__(self, app):
|
|
||||||
self.app = app
|
|
||||||
bus_name = dbus.service.BusName(app_id, bus = dbus.SessionBus())
|
|
||||||
dbus.service.Object.__init__(self, bus_name, '/')
|
|
||||||
|
|
||||||
|
|
||||||
@dbus.service.method(app_id)
|
|
||||||
def call_app(self):
|
|
||||||
self.app.present()
|
|
||||||
"""
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
# dbus.mainloop.glib.DBusGMainLoop(set_as_default = True)
|
|
||||||
# bus = dbus.SessionBus()
|
|
||||||
|
|
||||||
# try:
|
|
||||||
# obj = bus.get_object(app_id, '/')
|
|
||||||
# obj.call_app()
|
|
||||||
# sys.exit(0)
|
|
||||||
# except dbus.DBusException:
|
|
||||||
# pass
|
|
||||||
|
|
||||||
|
|
||||||
app = Application()
|
app = Application()
|
||||||
|
|
||||||
# ApplicationService(app)
|
|
||||||
app.run(sys.argv)
|
app.run(sys.argv)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ class ScaleImage(Gtk.Image):
|
||||||
w = self.origin.get_width()
|
w = self.origin.get_width()
|
||||||
h = self.origin.get_height()
|
h = self.origin.get_height()
|
||||||
_size = min(w, h) # 按小边裁剪成正方形
|
_size = min(w, h) # 按小边裁剪成正方形
|
||||||
# size = min(size, _size) # 缩放按最小值来
|
|
||||||
self.width = size
|
self.width = size
|
||||||
self.height = size
|
self.height = size
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class SonistWindow(Gtk.Window):
|
||||||
|
|
||||||
self.set_opacity(0.9)
|
self.set_opacity(0.9)
|
||||||
|
|
||||||
self.set_background_image(image_dict['album'])
|
self.set_background_image(image_dict['disk'])
|
||||||
|
|
||||||
layout = Gtk.Layout()
|
layout = Gtk.Layout()
|
||||||
|
|
||||||
|
@ -111,7 +111,7 @@ class SonistWindow(Gtk.Window):
|
||||||
provider = Gtk.CssProvider()
|
provider = Gtk.CssProvider()
|
||||||
css = f"""
|
css = f"""
|
||||||
#SonistWindow {{
|
#SonistWindow {{
|
||||||
background-image: url('{image_dict['album']}');
|
background-image: url('{image_dict['disk']}');
|
||||||
background-size: 100% 100%;
|
background-size: 100% 100%;
|
||||||
background-position: center;
|
background-position: center;
|
||||||
}}
|
}}
|
||||||
|
@ -333,7 +333,7 @@ class SonistWindow(Gtk.Window):
|
||||||
|
|
||||||
@idle
|
@idle
|
||||||
def update_album(self, filepath = None):
|
def update_album(self, filepath = None):
|
||||||
self.set_background_image(filepath or image_dict['album'])
|
self.set_background_image(filepath or image_dict['disk'])
|
||||||
self.album.reset(filepath, True).set_radius(64)
|
self.album.reset(filepath, True).set_radius(64)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,9 @@
|
||||||
|
[Desktop Entry]
|
||||||
|
Name=Sonist Music Player
|
||||||
|
Comment[zh_CN]=Sonist 音乐播放器
|
||||||
|
Exec=sonist
|
||||||
|
Icon=sonist
|
||||||
|
Terminal=false
|
||||||
|
X-MultipleArgs=false
|
||||||
|
Type=Application
|
||||||
|
Categories=Music;
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Binary file not shown.
After Width: | Height: | Size: 35 KiB |
File diff suppressed because one or more lines are too long
After Width: | Height: | Size: 74 KiB |
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Loading…
Reference in New Issue