Skip to content
Permalink
Browse files

add newest code and remove old module

  • Loading branch information...
cosven committed Apr 24, 2016
1 parent 009140c commit 90113d6b35516665e2671d9cd07f87fc12faf166
Showing with 11,578 additions and 6,818 deletions.
  1. +0 −188 README.md
  2. +0 −4 app.sh
  3. +16 −0 feeluown/__init__.py
  4. +41 −0 feeluown/__main__.py
  5. +52 −0 feeluown/app.py
  6. +2 −55 feeluown/config.py
  7. +0 −60 feeluown/constants.py
  8. +17 −0 feeluown/consts.py
  9. +0 −100 feeluown/controller_api.py
  10. +0 −3 feeluown/controllers/__init__.py
  11. +0 −26 feeluown/controllers/focus_manager.py
  12. +0 −133 feeluown/controllers/modes.py
  13. +0 −15 feeluown/controllers/tips_manager.py
  14. +0 −38 feeluown/controllers/version_manager.py
  15. +1 −0 feeluown/daemon.py
  16. +1 −0 feeluown/db.py
  17. +0 −26 feeluown/default_config.yaml
  18. +0 −318 feeluown/glue.py
  19. +0 −119 feeluown/introspect.xml
  20. +0 −130 feeluown/left_widget.py
  21. +1 −0 feeluown/libs/utils.py
  22. +85 −0 feeluown/libs/widgets/base.py
  23. +8 −0 feeluown/libs/widgets/btns.py
  24. +66 −0 feeluown/libs/widgets/components.py
  25. +22 −0 feeluown/libs/widgets/labels.py
  26. +35 −0 feeluown/libs/widgets/sliders.py
  27. +0 −43 feeluown/logger.py
  28. +0 −62 feeluown/main.py
  29. +36 −19 feeluown/{standard_model.py → model.py}
  30. +0 −215 feeluown/models.py
  31. +0 −28 feeluown/network_manager.py
  32. +1 −287 feeluown/player.py
  33. +40 −0 feeluown/plugin.py
  34. +0 −10 feeluown/plugin/Hotkey/__init__.py
  35. +0 −76 feeluown/plugin/Hotkey/mac.py
  36. +0 −16 feeluown/plugin/LocalSong/__init__.py
  37. +0 −55 feeluown/plugin/LocalSong/glue.py
  38. +0 −24 feeluown/plugin/LocalSong/models.py
  39. +0 −37 feeluown/plugin/LocalSong/parse.py
  40. +0 −1 feeluown/plugin/LocalSong/requirements.txt
  41. +0 −18 feeluown/plugin/MprisEx/__init__.py
  42. +0 −14 feeluown/plugin/MprisEx/makefile
  43. 0 feeluown/plugin/MprisEx/requirements.txt
  44. +0 −204 feeluown/plugin/MprisEx/service.py
  45. +0 −27 feeluown/plugin/NetEaseMusic/__init__.py
  46. +0 −153 feeluown/plugin/NetEaseMusic/db.py
  47. +0 −3 feeluown/plugin/NetEaseMusic/model.py
  48. +0 −474 feeluown/plugin/NetEaseMusic/normalize.py
  49. +0 −1 feeluown/plugin/__init__.py
  50. +21 −0 feeluown/plugins/neteasemusic/__init__.py
  51. +78 −79 feeluown/{plugin/NetEaseMusic → plugins/neteasemusic}/api.py
  52. +5 −0 feeluown/plugins/neteasemusic/consts.py
  53. +153 −0 feeluown/plugins/neteasemusic/model.py
  54. +51 −0 feeluown/plugins/neteasemusic/nem.py
  55. +22 −0 feeluown/plugins/neteasemusic/normalize.py
  56. +2,168 −0 feeluown/plugins/neteasemusic/tests/album.json
  57. +7,493 −0 feeluown/plugins/neteasemusic/tests/artist.json
  58. +155 −0 feeluown/plugins/neteasemusic/tests/song.json
  59. +54 −0 feeluown/plugins/neteasemusic/tests/test_model.py
  60. +134 −0 feeluown/plugins/neteasemusic/ui.py
  61. +1 −0 feeluown/requirements.txt
  62. +0 −115 feeluown/right_widget.py
  63. +0 −8 feeluown/tests/readme.md
  64. +0 −6 feeluown/tests/requirements.txt
  65. +0 −16 feeluown/tests/test_base_common.py
  66. +0 −17 feeluown/tests/test_controller.py
  67. +0 −11 feeluown/tests/test_ui.py
  68. +0 −30 feeluown/tests/test_widgets.py
  69. +182 −0 feeluown/theme.py
  70. +65 −0 feeluown/themes/Github.colorscheme
  71. +65 −0 feeluown/themes/Molokai.colorscheme
  72. +65 −0 feeluown/themes/Solarized.colorscheme
  73. +65 −0 feeluown/themes/Tomorrow Night.colorscheme
  74. +0 −628 feeluown/themes/default.qss
  75. +0 −508 feeluown/themes/mac.qss
  76. +0 −12 feeluown/tips.py
  77. +0 −226 feeluown/top_widget.py
  78. +372 −121 feeluown/ui.py
  79. +0 −84 feeluown/utils.py
  80. +0 −213 feeluown/view_api.py
  81. 0 feeluown/widgets/__init__.py
  82. +0 −42 feeluown/widgets/add_to_playlist_btn.py
  83. +0 −237 feeluown/widgets/desktop_mini.py
  84. +0 −188 feeluown/widgets/login_dialog.py
  85. +0 −166 feeluown/widgets/lyric.py
  86. +0 −352 feeluown/widgets/music_table.py
  87. +0 −117 feeluown/widgets/notify.py
  88. +0 −350 feeluown/widgets/playlist_widget.py
  89. +0 −56 feeluown/widgets/playmode_switch.py
  90. +0 −19 feeluown/widgets/statusbar.py
  91. BIN icons/FeelUOwn.icns
  92. BIN icons/FeelUOwn.png
  93. BIN icons/album.png
  94. BIN icons/current_play.png
  95. BIN icons/desktop.png
  96. BIN icons/dislike.png
  97. BIN icons/fm.png
  98. BIN icons/fold.png
  99. BIN icons/fold_hover.png
  100. BIN icons/heart.png
  101. BIN icons/heart_hover.png
  102. BIN icons/heart_mix.png
  103. BIN icons/help.png
  104. BIN icons/help_hover.png
  105. BIN icons/help_mix.png
  106. BIN icons/home_recommend.png
  107. BIN icons/last.png
  108. BIN icons/last_hover.png
  109. BIN icons/like.png
  110. BIN icons/login.png
  111. BIN icons/login_hover.png
  112. BIN icons/login_mix.png
  113. BIN icons/mask copy.psd
  114. BIN icons/mini_last.png
  115. BIN icons/mini_next.png
  116. BIN icons/next.png
  117. BIN icons/next_hover.png
  118. BIN icons/pause.png
  119. BIN icons/pause_hover.png
  120. BIN icons/play.png
  121. BIN icons/play_hover.png
  122. BIN icons/playlist.png
  123. BIN icons/playlist_favorite.png
  124. BIN icons/playlist_hover.png
  125. BIN icons/playlist_mine.png
  126. BIN icons/random.png
  127. BIN icons/recommend copy.png
  128. BIN icons/recommend.png
  129. BIN icons/repeat.png
  130. BIN icons/search.png
  131. BIN icons/search_hover.png
  132. BIN icons/single_repeat.png
  133. BIN icons/spread.png
  134. BIN icons/spread_hover.png
  135. BIN icons/trash_btn.png
  136. BIN icons/trash_btn_hover.png
  137. BIN icons/trash_btn_hover.png.bak.png
  138. +0 −130 install.sh
  139. +5 −0 makefile
  140. +0 −3 requirements.txt
  141. +0 −3 run_test.sh
  142. +0 −47 uninstall.sh
  143. +0 −52 update.sh
