def __init__(self): Window.__init__(self) # The main window self.create(100, 100, 500, 500, caption=True, minmax=False, resize=False) # The color data implements observable protocol self.color = ColorData() # Instantiation and Initialization of the components self.initText(self, 'R', (80, 45, 15, 15)) self.initText(self, 'G', (80, 65, 15, 15)) self.initText(self, 'B', (80, 85, 15, 15)) self.initText(self, 'H', (80, 115, 15, 15)) self.initText(self, 'S', (80, 135, 15, 15)) self.initText(self, 'V', (80, 155, 15, 15)) RGBEditObserver(self, self.color) RGBSliderObserver(self, self.color) HSVEditObserver(self, self.color) HSVSliderObserver(self, self.color) ColorMapObserver(self, self.color) ColorComponentObserver(self, self.color) ##### # Restore color from disk self.color.loadColor()
def __init__(self): """ window init """ Window.__init__(self) self.create(0, 0, 400, 150, caption=True) self.dsPlayer = DSPlayer.CreateDSPlayerObject() self.statusText = "" self.fileName = None """ logger setting """ self.logger = logging.getLogger(__name__) formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') console = logging.StreamHandler() console.setLevel(logging.DEBUG) console.setFormatter(formatter) fileHandler = logging.FileHandler("AudioBox.log", mode='w') fileHandler.setFormatter(formatter) self.logger.addHandler(console) self.logger.addHandler(fileHandler) self.logger.setLevel(logging.DEBUG)
def __init__(self): """ window init """ Window.__init__(self) self.create(0, 0, 400, 150, caption=True) self.dsPlayer = DSPlayer.CreateDSPlayerObject() self.statusText = "" self.fileName = None """ logger setting """ self.logger = logging.getLogger(__name__) formatter = logging.Formatter('%(asctime)s - %(name)s - %(levelname)s - %(message)s') console = logging.StreamHandler() console.setLevel(logging.DEBUG) console.setFormatter(formatter) fileHandler = logging.FileHandler("AudioBox.log", mode='w') fileHandler.setFormatter(formatter) self.logger.addHandler(console) self.logger.addHandler(fileHandler) self.logger.setLevel(logging.DEBUG)
def __init__(self): Window.__init__(self) self.create(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, caption=True, resize=False) self._initTetris() # Button for 'Start' and 'Tetris.PAUSE' self._triggerButton = TextButton(self) self._triggerButton.rect = (0, 0, 50, 30) self._triggerButton.fontColor = color.red self._triggerButton.text = 'Start' self._triggerButton.background = r'Images\Button.jpg' self.autoRemove(self._triggerButton.bind('Click', self._onTrigger)) # Button for 'Restart' self._restartButton = TextButton(self) self._restartButton.rect = (60, 0, 50, 30) self._restartButton.fontColor = color.red self._restartButton.text = 'Restart' self._restartButton.background = r'Images\Button.jpg' self.autoRemove(self._restartButton.bind('Click', self._onRestart)) self._backgroundTexture = self.imageTextureManager.GetTexture(r'Images\Background.jpg') self._backgroundEffect = self.effectManager.GetEffect(r'backgroundEffects\Background.fx') self._fontEffect = self.effectManager.GetEffect(r'fontEffects\font.fx')
def __init__(self): Window.__init__(self) self.create(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, caption=True, resize=False) self._initTetris() # Button for 'Start' and 'Tetris.PAUSE' self._triggerButton = TextButton(self) self._triggerButton.rect = (0, 0, 50, 30) self._triggerButton.fontColor = color.red self._triggerButton.text = 'Start' self._triggerButton.background = r'Images\Button.jpg' self.autoRemove(self._triggerButton.bind('Click', self._onTrigger)) # Button for 'Restart' self._restartButton = TextButton(self) self._restartButton.rect = (60, 0, 50, 30) self._restartButton.fontColor = color.red self._restartButton.text = 'Restart' self._restartButton.background = r'Images\Button.jpg' self.autoRemove(self._restartButton.bind('Click', self._onRestart)) self._backgroundTexture = self.imageTextureManager.GetTexture( r'Images\Background.jpg') self._backgroundEffect = self.effectManager.GetEffect( r'backgroundEffects\Background.fx') self._fontEffect = self.effectManager.GetEffect(r'fontEffects\font.fx')
def __init__(self): Window.__init__(self) self.create(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, caption = True) self._plate_images = [] # Button for 'Start' and 'Pause' self._trigger_button = TextButton(self) self._trigger_button.rect = 0, 0, 50, 30 self._trigger_button.text = 'Start' self._trigger_button.background = r'Images\Root_button.png' self.autoRemove(self._trigger_button.bind('Click', self._on_trigger_button_click)) # Button for 'Restart' self._restart_button = TextButton(self) self._restart_button.rect = 60, 0, 50, 30 self._restart_button.text = 'Restart' self._restart_button.background = r'Images\Root_button.png' self.autoRemove(self._restart_button.bind('Click', self._on_restart_button_click)) # Button for 'Next' self._next_button = TextButton(self) self._next_button.rect = 120, 0, 50, 30 self._next_button.text = 'Next' self._next_button.background = r'Images\Root_button.png' self.autoRemove(self._next_button.bind('Click', self._on_next_button_click)) self._init_hanoi()
def __init__(self): Window.__init__(self) self.create(0, 0, WINDOW_WIDTH, WINDOW_HEIGHT, caption=True) self._plate_images = [] # Button for 'Start' and 'Pause' self._trigger_button = TextButton(self) self._trigger_button.rect = 0, 0, 50, 30 self._trigger_button.text = 'Start' self._trigger_button.background = r'Images\Root_button.png' self.autoRemove( self._trigger_button.bind('Click', self._on_trigger_button_click)) # Button for 'Restart' self._restart_button = TextButton(self) self._restart_button.rect = 60, 0, 50, 30 self._restart_button.text = 'Restart' self._restart_button.background = r'Images\Root_button.png' self.autoRemove( self._restart_button.bind('Click', self._on_restart_button_click)) # Button for 'Next' self._next_button = TextButton(self) self._next_button.rect = 120, 0, 50, 30 self._next_button.text = 'Next' self._next_button.background = r'Images\Root_button.png' self.autoRemove( self._next_button.bind('Click', self._on_next_button_click)) self._init_hanoi()
def __del__(self): DSPlayer.DeleteDSPlayerObject(self.dsPlayer) Window.__del__(self)
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
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