示例#1
0
    def __init__(self, parent=None):
        QtGui.QMainWindow.__init__(self, parent)

        # TODO: add profiles
        self.ui = Ui_MainWindow()

        self._soundcontainer = soundContainer()
        self._profilecontainer = profileContainer(self._soundcontainer)

        self.ui.setupUi(self)

        appconf = appconfig(appname, appver)
        appconf.readconfig()
        config = appconf.config
        self.dict_loadConfig(config)
        #self.dict_updateActiveProfileUi()

        self.dict_initSlots()
示例#2
0
    def renamedCB(self):
        self.ui.soundButton.setText(
                self._soundcontainer.soundName(self._handler))

    #TODO: use a library for playing the media file
    def playSound(self):
        sfile = self.file
        if sfile is not None:
            import os
            if os.path.isfile(sfile):
                import subprocess
                import sys
                opts = ""
                if sys.platform == "win32":
                    player = "vlc"
                    opts = "--play-and-exit"
                    sfile = u"file:///" + sfile
                else:
                    player = "mplayer"
                subprocess.call([player, opts, sfile])
            else:
                self.active = False

if __name__ == "__main__":
    import sys
    app = QtGui.QApplication(sys.argv)
    sndcont = soundContainer()
    myapp = soundControl(soundcontainer=sndcont)
    myapp.show()
    sys.exit(app.exec_())