Esempio n. 1
0
 def __init__(self, unit):
     super().__init__(unit)
     self.actions.add_action(
         resource.Action('playqueue-high-priority',
                         self.action_priority_cb))
     self.actions.add_action(
         resource.Action('playqueue-normal-priority',
                         self.action_priority_cb))
     self.actions.add_action(
         resource.Action('playqueue-choose-priority',
                         self.action_priority_cb))
     self.actions.add_action(
         resource.Action('playqueue-shuffle',
                         self.action_shuffle_cb,
                         dangerous=True,
                         protector=unit.unit_persistent))
     self.actions.add_action(
         resource.Action('playqueue-go-to-current',
                         self.action_go_to_current_cb))
     self.signal_handler_connect(unit.unit_server.ampd_server_properties,
                                 'notify::current-song',
                                 self.notify_current_song_cb)
     for name in self.actions.list_actions():
         if name.startswith('playqueue-ext-'):
             self.actions.remove(name)
     self.signal_handler_connect(self.treeview, 'cursor-changed',
                                 self.cursor_changed_cb)
     self.cursor_by_profile = {}
     self.set_cursor = False
Esempio n. 2
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.db = SearchDatabase(self.name)

        self.actions.add_action(
            resource.Action('savedsearch-new', self.action_search_new_cb))
        self.actions.add_action(
            resource.Action('savedsearch-edit', self.action_search_edit_cb))
        self.actions.add_action(
            resource.Action('savedsearch-delete',
                            self.action_search_delete_cb))

        self.left_store = Gtk.ListStore()
        self.left_store.set_column_types([str])
        self.left_treeview.set_model(self.left_store)
        self.left_treeview.append_column(
            Gtk.TreeViewColumn(
                None,
                Gtk.CellRendererPixbuf(
                    icon_name='folder-saved-search-symbolic')))
        self.left_treeview.append_column(
            Gtk.TreeViewColumn(_("Saved search name"),
                               Gtk.CellRendererText(),
                               text=0))
        self.left_treeview.connect('row-activated',
                                   self.left_treeview_row_activated_cb)

        self.current_search = None
        self.setup_searches()
Esempio n. 3
0
    def __init__(self, unit):
        self.box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, visible=True)

        super().__init__(unit)

        self.current_tanda = None
        self.current_tanda_path = None

        self.actions.add_action(
            resource.Action('tanda-delete', self.action_tanda_delete_cb))
        self.actions.add_action(
            resource.Action('tanda-reset', self.action_tanda_reset_cb))
        self.actions.add_action(
            resource.Action('tanda-reset-field', self.action_tanda_field_cb))
        self.actions.add_action(
            resource.Action('tanda-fill-field', self.action_tanda_field_cb))

        self.tanda_treeview = data.RecordTreeView(self.unit.db.fields,
                                                  self.tanda_data_func, True)
        self.tanda_treeview.set_name('tanda-treeview')
        self.tanda_treeview.connect('button-press-event',
                                    self.tanda_treeview_button_press_event_cb)
        self.setup_context_menu('tanda-edit.left-context', self.tanda_treeview)
        self.init_tandaid_treeview(self.tanda_treeview)

        for name in self.unit.db.fields.basic_names:
            col = self.tanda_treeview.cols[name]
            col.renderer.set_property('editable', True)
            col.renderer.connect('editing-started',
                                 self.renderer_editing_started_cb, name)
        self.tanda_store = self.tanda_treeview.get_model()
        self.tanda_treeview.connect('cursor-changed',
                                    self.tanda_treeview_cursor_changed_cb)
        self.tanda_filter = data.TreeViewFilter(self.unit.unit_misc,
                                                self.tanda_treeview)

        self.actions.remove('filter')
        self.actions.add_action(
            Gio.PropertyAction(name='filter',
                               object=self.tanda_filter,
                               property_name='active'))

        self.treeview.set_vexpand(False)
        self.treeview_filter.scroller.set_policy(Gtk.PolicyType.AUTOMATIC,
                                                 Gtk.PolicyType.NEVER)

        self.box.pack_start(self.tanda_filter, True, True, 0)
        super().add(self.box)

        self.queue = []
Esempio n. 4
0
    def __init__(self, unit):
        self.fields = unit.fields

        super().__init__(unit)

        self.actions.add_action(
            resource.Action('stream-add', self.action_add_cb))
        self.actions.add_action(
            resource.Action('stream-modify', self.action_modify_cb))

        self.signal_handler_connect(
            self.unit.unit_server.ampd_server_properties,
            'notify::current-song', self.notify_current_song_cb)

        self.load_streams()
Esempio n. 5
0
    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        self.actions.add_action(resource.Action('playlist-rename', self.action_playlist_rename_cb))
        self.actions.add_action(resource.Action('playlist-delete', self.action_playlist_delete_cb))
        self.actions.add_action(resource.Action('playlist-update-from-queue', self.action_playlist_update_from_queue_cb))

        self.playlist_names = []
        self.modified = False

        self.left_store = Gtk.ListStore()
        self.left_store.set_column_types([str])
        self.left_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE)
        self.left_treeview.set_model(self.left_store)
        self.left_treeview.insert_column_with_attributes(0, '', Gtk.CellRendererPixbuf(icon_name='view-list-symbolic'))
        self.left_treeview.insert_column_with_data_func(1, _("Playlist name"), Gtk.CellRendererText(), self.playlist_name_data_func)
        self.left_treeview.connect('row-activated', self.left_treeview_row_activated_cb)
