class VideoPlayer(BaseWidget): def __init__(self): super(VideoPlayer, self).__init__('Video Player') #Defnition of the form fields # self._dirname = ControlText('Directory', 'Default Value') self._button_play = ControlButton("Play") self._button_play.value = self.__play_all self._button_pause = ControlButton("Pause") self._button_pause.value = self.__pause_all self._button_refresh = ControlButton("Reload") self._button_refresh.value = self.__refresh_all self._button_print = ControlButton("Print") self._button_print.value = self.__print_value # self.formset = [{'Tab1':['_dirname'],},'_button'] # self._directory = ControlDir('Choose a directory') self._file1 = ControlFile('File 1') self._file2 = ControlFile('File 2') # print(self._file.value) self._filetree = ControlFilesTree('Choose a file') # self._filetree.value = 'C:\\Users\\Ashwini Naik\\Videos\\Captures' # self._checkbox = ControlCheckBox('Choose a directory') # self._checkboxList = ControlCheckBoxList('Choose a file') self._player = ControlPlayer('Choose a file') self._player1 = ControlPlayer('Choose a file') # self._slider = ControlSlider('Slider') self._player.value = '_file.value' # self._player.refresh() self.formset = [('_button_play', '_button_pause', '_button_refresh'), ('_file1', '_file2'), ('_player', '_player1')] # self._control.changed_event = self.__print_value def __print_value(self): print("Player 1" + self._player.value) print("Player 2" + self._player1.value) print("File 1" + self._file1.value) print("File 2" + self._file2.value) def __play_all(self): self._player.show() self._player.value = self._file1.value self._player1.show() self._player1.value = self._file2.value self._player.play() self._player1.play() def __pause_all(self): self._player.stop() self._player1.stop() def __refresh_all(self): self._player.value = self._file1.value self._player1.value = self._file2.value
class Example1(BaseWidget): def __init__(self): super(Example1, self).__init__('dir examples') self.parent = None self._directory = ControlDir('Choose a directory') self._file = ControlFile('Choose a file') self._filetree = ControlFilesTree('Choose a file') self._image = ControlImage('Image') self._boundaries = ControlBoundingSlider('Bounding', horizontal=True) self._button = ControlButton('Click') self._button.value = self.onButtonClick # self._directory.value=self.onButtonClick self._checkbox = ControlCheckBox('Choose a directory') self._checkboxList = ControlCheckBoxList('Choose a file') self._player = ControlPlayer('Choose a file') self._slider = ControlSlider('Slider') self._player.show() self._checkboxList.value = [('Item 1', True), ('Item 2', False), ('Item 3', True)] self._combobox = ControlCombo('Choose a item') self._list = ControlList('List label') self._progress = ControlProgress('Progress bar') self._visvisVolume = ControlVisVisVolume('Visvis') self._timeline = ControlEventTimeline('Timeline') self._combobox.add_item('Item 1', 'Value 1') self._combobox.add_item('Item 2', 'Value 2') self._combobox.add_item('Item 3', 'Value 3') self._combobox.add_item('Item 4') self._list.value = [('Item1', 'Item2', 'Item3',), ('Item3', 'Item4', 'Item5',)] imageWithVolume = np.zeros((100, 100, 100), np.uint8) imageWithVolume[30:40, 30:50, :] = 255 imageWithVolume[30:40, 70:72, :] = 255 self._visvisVolume.value = imageWithVolume self._visvis = ControlVisVis('Visvis') values1 = [(i, random.random(), random.random()) for i in range(130)] values2 = [(i, random.random(), random.random()) for i in range(130)] self._visvis.value = [values1, values2] self.formset = [ '_visvis' , '_directory' , '_button' , '_file' , '_boundaries' , '_filetree' , '_image' , '_slider' , ('_checkboxList', '_player') , ('_checkbox', ' ') , ('_combobox', ' ') , '_progress' , '=' , ('_visvisVolume', '||', '_list') , '_timeline' ] def onButtonClick(self): self._filetree.value = self._directory.value