From 0584848bb88528feb5d2b2d234848d410b1beefb Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Thu, 11 Jun 2009 14:40:47 -0700 Subject: Adding a management command that will display the SQL generated by Django as you use the interactive Python shell. --- debug_toolbar/management/__init__.py | 0 debug_toolbar/management/commands/__init__.py | 0 debug_toolbar/management/commands/debugsqlshell.py | 84 ++++++++++++++++++++++ 3 files changed, 84 insertions(+) create mode 100644 debug_toolbar/management/__init__.py create mode 100644 debug_toolbar/management/commands/__init__.py create mode 100644 debug_toolbar/management/commands/debugsqlshell.py (limited to 'debug_toolbar') diff --git a/debug_toolbar/management/__init__.py b/debug_toolbar/management/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/debug_toolbar/management/commands/__init__.py b/debug_toolbar/management/commands/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/debug_toolbar/management/commands/debugsqlshell.py b/debug_toolbar/management/commands/debugsqlshell.py new file mode 100644 index 0000000..0f2fc6a --- /dev/null +++ b/debug_toolbar/management/commands/debugsqlshell.py @@ -0,0 +1,84 @@ +import os +from optparse import make_option + +from django.core.management.base import NoArgsCommand +from django.db.backends import util + +# Optional sqlparse to make the SQL look pretty... +# http://code.google.com/p/python-sqlparse/ +try: + import sqlparse +except ImportError: + sqlparse = None + +class PrintQueryWrapper(util.CursorDebugWrapper): + def execute(self, sql, params=()): + try: + return self.cursor.execute(sql, params) + finally: + raw_sql = self.db.ops.last_executed_query(self.cursor, sql, params) + if sqlparse: + print sqlparse.format(raw_sql, reindent=True) + else: + print raw_sql + print + +util.CursorDebugWrapper = PrintQueryWrapper + +# The rest is copy/paste from django/core/management/commands/shell.py + +class Command(NoArgsCommand): + option_list = NoArgsCommand.option_list + ( + make_option('--plain', action='store_true', dest='plain', + help='Tells Django to use plain Python, not IPython.'), + ) + help = "Runs a Python interactive interpreter. Tries to use IPython, if it's available." + + requires_model_validation = False + + def handle_noargs(self, **options): + # XXX: (Temporary) workaround for ticket #1796: force early loading of all + # models from installed apps. + from django.db.models.loading import get_models + loaded_models = get_models() + + use_plain = options.get('plain', False) + + try: + if use_plain: + # Don't bother loading IPython, because the user wants plain Python. + raise ImportError + import IPython + # Explicitly pass an empty list as arguments, because otherwise IPython + # would use sys.argv from this script. + shell = IPython.Shell.IPShell(argv=[]) + shell.mainloop() + except ImportError: + import code + # Set up a dictionary to serve as the environment for the shell, so + # that tab completion works on objects that are imported at runtime. + # See ticket 5082. + imported_objects = {} + try: # Try activating rlcompleter, because it's handy. + import readline + except ImportError: + pass + else: + # We don't have to wrap the following import in a 'try', because + # we already know 'readline' was imported successfully. + import rlcompleter + readline.set_completer(rlcompleter.Completer(imported_objects).complete) + readline.parse_and_bind("tab:complete") + + # We want to honor both $PYTHONSTARTUP and .pythonrc.py, so follow system + # conventions and get $PYTHONSTARTUP first then import user. + if not use_plain: + pythonrc = os.environ.get("PYTHONSTARTUP") + if pythonrc and os.path.isfile(pythonrc): + try: + execfile(pythonrc) + except NameError: + pass + # This will import .pythonrc.py as a side-effect + import user + code.interact(local=imported_objects) -- cgit v1.2.3 From 658c7384112cc45ec04343b03ce7f670b012ab0e Mon Sep 17 00:00:00 2001 From: Mike Korobov Date: Thu, 23 Jul 2009 16:48:41 +0800 Subject: Bypass context variables which 'repr' is broken. Signed-off-by: Rob Hudson --- debug_toolbar/panels/template.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'debug_toolbar') diff --git a/debug_toolbar/panels/template.py b/debug_toolbar/panels/template.py index 7dc7b06..b548287 100644 --- a/debug_toolbar/panels/template.py +++ b/debug_toolbar/panels/template.py @@ -72,7 +72,14 @@ class TemplateDebugPanel(DebugPanel): info['template'] = t # Clean up context for better readability c = d.get('context', None) - info['context'] = '\n'.join([pformat(_d) for _d in c.dicts]) + + d_list = [] + for _d in c.dicts: + try: + d_list.append(pformat(d)) + except UnicodeEncodeError: + pass + info['context'] = '\n'.join(d_list) template_context.append(info) context = { 'templates': template_context, -- cgit v1.2.3 From b5ccbcdfa1b4cc71aec7c289d455298bc5cd1bfb Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Fri, 7 Aug 2009 07:20:38 -0700 Subject: Cleaned up trailing spaces. --- debug_toolbar/management/commands/debugsqlshell.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'debug_toolbar') diff --git a/debug_toolbar/management/commands/debugsqlshell.py b/debug_toolbar/management/commands/debugsqlshell.py index 0f2fc6a..84b4a2f 100644 --- a/debug_toolbar/management/commands/debugsqlshell.py +++ b/debug_toolbar/management/commands/debugsqlshell.py @@ -22,7 +22,7 @@ class PrintQueryWrapper(util.CursorDebugWrapper): else: print raw_sql print - + util.CursorDebugWrapper = PrintQueryWrapper # The rest is copy/paste from django/core/management/commands/shell.py @@ -72,12 +72,12 @@ class Command(NoArgsCommand): # We want to honor both $PYTHONSTARTUP and .pythonrc.py, so follow system # conventions and get $PYTHONSTARTUP first then import user. - if not use_plain: - pythonrc = os.environ.get("PYTHONSTARTUP") - if pythonrc and os.path.isfile(pythonrc): - try: - execfile(pythonrc) - except NameError: + if not use_plain: + pythonrc = os.environ.get("PYTHONSTARTUP") + if pythonrc and os.path.isfile(pythonrc): + try: + execfile(pythonrc) + except NameError: pass # This will import .pythonrc.py as a side-effect import user -- cgit v1.2.3 From 565b100f9d97214043ae93c51d276951a65331e8 Mon Sep 17 00:00:00 2001 From: Rob Hudson Date: Tue, 11 Aug 2009 09:45:18 -0700 Subject: Refactored the UI to be a right hand side vertical toolbar. DebugPanel subclass grew a subtitle method to display informative text under the title. --- debug_toolbar/media/debug_toolbar/toolbar.css | 91 +++++++++++------------ debug_toolbar/media/debug_toolbar/toolbar.min.css | 2 +- debug_toolbar/panels/__init__.py | 5 ++ debug_toolbar/panels/logger.py | 5 +- debug_toolbar/panels/sql.py | 5 +- debug_toolbar/panels/timer.py | 7 +- debug_toolbar/panels/version.py | 7 +- debug_toolbar/templates/debug_toolbar/base.html | 7 +- 8 files changed, 72 insertions(+), 57 deletions(-) (limited to 'debug_toolbar') diff --git a/debug_toolbar/media/debug_toolbar/toolbar.css b/debug_toolbar/media/debug_toolbar/toolbar.css index 9ef6dc3..275a776 100644 --- a/debug_toolbar/media/debug_toolbar/toolbar.css +++ b/debug_toolbar/media/debug_toolbar/toolbar.css @@ -7,37 +7,39 @@ text-align: left; } #djDebug a { - color: #f7c757; + color: #fff; } #djDebug a:hover { - color: #aaa; + color: #900; } #djDebugToolbar { - background: #326342; - height: 30px; + background: #111; + width: 150px; z-index: 100000000; - border-bottom: 2px solid #234f32; position:absolute; top:0; - left:0; + bottom:0; right:0; + opacity:0.9; +} + +#djDebugToolbar small { + color:#999; } #djDebugToolbarHandle { - background: #326342; - height: 30px; - z-index: 100000000; - border-bottom: 2px solid #234f32; position:absolute; + background: #111; top:0; - left:0; + bottom:0; right:0; - width: 16px; + z-index: 100000000; } #djDebugToolbarHandle ul li { - padding: 3px 0px 0px 3px; + list-style-type:none; + padding: 3px; } #djDebugToolbarHandle ul li a { @@ -52,33 +54,27 @@ } #djDebugToolbar li { - border-left: 1px solid #487858; + border-bottom: 1px solid #222; color: #fff; - display: inline; + display: block; font-size: 11px; font-weight: bold; float: none; - height: 20px; margin: 0; padding: 0; - line-height: 30px; - padding: 8px 9px 9px; + padding: 8px; position: relative; width: auto; } #djDebugToolbar li:hover { - background: #487858; + background: #222; } #djDebugToolbar li:hover a { color: #fff; } -#djDebugToolbar li:last-child { - border-right: 1px solid #487858; -} - #djDebugToolbar #djDebugButton { color: #92ef3f; } @@ -92,33 +88,30 @@ } #djDebug .panelContent { - background: #2a5738; - border-bottom: 2px solid #234f32; - border-top: 2px solid #487858; + background: #222; display: none; position: absolute; margin: 0; padding: 10px; - top: 32px; + top: 0; width: auto; left: 0px; - right: 0px; - bottom: 5px; - color: black; + right: 150px; + bottom: 0; + color: #fff; z-index: 1000000; overflow: auto; } #djDebug .panelContent p a, #djDebug .panelContent dl a { - color: #40684c; + color: #000; } #djDebug .panelContent p a:hover, #djDebug .panelContent dl a:hover { - color: #92EF3F; + color: #900; } #djDebug .panelContent h3 { - border-bottom: 1px solid #40684c; - color: #92ef3f; + color: #fff; padding: 0 0 5px; } @@ -137,18 +130,20 @@ } #djDebug .panelContent table a { - color: #40684C; + color: #000; +} +#djDebug .panelContent table a:hover { + color: #900; } #djDebug .panelContent table th { - background-color: #9dcc49; + background-color: #333; font-weight: bold; - color: #000; + color: #fff; font-size: 11px; padding: 3px 7px 3px; text-align: left; cursor: pointer; - border-right: 1px solid #b9d977; } #djDebug .panelContent table td { padding: 5px 10px; @@ -177,19 +172,19 @@ #djDebug .highlight { color: #000; } #djDebug .highlight .err { color: #000; } /* Error */ #djDebug .highlight .g { color: #000; } /* Generic */ -#djDebug .highlight .k { color: #40684C; font-weight: bold } /* Keyword */ +#djDebug .highlight .k { color: #000; font-weight: bold } /* Keyword */ #djDebug .highlight .o { color: #000; } /* Operator */ #djDebug .highlight .n { color: #000; } /* Name */ -#djDebug .highlight .mi { color: #40684C; font-weight: bold } /* Literal.Number.Integer */ +#djDebug .highlight .mi { color: #000; font-weight: bold } /* Literal.Number.Integer */ #djDebug .highlight .l { color: #000; } /* Literal */ #djDebug .highlight .x { color: #000; } /* Other */ #djDebug .highlight .p { color: #000; } /* Punctuation */ -#djDebug .highlight .m { color: #40684C; font-weight: bold } /* Literal.Number */ -#djDebug .highlight .s { color: #0086d2 } /* Literal.String */ +#djDebug .highlight .m { color: #000; font-weight: bold } /* Literal.Number */ +#djDebug .highlight .s { color: #333 } /* Literal.String */ #djDebug .highlight .w { color: #888888 } /* Text.Whitespace */ -#djDebug .highlight .il { color: #40684C; font-weight: bold } /* Literal.Number.Integer.Long */ -#djDebug .highlight .na { color: #7D9029 } /* Name.Attribute */ -#djDebug .highlight .nt { color: #008000; font-weight: bold } /* Name.Tag */ -#djDebug .highlight .nv { color: #19177C } /* Name.Variable */ -#djDebug .highlight .s2 { color: #BA2121 } /* Literal.String.Double */ -#djDebug .highlight .cp { color: #BC7A00 } /* Comment.Preproc */ +#djDebug .highlight .il { color: #000; font-weight: bold } /* Literal.Number.Integer.Long */ +#djDebug .highlight .na { color: #333 } /* Name.Attribute */ +#djDebug .highlight .nt { color: #000; font-weight: bold } /* Name.Tag */ +#djDebug .highlight .nv { color: #333 } /* Name.Variable */ +#djDebug .highlight .s2 { color: #333 } /* Literal.String.Double */ +#djDebug .highlight .cp { color: #333 } /* Comment.Preproc */ diff --git a/debug_toolbar/media/debug_toolbar/toolbar.min.css b/debug_toolbar/media/debug_toolbar/toolbar.min.css index c172fbd..21262aa 100644 --- a/debug_toolbar/media/debug_toolbar/toolbar.min.css +++ b/debug_toolbar/media/debug_toolbar/toolbar.min.css @@ -1 +1 @@ -#djDebug *{color:#000;float:none;margin:0;padding:0;position:static;text-align:left;}#djDebug a{color:#f7c757;}#djDebug a:hover{color:#aaa;}#djDebugToolbar{background:#326342;height:30px;z-index:100000000;border-bottom:2px solid #234f32;position:absolute;top:0;left:0;right:0;}#djDebugToolbarHandle{background:#326342;height:30px;z-index:100000000;border-bottom:2px solid #234f32;position:absolute;top:0;left:0;right:0;width:16px;}#djDebugToolbarHandle ul li{padding:3px 0 0 3px;}#djDebugToolbarHandle ul li a{font-size:16px;font-weight:bold;}#djDebugToolbar ul{margin:0;padding:0;list-style:none;}#djDebugToolbar li{border-left:1px solid #487858;color:#fff;display:inline;font-size:11px;font-weight:bold;float:none;height:20px;margin:0;padding:0;line-height:30px;padding:8px 9px 9px;position:relative;width:auto;}#djDebugToolbar li:hover{background:#487858;}#djDebugToolbar li:hover a{color:#fff;}#djDebugToolbar li:last-child{border-right:1px solid #487858;}#djDebugToolbar #djDebugButton{color:#92ef3f;}#djDebug pre{background-color:#fff;}#djDebug tr.djDebugOdd pre{background-color:#eee;}#djDebug .panelContent{background:#2a5738;border-bottom:2px solid #234f32;border-top:2px solid #487858;display:none;position:absolute;margin:0;padding:10px;top:32px;width:auto;left:0;right:0;bottom:5px;color:black;z-index:1000000;overflow:auto;}#djDebug .panelContent p a,#djDebug .panelContent dl a{color:#40684c;}#djDebug .panelContent p a:hover,#djDebug .panelContent dl a:hover{color:#92EF3F;}#djDebug .panelContent h3{border-bottom:1px solid #40684c;color:#92ef3f;padding:0 0 5px;}#djDebug .panelContent p{padding:0 5px;}#djDebug .panelContent p,#djDebug .panelContent table,#djDebug .panelContent ol,#djDebug .panelContent ul,#djDebug .panelContent dl{margin:5px 0 15px;background-color:#fff;}#djDebug .panelContent table{width:100%;clear:both;}#djDebug .panelContent table a{color:#40684C;}#djDebug .panelContent table th{background-color:#9dcc49;font-weight:bold;color:#000;font-size:11px;padding:3px 7px 3px;text-align:left;cursor:pointer;border-right:1px solid #b9d977;}#djDebug .panelContent table td{padding:5px 10px;font-size:11px;background:#fff;color:#000;vertical-align:top;}#djDebug .panelContent table tr.djDebugOdd td{background:#eee;}#djDebug .panelContent .close{float:right;font-weight:bold;}#djDebug .panelContent dt,#djDebug .panelContent dd{display:block;}#djDebug .panelContent dd{margin-left:10px;}#djDebug .highlight{color:#000;}#djDebug .highlight .err{color:#000;}#djDebug .highlight .g{color:#000;}#djDebug .highlight .k{color:#40684C;font-weight:bold;}#djDebug .highlight .o{color:#000;}#djDebug .highlight .n{color:#000;}#djDebug .highlight .mi{color:#40684C;font-weight:bold;}#djDebug .highlight .l{color:#000;}#djDebug .highlight .x{color:#000;}#djDebug .highlight .p{color:#000;}#djDebug .highlight .m{color:#40684C;font-weight:bold;}#djDebug .highlight .s{color:#0086d2;}#djDebug .highlight .w{color:#888;}#djDebug .highlight .il{color:#40684C;font-weight:bold;}#djDebug .highlight .na{color:#7D9029;}#djDebug .highlight .nt{color:#008000;font-weight:bold;}#djDebug .highlight .nv{color:#19177C;}#djDebug .highlight .s2{color:#BA2121;}#djDebug .highlight .cp{color:#BC7A00;} \ No newline at end of file +#djDebug *{color:#000;float:none;margin:0;padding:0;position:static;text-align:left;}#djDebug a{color:#fff;}#djDebug a:hover{color:#900;}#djDebugToolbar{background:#111;width:150px;z-index:100000000;position:absolute;top:0;bottom:0;right:0;opacity:.9;}#djDebugToolbar small{color:#999;}#djDebugToolbarHandle{position:absolute;background:#111;top:0;bottom:0;right:0;z-index:100000000;}#djDebugToolbarHandle ul li{list-style-type:none;padding:3px;}#djDebugToolbarHandle ul li a{font-size:16px;font-weight:bold;}#djDebugToolbar ul{margin:0;padding:0;list-style:none;}#djDebugToolbar li{border-bottom:1px solid #222;color:#fff;display:block;font-size:11px;font-weight:bold;float:none;margin:0;padding:0;padding:8px;position:relative;width:auto;}#djDebugToolbar li:hover{background:#222;}#djDebugToolbar li:hover a{color:#fff;}#djDebugToolbar #djDebugButton{color:#92ef3f;}#djDebug pre{background-color:#fff;}#djDebug tr.djDebugOdd pre{background-color:#eee;}#djDebug .panelContent{background:#222;display:none;position:absolute;margin:0;padding:10px;top:0;width:auto;left:0;right:150px;bottom:0;color:#fff;z-index:1000000;overflow:auto;}#djDebug .panelContent p a,#djDebug .panelContent dl a{color:#000;}#djDebug .panelContent p a:hover,#djDebug .panelContent dl a:hover{color:#900;}#djDebug .panelContent h3{color:#fff;padding:0 0 5px;}#djDebug .panelContent p{padding:0 5px;}#djDebug .panelContent p,#djDebug .panelContent table,#djDebug .panelContent ol,#djDebug .panelContent ul,#djDebug .panelContent dl{margin:5px 0 15px;background-color:#fff;}#djDebug .panelContent table{width:100%;clear:both;}#djDebug .panelContent table a{color:#000;}#djDebug .panelContent table a:hover{color:#900;}#djDebug .panelContent table th{background-color:#333;font-weight:bold;color:#fff;font-size:11px;padding:3px 7px 3px;text-align:left;cursor:pointer;}#djDebug .panelContent table td{padding:5px 10px;font-size:11px;background:#fff;color:#000;vertical-align:top;}#djDebug .panelContent table tr.djDebugOdd td{background:#eee;}#djDebug .panelContent .close{float:right;font-weight:bold;}#djDebug .panelContent dt,#djDebug .panelContent dd{display:block;}#djDebug .panelContent dd{margin-left:10px;}#djDebug .highlight{color:#000;}#djDebug .highlight .err{color:#000;}#djDebug .highlight .g{color:#000;}#djDebug .highlight .k{color:#000;font-weight:bold;}#djDebug .highlight .o{color:#000;}#djDebug .highlight .n{color:#000;}#djDebug .highlight .mi{color:#000;font-weight:bold;}#djDebug .highlight .l{color:#000;}#djDebug .highlight .x{color:#000;}#djDebug .highlight .p{color:#000;}#djDebug .highlight .m{color:#000;font-weight:bold;}#djDebug .highlight .s{color:#333;}#djDebug .highlight .w{color:#888;}#djDebug .highlight .il{color:#000;font-weight:bold;}#djDebug .highlight .na{color:#333;}#djDebug .highlight .nt{color:#000;font-weight:bold;}#djDebug .highlight .nv{color:#333;}#djDebug .highlight .s2{color:#333;}#djDebug .highlight .cp{color:#333;} \ No newline at end of file diff --git a/debug_toolbar/panels/__init__.py b/debug_toolbar/panels/__init__.py index 54b3318..459e550 100644 --- a/debug_toolbar/panels/__init__.py +++ b/debug_toolbar/panels/__init__.py @@ -15,8 +15,13 @@ class DebugPanel(object): return 'djDebug%sPanel' % (self.name.replace(' ', '')) def title(self): + """Title showing in toolbar""" raise NotImplementedError + def subtitle(self): + """Subtitle showing until title in toolbar""" + return '' + def url(self): raise NotImplementedError diff --git a/debug_toolbar/panels/logger.py b/debug_toolbar/panels/logger.py index cb88148..91688a8 100644 --- a/debug_toolbar/panels/logger.py +++ b/debug_toolbar/panels/logger.py @@ -52,7 +52,10 @@ class LoggingPanel(DebugPanel): return records def title(self): - return "Logging (%s message%s)" % (len(handler.get_records()), (len(handler.get_records()) == 1) and '' or 's') + return "Logging" + + def subtitle(self): + return "%s message%s" % (len(handler.get_records()), (len(handler.get_records()) == 1) and '' or 's') def url(self): return '' diff --git a/debug_toolbar/panels/sql.py b/debug_toolbar/panels/sql.py index d3ac7f3..d1d1ead 100644 --- a/debug_toolbar/panels/sql.py +++ b/debug_toolbar/panels/sql.py @@ -74,9 +74,12 @@ class SQLDebugPanel(DebugPanel): self._sql_time = 0 def title(self): + return 'SQL' + + def subtitle(self): self._sql_time = sum(map(lambda q: float(q['time']), connection.queries)) num_queries = len(connection.queries) - self._offset - return '%d SQL %s (%.2fms)' % ( + return "%d %s in %.2fms" % ( num_queries, (num_queries == 1) and 'query' or 'queries', self._sql_time diff --git a/debug_toolbar/panels/timer.py b/debug_toolbar/panels/timer.py index 352bf55..1491272 100644 --- a/debug_toolbar/panels/timer.py +++ b/debug_toolbar/panels/timer.py @@ -32,12 +32,15 @@ class TimerDebugPanel(DebugPanel): self._end_rusage = resource.getrusage(resource.RUSAGE_SELF) def title(self): + return 'Time' + + def subtitle(self): if self.has_resource: utime = self._end_rusage.ru_utime - self._start_rusage.ru_utime stime = self._end_rusage.ru_stime - self._start_rusage.ru_stime - return 'Time: %0.2fms, %0.2fms CPU' % (self.total_time, (utime + stime) * 1000.0) + return 'CPU: %0.2fms (%0.2fms)' % ((utime + stime) * 1000.0, self.total_time) else: - return 'Time: %0.2fms' % (self.total_time) + return 'TOTAL: %0.2fms' % (self.total_time) def url(self): return '' diff --git a/debug_toolbar/panels/version.py b/debug_toolbar/panels/version.py index 7ea6543..da05bf1 100644 --- a/debug_toolbar/panels/version.py +++ b/debug_toolbar/panels/version.py @@ -6,9 +6,12 @@ class VersionDebugPanel(DebugPanel): Panel that displays the Django version. """ name = 'Version' - + def title(self): - return 'Version: %s' % (django.get_version()) + return 'Django Version' + + def subtitle(self): + return django.get_version() def url(self): return '' diff --git a/debug_toolbar/templates/debug_toolbar/base.html b/debug_toolbar/templates/debug_toolbar/base.html index 52b7a5b..e3681b2 100644 --- a/debug_toolbar/templates/debug_toolbar/base.html +++ b/debug_toolbar/templates/debug_toolbar/base.html @@ -19,7 +19,7 @@ {% for panel in panels %} -- cgit v1.2.3 From c67c719047645381011f02c56daaa152efbf796c Mon Sep 17 00:00:00 2001 From: Idan Gazit Date: Wed, 12 Aug 2009 04:37:47 +0300 Subject: toolbar restyling, switched to non-minified css/js --- debug_toolbar/media/debug_toolbar/indicator.png | Bin 0 -> 278 bytes debug_toolbar/media/debug_toolbar/toolbar.css | 96 ++++++++++++++++++------ debug_toolbar/media/debug_toolbar/toolbar.js | 4 + debug_toolbar/templates/debug_toolbar/base.html | 15 +++- 4 files changed, 88 insertions(+), 27 deletions(-) create mode 100644 debug_toolbar/media/debug_toolbar/indicator.png (limited to 'debug_toolbar') diff --git a/debug_toolbar/media/debug_toolbar/indicator.png b/debug_toolbar/media/debug_toolbar/indicator.png new file mode 100644 index 0000000..a21fc6e Binary files /dev/null and b/debug_toolbar/media/debug_toolbar/indicator.png differ diff --git a/debug_toolbar/media/debug_toolbar/toolbar.css b/debug_toolbar/media/debug_toolbar/toolbar.css index 275a776..b6e3f5d 100644 --- a/debug_toolbar/media/debug_toolbar/toolbar.css +++ b/debug_toolbar/media/debug_toolbar/toolbar.css @@ -5,17 +5,13 @@ padding: 0; position: static; text-align: left; -} -#djDebug a { - color: #fff; -} -#djDebug a:hover { - color: #900; + font-family: Cambria, Georgia, serif; + font-size: 16px; } #djDebugToolbar { background: #111; - width: 150px; + width: 200px; z-index: 100000000; position:absolute; top:0; @@ -28,23 +24,38 @@ color:#999; } + + #djDebugToolbarHandle { position:absolute; background: #111; top:0; - bottom:0; right:0; + height: 25px; + width: 25px; z-index: 100000000; } #djDebugToolbarHandle ul li { list-style-type:none; - padding: 3px; + padding: 0; } #djDebugToolbarHandle ul li a { - font-size: 16px; - font-weight: bold; + display: block; + width: 100%; + font-size: 16px; + line-height: 25px; + font-weight: bold; + text-decoration: none; + color: #daf7ff; + text-align: center; +} + +#djDebugToolbarHandle ul li a:hover { + color: #111; + background-color: #9fbb54; + border: 1px solid #111; } #djDebugToolbar ul { @@ -57,24 +68,58 @@ border-bottom: 1px solid #222; color: #fff; display: block; - font-size: 11px; font-weight: bold; float: none; margin: 0; padding: 0; - padding: 8px; position: relative; width: auto; } -#djDebugToolbar li:hover { - background: #222; + + +#djDebugToolbar li>a, +#djDebugToolbar li>div.contentless { + font-weight: normal; + font-style: normal; + font-variant: small-caps; + text-decoration: none; + display: block; + font-size: 18px; + padding: 10px 10px 5px 25px; + color: #fff; } -#djDebugToolbar li:hover a { - color: #fff; +#djDebugToolbar li a:hover { + color: #111; + background-color: #c6d6da; + border-right: 10px solid #fff; } +#djDebugToolbar li.active { + background-image: url(indicator.png); + background-repeat: no-repeat; + background-position: left center; +} + +#djDebugToolbar li.active a:hover { + background-color: #111; + background-image: inherit; + background-position: inherit; + background-repeat: inherit; + color: #b36a60; + border: none; +} + +#djDebugToolbar li small { + font-size: 12px; + color: #999; + font-style: italic; + text-decoration: none; + font-variant: normal; +} + + #djDebugToolbar #djDebugButton { color: #92ef3f; } @@ -88,19 +133,24 @@ } #djDebug .panelContent { - background: #222; + background: #daf7ff; display: none; position: absolute; margin: 0; padding: 10px; - top: 0; + top: 15px; width: auto; - left: 0px; - right: 150px; - bottom: 0; - color: #fff; + max-width: 700px; + min-width: 500px; + right: 200px; + bottom: 15px; + color: #111; z-index: 1000000; overflow: auto; + border-left: 10px solid #c6d6da; + border-top: 10px solid #c6d6da; + border-bottom: 10px solid #c6d6da; + opacity: 0.9; } #djDebug .panelContent p a, #djDebug .panelContent dl a { diff --git a/debug_toolbar/media/debug_toolbar/toolbar.js b/debug_toolbar/media/debug_toolbar/toolbar.js index 40e1a58..cde67a6 100644 --- a/debug_toolbar/media/debug_toolbar/toolbar.js +++ b/debug_toolbar/media/debug_toolbar/toolbar.js @@ -14,10 +14,13 @@ jQuery(function($j) { current = $j('#djDebug #' + this.className); if (current.is(':visible')) { $j(document).trigger('close.djDebug'); + $j(this).parent().removeClass("active"); } else { $j('.panelContent').hide(); current.show(); $j.djDebug.open(); + $j('#djDebugToolbar li').removeClass("active"); + $j(this).parent().addClass("active"); } return false; }); @@ -77,6 +80,7 @@ jQuery(function($j) { }, hide_toolbar: function(setCookie) { $j('#djDebugToolbar').hide("fast"); + $j('#djDebugToolbar li').removeClass("active"); $j(document).trigger('close.djDebug'); $j('#djDebugToolbarHandle').show(); if (setCookie) { diff --git a/debug_toolbar/templates/debug_toolbar/base.html b/debug_toolbar/templates/debug_toolbar/base.html index e3681b2..f6a508d 100644 --- a/debug_toolbar/templates/debug_toolbar/base.html +++ b/debug_toolbar/templates/debug_toolbar/base.html @@ -7,13 +7,14 @@ document.write(unescape('%3Cscript src="' + jquery_url + '" type="text/javascript"%3E%3C/script%3E')); } - + +