188 README.md

This file was deleted.

4 app.sh

This file was deleted.

@@ -1,3 +1,19 @@
# -*- coding: utf-8 -*-

import logging

from .consts import LOG_FILE
from .config import config


def logger_config():
if config.debug:
logging.basicConfig(
format="[%(levelname)s] [%(filename)s line:%(lineno)d] : %(message)s",
filename=LOG_FILE,
filemode='w',
)
else:
logging.basicConfig(
format="[%(levelname)s] [%(filename)s line:%(lineno)d] : %(message)s",
)
@@ -0,0 +1,41 @@
# -*- coding: utf-8 -*-

import sys
import asyncio

from PyQt5.QtWidgets import QApplication
from quamash import QEventLoop

from .app import App
from .consts import USER_PLUGINS_DIR, PLUGINS_DIR
from .config import config
from feeluown import logger_config


sys.path.append(PLUGINS_DIR)
sys.path.append(USER_PLUGINS_DIR)


def parse_args(args):
if '-d' in args:
config.debug = True
logger_config()


def main():
parse_args(sys.argv)

q_app = QApplication(sys.argv)
q_app.setQuitOnLastWindowClosed(True)
q_app.setApplicationName('FeelUOwn')

app_event_loop = QEventLoop(q_app)
asyncio.set_event_loop(app_event_loop)
app = App()
app.show()

