This is a test project for ./generate.py demobrowser-source command.
Run:
Then run:
And navigate to http://localhost:8000/demobrowser/source
to test it.
| qooxdoo | |
| demobrowser | |
| source/script | |
| /** <h3> demotest API Documentation </h3> | |
| * | |
| * Replace this text with an appropriate overview and introduction to your | |
| * application. | |
| * | |
| */ |
| This directory will contain translation (.po) files once you run the | |
| 'translation' job in your project. | |
| /* ************************************************************************ | |
| Copyright: | |
| License: | |
| Authors: | |
| ************************************************************************ */ | |
| qx.Theme.define("demotest.theme.Appearance", | |
| { | |
| extend : qx.theme.modern.Appearance, | |
| appearances : | |
| { | |
| } | |
| }); |
| /* ************************************************************************ | |
| Copyright: | |
| License: | |
| Authors: | |
| ************************************************************************ */ | |
| /* ************************************************************************ | |
| #asset(demotest/*) | |
| ************************************************************************ */ | |
| /** | |
| * This is the main application class of your custom application "demotest" | |
| */ | |
| qx.Class.define("demotest.Application", | |
| { | |
| extend : qx.application.Standalone, | |
| /* | |
| ***************************************************************************** | |
| MEMBERS | |
| ***************************************************************************** | |
| */ | |
| members : | |
| { | |
| /** | |
| * This method contains the initial application code and gets called | |
| * during startup of the application | |
| * | |
| * @lint ignoreDeprecated(alert) | |
| */ | |
| main : function() | |
| { | |
| // Call super class | |
| this.base(arguments); | |
| // Enable logging in debug variant | |
| if (qx.core.Environment.get("qx.debug")) | |
| { | |
| // support native logging capabilities, e.g. Firebug for Firefox | |
| qx.log.appender.Native; | |
| // support additional cross-browser console. Press F7 to toggle visibility | |
| qx.log.appender.Console; | |
| } | |
| /* | |
| ------------------------------------------------------------------------- | |
| Below is your actual application code... | |
| ------------------------------------------------------------------------- | |
| */ | |
| // Create a button | |
| var button1 = new qx.ui.form.Button("First Button", "demotest/test.png"); | |
| // Document is the application root | |
| var doc = this.getRoot(); | |
| // Add button to document at fixed coordinates | |
| doc.add(button1, {left: 100, top: 50}); | |
| // Add an event listener | |
| button1.addListener("execute", function(e) { | |
| alert("Hello World!"); | |
| }); | |
| } | |
| } | |
| }); |
| /* ************************************************************************ | |
| Copyright: | |
| License: | |
| Authors: | |
| ************************************************************************ */ | |
| qx.Theme.define("demotest.theme.Color", | |
| { | |
| extend : qx.theme.modern.Color, | |
| colors : | |
| { | |
| } | |
| }); |
| { | |
| "name" : "demotest", | |
| "include" : | |
| [ | |
| { | |
| "path" : "${QOOXDOO_PATH}/tool/data/config/application.json" | |
| } | |
| ], | |
| "export" : | |
| [ | |
| "api", | |
| "api-data", | |
| "build", | |
| "clean", | |
| "demobrowser-source", | |
| "distclean", | |
| "fix", | |
| "info", | |
| "inspector", | |
| "lint", | |
| "migration", | |
| "pretty", | |
| "profiling", | |
| "source", | |
| "source-all", | |
| "source-hybrid", | |
| "simulation-build", | |
| "simulation-run", | |
| "test", | |
| "test-source", | |
| "translation" | |
| ], | |
| "default-job" : "source-hybrid", | |
| "let" : | |
| { | |
| "APPLICATION" : "demotest", | |
| "QOOXDOO_PATH" : "qooxdoo", | |
| "QXTHEME" : "demotest.theme.Theme", | |
| "API_EXCLUDE" : ["qx.test.*", "${APPLICATION}.theme.*", "${APPLICATION}.test.*", "${APPLICATION}.simulation.*"], | |
| "LOCALES" : [ "en" ], | |
| "CACHE" : "${TMPDIR}/qx${QOOXDOO_VERSION}/cache", | |
| "ROOT" : "." | |
| }, | |
| } |
| /* ************************************************************************ | |
| Copyright: | |
| License: | |
| Authors: | |
| ************************************************************************ */ | |
| qx.Theme.define("demotest.theme.Decoration", | |
| { | |
| extend : qx.theme.modern.Decoration, | |
| decorations : | |
| { | |
| } | |
| }); |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <title>Title</title> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| <script type="text/javascript"> | |
| DEMO_NS = 'demotest.demo' | |
| </script> | |
| <!-- TODO: make QOOXDOO_PATH dynamic --> | |
| <script type="text/javascript" src="../../../qooxdoo/component/demobrowser/source/helper.js"></script> | |
| </head> | |
| <body> | |
| </body> | |
| </html> |
| qx.Class.define("demotest.demo.test.Demo", { extend : qx.application.Native | |
| ,members : { | |
| main: function() { | |
| this.base(arguments); | |
| var button1 = new qx.ui.form.Button("First Button", "demotest/test.png"); | |
| button1.addListener("execute", function(e) { | |
| alert("Hello Demo World!"); | |
| }); | |
| this.getRoot().add(button1, {left: 100, top: 50}); | |
| } | |
| } | |
| }); |
| /* ************************************************************************ | |
| Copyright: | |
| License: | |
| Authors: | |
| ************************************************************************ */ | |
| qx.Theme.define("demotest.theme.Font", | |
| { | |
| extend : qx.theme.modern.Font, | |
| fonts : | |
| { | |
| } | |
| }); |
| #!/usr/bin/env python | |
| # -*- coding: utf-8 -*- | |
| ################################################################################ | |
| # | |
| # qooxdoo - the new era of web development | |
| # | |
| # http://qooxdoo.org | |
| # | |
| # Copyright: | |
| # 2008 - 2012 1&1 Internet AG, Germany, http://www.1und1.de | |
| # | |
| # License: | |
| # LGPL: http://www.gnu.org/licenses/lgpl.html | |
| # EPL: http://www.eclipse.org/org/documents/epl-v10.php | |
| # See the LICENSE file in the project's top-level directory for details. | |
| # | |
| # Authors: | |
| # * Thomas Herchenroeder (thron7) | |
| # | |
| ################################################################################ | |
| ## | |
| # This is a stub proxy for the real generator.py | |
| ## | |
| import sys, os, re, subprocess, codecs, optparse | |
| CMD_PYTHON = sys.executable | |
| QOOXDOO_PATH = 'qooxdoo' | |
| QX_PYLIB = "tool/pylib" | |
| ## | |
| # A derived OptionParser class that ignores unknown options (The parent | |
| # class raises in those cases, and stops further processing). | |
| # We need this, as we are only interested in -c/--config on this level, and | |
| # want to ignore pot. other options. | |
| # | |
| class IgnoringUnknownOptionParser(optparse.OptionParser): | |
| ## | |
| # <rargs> is the raw argument list. The original _process_args mutates | |
| # rargs, processing options into <values> and copying interspersed args | |
| # into <largs>. This overridden version ignores unknown or ambiguous | |
| # options. | |
| def _process_args(self, largs, rargs, values): | |
| while rargs: | |
| try: | |
| optparse.OptionParser._process_args(self, largs, rargs, values) | |
| except (optparse.BadOptionError, optparse.AmbiguousOptionError): | |
| pass | |
| def parseArgs(): | |
| parser = IgnoringUnknownOptionParser(add_help_option=False) | |
| parser.add_option( | |
| "-c", "--config", dest="config", metavar="CFGFILE", | |
| default="config.json", help="path to configuration file" | |
| ) | |
| parser.add_option( | |
| "-v", "--verbose", dest="verbose", action="store_true", | |
| default=False, help="run in verbose mode" | |
| ) | |
| (options, args) = parser.parse_args(sys.argv[1:]) | |
| return options, args | |
| ShellOptions, ShellArgs = parseArgs() | |
| # this is from misc.json, duplicated for decoupling | |
| _eolComment = re.compile(r'(?<![a-zA-Z]:)//.*$', re.M) # double $ for string.Template | |
| _mulComment = re.compile(r'/\*.*?\*/', re.S) | |
| def stripComments(s): | |
| b = _eolComment.sub('',s) | |
| b = _mulComment.sub('',b) | |
| return b | |
| def getQxPath(): | |
| path = QOOXDOO_PATH | |
| # OS env takes precedence | |
| if os.environ.has_key("QOOXDOO_PATH"): | |
| path = os.environ["QOOXDOO_PATH"] | |
| # else use QOOXDOO_PATH from config.json | |
| else: | |
| config_file = ShellOptions.config | |
| if os.path.exists(config_file): | |
| # try json parsing with qx json | |
| if not path.startswith('${'): # template macro has been resolved | |
| sys.path.insert(0, os.path.join(path, QX_PYLIB)) | |
| try: | |
| from misc import json | |
| got_json = True | |
| except: | |
| got_json = False | |
| got_path = False | |
| if got_json: | |
| config_str = codecs.open(config_file, "r", "utf-8").read() | |
| #config_str = stripComments(config_str) # not necessary under demjson | |
| config = json.loads(config_str) | |
| p = config.get("let") | |
| if p: | |
| p = p.get("QOOXDOO_PATH") | |
| if p: | |
| path = p | |
| got_path = True | |
| # regex parsing - error prone | |
| if not got_path: | |
| qpathr=re.compile(r'"QOOXDOO_PATH"\s*:\s*"([^"]*)"\s*,?') | |
| conffile = codecs.open(config_file, "r", "utf-8") | |
| aconffile = conffile.readlines() | |
| for line in aconffile: | |
| mo = qpathr.search(line) | |
| if mo: | |
| path = mo.group(1) | |
| break # assume first occurrence is ok | |
| path = os.path.normpath(os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), path)) | |
| return path | |
| os.chdir(os.path.dirname(os.path.abspath(sys.argv[0]))) # switch to skeleton dir | |
| qxpath = getQxPath() | |
| REAL_GENERATOR = os.path.join(qxpath, 'tool', 'bin', 'generator.py') | |
| if not os.path.exists(REAL_GENERATOR): | |
| print "Cannot find real generator script under: \"%s\"; aborting" % REAL_GENERATOR | |
| sys.exit(1) | |
| elif ShellOptions.verbose: | |
| print "\nInvoking real generator under %s ..." % REAL_GENERATOR | |
| argList = [] | |
| argList.append(CMD_PYTHON) | |
| argList.append(REAL_GENERATOR) | |
| argList.extend(sys.argv[1:]) | |
| if sys.platform == "win32": | |
| argList1=[] | |
| for arg in argList: | |
| if arg.find(' ')>-1: | |
| argList1.append('"%s"' % arg) | |
| else: | |
| argList1.append(arg) | |
| argList = argList1 | |
| else: | |
| argList = ['"%s"' % x for x in argList] # quote argv elements | |
| cmd = " ".join(argList) | |
| retval = subprocess.call(cmd, shell=True) | |
| sys.exit(retval) |
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> | |
| <title>demotest</title> | |
| <script type="text/javascript" src="script/demotest.js"></script> | |
| </head> | |
| <body></body> | |
| </html> |
| { | |
| "info" : | |
| { | |
| "name" : "demotest", | |
| "summary" : "Custom Application", | |
| "description" : "This is a skeleton for a custom application with qooxdoo.", | |
| "homepage" : "http://some.homepage.url/", | |
| "license" : "SomeLicense", | |
| "authors" : | |
| [ | |
| { | |
| "name" : "First Author (uid)", | |
| "email" : "[email protected]" | |
| } | |
| ], | |
| "version" : "trunk", | |
| "qooxdoo-versions": ["2.2"] | |
| }, | |
| "provides" : | |
| { | |
| "namespace" : "demotest", | |
| "encoding" : "utf-8", | |
| "class" : "source/class", | |
| "resource" : "source/resource", | |
| "translation" : "source/translation", | |
| "type" : "application" | |
| } | |
| } | |
| /* ************************************************************************ | |
| Copyright: | |
| License: | |
| Authors: | |
| ************************************************************************ */ | |
| qx.Theme.define("demotest.theme.Theme", | |
| { | |
| meta : | |
| { | |
| color : demotest.theme.Color, | |
| decoration : demotest.theme.Decoration, | |
| font : demotest.theme.Font, | |
| icon : qx.theme.icon.Tango, | |
| appearance : demotest.theme.Appearance | |
| } | |
| }); |