Example #1
0
def openFile(fileName, window, cmd = None):
    """
    Opens a file with command cmd (string, read from config)
    or with the KDE default application (via KRun).
    """
    if cmd:
        cmd, err = KShell.splitArgs(cmd)
        if err == KShell.NoError:
            cmd.append(fileName)
            try:
                Popen(cmd)
                return
            except OSError:
                pass
    # let C++ own the KRun object, it will delete itself.
    sip.transferto(KRun(KUrl.fromPath(fileName), window), None)
Example #2
0
 def initializeProcess(self, p):
     cmd, err = KShell.splitArgs(config("commands").readEntry("timidity", default_timidity_command))
     if err == KShell.NoError:
         p.setProgram(cmd)
     else:
         pass # TODO: warn user about incorrect command