app_event_loop.run_forever()
sys.exit(0)


main()
@@ -0,0 +1,52 @@
# -*- coding: utf-8 -*-

from PyQt5.QtGui import QPainter
from PyQt5.QtWidgets import QStyleOption, QStyle

from .consts import DEFAULT_THEME_NAME
from .ui import Ui
from .theme import ThemeManager
from .plugin import PluginsManager
from feeluown.libs.widgets.base import FWidget


class App(FWidget):
def __init__(self):
super().__init__()
self.theme_manager = ThemeManager(self)
self.plugins_manager = PluginsManager(self)
self.theme_manager.set_theme(DEFAULT_THEME_NAME)

self.ui = Ui(self)

self._init_managers()

self.resize(960, 600)
self.setObjectName('app')
self.set_theme_style()

self.test()

def paintEvent(self, event):
option = QStyleOption()
option.initFrom(self)
painter = QPainter(self)
style = self.style()
style.drawPrimitive(QStyle.PE_Widget, option, painter, self)

def _init_managers(self):
self.plugins_manager.scan()

def set_theme_style(self):
theme = self.theme_manager.current_theme
style_str = '''
#app {{
background: {0};
color: {1};
}}
'''.format(theme.background.name(),
theme.foreground.name())
self.setStyleSheet(style_str)

def test(self):
self.theme_manager.choose('Molokai')
@@ -1,61 +1,8 @@
# -*- coding: utf-8 -*-

from collections.abc import MutableMapping

import yaml

from feeluown.constants import CONFIG_FILE_PATH
from feeluown.constants import DEFAULT_CONFIG_FILE_PATH
from feeluown.utils import update_dict_recursive
from feeluown.logger import LOG


# TODO: add version info to config file
class Config(MutableMapping):
"""load default config and user config
user config can override default config
"""
def __init__(self):
self._data = dict()

# TODO: bugy update policy
def load(self, path=CONFIG_FILE_PATH):
# load default config first, there may be some new key field which not
# exists in user config
with open(DEFAULT_CONFIG_FILE_PATH, 'r') as f:
self._data.update(yaml.load(f))
try:
with open(path, 'r') as f:
update_dict_recursive(self._data, yaml.load(f))
except OSError:
LOG.error('user config file not found, will load default config')

def save(self, path=CONFIG_FILE_PATH):
with open(path, 'w') as f:
f.write(yaml.dump(self._data))
LOG.info('save user config.')

def __getitem__(self, key):
return self._data[self.__keytransform__(key)]

def __setitem__(self, key, value):
self._data[self.__keytransform__(key)] = value

def __keytransform__(self, key):
return key

def __delitem__(self, key):
del self._data[self.__keytransform__(key)]

def __iter__(self):
return iter(self._data)

def __len__(self):
return iter(self._data)

def on_playback_mode_change(self, mode):
self._data['player']['playback_mode'] = mode
class Config():
debug = False


config = Config()

0 comments on commit 90113d6

Please sign in to comment.
You can’t perform that action at this time.