Commits

Anonymous committed 19d7ef5

Slight refactoring to make profiling easier.

Comments (0)

Files changed (1)

 ### Imports ###
 
 # First the GUI class and the Data about the program
-from rad import Rad, aboutData
+from rad import Rad
+from rad import aboutData
 from rad import version as __version__
 
 # Then commandline arguments and handling
 from sys import argv
+
 from PyKDE4.kdecore import KCmdLineArgs
 
 # KApplication for basics
 from PyKDE4.kdeui import KApplication
 
+
 # and exiting.
 from sys import exit as exit_
 
-### Self Test == Run the Program ###
+### Runner ###
 
-if __name__ == "__main__":
+def initKApp():
+    """Initialize the KApplication."""
     # First we need to compile the commandline args for KDE programs
     KCmdLineArgs.init (argv, aboutData)
     # Then do basic initializing
     app = KApplication()
     # And get and show the GUI
+    return app
+
+def run():
+    """Start and run the PyRad"""
+    # First we need to compile the commandline args for KDE programs
+    #KCmdLineArgs.init (argv, aboutData)
+    # Then do basic initializing
+    #app = KApplication()
+    app = initKApp()
+    # And get and show the GUI
     rad = Rad()
     rad.show()
-    # Finally we execute the program - and exit the script with the exit code from the program.
-    exit_(app.exec_())
+    #rad.close()
+    # Finally we execute the program - and return the exit code from the program.
+    return app.exec_()
+
+
+### Self Test == Run the Program ###
+
+if __name__ == "__main__":
+    exit_(run())