调整目录
parent
4d2c6b37a1
commit
4ec7696911
|
@ -0,0 +1,21 @@
|
|||
MIT License
|
||||
|
||||
Copyright (c) 2018
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
|
@ -0,0 +1,5 @@
|
|||
#!/bin/bash
|
||||
|
||||
export SONIST_LIB_DIR=$(pwd)
|
||||
|
||||
./usr/lib/sonist/sonist.py
|
|
@ -0,0 +1,3 @@
|
|||
#!/bin/bash
|
||||
|
||||
/usr/lib/sonist/sonist.py
|
|
@ -38,6 +38,10 @@ class Application(Gtk.Application):
|
|||
def __init__(self):
|
||||
Gtk.Application.__init__(self, application_id = app_id)
|
||||
|
||||
self.lib_dir = f"{os.getenv('SONIST_LIB_DIR')}/" if os.getenv('SONIST_LIB_DIR') else ''
|
||||
|
||||
print(self.lib_dir)
|
||||
|
||||
self.music_dir = get_music_dir()
|
||||
self.album_cache_dir = f"{home_dir}/.cache/sonist/album"
|
||||
self.lyric_cache_dir = f"{home_dir}/.cache/sonist/lyric"
|
|
@ -20,12 +20,16 @@ class CtrlBox(Gtk.Box):
|
|||
|
||||
self.disabled = True
|
||||
|
||||
self.modes = ['./usr/share/sonist/all.png','./usr/share/sonist/rand.png','./usr/share/sonist/single.png']
|
||||
self.modes = [
|
||||
'./usr/share/sonist/all.png',
|
||||
'./usr/share/sonist/rand.png',
|
||||
'./usr/share/sonist/single.png'
|
||||
]
|
||||
self.curr_mode = 0
|
||||
|
||||
self.mode_btn = ImageButton(self.modes[0])
|
||||
self.prev_btn = ImageButton('./usr/share/sonist/prev.png')
|
||||
self.play_btn = ToggleButton(['./usr/share/sonist/pause.png', './usr/share/sonist/play.png', './usr/share/sonist/play_a.png'], 48, 48)
|
||||
self.play_btn = ToggleButton(['./usr/share/sonist/pause.png', './usr/share/sonist/play.png'], 48, 48)
|
||||
self.next_btn = ImageButton('./usr/share/sonist/next.png')
|
||||
self.vol_btn = ImageButton('./usr/share/sonist/volume.png')
|
||||
|
|
@ -51,24 +51,21 @@ class SonistWindow(Gtk.Window):
|
|||
|
||||
self.set_opacity(0.9)
|
||||
|
||||
# self.set_keep_above(True)
|
||||
|
||||
# album_img = './usr/share/sonist/album.png'
|
||||
album_img = './usr/share/sonist/avatar.jpg'
|
||||
album_img = f'{self.app.lib_dir}/usr/share/sonist/avatar.jpg'
|
||||
|
||||
self.set_background_image(album_img)
|
||||
|
||||
layout = Gtk.Layout()
|
||||
|
||||
# 菜单按钮
|
||||
menu_btn = ImageButton('./usr/share/sonist/menu.png')
|
||||
menu_btn = ImageButton(f'{self.app.lib_dir}/usr/share/sonist/menu.png')
|
||||
popup_menu = OptionMenu(app)
|
||||
menu_btn.connect('clicked', lambda btn: popup_menu.show(btn))
|
||||
layout.put(menu_btn, 276, 6)
|
||||
|
||||
# 唱片
|
||||
disk = ScaleImage('./usr/share/sonist/disk.png')
|
||||
handler = ScaleImage('./usr/share/sonist/handler.png')
|
||||
disk = ScaleImage(f'{self.app.lib_dir}/usr/share/sonist/disk.png')
|
||||
handler = ScaleImage(f'{self.app.lib_dir}/usr/share/sonist/handler.png')
|
||||
album = ScaleImage(album_img)
|
||||
|
||||
disk.resize(192, 192)
|
||||
|
@ -114,7 +111,7 @@ class SonistWindow(Gtk.Window):
|
|||
provider = Gtk.CssProvider()
|
||||
css = f"""
|
||||
#SonistWindow {{
|
||||
background-image: url('./usr/share/sonist/album.png');
|
||||
background-image: url('{self.app.lib_dir}/usr/share/sonist/album.png');
|
||||
background-size: 100% 100%;
|
||||
background-position: center;
|
||||
}}
|
||||
|
@ -256,9 +253,9 @@ class SonistWindow(Gtk.Window):
|
|||
def update_play_stat(self, is_play = True):
|
||||
|
||||
if is_play:
|
||||
self.handler.reset('./usr/share/sonist/handler_a.png')
|
||||
self.handler.reset(f'{self.app.lib_dir}/usr/share/sonist/handler_a.png')
|
||||
else:
|
||||
self.handler.reset('./usr/share/sonist/handler.png')
|
||||
self.handler.reset(f'{self.app.lib_dir}/usr/share/sonist/handler.png')
|
||||
|
||||
# 切换播放按钮状态
|
||||
self.ctrl_box.toggle_play_btn(is_play)
|
Binary file not shown.
Before Width: | Height: | Size: 1.7 KiB |
Loading…
Reference in New Issue