[z3-checkins] r14682 - z3/zopejam/trunk/src/zopejam
hathawsh at codespeak.net
hathawsh at codespeak.net
Fri Jul 15 08:52:44 CEST 2005
Author: hathawsh
Date: Fri Jul 15 08:52:40 2005
New Revision: 14682
Added:
z3/zopejam/trunk/src/zopejam/propbook.py
Modified:
z3/zopejam/trunk/src/zopejam/main.py
z3/zopejam/trunk/src/zopejam/resources.xrc
Log:
Began work on the properties notebook and added styles to the add tips
Modified: z3/zopejam/trunk/src/zopejam/main.py
==============================================================================
--- z3/zopejam/trunk/src/zopejam/main.py (original)
+++ z3/zopejam/trunk/src/zopejam/main.py Fri Jul 15 08:52:40 2005
@@ -16,7 +16,7 @@
from wx.lib.mixins import listctrl
from zcmledit.project import Project
-from zopejam import columns
+from zopejam import columns, propbook
from zope.schema.interfaces import IField
VERSION = '0.1'
@@ -106,6 +106,10 @@
self.tip_hide_timer.Bind(
wx.EVT_TIMER, lambda event: self.tip_frame.Hide())
+ self.status_label = xrc.XRCCTRL(self.frame, 'status_label')
+ self.book = propbook.PropertiesNotebook(
+ self, xrc.XRCCTRL(self.frame, 'properties_notebook'))
+
self.project = None
self.frame.Fit()
@@ -135,6 +139,9 @@
if proj_fn:
self.loadProject(proj_fn)
+ def setStatus(self, text):
+ self.status_label.SetLabel(text)
+
def update_commands_enabled(self):
p = self.project is not None
self.commands.newfile.enable(p)
@@ -248,6 +255,7 @@
incroot = structure.AddRoot('')
todo = [(incroot, self.project.root_config)]
+ # populate the structure tree
while todo:
parent, cfg = todo.pop(0)
@@ -350,7 +358,7 @@
if not fullname:
# hide the tip soon
if not self.tip_hide_timer.IsRunning():
- self.tip_hide_timer.Start(500, wx.TIMER_ONE_SHOT)
+ self.tip_hide_timer.Start(300, wx.TIMER_ONE_SHOT)
return
dfn = self.project.definitions[fullname]
@@ -358,8 +366,10 @@
if schema_info.get('error'):
doc = ('An error occurred while loading the '
'schema for this directive: %s' % schema_info['error'])
+ body_color = wx.RED
else:
doc = self.join_lines(schema_info.get('doc', ''))
+ body_color = wx.BLACK
if not doc:
doc = 'No documentation available.'
@@ -370,7 +380,23 @@
label = ns
tip_text = xrc.XRCCTRL(self.tip_frame, "tip_text")
- tip_text.SetValue("Directive: %s:%s\n\n%s" % (label, localname, doc))
+ tip_text.Clear()
+ f = tip_text.GetFont()
+ normal = wx.Font(
+ f.GetPointSize(),
+ f.GetFamily(),
+ f.GetStyle(),
+ wx.FONTWEIGHT_NORMAL)
+ bold = wx.Font(
+ f.GetPointSize(),
+ f.GetFamily(),
+ f.GetStyle(),
+ wx.FONTWEIGHT_BOLD)
+
+ tip_text.SetDefaultStyle(wx.TextAttr(wx.BLACK, font=bold))
+ tip_text.AppendText("%s:%s\n" % (label, localname))
+ tip_text.SetDefaultStyle(wx.TextAttr(body_color, font=normal))
+ tip_text.AppendText("\n%s" % doc)
self.tip_hide_timer.Stop()
if not self.tip_frame.IsShown():
@@ -430,6 +456,28 @@
self.SortListItems(0, 1)
+ self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.onSelectChange)
+ self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.onSelectChange)
+ self.Bind(wx.EVT_LIST_ITEM_FOCUSED, self.onSelectChange)
+
+ self.select_timer = wx.Timer()
+ self.select_timer.Bind(wx.EVT_TIMER, self.onSelectTimeout)
+
+ def onSelectChange(self, event):
+ self.select_timer.Stop()
+ self.select_timer.Start(300, wx.TIMER_ONE_SHOT)
+
+ def onSelectTimeout(self, event):
+ count = self.GetSelectedItemCount()
+ self.gui.setStatus("%d directive%s selected" %
+ (count, (count != 1 and 's' or '')))
+ selected = []
+ item = self.GetFirstSelected()
+ while item >= 0:
+ selected.append(self.elements[item])
+ item = self.GetNextSelected(item)
+ self.gui.book.onSelect(selected)
+
def populate(self):
self.itemDataMap = {}
for c in self.columns:
Added: z3/zopejam/trunk/src/zopejam/propbook.py
==============================================================================
--- (empty file)
+++ z3/zopejam/trunk/src/zopejam/propbook.py Fri Jul 15 08:52:40 2005
@@ -0,0 +1,23 @@
+
+# (c) 2005 Shane Hathaway
+# License: ZPL 2.1
+
+"""Zope Jam properties notebook
+"""
+
+import wx
+
+
+class PropertiesNotebook:
+
+ def __init__(self, gui, notebook):
+ self.gui = gui
+ self.notebook = notebook
+ self.props_page = wx.Panel(self.notebook)
+ self.notebook.AddPage(self.props_page, "Properties")
+ self.source_page = wx.Panel(self.notebook)
+ self.notebook.AddPage(self.source_page, "Source")
+
+ def onSelect(self, elements):
+ pass
+
Modified: z3/zopejam/trunk/src/zopejam/resources.xrc
==============================================================================
--- z3/zopejam/trunk/src/zopejam/resources.xrc (original)
+++ z3/zopejam/trunk/src/zopejam/resources.xrc Fri Jul 15 08:52:40 2005
@@ -302,76 +302,8 @@
<growablerows>0</growablerows>
<growablecols>0</growablecols>
<object class="sizeritem">
- <object class="wxNotebook" name="directive_notebook">
- <object class="notebookpage">
- <label>Properties</label>
- <object class="wxScrolledWindow" name="properties_tab">
- <object class="wxPanel" name="properties_panel">
- <object class="wxBoxSizer">
- <orient>wxVERTICAL</orient>
- <object class="sizeritem">
- <object class="wxFlexGridSizer">
- <cols>4</cols>
- <vgap>8</vgap>
- <object class="sizeritem">
- <object class="wxStaticText">
- <label>Name</label>
- </object>
- <flag>wxRIGHT|wxALIGN_CENTRE_VERTICAL</flag>
- <border>8</border>
- </object>
- <object class="sizeritem">
- <object class="wxTextCtrl">
- <value>Foo</value>
- </object>
- <flag>wxEXPAND|wxALIGN_CENTRE</flag>
- </object>
- <object class="sizeritem">
- <object class="wxBitmapButton">
- <bitmap>icons/other/clear_left.png</bitmap>
- <style>wxNO_BORDER</style>
- </object>
- <flag>wxALIGN_CENTRE_VERTICAL</flag>
- </object>
- <object class="sizeritem">
- <object class="wxBitmapButton">
- <bitmap>icons/other/help.png</bitmap>
- <style>wxNO_BORDER</style>
- </object>
- <flag>wxALIGN_CENTRE_VERTICAL</flag>
- </object>
- <growablecols>1</growablecols>
- </object>
- <flag>wxALL|wxEXPAND</flag>
- <border>8</border>
- </object>
- </object>
- </object>
- </object>
- <selected>1</selected>
- </object>
+ <object class="wxNotebook" name="properties_notebook">
<style></style>
- <object class="notebookpage">
- <label>Source</label>
- <object class="wxHtmlWindow" name="source_tab">
- <htmlcode><a href="#">/home/shane/src/zope/app/bigpackage/littlepackage/configure.zcml</a><br />
-line <a href="#">105</a><br />
-&lt;browser:page x="y"&gt;
-</htmlcode>
- </object>
- </object>
- <object class="notebookpage">
- <label>Adapters</label>
- <object class="wxPanel" name="adapters_tab"/>
- </object>
- <object class="notebookpage">
- <label>Views</label>
- <object class="wxPanel" name="views_tab"/>
- </object>
- <object class="notebookpage">
- <label>Code</label>
- <object class="wxHtmlWindow" name="code_tab"/>
- </object>
</object>
<flag>wxTOP|wxEXPAND</flag>
<border>1</border>
More information about the z3-checkins
mailing list