def __init__(self, parent, name, sound, color): super(SoundLayer, self).__init__(parent) print('[+] SoundLayer::__init__') self.setLayout(GridLayout(resolution=4)) self.sound = sound self.cp = Button(self, '') self.color = color self.cp.setBackgroundColor(color) label = Label(self, name + ':', 'sans-bold') label.setFixedSize((70, 20)) self.cp.setFixedSize((20, 40)) self.solomute = Widget(self) self.solomute.setLayout(GridLayout(resolution=3)) self._parent = parent self._focused = False self.issolo = False self.ismute = False self.selected_color = Color(0x3e, 0x3e, 0x3f, 0xff) slider = Slider(self.solomute) slider.setFixedSize((180, 20)) def mute_cb(): print('mute') mute = Button(self.solomute, 'M') mute.setCallback(mute_cb) def solo_cb(): print('solo') solo = Button(self.solomute, 'S') solo.setCallback(solo_cb) spacer = Widget(self) spacer.setWidth(20) self.setFixedSize((400, 40))
class PlaybackWindow(Window): def __init__(self, parent, engine): super(PlaybackWindow, self).__init__(parent, 'Playback') self.setPosition((15, 330)) self.setLayout(GroupLayout()) self.setFixedSize((400, 400)) self.engine = engine Label(self, 'Location', 'sans-bold') panel = Widget(self) panel.setLayout( BoxLayout(Orientation.Horizontal, Alignment.Middle, 0, 0)) self.frametb = TextBox(panel) self.frametb.setFixedSize((100, 25)) self.frametb.setValue('0') self.frametb.setFontSize(14) self.frametb.setAlignment(TextBox.Alignment.Right) self.frametb.setEditable(True) label = Label(panel, ' ', 'sans-bold') label.setFixedSize((15, 15)) label = Label(panel, '/', 'sans-bold') label.setFixedSize((20, 15)) self.total_framestb = TextBox(panel) self.total_framestb.setFixedSize((100, 25)) self.total_framestb.setValue('1000') self.total_framestb.setFontSize(14) self.total_framestb.setAlignment(TextBox.Alignment.Right) self.total_framestb.setEditable(True) Label(self, 'Controls', 'sans-bold') panel = Widget(self) panel.setLayout( BoxLayout(Orientation.Horizontal, Alignment.Minimum, 0, 0)) self.fbw_button = ToolButton(panel, entypo.ICON_CONTROLLER_FAST_BACKWARD) self.fbw_button.setFlags(Button.Flags.NormalButton) self.fbw_button.setCallback(lambda: self._fbw_cb()) self.stop_button = ToolButton(panel, entypo.ICON_CONTROLLER_STOP) self.stop_button.setFlags(Button.Flags.NormalButton) self.stop_button.setCallback(lambda: self._stop_cb()) self.play_button = ToolButton(panel, entypo.ICON_CONTROLLER_PLAY) self.play_button.setFlags(Button.Flags.NormalButton) self.play_button.setCallback(lambda: self._play_cb()) self.ffw_button = ToolButton(panel, entypo.ICON_CONTROLLER_FAST_FORWARD) self.ffw_button.setFlags(Button.Flags.NormalButton) self.ffw_button.setCallback(lambda: self._ffw_cb()) # Label(self, 'View Params', 'sans-bold') Label(self, 'Gamma', 'sans-bold') # panel = Widget(self) sub_panel = Widget(self) sub_panel.setLayout( BoxLayout(Orientation.Horizontal, Alignment.Minimum, 0, 0)) self.gslider = Slider(sub_panel) self.gslider.setFixedSize((180, 20)) self.gslider.setValue((1.0 / 6.0) * 2.0) self.gtb = TextBox(sub_panel) self.gtb.setFixedSize((100, 25)) self.gtb.setValue('2.0') def cb(value): # print (value) self.gtb.setValue('{:.2f}'.format(value * 6.0)) self.engine.set_gamma(value * 6.0) self.gslider.setCallback(cb) def _fbw_cb(self): self.engine.jump_to_frame(max(self.engine.get_cursor() - FFW_AMOUNT, 0)) def _ffw_cb(self): self.engine.jump_to_frame( min(self.engine.get_cursor() + FFW_AMOUNT, self.engine.get_total_frames())) def _play_cb(self): print('Play/Pause') if self.engine.is_playing: self.engine.pause() self.play_button.setIcon(entypo.ICON_CONTROLLER_PLAY) else: self.engine.play() self.play_button.setIcon(entypo.ICON_CONTROLLER_PAUS) def _stop_cb(self): print('Stop') self.engine.pause() self.engine.jump_to_frame(0) self.play_button.setIcon(entypo.ICON_CONTROLLER_PLAY)