コード例 #1
0
ファイル: artistInfo.py プロジェクト: J-CITY/Kitsune
    def process_event(self, event):
        if isinstance(event, KeyboardEvent):
            if event.key_code in [ord('q'), ord('Q'), Screen.ctrl("c")]:
                raise StopApplication("User quit")
            if event.key_code in [ord("i")]:
                self._scene.add_effect(
                    InfoDialog(self._screen,
                               "Info", ["OK"],
                               config=self.presenter.config,
                               win=self.frameName))

            self.swichWindow(self.presenter, event)
            self.presenter.playerEventControl(event)
        return super(ArtistInfoFrame, self).process_event(event)
コード例 #2
0
ファイル: equalizer.py プロジェクト: J-CITY/Kitsune
	def process_event(self, event):
		# Do the key handling for this Frame.
		#self.__clear()
		if isinstance(event, KeyboardEvent):
			if event.key_code == Screen.KEY_RIGHT:
				if self.listEqBar._has_focus:
					self.eqLevelsParam[self.listEqBar._line] = 15 if self.eqLevelsParam[self.listEqBar._line] == 15 else\
						self.eqLevelsParam[self.listEqBar._line] + 1
					self.setEqBarParam()
					for e in self.eqPresets:
						e.value = False
					self.eqPresets[0].value = True
				if self.listEqSpeed._has_focus:
					self.eqSpeedParam = 415 if self.eqSpeedParam + 10 >= 415 else\
						self.eqSpeedParam + 10
					self.setEqSpeedParam()
					for e in self.eqPresets:
						e.value = False
					self.eqPresets[0].value = True
				return
			if event.key_code == Screen.KEY_LEFT:
				if self.listEqBar._has_focus:
					self.eqLevelsParam[self.listEqBar._line] = -15 if self.eqLevelsParam[self.listEqBar._line] == -15 else\
						self.eqLevelsParam[self.listEqBar._line] - 1
					self.setEqBarParam()
				if self.listEqSpeed._has_focus:
					self.eqSpeedParam = -25 if self.eqSpeedParam-10 <= -25 else\
						self.eqSpeedParam - 10
					self.setEqSpeedParam()
				return
			if event.key_code in [ord('q'), ord('Q'), Screen.ctrl("c")]:
				raise StopApplication("User quit")
			if event.key_code in [ord("i")]:
				self._scene.add_effect(
					InfoDialog(self._screen, 
						"Info",
						["OK"],
						config=self.presenter.config, win=self.frameName))

			self.swichWindow(self.presenter, event)
			self.presenter.playerEventControl(event)
		
		super(EqualizerFrame, self).process_event(event)
		self.updateFocusColor()
		return
コード例 #3
0
ファイル: clock.py プロジェクト: J-CITY/Kitsune
    def process_event(self, event):
        # Do the key handling for this Frame.
        #self.__clear()
        if isinstance(event, KeyboardEvent):
            if event.key_code in [ord('q'), ord('Q'), Screen.ctrl("c")]:
                raise StopApplication("User quit")
            if event.key_code in [ord(" ")]:
                self.clock.needSeconds = not self.clock.needSeconds
            if event.key_code in [ord("i")]:
                self._scene.add_effect(
                    InfoDialog(self._screen,
                               "Info", ["OK"],
                               config=self.presenter.config,
                               win=self.frameName))

            self.swichWindow(self.presenter, event)
            self.presenter.playerEventControl(event)

        return super(ClockFrame, self).process_event(event)
コード例 #4
0
	def process_event(self, event):
		# Do the key handling for this Frame.
		if isinstance(event, KeyboardEvent):
			if event.key_code in [ord('q'), ord('Q'), Screen.ctrl("c")]:
				raise StopApplication("User quit")
			self.swichWindow(self.presenter, event)
			self.presenter.playerEventControl(event)
			if event.key_code in [ord('e')]:
				self.presenter.mainPlaylistAddSong(ADD_END, False, "current")
			if event.key_code in [ord('E')]:
				pls = self.presenter.getListOfPlaylists()
				for i, e in enumerate(pls):
					pls[i] = (e, i+1)
				pls = [(CURRENT_PLAYLIST, 0)] + pls
				self._scene.add_effect(
					AddMusicDialog(self._screen, 
						"Add song to playlist", 
						["OK", "Cancel"], 
						addList = [
							("At the end of playlist", ADD_END),
							("At the beginning of playlist", ADD_BEGIN),
							("After current song", ADD_AFTER),
							("Before current song", ADD_BEFORE)
						],
						playlistLists = pls,
						needNewPlaylist = True,
						needListAdd = True,
						needListPlaylists = True,
						needPlayCb = True,
						presenter=self.presenter, win="Browser"))
			if event.key_code in [ord("i")]:
				self._scene.add_effect(
					InfoDialog(self._screen, 
						"Info",
						["OK"],
						config=self.presenter.config, win=self.frameName))

		return super(BrowserFrame, self).process_event(event)
