Browse Source

Add --help and --version arguments

tags/1.9.7
falkTX 10 years ago
parent
commit
f898bce49c
4 changed files with 46 additions and 28 deletions
  1. +5
    -9
      source/carla
  2. +5
    -9
      source/carla-patchbay
  3. +5
    -9
      source/carla-rack
  4. +31
    -1
      source/carla_shared.py

+ 5
- 9
source/carla View File

@@ -54,17 +54,13 @@ if __name__ == '__main__':
# -------------------------------------------------------------
# Load project file if set

args = app.arguments()
for arg in app.arguments():
if arg.startswith("--with-appname=") or arg.startswith("--with-libprefix=") or arg == "--gdb":
continue

if len(args) > 1:
arg = args[-1]

if arg.startswith("--with-appname=") or arg.startswith("--with-libprefix="):
pass
elif arg == "--gdb":
pass
elif os.path.exists(arg):
if os.path.exists(arg):
gui.loadProjectLater(arg)
break

# -------------------------------------------------------------
# Show GUI


+ 5
- 9
source/carla-patchbay View File

@@ -56,17 +56,13 @@ if __name__ == '__main__':
# -------------------------------------------------------------
# Load project file if set

args = app.arguments()
for arg in app.arguments():
if arg.startswith("--with-appname=") or arg.startswith("--with-libprefix=") or arg == "--gdb":
continue

if len(args) > 1:
arg = args[-1]

if arg.startswith("--with-appname=") or arg.startswith("--with-libprefix="):
pass
elif arg == "--gdb":
pass
elif os.path.exists(arg):
if os.path.exists(arg):
gui.loadProjectLater(arg)
break

# -------------------------------------------------------------
# Show GUI


+ 5
- 9
source/carla-rack View File

@@ -56,17 +56,13 @@ if __name__ == '__main__':
# -------------------------------------------------------------
# Load project file if set

args = app.arguments()
for arg in app.arguments():
if arg.startswith("--with-appname=") or arg.startswith("--with-libprefix=") or arg == "--gdb":
continue

if len(args) > 1:
arg = args[-1]

if arg.startswith("--with-appname=") or arg.startswith("--with-libprefix="):
pass
elif arg == "--gdb":
pass
elif os.path.exists(arg):
if os.path.exists(arg):
gui.loadProjectLater(arg)
break

# -------------------------------------------------------------
# Show GUI


+ 31
- 1
source/carla_shared.py View File

@@ -541,7 +541,7 @@ def getIcon(icon, size = 16):
# Handle some basic command-line arguments shared between all carla variants

def handleInitialCommandLineArguments(file):
initName = os.path.basename(file) if ("__file__" in dir() and os.path.dirname(file) in PATH) else sys.argv[0]
initName = os.path.basename(file) if ("__file__" in dir() and os.path.dirname(file) in PATH) else sys.argv[0]
libPrefix = None

for arg in sys.argv:
@@ -551,6 +551,36 @@ def handleInitialCommandLineArguments(file):
elif arg.startswith("--with-libprefix="):
libPrefix = arg.replace("--with-libprefix=", "")

elif arg == "--gdb":
pass

elif arg in ("-h", "--h", "-help", "--help"):
print("Usage: %s [OPTION]... [FILE|URL]" % initName)
print("")
print(" where FILE can be a Carla project or preset file to be loaded, or URL if using Carla-Control")
print("")
print(" and OPTION can be one or more of the following:")
print("")
print(" --gdb \t Run Carla inside gdb.")
print("")
print(" -h,--help \t Print this help text and exit.")
print(" -v,--version\t Print version information and exit.")
print("")

sys.exit(0)

elif arg in ("-v", "--v", "-version", "--version"):
pathBinaries, pathResources = getPaths(libPrefix)

print("Using Carla version %s" % VERSION)
print(" Python version: %s" % sys.version.split(" ",1)[0])
print(" Qt version: %s" % qVersion())
print(" PyQt version: %s" % PYQT_VERSION_STR)
print(" Binary dir: %s" % pathBinaries)
print(" Resources dir: %s" % pathResources)

sys.exit(0)

return (initName, libPrefix)

# ------------------------------------------------------------------------------------------------------------


Loading…
Cancel
Save