main.py 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. # coding:utf-8
  2. #!/usr/bin/python
  3. # coding:utf-8
  4. #!/usr/bin/python
  5. #
  6. # Copyright (c) Contributors to the Open 3D Engine Project.
  7. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  8. #
  9. # SPDX-License-Identifier: Apache-2.0 OR MIT
  10. #
  11. #
  12. # -- This line is 75 characters -------------------------------------------
  13. # built-ins
  14. import os
  15. import sys
  16. import logging as _logging
  17. # azpy extensions
  18. import azpy.config_utils
  19. _config = azpy.config_utils.get_dccsi_config()
  20. settings = _config.get_config_settings(setup_ly_pyside=True)
  21. # 3rd Party (we may or do provide)
  22. from pathlib import Path
  23. from pathlib import PurePath
  24. # Lumberyard extensions
  25. from azpy.env_bool import env_bool
  26. from azpy.constants import ENVAR_DCCSI_GDEBUG
  27. from azpy.constants import ENVAR_DCCSI_DEV_MODE
  28. # -------------------------------------------------------------------------
  29. # set up global space, logging etc.
  30. _G_DEBUG = env_bool(ENVAR_DCCSI_GDEBUG, settings.DCCSI_GDEBUG)
  31. _DCCSI_DEV_MODE = env_bool(ENVAR_DCCSI_DEV_MODE, settings.DCCSI_GDEBUG)
  32. for handler in _logging.root.handlers[:]:
  33. _logging.root.removeHandler(handler)
  34. _MODULENAME = 'DCCsi.SDK.pythontools.launcher.main'
  35. _log_level = _logging.INFO
  36. if _G_DEBUG:
  37. _log_level = _logging.DEBUG
  38. _LOGGER = azpy.initialize_logger(name=_MODULENAME,
  39. log_to_file=True,
  40. default_log_level=_log_level)
  41. _LOGGER.debug('Starting up: {0}.'.format({_MODULENAME}))
  42. # -------------------------------------------------------------------------
  43. # -------------------------------------------------------------------------
  44. def main():
  45. from PySide2.QtWidgets import QApplication, QPushButton
  46. app = QApplication(sys.argv)
  47. # -------------------------------------------------------------------------
  48. # --------------------------------------------------------------------------
  49. if __name__ == '__main__':
  50. """Run this file as main"""
  51. app = QApplication([]) # Start an application.
  52. window = QWidget() # Create a window.
  53. layout = QVBoxLayout() # Create a layout.
  54. button = QPushButton("I'm just a Button man") # Define a button
  55. layout.addWidget(QLabel('Hello World!')) # Add a label
  56. layout.addWidget(button) # Add the button man
  57. window.setLayout(layout) # Pass the layout to the window
  58. window.show() # Show window
  59. app.exec_() # Execute the App