コード例 #5
0
    def process_event(self, event):
        # Do the key handling for this Frame.
        if isinstance(event, KeyboardEvent):
            if event.key_code in [ord('q'), ord('Q'), Screen.ctrl("c")]:
                raise StopApplication("User quit")
            self.swichWindow(self.presenter, event)
            if event.key_code in [ord('e')]:
                self.presenter.mainPlaylistSetPlayId(self.table.value)
                self.presenter.playerPlayById(self.table.value)
            if event.key_code in [ord('j')]:  #swap
                _from = self.table._line
                _to = self.table._line - 1 if self.table._line > 0 else self.table._line
                self.presenter.playerSwap(_from, _to)
                self.table._line = max(0, self.table._line - 1)
                self.table.value = self.table._options[self.table._line][1]
            if event.key_code in [ord('k')]:  #swap
                _from = self.table._line
                _to = self.table._line + 1 if self.table._line < len(
                    self.table._options) - 1 else self.table._line
                self.presenter.playerSwap(_from, _to)
                self.table._line = min(
                    len(self.table._options) - 1, self.table._line + 1)
                self.table.value = self.table._options[self.table._line][1]
            if event.key_code in [ord('d')]:  #delete
                _id = self.table._line
                self.presenter.playerDelete(_id)
                if len(self.table._options) > 0:
                    self.table._line = min(
                        len(self.table._options) - 1, self.table._line + 1)
                    self.table.value = self.table._options[self.table._line][1]
                    _new_options = []
                    for i, e in enumerate(self.table._options):
                        v = e[0]
                        v[0] = str(i)
                        _new_options.append((v, i))
                    self.table._options = _new_options

            if event.key_code in [ord('E')]:
                pls = self.presenter.getListOfPlaylists()
                for i, e in enumerate(pls):
                    pls[i] = (e, i)
                self._scene.add_effect(
                    AddMusicDialog(self._screen,
                                   "Save playlist", ["OK", "Cancel"],
                                   addList=[("At the end of playlist",
                                             ADD_END),
                                            ("At the beginning of playlist",
                                             ADD_BEGIN)],
                                   playlistLists=pls,
                                   needNewPlaylist=True,
                                   needListAdd=True,
                                   needListPlaylists=True,
                                   needPlayCb=False,
                                   presenter=self.presenter,
                                   win="MainPlaylist"))
            if event.key_code in [ord("i")]:
                self._scene.add_effect(
                    InfoDialog(self._screen,
                               "Info", ["OK"],
                               config=self.presenter.config,
                               win=self.frameName))

            self.presenter.playerEventControl(event)

        # Now pass on to lower levels for normal handling of the event.
        return super(MainPlaylistFrame, self).process_event(event)
コード例 #6
0
    def process_event(self, event):
        # Do the key handling for this Frame.
        if isinstance(event, KeyboardEvent):
            if event.key_code in [ord('q'), ord('Q'), Screen.ctrl("c")]:
                raise StopApplication("User quit")
            self.swichWindow(self.presenter, event)
            self.presenter.playerEventControl(event)
            if event.key_code in [ord('e')]:
                if self.listSongs._has_focus:
                    self.addSong(False)
                elif self.listAlbums._has_focus:
                    self.presenter.mainPlaylistOpen(self.getCurrentAlbum())
                    #self.presenter.medialibAddAlbum(ADD_END, False, "current")
            if event.key_code in [ord('E')]:
                name = ""
                title = ""
                if self.listSongs._has_focus:
                    name = "Medialib"
                    title = "Add song"
                elif self.listAlbums._has_focus:
                    name = "MedialibAlbum"
                    title = "Add album"
                if name != "":
                    pls = self.presenter.getListOfPlaylists()
                    for i, e in enumerate(pls):
                        pls[i] = (e, i + 1)
                    pls = [(CURRENT_PLAYLIST, 0)] + pls
                    self._scene.add_effect(
                        AddMusicDialog(self._screen,
                                       title, ["OK", "Cancel"],
                                       addList=[
                                           ("At the end of playlist", ADD_END),
                                           ("At the beginning of playlist",
                                            ADD_BEGIN),
                                           ("After current song", ADD_AFTER),
                                           ("Before current song", ADD_BEFORE)
                                       ],
                                       playlistLists=pls,
                                       needNewPlaylist=True,
                                       needListAdd=True,
                                       needListPlaylists=True,
                                       needPlayCb=True,
                                       presenter=self.presenter,
                                       win=name))
            if event.key_code in [ord("i")]:
                self._scene.add_effect(
                    InfoDialog(self._screen,
                               "Info", ["OK"],
                               config=self.presenter.config,
                               win=self.frameName))

        super(MedialibFrame, self).process_event(event)

        if self.listArtists._has_focus:
            self.listArtists._chColors = [self.color_choice]
        else:
            self.listArtists._chColors = [self.color_not_focus]
        if self.listAlbums._has_focus:
            self.listAlbums._chColors = [self.color_choice]
        else:
            self.listAlbums._chColors = [self.color_not_focus]
        if self.listSongs._has_focus:
            self.listSongs._chColors = [self.color_choice]
        else:
            self.listSongs._chColors = [self.color_not_focus]
        return