本文整理汇总了Python中library.MediaDB.connect方法的典型用法代码示例。如果您正苦于以下问题:Python MediaDB.connect方法的具体用法?Python MediaDB.connect怎么用?Python MediaDB.connect使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类library.MediaDB
的用法示例。
在下文中一共展示了MediaDB.connect方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import connect [as 别名]
def __init__(self):
TreeView.__init__(self, enable_drag_drop=False, enable_multiple_select=True)
targets = [("text/deepin-songs", gtk.TARGET_SAME_APP, 1), ("text/uri-list", 0, 2), ("text/plain", 0, 3)]
self.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_DROP,
targets, gtk.gdk.ACTION_COPY)
self.pl = None
self.add_song_cache = []
sort_key = ["file", "album", "genre", "#track", "artist", "title", "#playcount", "#added"]
self.sort_reverse = {key : False for key in sort_key }
self.connect_after("drag-data-received", self.on_drag_data_received)
self.connect("double-click-item", self.double_click_item_cb)
self.connect("button-press-event", self.button_press_cb)
self.connect("delete-select-items", self.try_emit_empty_signal)
self.connect("motion-notify-item", self.on_motion_notify_item)
self.connect("press-return", self.on_press_return)
self.draw_area.connect("leave-notify-event", self.on_leave_notify_event)
self.set_hide_columns([1])
self.set_expand_column(None)
MediaDB.connect("removed", self.__remove_songs)
MediaDB.connect("simple-changed", self.__songs_changed)
self.song_notify = SongNotify()
self.notify_timeout_id = None
self.notify_timeout = 400 # ms
self.delay_notify_item = None
self.notify_offset_x = 5
self.invaild_items = set()
示例2: __init__
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import connect [as 别名]
def __init__(self):
gobject.GObject.__init__(self)
# Init.
self.song = None
self.fetch_song = None
self.__source = None
self.__need_load_prefs = True
self.__current_stream_seeked = False
self.__next_already_called = False
self.__emit_signal_new_song_id = None
self.skip_error_song_flag = False
self.stop_after_this_track = False
self.__current_song_reported = False
self.__current_duration = None
self.play_thread_id = 0
MediaDB.connect("simple-changed", self.__on_change_songs)
self.bin = PlayerBin()
self.bin.connect("eos", self.__on_eos)
self.bin.connect("error", self.__on_error)
self.bin.connect("tags-found", self.__on_tag)
self.bin.connect("tick", self.__on_tick)
self.bin.connect("playing-stream", self.__on_playing)
示例3: __init
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import connect [as 别名]
def __init(self):
# Loaded theme file.
self.loginfo("Loading application theme...")
from widget.skin import app_theme
# Loaded configure.
self.loginfo("Loading settings...")
from config import config
config.load()
self.__show_splash()
# Loaded MediaDB.
self.loginfo("Loading MediaDB...")
from library import MediaDB
MediaDB.connect("loaded", self.on_db_loaded)
MediaDB.load()
# Loaded Chinese to Pinyin DB.
from pinyin import TransforDB
TransforDB.load()
# initialize Gui
self.loginfo("Initialize Gui...")
from widget.instance import DeepinMusic
self.app_instance = DeepinMusic()
self.app_instance.connect("ready", self.on_ready_cb)
if self.options.StartMinimized:
self.app_instance.window.iconify()
示例4: __init__
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import connect [as 别名]
def __init__(self):
super(CoverButton, self).__init__()
self.current_cover_pixbuf = CoverManager.get_default_cover(COVER_SIZE["x"], COVER_SIZE["y"])
self.cover_side_pixbuf = app_theme.get_pixbuf("cover/side.png").get_pixbuf()
self.set_size_request(self.cover_side_pixbuf.get_width(), self.cover_side_pixbuf.get_height())
self.connect("expose-event", self.expose_button_cb)
MediaDB.connect("simple-changed", self.update_cover)
self.current_song = None
self.next_cover_to_download = None
self.condition = threading.Condition()
self.thread = threading.Thread(target=self.func_thread)
self.thread.setDaemon(True)
self.thread.start()
示例5: __init__
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import connect [as 别名]
def __init__(self):
ListView.__init__(self)
targets = [("text/deepin-songs", gtk.TARGET_SAME_APP, 1), ("text/uri-list", 0, 2), ("text/plain", 0, 3)]
self.drag_dest_set(gtk.DEST_DEFAULT_MOTION | gtk.DEST_DEFAULT_DROP,
targets, gtk.gdk.ACTION_COPY)
self.pl = None
self.add_song_cache = []
sort_key = ["album", "genre", "artist", "title", "#playcount", "#added"]
self.sort_reverse = {key : False for key in sort_key }
self.connect_after("drag-data-received", self.on_drag_data_received)
self.connect("double-click-item", self.double_click_item_cb)
self.connect("button-press-event", self.button_press_cb)
self.connect("delete-select-items", self.try_emit_empty_signal)
MediaDB.connect("removed", self.__remove_songs)
MediaDB.connect("simple-changed", self.__songs_changed)
示例6: __init__
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import connect [as 别名]
def __init__(self, songs, init_index=0):
super(SongEditor, self).__init__(_("Property"), 500, 400, mask_type=DIALOG_MASK_TAB_PAGE)
self.set_position(gtk.WIN_POS_CENTER)
close_button = Button(_("Close"))
close_button.connect("clicked", self.click_close_button)
previous_button = Button(_("Previous"))
previous_button.connect("clicked", lambda w : self.update_previous_song())
next_button = Button(_("Next"))
next_button.connect("clicked", lambda w : self.update_next_song())
self.record_label = Label("0/0")
action_box = gtk.HBox(spacing=5)
action_box.pack_start(previous_button, False, False)
action_box.pack_start(self.record_label, False, False)
action_box.pack_start(next_button, False, False)
MediaDB.connect("simple-changed", self.db_simple_changed)
# action_box.
if len(songs) <= 1:
action_box.set_no_show_all(True)
else:
self.record_label.set_text("%d/%d" % (init_index + 1, len(songs)))
# tabs
self.song_info = SongInfo(songs[init_index])
self.info_setting = InfoSetting(songs[init_index])
self.cover_setting = CoverSetting(songs[init_index])
self.tab_box = TabBox()
self.tab_box.add_items([(_("Track Infomation"), self.song_info),
(_("Edit tags"), self.info_setting),
(_("Edit cover"), self.cover_setting)])
# DialogBox code, simple, ah? :)
self.left_button_box.set_buttons([action_box])
self.right_button_box.set_buttons([close_button])
self.body_box.pack_start(self.tab_box, True, True)
# Constants.
self.current_index = init_index
self.songs = songs
示例7: __init__
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import connect [as 别名]
def __init__(self, default_width=127):
super(PlayInfo, self).__init__()
self.set_size_request(default_width, 44)
self.default_width = default_width
self.artist_label = self.create_simple_label(_("Deepin Music"), 9.5)
self.title_label = self.create_simple_label("Linux Deepin ", 9.5)
Player.connect("instant-new-song",self.__new_song)
MediaDB.connect("simple-changed",self.__on_change)
Player.bin.connect("buffering", self.__on_buffering)
self.set_spacing(3)
artist_label_align = gtk.Alignment()
artist_label_align.set_padding(1, 0, 0, 0)
artist_label_align.set(0, 0, 1, 1)
artist_label_align.add(self.artist_label)
self.pack_start(artist_label_align, False, False)
self.pack_start(self.title_label, False, False)
self.song = None
示例8: __init__
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import connect [as 别名]
def __init__(self):
gobject.GObject.__init__(self)
self.__volumes = set()
if dbus_imported:
try:
self.bus = dbus.SystemBus()
except:
self.bus = None
if dbus_imported and self.bus and check_dbus(self.bus, "org.freedesktop.UDisks"):
self.dbus_udisks = True
self.udisks_object = self.bus.get_object("org.freedesktop.UDisks", "/org/freedesktop/UDisks")
self.udisks_interface = dbus.Interface(self.udisks_object, "org.freedesktop.UDisks")
if MediaDB.isloaded():
self.__connect_to_db()
else:
MediaDB.connect("loaded", self.__connect_to_db)
else:
self.dbus_udisks = False
self.logdebug("No UDisks support")
示例9: __init__
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import connect [as 别名]
def __init__(self, default_width=110, gaussian_radious=2, border_radious=1, text_color="#FFFFFF"):
super(PlayInfo, self).__init__()
self.set_visible_window(False)
self.default_height = 18
self.set_size_request(default_width, self.default_height)
self.default_width = default_width
self.artist_label = _("Deepin Music")
Player.connect("instant-new-song",self.__new_song)
MediaDB.connect("simple-changed",self.__on_change)
Player.bin.connect("buffering", self.__on_buffering)
Player.connect("init-status", self.__on_player_init_status)
Player.connect("fetch-start", self.on_player_fetch_start)
Player.connect("fetch-end", self.on_player_fetch_end)
self.connect("expose-event", self.on_expose_event)
self.padding_x = 0
self.gaussian_radious = gaussian_radious
self.border_radious = border_radious
self.text_color = text_color
self.set_size_request(self.default_width, self.default_height)
self.song = None
示例10: __init__
# 需要导入模块: from library import MediaDB [as 别名]
# 或者: from library.MediaDB import connect [as 别名]
def __init__(self):
'''Init.'''
gtk.VBox.__init__(self)
# Init catagory list.
self.category_list = CategoryView()
setattr(self.category_list, "save_to_library", self.save_to_library)
self.category_list.draw_mask = self.draw_category_list_mask
self.category_list.connect("single-click-item", self.on_category_single_click)
self.category_list.connect("right-press-items", self.on_category_right_press)
self.category_list.set_size_request(CATEGROYLIST_WIDTH, -1)
del self.category_list.keymap["Delete"]
# Init SearchEntry.
self.entry_box = SearchEntry("")
self.entry_box.entry.connect("changed", self.search_cb)
self.entry_box.set_no_show_all(True)
entry_align = gtk.Alignment()
entry_align.set(0, 0, 1, 1)
entry_align.set_padding(2, 0, 10, 10)
entry_align.add(self.entry_box)
entry_align.connect("expose-event", self.expose_entry_mask)
# Init toolbar.
self.toolbar_box = gtk.HBox(spacing=45)
self.search_button = self.__create_simple_toggle_button("search", self.show_text_entry,
_("Search in Current Playlist"))
self.__create_simple_button("list", self.popup_list_menu, _("Playlist Operations"))
self.__create_simple_button("add", self.popup_add_menu, _("Add"))
self.playmode_button = PlaymodeButton(config.get("setting", "loop_mode", "list_mode").split("_")[0])
Tooltip.text(self.playmode_button, _("Playback mode"))
self.playmode_button.connect("button-press-event", self.popup_sort_menu)
self.toolbar_box.pack_start(self.playmode_button, False, False)
self.__create_simple_button("delete", self.popup_delete_menu, _("Delete"))
toolbar_align = gtk.Alignment()
toolbar_align.set_padding(6, 6, 28, 0)
toolbar_align.add(self.toolbar_box)
toolbar_align.connect("expose-event", self.expose_toolbar_mask)
self.right_box = gtk.VBox()
self.right_box.connect("size-allocate", self.on_right_box_size_allocate)
self.list_paned = HPaned(handle_color=app_theme.get_color("panedHandler"), enable_drag=True)
self.list_paned.pack1(self.category_list, True, True)
self.list_paned.pack2(self.right_box, True, False)
bottom_box = gtk.VBox()
bottom_box.set_size_request(-1, 22)
self.pack_start(self.list_paned, True, True)
self.pack_start(entry_align, False, False)
self.pack_start(toolbar_align, False, True)
# Current
self.current_playlist = None
self.search_time_source = 0
self.current_item = None
self.search_flag = False
self.cache_items = None
self.delete_source_id = None
self.drag_source_id = None
self.menu_source_id = None
self.song_notify_id = None
self.detail_menu = None
self.save_flag = False
if MediaDB.isloaded():
self.__on_db_loaded(MediaDB)
else:
MediaDB.connect("loaded", self.__on_db_loaded)
Player.connect("loaded", self.__on_player_loaded)
Dispatcher.connect("play-song", self.__play_and_add)
Dispatcher.connect("add-songs", self.__add_songs_to_list)
Dispatcher.connect("new-cd-playlist", self.__new_audiocd_playlist)
Dispatcher.connect("del-cd-playlist", self.delete_audiocd_list)
Dispatcher.connect("save-current-list", self.save_current_playlist)
config.connect("config-changed", self.on_config_changed)