def __init__(self): self.app = Gtk.Application.new('org.gtk.kuwo', 0) self.app.connect('startup', self.on_app_startup) self.app.connect('activate', self.on_app_activate) self.app.connect('shutdown', self.on_app_shutdown) self.conf = Config.load_conf() self.theme = Config.load_theme()
def __init__(self): self.app = Gtk.Application.new(DBUS_APP_NAME, 0) self.app.connect('startup', self.on_app_startup) self.app.connect('activate', self.on_app_activate) self.app.connect('shutdown', self.on_app_shutdown) self.conf = Config.load_conf() self.theme, self.theme_path = Config.load_theme()
def __init__(self): self.app = Gtk.Application.new('org.gtk.kuwo', 0) self.app.connect('startup', self.on_app_startup) self.app.connect('activate', self.on_app_activate) self.app.connect('shutdown', self.on_app_shutdown) self.conf = Config.load_conf() if 'use-status-icon' not in self.conf: self.conf['use-status-icon'] = True self.theme = Config.load_theme()
def on_app_startup(self, app): self.conf = Config.load_conf() self.icon_theme = Gtk.IconTheme.get_default() self.icon_theme.append_search_path(Config.ICON_PATH) GLib.set_application_name(Config.APPNAME) self.window = Gtk.ApplicationWindow(application=app) self.window.set_default_size(*self.conf['window-size']) self.window.set_title(Config.APPNAME) self.window.set_default_icon_name(Config.NAME) self.window.props.hide_titlebar_when_maximized = True app.add_window(self.window) self.window.connect('check-resize', self.on_main_window_resized) self.window.connect('delete-event', self.on_main_window_deleted) self.accel_group = Gtk.AccelGroup() self.window.add_accel_group(self.accel_group) box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL) self.window.add(box) self.osdlrc = OSDLrc(self) self.notify = None self.init_notify() self.player = Player(self) box.pack_start(self.player, False, False, 0) self.notebook = Gtk.Notebook() self.notebook.props.tab_pos = Gtk.PositionType.BOTTOM self.notebook.get_style_context().add_class('main_tab') box.pack_start(self.notebook, True, True, 0) self.init_notebook() self.notebook.connect('switch-page', self.on_notebook_switch_page) self.init_status_icon() # load default styles when all widgets have been constructed. self.load_styles()
def on_app_shutdown(self, app): Config.dump_conf(self.conf)
# Copyright (C) 2013-2014 LiuLang <*****@*****.**> # Use of this source code is governed by GPLv3 license that can be found # in the LICENSE file. import os import sys from gi.repository import Gdk from gi.repository import GdkPixbuf from gi.repository import GObject from gi.repository import Gtk from kuwo import Config # ~/.config/kuwo and ~/.cache/kuwo need to be created at first time Config.check_first() _ = Config._ from kuwo.Artists import Artists from kuwo.Lrc import Lrc from kuwo.MV import MV from kuwo.Player import Player from kuwo.PlayList import PlayList from kuwo.Radio import Radio from kuwo.Search import Search from kuwo.Themes import Themes from kuwo.TopCategories import TopCategories from kuwo.TopList import TopList from kuwo.Shortcut import Shortcut GObject.threads_init() DBUS_APP_NAME = 'org.liulang.kwplayer'
# in the LICENSE file. import os import sys import traceback from gi.repository import Gdk from gi.repository import GdkPixbuf from gi.repository import GLib from gi.repository import GObject from gi.repository import Gtk from gi.repository import Notify from kuwo import Config # ~/.config/kuwo and ~/.cache/kuwo need to be created at first time Config.check_first() _ = Config._ Notify.init(Config.APPNAME) from kuwo.log import logger from kuwo import Net from kuwo import Widgets from kuwo.Artists import Artists from kuwo.Lrc import Lrc from kuwo.MV import MV from kuwo.OSDLrc import OSDLrc from kuwo.Player import Player from kuwo.PlayList import PlayList from kuwo.Radio import Radio from kuwo.Search import Search from kuwo.Shortcut import Shortcut from kuwo.Themes import Themes
def on_destroy(self): print('dialog.on_destroy()') Config.dump_conf(self.app.conf)
def on_destroy(self): Config.dump_conf(self.app.conf)