def __init__(self, db_query): SignalContainer.__init__(self) self.__db_query = db_query self.artist_missions_threadpool = MissionThreadPool( 5, 1000, self.feedback) self.album_missions_threadpool = MissionThreadPool( 5, 1000, self.feedback)
def __init__(self): gtk.VBox.__init__(self) SignalContainer.__init__(self) # Init categorys. self.get_categorys() # load data. self.__load_webcast_query() # Init webcastbar. self.__init_webcastbar() # Init iconview. self.metro_view = self.get_icon_view() self.metro_view_sw = self.metro_view.get_scrolled_window() self.page_box = gtk.VBox() self.page_box.add(self.metro_view_sw) # webcasts view self.webcast_view = self.get_webcast_view() self.webcast_view_sw = self.webcast_view.get_scrolled_window() # collect view self.collected_db_file = get_config_file("favorite_webcasts.db") self.collected_view = self.get_webcast_view() self.collected_view_sw = self.collected_view.get_scrolled_window() # Init collect view. # init listview page. self.init_listview_page() Dispatcher.connect("change-webcast", self.on_dispatcher_change_webcast) WebcastDB.connect("changed", self.on_db_update_songs) body_paned = HPaned(handle_color=app_theme.get_color("panedHandler"), enable_drag=True) body_paned.add1(self.webcastbar) body_paned.add2(self.page_box) self.add(body_paned)
def __init__(self, db_query): # Init. gtk.VBox.__init__(self) SignalContainer.__init__(self) self.__db_query = db_query self.update_interval = 3000 # 3000 millisecond. self.reload_flag = False self.search_flag = False self.cache_search_list = [] self.cache_search_view = [] self.__selected_tag = {"album": [], "artist": [], "genre": []} Dispatcher.connect("reload-browser", self.on_dispatcher_reload_browser) gobject.timeout_add(self.update_interval, self.on_interval_loaded_view) # The saving song Classification presented to the user. self.artists_view, self.artists_sw = self.get_icon_view(14) self.albums_view, self.albums_sw = self.get_icon_view(14) self.genres_view, self.genres_sw = self.get_icon_view(14) self.folders_view, self.folders_sw = self.get_icon_view(20) self.folders_view.connect("motion-notify-item", self.on_folders_view_motion_notify) # Song list for temporarily storing # self.songs_view, self.songs_view_sw = self.get_song_view() self.songs_view = self.get_song_view() # Classification navigation bar. self.filterbar = OptionBar( [(app_theme.get_pixbuf("filter/artist_normal.png"), app_theme.get_pixbuf("filter/artist_press.png"), _("Artist"), lambda : self.switch_filter_view("artist")), (app_theme.get_pixbuf("filter/album_normal.png"), app_theme.get_pixbuf("filter/album_press.png"), _("Album"), lambda : self.switch_filter_view("album")), (app_theme.get_pixbuf("filter/genre_normal.png"), app_theme.get_pixbuf("filter/genre_press.png"), _("Genre"), lambda : self.switch_filter_view("genre")), (app_theme.get_pixbuf("filter/local_normal.png"), app_theme.get_pixbuf("filter/local_press.png"), _("Folder"), lambda : self.switch_filter_view("folder")) ]) # Manage the media library (import, refresh) self.importbar = SongImportBar() self.importbar.reload_items( [ (_("Quick Scan"), lambda : ImportFolderJob([os.path.expanduser("~")])), (_("Scan"), lambda : ImportFolderJob()), (_("Refresh"), lambda : ReloadDBJob()) ]) # Left box invailed_box = gtk.VBox() invailed_box.set_size_request(-1, 10) left_vbox = gtk.VBox(spacing=10) left_vbox.set_size_request(121, -1) # left_vbox.pack_start(invailed_box, False, True) left_vbox.pack_start(self.filterbar, False, False) left_vbox.pack_start(create_separator_box(), False, False) left_vbox.pack_start(self.importbar, False, False) # Used to switch songs category view, in the right side of the layout. self.switch_view_box = gtk.VBox() self.switch_view_box.add(self.artists_sw) # self.switch_view_box.add(TaskView()) # Control back on a view. self.back_hbox = gtk.HBox() self.back_hbox.set_size_request(-1, 26) self.back_hbox.set_no_show_all(True) self.back_button = BackButton() self.back_button.connect("clicked", self.on_back_button_clicked) self.prompt_button = PromptButton() self.back_hbox.pack_start(self.back_button, False, False, 5) self.back_hbox.pack_start(self.prompt_button, False, False) # searchbar self.search_entry, search_align = self.get_search_entry() search_hbox = gtk.HBox() search_hbox.pack_start(self.back_hbox, False, False) search_hbox.pack_start(create_right_align(), True, True) # search_hbox.pack_start(search_align, False, False) search_hbox_align = gtk.Alignment() search_hbox_align.set_padding(5, 0, 0, 0) search_hbox_align.set(0, 0, 1, 1) search_hbox_align.add(search_hbox) # Layout on the right. content_box = gtk.VBox(spacing=5) content_box.pack_start(search_hbox_align, False, False) content_box.pack_start(self.switch_view_box, True, True) body_paned = HPaned(handle_color=app_theme.get_color("panedHandler"), enable_drag=True) body_paned.add1(left_vbox) body_paned.add2(content_box) self.pack_start(body_paned, True, True)
def __init__(self, db_query): # Init. gtk.VBox.__init__(self) SignalContainer.__init__(self) self.__db_query = db_query self.update_interval = 3000 # 3000 millisecond. self.reload_flag = False self.search_flag = False self.cache_search_list = [] self.cache_search_view = [] self.__selected_tag = {"album": [], "artist": [], "genre": []} Dispatcher.connect("reload-browser", self.on_dispatcher_reload_browser) gobject.timeout_add(self.update_interval, self.on_interval_loaded_view) # The saving song Classification presented to the user. self.artists_view, self.artists_sw = self.get_icon_view(14) self.albums_view, self.albums_sw = self.get_icon_view(14) self.genres_view, self.genres_sw = self.get_icon_view(14) self.folders_view, self.folders_sw = self.get_icon_view(20) self.folders_view.connect("motion-notify-item", self.on_folders_view_motion_notify) # Song list for temporarily storing # self.songs_view, self.songs_view_sw = self.get_song_view() self.songs_view = self.get_song_view() # Classification navigation bar. self.filterbar = OptionBar([ (app_theme.get_pixbuf("filter/artist_normal.png"), app_theme.get_pixbuf("filter/artist_press.png"), _("Artist"), lambda: self.switch_filter_view("artist")), (app_theme.get_pixbuf("filter/album_normal.png"), app_theme.get_pixbuf("filter/album_press.png"), _("Album"), lambda: self.switch_filter_view("album")), (app_theme.get_pixbuf("filter/genre_normal.png"), app_theme.get_pixbuf("filter/genre_press.png"), _("Genre"), lambda: self.switch_filter_view("genre")), (app_theme.get_pixbuf("filter/local_normal.png"), app_theme.get_pixbuf("filter/local_press.png"), _("Folder"), lambda: self.switch_filter_view("folder")) ]) # Manage the media library (import, refresh) self.importbar = SongImportBar() self.importbar.reload_items([ (_("Quick Scan"), lambda: ImportFolderJob([os.path.expanduser("~")])), (_("Scan"), lambda: ImportFolderJob()), (_("Refresh"), lambda: ReloadDBJob()) ]) # Left box invailed_box = gtk.VBox() invailed_box.set_size_request(-1, 10) left_vbox = gtk.VBox(spacing=10) left_vbox.set_size_request(121, -1) # left_vbox.pack_start(invailed_box, False, True) left_vbox.pack_start(self.filterbar, False, False) left_vbox.pack_start(create_separator_box(), False, False) left_vbox.pack_start(self.importbar, False, False) # Used to switch songs category view, in the right side of the layout. self.switch_view_box = gtk.VBox() self.switch_view_box.add(self.artists_sw) # self.switch_view_box.add(TaskView()) # Control back on a view. self.back_hbox = gtk.HBox() self.back_hbox.set_size_request(-1, 26) self.back_hbox.set_no_show_all(True) self.back_button = BackButton() self.back_button.connect("clicked", self.on_back_button_clicked) self.prompt_button = PromptButton() self.back_hbox.pack_start(self.back_button, False, False, 5) self.back_hbox.pack_start(self.prompt_button, False, False) # searchbar self.search_entry, search_align = self.get_search_entry() search_hbox = gtk.HBox() search_hbox.pack_start(self.back_hbox, False, False) search_hbox.pack_start(create_right_align(), True, True) # search_hbox.pack_start(search_align, False, False) search_hbox_align = gtk.Alignment() search_hbox_align.set_padding(5, 0, 0, 0) search_hbox_align.set(0, 0, 1, 1) search_hbox_align.add(search_hbox) # Layout on the right. content_box = gtk.VBox(spacing=5) content_box.pack_start(search_hbox_align, False, False) content_box.pack_start(self.switch_view_box, True, True) body_paned = HPaned(handle_color=app_theme.get_color("panedHandler"), enable_drag=True) body_paned.add1(left_vbox) body_paned.add2(content_box) self.pack_start(body_paned, True, True)
def __init__(self, db_query): SignalContainer.__init__(self) self.__db_query = db_query self.artist_missions_threadpool = MissionThreadPool(5, 1000, self.feedback) self.album_missions_threadpool = MissionThreadPool(5, 1000, self.feedback)
def __init__(self, db_query): gtk.VBox.__init__(self) SignalContainer.__init__(self) self.__db_query = db_query self._tree = {} self.__selected_tag = {"album": [], "artist": [], "genre": []} self.view_mode = ICON_VIEW_MODE self.__search_flag = False self.__song_cache_items = [] self.__cover_cache_items = [] # init widget. self.entry_box = SearchEntry("") self.entry_box.set_size(155, 22) self.entry_box.entry.connect("changed", self.__search_cb) # upper box. self.back_button = self.__create_simple_button("back", self.__switch_to_filter_view) self.back_button.set_no_show_all(True) back_align = gtk.Alignment() back_align.set(0.5, 0.5, 0, 0) back_align.set_padding(0, 0, 0, 10) back_align.add(self.back_button) # path control self.path_combo_box = ComboMenuButton() self.path_combo_box.connect("list-actived", lambda w: self.update_path_list_view()) self.path_combo_box.connect("combo-actived", lambda w, k : self.update_path_filter_view(k)) path_combo_align = gtk.Alignment() path_combo_align.set_padding(0, 0, 10, 0) path_combo_align.add(self.path_combo_box) self.path_combo_box.set_no_show_all(True) upper_box = gtk.HBox(spacing=5) upper_box.pack_start(path_combo_align, False, False) upper_box.pack_start(create_right_align(), True, True) upper_box.pack_start(back_align, False, False) entry_box_align = gtk.Alignment() entry_box_align.set(0.5, 0.5, 0, 0) entry_box_align.set_padding(1, 0, 0, 0) entry_box_align.add(self.entry_box) upper_box.pack_start(entry_box_align, False, False) upper_box_align = gtk.Alignment() upper_box_align.set_padding(0, 10, 0, 10) upper_box_align.set(0.5, 0.5, 1, 1) upper_box_align.connect("expose-event", self.expose_upper_box_mask) upper_box_align.add(upper_box) self.categorybar_status = "artist" self.filter_categorybar = OptionBar( [(app_theme.get_pixbuf("filter/artist_normal.png"), app_theme.get_pixbuf("filter/artist_press.png"), _("By artist"), lambda : self.reload_filter_view("artist", True)), (app_theme.get_pixbuf("filter/album_normal.png"), app_theme.get_pixbuf("filter/album_press.png"), _("By album"), lambda : self.reload_filter_view("album", True)), (app_theme.get_pixbuf("filter/genre_normal.png"), app_theme.get_pixbuf("filter/genre_press.png"), _("By genre"), lambda : self.reload_filter_view("genre", True)),] ) # Song path bar. self.__current_path = None self.current_icon_item = None self.reload_path_flag = True self.path_categorybar = SongPathBar(_("Local")) self.path_categorybar.set_size_request(-1, 205) # Song import bar. self.import_categorybar = SongImportBar() self.import_categorybar.reload_items( [ (_("Scan Home dir"), lambda : ImportFolderJob([os.path.expanduser("~")])), (_("Select dir to scan"), lambda : ImportFolderJob()), (_("Refresh library"), lambda : ReloadDBJob())] ) # iconview. self.filter_view = IconView(10, 10) targets = [("text/deepin-songs", gtk.TARGET_SAME_APP, 1), ("text/uri-list", 0, 2)] self.filter_view.drag_source_set(gtk.gdk.BUTTON1_MASK, targets, gtk.gdk.ACTION_COPY) self.filter_view.connect("drag-data-get", self.__on_drag_data_get) self.filter_view.connect("double-click-item", self.__on_double_click_item) self.filter_view.connect("single-click-item", self.__on_single_click_item) self.filter_view.draw_mask = self.draw_filter_view_mask self.filter_scrolled_window = ScrolledWindow() self.filter_scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) self.filter_scrolled_window.add_child(self.filter_view) # songs_view self.songs_view = MultiDragSongView() self.songs_view.add_titles([_("Title"), _("Artist"), _("Album"), _("Added time")]) self.songs_scrolled_window = ScrolledWindow(0, 0) self.songs_scrolled_window.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) self.songs_scrolled_window.add_child(self.songs_view) # left_vbox align = gtk.Alignment() align.set(0, 1, 0, 0) left_box = gtk.VBox(spacing=10) left_box.set_size_request(140, -1) left_box.pack_start(self.filter_categorybar, False, False) left_box.pack_start(self.create_separator_box(), False, False) left_box.pack_start(self.path_categorybar, False, False) left_box.pack_start(self.create_separator_box(), False, False) left_box.pack_start(self.import_categorybar, False, False) left_box.pack_start(align, True, True) left_box.connect("expose-event", self.expose_left_box_mask) # right_box. self.right_box = gtk.VBox() self.right_box.add(self.filter_scrolled_window) # swith_box right_box_align = gtk.Alignment() right_box_align.set_padding(0, 0, 0, 2) right_box_align.set(1, 1, 1, 1) right_box_align.add(self.right_box) browser_box = gtk.VBox() browser_box.pack_start(upper_box_align, False, False) browser_box.pack_start(right_box_align, True, True) body_box = gtk.HBox() body_box.pack_start(left_box, False, False) body_box.pack_start(browser_box, True, True) self.pack_start(body_box, True, True) self.reload_flag = False Dispatcher.connect("reload-browser", self.reload_browser) gobject.timeout_add(5000, self.interval_reload_browser)