Esempio n. 6
0
    def __init__(self, unit):
        super().__init__(unit)
        widget = self.get_child()
        self.remove(widget)

        self.entry = Gtk.SearchEntry(visible=True)
        self.entry.connect('activate', self.entry_activate_cb)
        self.entry.connect('focus-in-event', self.entry_focus_cb)
        self.entry.connect('focus-out-event', self.entry_focus_cb)
        self.field_choice = Gtk.ComboBoxText(visible=True)
        self.field_choice.append_text(_("any field"))
        for name in self.fields.names:
            self.field_choice.append_text(name)
        box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL, visible=True)
        box.add(widget)
        box.add(self.entry)
        self.add(box)

        self.connect('map', self.action_search_cb)
        self.actions.add_action(
            resource.Action('search', self.action_search_cb))
Esempio n. 7
0
 def __init__(self, unit):
     super().__init__(unit)
     self.actions.add_action(
         resource.Action('add-separator', self.action_add_separator_cb))
     self.actions.add_action(
         resource.Action('add-url', self.action_add_url_cb))
Esempio n. 8
0
    def __init__(self, unit):
        super().__init__(unit)

        self.all_tandas = self.filtered_tandas = []
        self.selected_artists = ['*']

        self.left_store = Gtk.ListStore(str)
        self.left_treeview.set_model(self.left_store)
        self.left_treeview.insert_column_with_attributes(
            0, _("Artist"), Gtk.CellRendererText(), text=0)
        self.left_treeview.get_selection().set_mode(Gtk.SelectionMode.MULTIPLE)

        self.button_box = Gtk.ButtonBox(orientation=Gtk.Orientation.HORIZONTAL,
                                        layout_style=Gtk.ButtonBoxStyle.START,
                                        visible=True)
        self.actions.add_action(
            Gio.PropertyAction(name='genre-filter',
                               object=self,
                               property_name='genre-filter'))
        for i, genre in enumerate(self.GENRES):
            button = Gtk.ModelButton(iconic=True,
                                     text=genre,
                                     centered=True,
                                     visible=True,
                                     can_focus=False,
                                     action_name='supermod.genre-filter',
                                     action_target=GLib.Variant.new_int32(i))
            self.button_box.pack_start(button, False, False, 0)
        self.connect('notify::genre-filter',
                     lambda *args: self.filter_tandas(False))

        self.problem_button = Gtk.ToggleButton(
            image=Gtk.Image(icon_name='object-select-symbolic'),
            visible=True,
            can_focus=False,
            active=unit.unit_persistent.protected,
            tooltip_text=_("Filter zero note"))
        self.problem_button.connect('toggled',
                                    lambda *args: self.filter_tandas(False))

        self.stack = Gtk.Stack(
            visible=True, transition_type=Gtk.StackTransitionType.CROSSFADE)
        self.switcher = Gtk.StackSwitcher(visible=True, stack=self.stack)

        self.button_box.pack_end(self.problem_button, False, False, 0)
        self.button_box.set_child_secondary(self.problem_button, True)
        self.button_box.pack_end(self.switcher, False, False, 0)
        self.button_box.set_child_secondary(self.switcher, True)

        self.right_box = Gtk.Box(orientation=Gtk.Orientation.VERTICAL,
                                 visible=True)
        self.right_box.pack_start(self.button_box, False, False, 0)
        self.right_box.add(self.stack)
        self.add(self.right_box)

        self.edit = TandaEdit(unit)
        self.view = TandaView(unit)
        self.stack.add_titled(self.edit, 'edit', _("Edit tandas"))
        self.stack.add_titled(self.view, 'view', _("View tandas"))
        self.sub_components = [self.edit, self.view]
        for c in self.sub_components:
            self.bind_property(
                'current-tandaid', c, 'current-tandaid',
                GObject.BindingFlags.BIDIRECTIONAL
                | GObject.BindingFlags.SYNC_CREATE)

        self.signal_handler_connect(self.unit.db, 'changed',
                                    self.db_changed_cb)
        self.signal_handler_connect(self.unit.db, 'verify-progress',
                                    self.db_verify_progress_cb)
        self.signal_handler_connect(self.unit.db, 'missing-song',
                                    self.db_missing_song_cb)

        self.actions.add_action(
            resource.Action('tanda-switch-subcomponent',
                            self.action_sub_component_next_cb))
        self.actions.add_action(
            resource.Action('tanda-verify',
                            self.unit.db.action_tanda_verify_cb))
        self.actions.add_action(
            resource.Action('tanda-cleanup-db',
                            self.unit.db.action_cleanup_db_cb))

        self.signal_handler_connect(
            self.unit.unit_persistent, 'notify::protected',
            lambda unit_persistent, param_spec: unit_persistent.protected and
            self.problem_button.set_active(True))

        self.read_db()