当前位置: 首页>>代码示例>>Python>>正文


Python Gui.setStatus方法代码示例

本文整理汇总了Python中gui.Gui.setStatus方法的典型用法代码示例。如果您正苦于以下问题:Python Gui.setStatus方法的具体用法?Python Gui.setStatus怎么用?Python Gui.setStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在gui.Gui的用法示例。


在下文中一共展示了Gui.setStatus方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from gui import Gui [as 别名]
# 或者: from gui.Gui import setStatus [as 别名]
def main():

    gui = Gui()
    player = Player()

    global currentMode
    global currentChoice
    global maxChoice
    global chosenArtist
    global chosenAlbum
    global letsDo

    oldArtistChoice = 0


    def alarm_signal_handler(ssignal, stack):
        """ Shows song name playing """
        global old_song
        song = what_song_playing()
        if not song == old_song:
            old_song = song
            try:
                gui.setStatus('{:} [{:}]'.format(song['title'],
                              song['artist'])[:32])
            except:
                pass

    def setMode(mode):
        global currentMode

        if not currentMode == 'playing':
            if mode == 'playing':
                print('starting timer')
                signal.setitimer(signal.ITIMER_REAL, 1, 5)   # set timer
        else:
            signal.setitimer(signal.ITIMER_REAL, 0)   # cancel timer

        currentMode = mode
        gui.setMode(currentMode)


    def getMode():
        return currentMode

    def nextsong():
        player.MPDnext()

    def pause():
        player.MPDpause()

    def play():
        player.MPDplay()

    def prevsong():
        player.MPDprev()

    def showArtists(what):
        global currentChoice
        global maxChoice
        if what=='curr':
            msg = player.currLetter()
        elif what=='next':
            msg = player.nextLetter()
        elif what=='prev':
            msg = player.prevLetter()
        currentChoice = 0
        maxChoice = len(msg)
        gui.clearListBox()
        gui.feedToListbox(msg)
        gui.selectListBoxLine(currentChoice)


    def showAlbums():
        global currentChoice
        global maxChoice
        global chosenArtist
        idx, chosenArtist = gui.getListBoxSelectedLine()
        msg = player.MPDscanArtistsAlbums(chosenArtist)
        currentChoice = 0
        maxChoice = len(msg)
        gui.clearListBox()
        gui.feedToListbox(msg)
        gui.selectListBoxLine(currentChoice)


    def status():
        return player.MPDstatus()


    def volumeUp():
        player.VolUp()


    def volumeDn():
        player.VolDn()


    def what_song_playing():
        return player.MPDwhat_song_playing()

#.........这里部分代码省略.........
开发者ID:OSliusarenko,项目名称:yaih,代码行数:103,代码来源:main.py


注:本文中的gui.Gui.setStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。