OpenShot Video Editor  2.0.0
launch.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 
3 ##
4 #
5 # @file
6 # @brief This file is used to launch OpenShot
7 # @author Jonathan Thomas <jonathan@openshot.org>
8 # @author Noah Figg <eggmunkee@hotmail.com>
9 #
10 # @mainpage OpenShot Video Editor 2.0
11 #
12 # Welcome to the OpenShot Video Editor 2.0 PyQt5 documentation. OpenShot was developed to
13 # make high-quality video editing and animation solutions freely available to the world. With a focus
14 # on stability, performance, and ease-of-use, we believe OpenShot is the best cross-platform,
15 # open-source video editing application in the world!
16 #
17 # This documentation is auto-generated by Doxygen, using the doxypy Python filter. If you are
18 # interested in how OpenShot Video Editor is designed, feel free to dive in, because this
19 # documentation was built just for you. If you are not a developer, please feel free to visit
20 # our main website (http://www.openshot.org/download/), and download a copy today for Linux, Mac, or Windows.
21 #
22 # @section LICENSE
23 #
24 # Copyright (c) 2008-2018 OpenShot Studios, LLC
25 # (http://www.openshotstudios.com). This file is part of
26 # OpenShot Video Editor (http://www.openshot.org), an open-source project
27 # dedicated to delivering high quality video editing and animation solutions
28 # to the world.
29 #
30 # OpenShot Video Editor is free software: you can redistribute it and/or modify
31 # it under the terms of the GNU General Public License as published by
32 # the Free Software Foundation, either version 3 of the License, or
33 # (at your option) any later version.
34 #
35 # OpenShot Video Editor is distributed in the hope that it will be useful,
36 # but WITHOUT ANY WARRANTY; without even the implied warranty of
37 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
38 # GNU General Public License for more details.
39 #
40 # You should have received a copy of the GNU General Public License
41 # along with OpenShot Library. If not, see <http://www.gnu.org/licenses/>.
42 #
43 
44 import sys
45 from argparse import ArgumentParser
46 
47 try:
48  from classes import info
49  print("Loaded modules from current directory: %s" % info.PATH)
50 except ImportError:
51  from openshot_qt.classes import info
52  sys.path.append(info.PATH)
53  print("Loaded modules from installed directory: %s" % info.PATH)
54 
55 from classes.app import OpenShotApp
56 from classes.logger import log, reroute_output
57 from classes.language import get_all_languages
58 
59 
60 ##
61 # "Initialize settings (not implemented) and create main window/application.
62 def main():
63 
64  parser = ArgumentParser(description = 'OpenShot version ' + info.SETUP['version'])
65  parser.add_argument('-l', '--lang', action='store',
66  help='language code for interface (overrides '
67  'preferences and system environment)')
68  parser.add_argument('--list-languages', dest='list_languages',
69  action='store_true', help='List all language '
70  'codes supported by OpenShot')
71  parser.add_argument('-V', '--version', action='store_true')
72 
73  args = parser.parse_args()
74 
75  # Display version and exit (if requested)
76  if args.version:
77  print("OpenShot version %s" % info.SETUP['version'])
78  exit()
79 
80  if args.list_languages:
81  print("Supported Languages:")
82  for lang in get_all_languages():
83  print(" {:>12} {}".format(lang[0],lang[1]))
84  exit()
85 
86  if args.lang:
87  if args.lang in info.SUPPORTED_LANGUAGES:
88  info.CMDLINE_LANGUAGE = args.lang
89  else:
90  print("Unsupported language '{}'! (See --list-languages)".format(args.lang))
91  exit(-1)
92 
94 
95  log.info("------------------------------------------------")
96  log.info(" OpenShot (version %s)" % info.SETUP['version'])
97  log.info("------------------------------------------------")
98 
99  # Create Qt application
100  app = OpenShotApp(sys.argv)
101 
102  # Run and return result
103  sys.exit(app.run())
104 
105 
106 if __name__ == "__main__":
107  main()
def main
"Initialize settings (not implemented) and create main window/application.
Definition: launch.py:62
def get_all_languages
Get all language names and countries packaged with OpenShot.
Definition: language.py:142
def reroute_output
Route stdout and stderr to logger (custom handler)
Definition: logger.py:74