Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 34 additions & 16 deletions friture/analyzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import sys
import os
import os.path
import argparse
import errno
import platform
import logging
Expand Down Expand Up @@ -345,6 +346,26 @@ def flush(self):


def main():
# parse command line arguments
parser = argparse.ArgumentParser()

parser.add_argument(
"--python",
action="store_true",
help="Print data to friture.cprof")

parser.add_argument(
"--kcachegrind",
action="store_true")

parser.add_argument(
"--no-splash",
action="store_true",
help="Disable the splash screen on startup")

program_arguments, remaining_arguments = parser.parse_known_args()
remaining_arguments.insert(0, sys.argv[0])

# make the Python warnings go to Friture logger
logging.captureWarnings(True)

Expand Down Expand Up @@ -404,7 +425,7 @@ def main():
except:
logger.error("Could not set the app model ID. If the plaftorm is older than Windows 7, this is normal.")

app = QApplication(sys.argv)
app = QApplication(remaining_arguments)

if platform.system() == "Darwin":
logger.info("Applying Mac OS-specific setup")
Expand All @@ -414,27 +435,24 @@ def main():
QApplication.addLibraryPath(pluginsPath)

# Splash screen
pixmap = QPixmap(":/images/splash.png")
splash = QSplashScreen(pixmap)
splash.show()
splash.showMessage("Initializing the audio subsystem")
app.processEvents()
if not program_arguments.no_splash:
pixmap = QPixmap(":/images/splash.png")
splash = QSplashScreen(pixmap)
splash.show()
splash.showMessage("Initializing the audio subsystem")
app.processEvents()

window = Friture()
window.show()
splash.finish(window)
if not program_arguments.no_splash:
splash.finish(window)

profile = "no" # "python" or "kcachegrind" or anything else to disable

if len(sys.argv) > 1:
if sys.argv[1] == "--python":
profile = "python"
elif sys.argv[1] == "--kcachegrind":
profile = "kcachegrind"
elif sys.argv[1] == "--no":
profile = "no"
else:
logger.info("command-line arguments (%s) not recognized", sys.argv[1:])
if program_arguments.python:
profile = "python"
elif program_arguments.kcachegrind:
profile = "kcachegrind"

return_code = 0
if profile == "python":
Expand Down