Python gui.MainWindow() Examples

The following are 1 code examples of gui.MainWindow(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module gui , or try the search function .
Example #1
Source File: main.py    From ExCo with GNU General Public License v3.0 4 votes vote down vote up
def main():
    """Main function of Ex.Co."""
    #Check arguments
    options = parse_arguments()
    if options.debug_mode == True:
        data.debug_mode = True
    if options.logging_mode == True:
        data.logging_mode = True
    file_arguments = options.files
    if options.single_file != None:
        if file_arguments != None:
            file_list = file_arguments.split(";")
            file_list.append(options.single_file)
            file_arguments = ";".join(file_list)
        else:
            file_arguments = [options.single_file]
    if file_arguments == ['']:
        file_arguments = None
    #Get the application directory
    if getattr(sys, 'frozen', False):
        # frozen
        data.application_directory = os.path.dirname(sys.executable).replace("\\", "/")
    else:
        # unfrozen
        data.application_directory = os.path.dirname(os.path.realpath(__file__)).replace("\\", "/")
    #Check if Ex.Co. is run as a cx_freeze executable (the path will contain library.zip)
    if data.application_directory.endswith(".zip"):
        data.application_directory = os.path.dirname(data.application_directory)
    #Set the resources directory
    data.resources_directory = os.path.join(data.application_directory,  "resources")
    #Combine the application path with the Ex.Co. icon file name (the icon file name is set in the global module)
    data.application_icon = os.path.join(
        data.resources_directory,
        data.application_icon
    )
    #Combine the application path with the Ex.Co. information file name (the information file name is set in the global module)
    data.about_image = os.path.join(
        data.resources_directory,
        data.about_image
    )
    #Create QT application, needed to use QT forms
    app = data.QApplication(sys.argv)
    #Save the Qt application to the global reference
    data.application = app
    #Create the main window, pass the filename that may have been passed as an argument
    main_window = gui.MainWindow(
        new_document = options.new_document, 
        logging=data.logging_mode, 
        file_arguments=file_arguments
    )
    components.TheSquid.init_objects(main_window)
    main_window.import_user_functions()
    main_window.show()
    sys.exit(app.exec_())
    
#Check if this is the main executing script