Home | Trees | Indices | Help |
|
---|
|
1 """Graphical user interface for managing TurboGears projects""" 2 3 import pkg_resources 4 5 import cherrypy 6 7 from turbogears import controllers, expose 8 from turbogears.util import get_project_name, setlike12 """TurboGears System Information. 13 14 Lists your TurboGears packages and version information. 15 16 """ 17 18 __label__ = "System Info" 19 __version__ = "0.1" 20 __author__ = "Ronald Jaramillo" 21 __email__ = "ronald@checkandshare.com" 22 __copyright__ = "Copyright 2005 Ronald Jaramillo" 23 __license__ = "MIT" 24 25 icon = "/tg_static/images/info.png" 26 27 @expose(template='turbogears.toolbox.info')3229 from turbogears.command.info import retrieve_info 30 packages, plugins = retrieve_info(with_links=True) 31 return dict(packages=packages, plugins=plugins)35 """The widget browser. 36 37 Browse usage samples, description and source code for the available 38 TurboGears Widgets. 39 40 """ 41 42 __label__ = "Widget Browser" 43 __version__ = "0.1" 44 __author__ = "Kevin Dangoor" 45 __email__ = "dangoor+turbogears@gmail.com" 46 __copyright__ = "Copyright 2005 Kevin Dangoor" 47 __license__ = "MIT" 48 49 all_descs = None 50 icon = "/tg_static/images/widgets.png" 5110353 try: 54 import turbokid 55 except ImportError: 56 raise ImportError("Widgets need TurboKid to work.")57 58 # We use a Kid page template here since the Widget browser 59 # needs Kid anyway to display the widgets (will be fixed in TG 1.5). 60 @expose(template="kid:turbogears.toolbox.widgets")62 from turbogears import widgets 63 from turbogears.widgets import js_location, Tabber, SyntaxHighlighter 64 all_descs = self.all_descs 65 if not all_descs: 66 widgets.load_widgets() 67 all_descs = dict() 68 for widgetdesc in widgets.all_widgets: 69 wd = widgetdesc() 70 all_descs[wd.full_class_name.replace('.', '_')] = wd 71 self.all_descs = all_descs 72 if name: 73 all_descs = {name: all_descs[name]} 74 desclist = sorted(all_descs.itervalues(), key=lambda x: x.name.lower()) 75 output = dict(descs=desclist, viewing_one=name != None) 76 if name: 77 # do not extend desclist! 78 desclist = desclist + [Tabber(), SyntaxHighlighter()] 79 80 css = setlike() 81 js = dict() 82 for location in js_location: 83 js[location] = setlike() 84 85 for widgetdesc in desclist: 86 if not name and widgetdesc.show_separately: 87 continue 88 css.add_all(widgetdesc.retrieve_css()) 89 for script in widgetdesc.retrieve_javascript(): 90 js[getattr(script, 'location', js_location.head)].add(script) 91 92 output['widget_css'] = css 93 for location in js: 94 output['widget_js_%s' % str(location)] = js[location] 95 96 return output97106 109 114174116 project_name = get_project_name() 117 toolbox = [] 118 for i in pkg_resources.iter_entry_points("turbogears.toolboxcommand"): 119 tool = i.load() 120 args = { 121 'path': i.name, 122 'label': getattr(tool, '__label__', i.name), 123 'description': getattr(tool, '__doc__', ''), 124 'version': getattr(tool, '__version__', ''), 125 'author': getattr(tool, '__author__', ''), 126 'email': getattr(tool, '__email__', ''), 127 'copyright': getattr(tool, '__copyright__', ''), 128 'license': getattr(tool, '__license__', ''), 129 'icon': self.tool_icon(tool), 130 'disabled': False} 131 if project_name or not getattr(tool, 'need_project', False): 132 try: 133 setattr(self, i.name, tool()) 134 except Exception, e: 135 args["description"] = str(e) or 'Tool could not be loaded.' 136 args["disabled"] = 'disabled' 137 else: 138 args["description"] += '\nNeeds project.' 139 args["disabled"] = 'disabled' 140 toolbox.append(args) 141 return toolbox142144 p = [[], []] 145 for idx, tool in enumerate(tools): 146 p[idx % 2].append(tool) 147 pairs = zip(p[0], p[1]) 148 if len(p[0]) > len(p[1]): 149 pairs.append([p[0][-1], None]) 150 if len(p[0]) < len(p[1]): 151 pairs.append([p[1][-1], None]) 152 return pairs153 154 @expose(template="turbogears.toolbox.main") 158 159 @expose()161 return """<h3>No access for %s</h3> 162 <p> 163 By default only localhost (127.0.0.1) 164 has access to the Toolbox 165 </p> 166 <p> 167 You can provide access to your client by passing 168 your host address to Toolbox as a parameter. Ex: 169 </p> 170 <pre> 171 tg-admin toolbox -c %s 172 </pre> 173 """ % (cherrypy.request.remoteAddr,cherrypy.request.remoteAddr)
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Fri Jul 19 17:17:59 2019 | http://epydoc.sourceforge.net |