def __init__(self): self.desktop_lyrics_win = DesktopLyrics() self.desktop_lyrics_win.connect("moved", self.adjust_toolbar_rect) self.desktop_lyrics_win.connect("resized", self.adjust_toolbar_rect) self.desktop_lyrics_win.connect("hide-bg", self.hide_toolbar) self.desktop_lyrics_win.connect("show-bg", self.show_toolbar) self.desktop_lyrics_win.connect("button-press-event", self.popup_desktop_right_menu) self.desktop_lyrics_win.connect("configure-event", self.lyrics_desktop_configure_event) self.scroll_lyrics = ScrollLyrics() self.scroll_lyrics.connect("configure-event", self.lyrcis_scroll_configure_event) self.scroll_lyrics.revert_button.connect( "clicked", lambda w: self.switch_to_desktop_lyrics()) self.scroll_lyrics.connect("seek", self.seek_cb) self.scroll_lyrics.connect("right-press", self.scroll_right_press_cb) Player.connect("instant-new-song", self.instant_update_lrc) Player.connect("played", self.play_time_source) Player.connect("paused", self.pause_time_source) Player.connect("play-end", self.pause_time_source) Dispatcher.connect("reload-lrc", self.update_lrc) Dispatcher.connect("unlock-lyrics", self.__unlock_lyrics) Dispatcher.connect("lock-lyrics", self.__lock_lyrics) Dispatcher.connect("show-lyrics", lambda w: self.run()) Dispatcher.connect("close-lyrics", lambda w: self.hide_all()) Dispatcher.connect("search-lyrics", lambda w: self.open_search_window(w)) Dispatcher.connect("dialog-run", self.on_dialog_run) Dispatcher.connect("dialog-close", self.on_dialog_close) config.connect("config-changed", self.on_config_changed) self.lrc_manager = LrcManager() self.lrc = LrcParser() self.search_ui = SearchUI() self.lrc_id = -1 self.lrc_next_id = -1 self.current_line = 0 self.message_source = None self.time_source = None self.song_duration = 0 self.__find_flag = False self.__lyrics_mode = config.getint("lyrics", "mode") self.__dialog_locked_flag = False self.init_toolbar() self.current_song = None self.next_lrc_to_download = None self.condition = threading.Condition() self.thread = threading.Thread(target=self.func_thread) self.thread.setDaemon(True) self.thread.start()
def __init__(self): super(ScrollLyrics, self).__init__( _("Lyrics window"), 300, 200, DIALOG_MASK_GLASS_PAGE, self.hide_all, False, gtk.gdk.WINDOW_TYPE_HINT_NORMAL, gtk.WIN_POS_CENTER, False, True, ) self.revert_button = ImageButton( app_theme.get_pixbuf("scroll_lyrics/revert_normal.png"), app_theme.get_pixbuf("scroll_lyrics/revert_hover.png"), app_theme.get_pixbuf("scroll_lyrics/revert_press.png"), ) self.titlebar.button_box.pack_start(self.revert_button, False, False) self.titlebar.button_box.reorder_child(self.revert_button, 0) self.percentage = 0.0 self.whole_lyrics = [] self.message_text = "%s for %s" % (_("DMusic"), "Linux Deepin") self.current_lyric_id = -1 self.line_count = 20 self.active_color = self.get_render_color(True) self.inactive_color = self.get_render_color() self.bg_color = (1, 1, 1) self.font_name = "文泉驿微米黑 10" self.line_margin = 1 self.padding_x = 20 self.padding_y = 10 self.bg_opacity = 0.9 self.frame_width = 7 self.text = "" self.can_seek = True self.seeking = False self.current_pointer_y = 0 self.saved_lyric_id = -1 self.saved_seek_offset = 0 self.saved_pointer_y = 0 self.drawing = gtk.EventBox() self.drawing.set_visible_window(False) self.drawing.set_app_paintable(True) self.drawing.connect_after("expose-event", self.expose_cb) self.drawing.connect("button-press-event", self.button_press_cb) self.drawing.connect("button-release-event", self.button_release_cb) self.drawing.connect("motion-notify-event", self.motion_notify_cb) self.titlebar.close_button.connect("clicked", lambda w: self.hide_and_emit()) self.body_box.add(self.drawing) self.update_line_height() config.connect("config-changed", self.changed_scroll_status)
def __init__(self): config.connect("config-changed", self.__on_config_changed) self.keybinder = GlobalKey() for field in self.func.keys(): keystr = config.get("globalkey", field) if keystr: self.__bind(keystr, field) config.set("globalkey", "%s_last" % field, keystr) self.keybinder.start()
def __init__(self): gtk.Window.__init__(self, gtk.WINDOW_POPUP) self.set_property("allow-shrink", True) self.set_skip_taskbar_hint(True) self.set_decorated(False) self.set_skip_pager_hint(True) self.set_app_paintable(True) self.set_colormap(gtk.gdk.Screen().get_rgba_colormap()) self.render_lyrics = RenderContextNew() self.bg_pixbuf = app_theme.get_pixbuf("lyric/bg.png").get_pixbuf() self.line_padding = 0.0 self.dock_drag_state = DRAG_NONE self.padding_x = self.padding_y = 10 self.old_x = self.old_y = self.old_width = 0 self.mouse_x = self.mouse_y = 0 self.raw_x, self.raw_y = self.get_position() self.mouse_over = False self.mouse_over_lyrics = False self.fade_in_size = 20.0 self.max_line_count = 2 self.active_lyric_surfaces = [None, None] self.inactive_lyric_surfaces = [None, None] self.lyrics_text = [_("DMusic"), "for Linux Deepin"] self.lyric_rects = [gtk.gdk.Rectangle(0, 0, 0, 0), gtk.gdk.Rectangle(0, 0, 0, 0)] self.lyrics_xpos = [0, 0] self.line_alignment = LINE_ALIGNMENT[config.get("lyrics", "double_line_align")] self.line_percentage = [0.0, 0.0] self.current_line = 0 self.time_source = 0 for i in range(self.get_line_count()): self.update_lyric_surface(i) width = self.adjust_window_height() self.set_default_size(600, int(width)) # Add events. self.add_events( gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.LEAVE_NOTIFY_MASK ) self.connect("button-press-event", self.button_press) # TRY self.connect("button-release-event", self.button_release) self.connect("motion-notify-event", self.motion_notify) self.connect("enter-notify-event", self.enter_notify) self.connect("leave-notify-event", self.leave_notify) self.connect("expose-event", self.expose_before) self.connect("realize", self.on_realize_event) config.connect("config-changed", self.update_render_color) self.time_source = gobject.timeout_add(200, self.check_mouse_leave)
def __init__(self): self.desktop_lyrics_win = DesktopLyrics() self.desktop_lyrics_win.connect("moved", self.adjust_toolbar_rect) self.desktop_lyrics_win.connect("resized", self.adjust_toolbar_rect) self.desktop_lyrics_win.connect("hide-bg", self.hide_toolbar) self.desktop_lyrics_win.connect("show-bg", self.show_toolbar) self.desktop_lyrics_win.connect("button-press-event", self.popup_desktop_right_menu) self.desktop_lyrics_win.connect("configure-event", self.lyrics_desktop_configure_event) self.scroll_lyrics = ScrollLyrics() self.scroll_lyrics.connect("configure-event", self.lyrcis_scroll_configure_event) self.scroll_lyrics.revert_button.connect("clicked", lambda w: self.switch_to_desktop_lyrics()) self.scroll_lyrics.connect("seek", self.seek_cb) self.scroll_lyrics.connect("right-press", self.scroll_right_press_cb) Player.connect("instant-new-song", self.instant_update_lrc) Player.connect("played", self.play_time_source) Player.connect("paused", self.pause_time_source) Player.connect("play-end", self.pause_time_source) Dispatcher.connect("reload-lrc", self.update_lrc) Dispatcher.connect("unlock-lyrics", self.__unlock_lyrics) Dispatcher.connect("lock-lyrics", self.__lock_lyrics) Dispatcher.connect("show-lyrics", lambda w : self.run()) Dispatcher.connect("close-lyrics", lambda w: self.hide_all()) Dispatcher.connect("search-lyrics", lambda w: self.open_search_window(w)) Dispatcher.connect("dialog-run", self.on_dialog_run) Dispatcher.connect("dialog-close", self.on_dialog_close) config.connect("config-changed", self.on_config_changed) self.lrc_manager = LrcManager() self.lrc = LrcParser() self.search_ui = SearchUI() self.lrc_id = -1 self.lrc_next_id = -1 self.current_line = 0 self.message_source = None self.time_source = None self.song_duration = 0 self.__find_flag = False self.__lyrics_mode = config.getint("lyrics", "mode") self.__dialog_locked_flag = False self.init_toolbar() self.current_song = None self.next_lrc_to_download = None self.condition = threading.Condition() self.thread = threading.Thread(target=self.func_thread) self.thread.setDaemon(True) self.thread.start()
def __init__(self): gtk.Window.__init__(self, gtk.WINDOW_POPUP) self.set_property("allow-shrink", True) self.set_skip_taskbar_hint(True) self.set_decorated(False) self.set_skip_pager_hint(True) self.set_app_paintable(True) self.set_colormap(gtk.gdk.Screen().get_rgba_colormap()) self.render_lyrics = RenderContextNew() self.bg_pixbuf = app_theme.get_pixbuf("lyric/bg.png").get_pixbuf() self.line_padding = 0.0 self.dock_drag_state = DRAG_NONE self.padding_x = self.padding_y = 10 self.old_x = self.old_y = self.old_width = 0 self.mouse_x = self.mouse_y = 0 self.raw_x, self.raw_y = self.get_position() self.mouse_over = False self.mouse_over_lyrics = False self.fade_in_size = 20.0 self.max_line_count = 2 self.active_lyric_surfaces = [None, None] self.inactive_lyric_surfaces = [None, None] self.lyrics_text = [_("DMusic"), "for Linux Deepin"] self.lyric_rects = [gtk.gdk.Rectangle(0, 0, 0, 0), gtk.gdk.Rectangle(0, 0, 0, 0)] self.lyrics_xpos = [0, 0] self.line_alignment = LINE_ALIGNMENT[config.get("lyrics", "double_line_align")] self.line_percentage = [0.0, 0.0] self.current_line = 0 self.time_source = 0 for i in range(self.get_line_count()): self.update_lyric_surface(i) width = self.adjust_window_height() self.set_default_size(600, int( width)) # Add events. self.add_events(gtk.gdk.BUTTON_PRESS_MASK | gtk.gdk.BUTTON_RELEASE_MASK | gtk.gdk.POINTER_MOTION_MASK | gtk.gdk.ENTER_NOTIFY_MASK | gtk.gdk.LEAVE_NOTIFY_MASK) self.connect("button-press-event", self.button_press) # TRY self.connect("button-release-event", self.button_release) self.connect("motion-notify-event", self.motion_notify) self.connect("enter-notify-event", self.enter_notify) self.connect("leave-notify-event", self.leave_notify) self.connect("expose-event", self.expose_before) self.connect("realize", self.on_realize_event) config.connect("config-changed", self.update_render_color) self.time_source = gobject.timeout_add(200, self.check_mouse_leave)
def __init__(self): super(ScrollLyrics, self).__init__(_("Lyrics window"), 300, 200, DIALOG_MASK_GLASS_PAGE, self.hide_all, False, gtk.gdk.WINDOW_TYPE_HINT_NORMAL, gtk.WIN_POS_CENTER, False, True ) self.revert_button = ImageButton( app_theme.get_pixbuf("scroll_lyrics/revert_normal.png"), app_theme.get_pixbuf("scroll_lyrics/revert_hover.png"), app_theme.get_pixbuf("scroll_lyrics/revert_press.png"), ) self.titlebar.button_box.pack_start(self.revert_button, False, False) self.titlebar.button_box.reorder_child(self.revert_button, 0) self.percentage = 0.0 self.whole_lyrics = [] self.message_text = "%s for %s" % (_("DMusic"), "Linux Deepin") self.current_lyric_id = -1 self.line_count = 20 self.active_color = self.get_render_color(True) self.inactive_color = self.get_render_color() self.bg_color = (1, 1, 1) self.font_name = "文泉驿微米黑 10" self.line_margin = 1 self.padding_x = 20 self.padding_y = 10 self.bg_opacity= 0.9 self.frame_width = 7 self.text = "" self.can_seek = True self.seeking = False self.current_pointer_y = 0 self.saved_lyric_id = -1 self.saved_seek_offset = 0 self.saved_pointer_y = 0 self.drawing = gtk.EventBox() self.drawing.set_visible_window(False) self.drawing.set_app_paintable(True) self.drawing.connect_after("expose-event", self.expose_cb) self.drawing.connect("button-press-event", self.button_press_cb) self.drawing.connect("button-release-event", self.button_release_cb) self.drawing.connect("motion-notify-event", self.motion_notify_cb) self.titlebar.close_button.connect("clicked", lambda w: self.hide_and_emit()) self.body_box.add(self.drawing) self.update_line_height() config.connect("config-changed", self.changed_scroll_status)
def __init__(self): super(LyricBoard, self).__init__() # self.fontdes = pango.FontDescription(fontdes) self.connect("expose_event", self.on_expose) # 不是同一个config # self.config = Config() # self.config.load() # 读入 config.load() # 先读入,不然什么都找不到 # config.connect("config-changed", self.draw) config.connect("config-changed", self.get_font_and_bgcolor) # --------------- logger -------------- self.logger = logging.getLogger("lyricboard") # 低于level的log会被抛弃 self.logger.setLevel(logging.DEBUG) formatter = logging.Formatter("%(levelname)-8s %(message)s") handler = logging.StreamHandler() handler.setFormatter(formatter) # add some handler to log self.logger.addHandler(handler) handler = logging.FileHandler('lyricboard', 'w') handler.setFormatter(formatter) self.logger.addHandler(handler) # self.logger.debug("hello world") # 初始化字体和颜色 self.get_font_and_bgcolor() # 定时滚动歌词 gobject.timeout_add(1000, self.on_time_out) self.time_count = 0 # 当前播放时刻,定时查询 self.current_play_time = None self.current_lyric = None self.current_linecount = None self.lyrictext = parser.text
def __init__(self): super(DesktopLyricsSetting, self).__init__() self.render_lyrics = RenderContextNew() main_align = gtk.Alignment() main_align.set(1, 1, 0, 0) main_align.set_padding(20, 0, 0, 0) main_align.add(self.create_style_table()) self.pack_start(main_align, False, False) self.preview = gtk.EventBox() self.preview.set_visible_window(False) self.preview.set_size_request(-1, 135) preview_align = gtk.Alignment() preview_align.set(0.0, 0.0, 1.0, 1.0) preview_align.set_padding(0, 10, 5, 5) preview_align.add(self.preview) # self.pack_start(preview_align, False, True) # Signals. self.preview.connect("expose-event", self.draw_lyrics) self.font_name_combo_box.connect("item-selected", self.update_preview_font_name) self.font_type_combo_box.connect("item-selected", self.update_preview_font_type) self.font_size_spin.connect("value-changed", self.update_preview_font_size) self.line_number_combo_box.connect("item-selected", self.update_preview_line_number) self.single_align_combo_box.connect("item-selected", self.update_preview_single_align) self.double_align_combo_box.connect("item-selected", self.update_preview_double_align) self.outline_spin.connect("value-changed", self.update_preview_outline_width) self.blur_color_button.connect("color-select", self.update_blur_color) self.predefine_color_combo_box.connect("item-selected", self.update_preview_predefine_color) self.inactive_upper_color_button.connect("color-select", self.update_inactive_upper_color) self.inactive_middle_color_button.connect("color-select", self.update_inactive_middle_color) self.inactive_bottom_color_button.connect("color-select", self.update_inactive_bottom_color) self.active_upper_color_button.connect("color-select", self.update_active_upper_color) self.active_middle_color_button.connect("color-select", self.update_active_middle_color) self.active_bottom_color_button.connect("color-select", self.update_active_bottom_color) config.connect("config-changed", self.on_config_changed)
def __init__(self): config.connect("config-changed", self.__on_config_changed) self.bind_flag = False
def __init__(self): super(EqualizerWindow, self).__init__(_("Equalizer"), 372, 168, DIALOG_MASK_SINGLE_PAGE, close_callback=self.hide_all, modal=False, window_hint=None, skip_taskbar_hint=False) self.manual_flag = False try: pre_value = float(config.get("equalizer", "preamp")) except: pre_value = 0.6 pre_adjust = gtk.Adjustment(value=pre_value, lower=-10, upper=10, step_incr=0.1, page_incr=1, page_size=0) self.preamp_scale = PreampScalebar() self.preamp_scale.scalebar.set_adjustment(pre_adjust) pre_adjust.connect("value-changed", self.preamp_change) self.connect("configure-event", self.equalizer_configure_event) control_box = gtk.HBox(spacing=10) control_box.pack_start(self.preamp_scale, False, False) self.__scales = {} for i, label in enumerate( ["32", "64", "125", "250", "500", "1k", "2k", "4k", "8k", "16k"]): slipper_scale = SlipperScalebar(label) try: value = float( config.get("equalizer", "equalizer-band%s" % str(i))) except: value = 0.0 adjust = gtk.Adjustment(value=value, lower=-12, upper=12, step_incr=0.1, page_incr=1, page_size=0) adjust.changed_id = adjust.connect("value-changed", self.__on_adjust_change, i) slipper_scale.scalebar.set_adjustment(adjust) self.__scales[i] = slipper_scale.scalebar control_box.pack_start(slipper_scale, False, False) try: self.__equalizer = gst.element_factory_make("equalizer-10bands") except gst.PluginNotFoundError: self.__equalizer = None self.logerror( "Equalizer support requires gstreamer-plugins-bad (>= 0.10.5)") else: Player.bin.xfade_add_filter(self.__equalizer) for i in range(0, 10): try: value = float( config.get("equalizer", "equalizer-band%s" % str(i))) except: value = 0 self.__equalizer.set_property("band" + str(i), float(value)) Player.bin.connect("tee-removed", self.__on_remove) config.connect("config-changed", self.__on_config_change) self.active_button = Button(_("Close")) self.active_button.connect("clicked", self.hide_win) self.reset_button = Button(_("Reset")) self.reset_button.connect("clicked", self.set_default_value) self.predefine_button = Button(_("Predefined")) self.predefine_button.connect("clicked", self.show_predefine) self.predefine_combo_box = ComboBox( [(value, key) for key, value in mandatory_i18n.items()], 250, select_index=self.get_selected_index()) self.predefine_combo_box.connect("item-selected", self.set_predefine_value) control_box_align = gtk.Alignment() control_box_align.set(0.0, 0.0, 1.0, 1.0) control_box_align.set_padding(10, 20, 15, 15) control_box_align.add(control_box) main_align = gtk.Alignment() main_align.set(0.0, 0.0, 1.0, 1.0) main_align.set_padding(0, 5, 2, 2) main_box = gtk.VBox(spacing=5) main_align.add(main_box) main_box.add(control_box_align) self.body_box.pack_start(main_align, True, True) self.left_button_box.set_buttons([self.predefine_combo_box]) self.right_button_box.set_buttons( [self.reset_button, self.active_button])
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)
def __init__(self): super(EqualizerWindow, self).__init__( _("Equalizer"), 372, 168, DIALOG_MASK_SINGLE_PAGE, close_callback=self.hide_all, modal=False, window_hint=None, skip_taskbar_hint=False, ) self.manual_flag = False try: pre_value = float(config.get("equalizer", "preamp")) except: pre_value = 0.6 pre_adjust = gtk.Adjustment(value=pre_value, lower=-10, upper=10, step_incr=0.1, page_incr=1, page_size=0) self.preamp_scale = PreampScalebar() self.preamp_scale.scalebar.set_adjustment(pre_adjust) pre_adjust.connect("value-changed", self.preamp_change) self.connect("configure-event", self.equalizer_configure_event) control_box = gtk.HBox(spacing=10) control_box.pack_start(self.preamp_scale, False, False) self.__scales = {} for i, label in enumerate(["32", "64", "125", "250", "500", "1k", "2k", "4k", "8k", "16k"]): slipper_scale = SlipperScalebar(label) try: value = float(config.get("equalizer", "equalizer-band%s" % str(i))) except: value = 0.0 adjust = gtk.Adjustment(value=value, lower=-12, upper=12, step_incr=0.1, page_incr=1, page_size=0) adjust.changed_id = adjust.connect("value-changed", self.__on_adjust_change, i) slipper_scale.scalebar.set_adjustment(adjust) self.__scales[i] = slipper_scale.scalebar control_box.pack_start(slipper_scale, False, False) try: self.__equalizer = gst.element_factory_make("equalizer-10bands") except gst.PluginNotFoundError: self.__equalizer = None self.logerror("Equalizer support requires gstreamer-plugins-bad (>= 0.10.5)") else: Player.bin.xfade_add_filter(self.__equalizer) for i in range(0, 10): try: value = float(config.get("equalizer", "equalizer-band%s" % str(i))) except: value = 0 self.__equalizer.set_property("band" + str(i), float(value)) Player.bin.connect("tee-removed", self.__on_remove) config.connect("config-changed", self.__on_config_change) self.active_button = Button(_("Close")) self.active_button.connect("clicked", self.hide_win) self.reset_button = Button(_("Reset")) self.reset_button.connect("clicked", self.set_default_value) self.predefine_button = Button(_("Predefined")) self.predefine_button.connect("clicked", self.show_predefine) self.predefine_combo_box = ComboBox( [(value, key) for key, value in mandatory_i18n.items()], 250, select_index=self.get_selected_index() ) self.predefine_combo_box.connect("item-selected", self.set_predefine_value) control_box_align = gtk.Alignment() control_box_align.set(0.0, 0.0, 1.0, 1.0) control_box_align.set_padding(10, 20, 15, 15) control_box_align.add(control_box) main_align = gtk.Alignment() main_align.set(0.0, 0.0, 1.0, 1.0) main_align.set_padding(0, 5, 2, 2) main_box = gtk.VBox(spacing=5) main_align.add(main_box) main_box.add(control_box_align) self.body_box.pack_start(main_align, True, True) self.left_button_box.set_buttons([self.predefine_combo_box]) self.right_button_box.set_buttons([self.reset_button, self.active_button])
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 Order")) 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)