def __init__(self): super(Player, self).__init__() self.adjustment = Gtk.Adjustment.new(0.0, 0.0, 100.0, 0.5, 10.0, 0.0) self.adjustment.connect('value-changed', self.on_adjustment_changed) self.progress = Gtk.Scale.new(Gtk.Orientation.HORIZONTAL, self.adjustment) self.progress.set_hexpand(True) self.progress.set_sensitive(False) self.progress.set_draw_value(False) self.progress.connect('button-press-event', self.on_mouse_press) self.progress.connect('button-release-event', self.on_mouse_release) font = Font() font.set_size(8) self.current_time = Gtk.Label('00:00:00.00', xalign=0, xpad=6) self.current_time.modify_font(font.to_pango_desc()) self.changing_time = Gtk.Label(' ', xpad=6) self.changing_time.modify_font(font.to_pango_desc()) self.total_time = Gtk.Label('00:00:00.00', xalign=1, xpad=6) self.total_time.modify_font(font.to_pango_desc()) self.track_label = Gtk.Label(' ') self.play_pause_button = Gtk.Button() self.play_pause_button.set_image(self.play_img) self.play_pause_button.connect('clicked', self.play_pause_action) self.stop_button = Gtk.Button() self.stop_button.set_image(self.stop_img) self.stop_button.connect('clicked', self.stop_action) self.set_column_spacing(6) self.set_row_spacing(3) self.attach(self.track_label, 0, 0, 3, 1) self.attach(self.current_time, 0, 1, 1, 1) self.attach(self.changing_time, 1, 1, 1, 1) self.attach(self.total_time, 2, 1, 1, 1) self.attach(self.progress, 0, 2, 3, 1) self.attach(self.play_pause_button, 3, 2, 1, 1) self.attach(self.stop_button, 4, 2, 1, 1) self.duration = 360000000 self.duration_str = '0' self.player_state = PlayerState.STOPPED self.player = AudioStreamer() self.timeout_id = GObject.timeout_add(1000, self.on_timeout, None) self.mouse_moving = False