Ejemplo n.º 1
0
    def initSlider(self, parent, rect):
        tempSlider = Slider(parent)

        tempSlider.bgColor = color.gray
        tempSlider.vertical = False
        tempSlider.rect = rect
        tempSlider.thumbMinSize = 10
        tempSlider.thumbImage = r'Images\SliderThumb.jpg'

        return tempSlider
Ejemplo n.º 2
0
    def __init__(self):
        Window.__init__(self)

        # Initialization of the C++ DirectShow Library
        self.audioFunctions = AudioFunctions()
        self.audioFunctions.InitDirectShow()

        # Media Information
        self.media = Media()

        # The main window
        self.create(100, 100, 700, 300, caption=True, resize=False)

        # Button for 'OpenFile'
        self._openFileButton = TextButton(self)
        self._openFileButton.rect = (0, 0, 50, 30)
        self._openFileButton.text = 'OpenFile'
        self._openFileButton.background = r'Images\Root_button.png'
        self.autoRemove(self._openFileButton.bind('Click', self._onOpenFile))

        # Button for 'Play' and 'Pause'
        self._triggerButton = TextButton(self)
        self._triggerButton.rect = (60, 0, 50, 30)
        self._triggerButton.text = 'Play'
        self._triggerButton.background = r'Images\Root_button.png'
        self.autoRemove(self._triggerButton.bind('Click', self._onTrigger))

        # Button for 'Stop'
        self._stopButton = TextButton(self)
        self._stopButton.rect = (120, 0, 50, 30)
        self._stopButton.text = 'Stop'
        self._stopButton.background = r'Images\Root_button.png'
        self.autoRemove(self._stopButton.bind('Click', self._onStop))

        # Button for 'Remove'
        self._stopButton = TextButton(self)
        self._stopButton.rect = (450, 0, 50, 30)
        self._stopButton.text = 'Remove'
        self._stopButton.background = r'Images\Root_button.png'
        self.autoRemove(self._stopButton.bind('Click', self._onRemove))

        # PlayTime
        self._playTimeText = Text(self)
        self._playTimeText.autosize = True
        self._playTimeText.text = 'PlayTime'
        self._playTimeText.fontSize = 15
        self._playTimeText.xy = (30, 155)

        # Slider for 'playTime'
        self._playTimeSlider = Slider(self)
        self._playTimeSlider.bgColor = color.gray
        self._playTimeSlider.vertical = False
        self._playTimeSlider.rect = (100, 160, 255, 10)
        self._playTimeSlider.thumbMinSize = 10
        self._playTimeSlider.thumbImage = r'Images\ScrollBarThumb.jpg'
        self.autoRemove(
            self._playTimeSlider.bind('Slide', self._onPlayTimeSlide))
        self.autoRemove(
            self._playTimeSlider.bind('Slide Start',
                                      self._onPlayTimeSlideStart))
        self.autoRemove(
            self._playTimeSlider.bind('Slide End', self._onPlayTimeSlideEnd))

        # Slider for 'Volume'
        self._volumeSlider = Slider(self)
        self._volumeSlider.bgColor = color.gray
        self._volumeSlider.vertical = True
        self._volumeSlider.rect = (400, 50, 10, 100)
        self._volumeSlider.thumbMinSize = 10
        self._volumeSlider.thumbImage = r'Images\ScrollBarThumb.jpg'
        self.autoRemove(self._volumeSlider.bind('Slide', self._onVolumeSlide))

        # Volume
        self._volumeText = Text(self)
        self._volumeText.autosize = True
        self._volumeText.text = 'Volume'
        self._volumeText.fontSize = 15
        self._volumeText.xy = (380, 155)

        # Media Information text
        self._mediaInfoText = Text(self)
        self._mediaInfoText.autosize = True
        self._mediaInfoText.fontSize = 15
        self._mediaInfoText.xy = (20, 45)
        self._mediaInfoText.text = 'FileName: \n' \
                                   'Duration: 0 min 0 sec\n'

        # Media Position text
        self._mediaPositionText = Text(self)
        self._mediaPositionText.autosize = True
        self._mediaPositionText.fontSize = 15
        self._mediaPositionText.xy = (20, 80)
        self._mediaPositionText.text = 'Position: 0 min 0 sec\n'

        # Playlist text
        self._playlistText = Text(self)
        self._playlistText.autosize = True
        self._playlistText.text = 'Playlist'
        self._playlistText.fontSize = 15
        self._playlistText.fontColor = color.blue
        self._playlistText.xy = (450, 30)

        # Restore the playlist from disk
        self.playList = {}
        self.workingDir = os.getcwd()  # Locate the current working directory

        try:
            playListFile = open(self.workingDir + r'\PlayList.pickle', 'rb')
        except IOError:
            print '[AudioBoxWindow::__init__] No Playlist File Found'
        else:
            print '[AudioBoxWindow::__init__] Load Playlist File'
            self.playList = pickle.load(
                playListFile)  # Dictionary storing the playlist
            playListFile.close()

        # Radio button group
        self._platListGroup = Group(self)
        self._platListGroup.xy = (450, 50)
        self._platListGroup.size = (200, 500)
        self._platListGroup.autosize = True

        # Display the playlist
        self.mediaButtonList = []
        self._refreshPlayList()

        # Flag indicating if the playTime slider is sliding
        self.playTimeSliding = False

        self.displayAnim = None
        self.displayAnimRunning = False