示例#1
0
文件: pyview.py 项目: sunsided/pyview
def main():
	"""The pyview main entry point"""

	global folderHelper, window

	# Build command line parser
	cmdLine = CommandLine(LocalizedVersion())
	options = cmdLine.getOptions()

	# Load image format plugins
	ImageFormats.loadImageFormatPlugins()

	# Get initial directory
	folderHelper = FolderHelper(options)
	folderHelper.setLastOpenedFile(options.initialFile)
	startDir = folderHelper.getFileDialogInitialDirectory()

	# Get and configure App object
	app = QtGui.QApplication(sys.argv)
	#QtGui.QApplication.setStyle(QtGui.QStyleFactory.create("Cleanlooks"))

	# Create and set window
	window = MainWindow()
	window.setFileDialogDirectory(startDir)
	window.centerWindow()
	
	# Connections
	window.connect(window, QtCore.SIGNAL("openFileFinished(char*, bool)"), onFileLoaded)
	
	# Show the window
	window.show()

	# Load initial file
	if options.initialFile:
		window.openFile(options.initialFile)

	# Start the application
	return app.exec_()