- Revision
- 16047
- Author
- stearns
- Date
- 2007-12-05 12:53:26 -0800 (Wed, 05 Dec 2007)
Log Message
don't use 'sample' for the name of the thing we measure - too confusing with the hint mechanism; make cert blocks a little bigger, but still wrong; use logging instead of print in the sizer
Modified Paths
Diff
Modified: branches/detail_layout/chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py (16046 => 16047)
--- branches/detail_layout/chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py 2007-12-05 18:30:35 UTC (rev 16046) +++ branches/detail_layout/chandler/parcels/osaf/framework/attributeEditors/AttributeEditors.py 2007-12-05 20:53:26 UTC (rev 16047) @@ -494,21 +494,22 @@ """ # We add this much to the measurement - this could be platform-specific # if it needed to be... - padding = 10 + examplePadding = 10 def GetEffectiveMinSize(self): cachedMinSize = getattr(self, 'cachedMinSize', None) if cachedMinSize is None: dc = wx.ClientDC(self) dc.SetFont(self.GetFont()) - sampleWidth = dc.GetTextExtent(self.sampleString)[0] + self.padding + exampleWidth = dc.GetTextExtent(self.exampleString)[0] \ + + self.examplePadding minHeight = super(FixedWidthTextCtrl, self).GetEffectiveMinSize()[1] - cachedMinSize = wx.Size(sampleWidth, minHeight) + cachedMinSize = wx.Size(exampleWidth, minHeight) self.cachedMinSize = cachedMinSize return cachedMinSize class DateTextCtrl(FixedWidthTextCtrl): - sampleString = DateTimeUtil.sampleDate + " ?" + exampleString = DateTimeUtil.sampleDate + " ?" class DateAttributeEditor (StringAttributeEditor): @@ -627,7 +628,7 @@ return super(DateAttributeEditor, self).finishCompletion(completionString) class TimeTextCtrl(FixedWidthTextCtrl): - sampleString = DateTimeUtil.sampleTime + " ?" + exampleString = DateTimeUtil.sampleTime + " ?" class TimeAttributeEditor(StringAttributeEditor): @@ -749,7 +750,7 @@ return pim.sampleTime # Get a hint like "hh:mm PM" class SmallNumberTextCtrl(FixedWidthTextCtrl): - sampleString = "1234" + exampleString = "1234" class SmallNumberAttributeEditor(StringAttributeEditor): def CreateControl(self, forEditing, readOnly, parentWidget,
Modified: branches/detail_layout/chandler/parcels/osaf/framework/certstore/blocks.py (16046 => 16047)
--- branches/detail_layout/chandler/parcels/osaf/framework/certstore/blocks.py 2007-12-05 18:30:35 UTC (rev 16046) +++ branches/detail_layout/chandler/parcels/osaf/framework/certstore/blocks.py 2007-12-05 20:53:26 UTC (rev 16047) @@ -105,13 +105,15 @@ dv.addRow(parcel, "PurposeArea", 0.1, _(u'purpose'), detail.makeEditor(parcel, 'PurposeAttribute', viewAttribute=u'purpose', - #minimumSize=SizeType(60, -1) + stretchFactor=0.0, + minimumSize=SizeType(60, -1) ), detail.PAD_LEFT) dv.addRow(parcel, "TrustArea", 0.2, _(u"trust"), detail.makeEditor(parcel, "TrustAttribute", viewAttribute="trust", - #size=SizeType(60, -1) + stretchFactor=0.0, + size=SizeType(60, -1) ), detail.PAD_LEFT) dv.addRow(parcel, "FingerprintArea", 0.3, _(u"fingerprint"), @@ -121,7 +123,8 @@ dv.addRow(parcel, "FingerprintAlgArea", 0.4, _(u"trust"), detail.makeEditor(parcel, "FingerprintAlgLabel", viewAttribute="fingerprintAlgorithm", - #size=SizeType(60, -1) + stretchFactor=0.0, + size=SizeType(60, -1) )) #XXX [i18n] Rather than getting all as text which cannot be localized,
Modified: branches/detail_layout/chandler/parcels/osaf/views/detail/sizer.py (16046 => 16047)
--- branches/detail_layout/chandler/parcels/osaf/views/detail/sizer.py 2007-12-05 18:30:35 UTC (rev 16046) +++ branches/detail_layout/chandler/parcels/osaf/views/detail/sizer.py 2007-12-05 20:53:26 UTC (rev 16047) @@ -43,7 +43,10 @@ from osaf.framework.attributeEditors import TimeTextCtrl, DateTextCtrl from osaf.framework.attributeEditors.DragAndDropTextCtrl \ import DragAndDropTextCtrl +import logging +logger = logging.getLogger(__name__) + # Repurpose some SizerItem flags EXPAND_HORIZONTALLY = wx.ALIGN_CENTER_HORIZONTAL EXPAND_VERTICALLY = wx.ALIGN_CENTER_VERTICAL @@ -198,8 +201,9 @@ if sizerItemRow != rowNumber: if rowLabel is not None: rowLabel.Show(anyVisible) - print "row %s: %svisible: %r, %s" % \ - (rowNumber, "" if anyVisible else "not ", nameit(rowItems), labelWidth) + logging.critical("row %s: %svisible: %r, %s" % \ + (rowNumber, "" if anyVisible else "not ", + nameit(rowItems), labelWidth)) if anyVisible: yield rowItems, labelWidth, horizontal_expander, expands_vertically anyVisible = False @@ -227,13 +231,14 @@ if rowLabel is not None: rowLabel.Show(anyVisible) - print "row %s: %svisible: %r" % \ - (rowNumber, "" if anyVisible else "not ", nameit(rowItems)) + logger.critical("row %s: %svisible: %r" % \ + (rowNumber, "" if anyVisible else "not ", + nameit(rowItems))) if anyVisible: yield rowItems, labelWidth, horizontal_expander, expands_vertically def RecalcSizes(self): - print "RecalcSizes..." + logger.critical("RecalcSizes...") totalSize = self.GetSize() if totalSize.width <= 20 and totalSize.height <= 20: # Ignore this call - we're bound to get another shortly. @@ -255,7 +260,7 @@ assert vertical_expander is None vertical_expander = rowIndex rows.append([rowItems, horizontal_expander]) - # print "Widest label is %s" % widestLabel + # logger.critical("Widest label is %s" % widestLabel) # Here's how we'll lay out one row, whether it's from the top or the bottom, or # it's the row that expands vertically @@ -330,7 +335,7 @@ # Give the item any excess height we have (less the padding we'll remove shortly) excessHeight = remainingHeight - (paddingAbove + paddingBelow) #if False: #rowHeight < excessHeight: - #print "%d: rowHeight %d < excess %d" % (rowIndex, rowHeight, excessHeight) + #logger.critical("%d: rowHeight %d < excess %d" % (rowIndex, rowHeight, excessHeight)) rowHeight = excessHeight # If necessary, adjust the size & Y position of this row, and take padding @@ -348,7 +353,7 @@ #from osaf.framework.blocks.Block import debugName #name = debugName(w) #break - # print "Row containing '%s' is %s+%s+%s tall, at %s" % (name, rowHeight, paddingAbove, paddingBelow, yPosition) + # logger.critical("Row containing '%s' is %s+%s+%s tall, at %s" % (name, rowHeight, paddingAbove, paddingBelow, yPosition)) # Now we can position everyone, and note how tall our row actually is for sizerIndex, sizerItem in enumerate(rowItems): @@ -371,7 +376,7 @@ # Layout each row do_layout(rows, vertical_expander, rowLayoutHandler, self.padding, total=totalSize.height) - # print "Done with RecalcSizes" + # logger.critical("Done with RecalcSizes") def getBaselineOffset(self, widget): """ @@ -395,7 +400,8 @@ else: # covers static text, our Label and ExpandoStaticText; # anything we don't know about will get handled here too - assert isinstance(widget, (wx.StaticText, wx.CheckBox, wx.Panel)) # notice what we don't know about. + assert isinstance(widget, (wx.StaticText, wx.CheckBox, wx.Panel, + wx.PyControl)) # notice what we don't know about. excess = 0 return metrics.height + excess @@ -412,140 +418,3 @@ if not getattr(self, 'layoutDirty', False): self.layoutDirty = True wx.CallAfter(doLayoutIfDirty) - -# -# This test application doesn't work anymore (because of dependencies -# this code has on the rest of Chandler...) -# -#if __name__ == "__main__": - #""" - #A little test application that looks like the detail view - #""" - - #def setFont(widget, size=11.0, weight=wx.NORMAL): - #""" return the widget we were given, after setting its font """ - #widget.SetFont(Styles.getFont(size=size, weight=weight)) - #return widget - - #class MainWindow(wx.Frame): - #def __init__(self): - #wx.Frame.__init__(self, None, wx.ID_ANY, "WxTest", wx.Point(40, 40), (350,500)) - #wx.GetApp().mainFrame = self - - #self.mainPanel = wx.Panel(self, wx.ID_ANY, - #size = self.GetSize(), - #style = wx.TAB_TRAVERSAL - #| wx.CLIP_CHILDREN - #| wx.FULL_REPAINT_ON_RESIZE) - #self.mainSizer = DetailViewSizer() - #self.mainPanel.SetMinSize(wx.Size(10,10)) - #self.mainPanel.SetSizer(self.mainSizer) - #self.thisRow = 0 - - #setFont(self.mainPanel) - - #markupBar = wx.Panel(self.mainPanel, -1) #, size=(-1, 20)) - #markupBar.SetBackgroundColour(wx.SystemSettings_GetColour(wx.SYS_COLOUR_3DSHADOW)) - #mbSizer = wx.BoxSizer() - #mbSizer.Add(wx.Button(markupBar, -1, "Lefty")) - #mbSizer.AddStretchSpacer() - #mbSizer.Add(wx.Button(markupBar, -1, "Middley")) - #mbSizer.AddStretchSpacer() - #mbSizer.Add(wx.Button(markupBar, -1, "Righty")) - #markupBar.SetSizer(mbSizer) - #self.addSlice(None, markupBar, EXPAND_HORIZONTALLY | PAD_LEFT | PAD_RIGHT, paddingAbove=0) - #self.addSlice("from", setFont(ExpandoStaticText(self.mainPanel, -1, - #"me <[EMAIL PROTECTED]>")), EXPAND_HORIZONTALLY | PAD_RIGHT) - #self.addSlice("to", setFont(ExpandoTextCtrl(self.mainPanel, -1, - #"[EMAIL PROTECTED], [EMAIL PROTECTED]")), EXPAND_HORIZONTALLY | PAD_RIGHT) - #self.addSlice("cc", setFont(ExpandoStaticText(self.mainPanel, -1, - #"")), EXPAND_HORIZONTALLY | PAD_RIGHT) - #self.addSlice("bcc", setFont(ExpandoStaticText(self.mainPanel, -1, - #"")), EXPAND_HORIZONTALLY | PAD_RIGHT) - - #self.addSlice("Edited by", setFont(self.makeChoice(("[EMAIL PROTECTED]", "Create outgoing mail account...")))) - - #self.addSlice(None, setFont(ExpandoStaticText(self.mainPanel, -1, - #"Welcome to Chandler"), size=16, weight=wx.BOLD), - #EXPAND_HORIZONTALLY | PAD_LEFT | PAD_RIGHT) - - #self.addSlice(None, setFont(ExpandoStaticText(self.mainPanel, -1, - #"Open Source Applications Foundation")), - #EXPAND_HORIZONTALLY | PAD_LEFT | PAD_RIGHT) - - #self.addSlice("all day", setFont(wx.CheckBox(self.mainPanel, -1, "")), paddingAbove=5) - - #self.addSlice("starts", [ - #setFont(DateTextCtrl(self.mainPanel, -1, "10/25/07")), - #setFont(wx.StaticText(self.mainPanel, -1, "at")), - #setFont(TimeTextCtrl(self.mainPanel, -1, "10:25 AM")) - #], PAD_BETWEEN) - - #self.addSlice("ends", [ - #setFont(DateTextCtrl(self.mainPanel, -1, "10/25/07")), - #setFont(wx.StaticText(self.mainPanel, -1, "at")), - #setFont(TimeTextCtrl(self.mainPanel, -1, "11:25 AM")) - #], PAD_BETWEEN) - - #self.addSlice("status", setFont(self.makeChoice(("Confirmed", "Tentative", "FYI")))) - #self.addSlice("occurs", setFont(self.makeChoice(("Once", "Never")))) - #self.addSlice("alarm", setFont(self.makeChoice(("None", "One", "Many")))) - #sampleText = u"""Welcome to Chandler(tm) Preview. Here is a list of resources to help you get started: - -#1. Get a tour of Chandler (http://chandlerproject.org/getstarted). -#2. Sign up for a sharing account on Chandler Hub (http://hub.chandlerproject.org/signup). -#3. Consult our FAQ (http://chandlerproject.org/faq). -#4. Read about known issues (http://chandlerproject.org/knownissuesdesktop-0.7). -#5. Ask questions and give us feedback by joining the Chandler-Users mailing list (http://chandlerproject.org/mailinglists). -#6. Learn more about the project on our wiki (http://chandlerproject.org/). -#7. Get involved and contribute to the project (http://chandlerproject.org/getinvolved). - -#Thank you for trying Chandler! - -#The Chandler Team -#""" - #self.addSlice(None, wx.TextCtrl(self.mainPanel, -1, sampleText, style=wx.TE_MULTILINE), - #EXPAND_HORIZONTALLY | EXPAND_VERTICALLY, paddingBelowIfLast=0) - - #appearsIn = setFont(ExpandoStaticText(self.mainPanel, -1, "Dashboard, Home, Out, Work")) - ## appearsIn.Hide() - #self.addSlice("Appears in", appearsIn, EXPAND_HORIZONTALLY | PAD_RIGHT) - - #self.mainPanel.Layout() - #self.Show() - - #def makeChoice(self, choices, selectedIndex=0): - #choice = wx.Choice(self.mainPanel) - #map(choice.Append, choices) - #choice.SetSelection(selectedIndex) - #choice.SetSize(choice.GetEffectiveMinSize()) # was GetBestFittingSize - #return choice - - #def addSlice(self, labelText, valueWidgets, sizerFlags=0, paddingAbove=5, paddingBelowIfLast=3): - #passSizerFlags = sizerFlags & ~(PAD_LEFT | PAD_RIGHT | PAD_BETWEEN) - #userData = (self.thisRow, paddingAbove, paddingBelowIfLast) - #if labelText is not None: - #label = setFont(Label(self.mainPanel, -1, labelText, style=wx.ALIGN_RIGHT)) - #self.mainSizer.Add((1,1), userData=userData) - #self.mainSizer.Add(label, userData=userData) - #self.mainSizer.Add((2,1), userData=userData) - #if sizerFlags & PAD_LEFT: - #self.mainSizer.Add((1,1), userData=userData) - #if isinstance(valueWidgets, (list, tuple)): - #first = True - #for v in valueWidgets: - #if (sizerFlags & PAD_BETWEEN): - #if not first: - #self.mainSizer.Add((1,1), userData=userData) - #else: - #first = False - #self.mainSizer.Add(v, 0, passSizerFlags, userData=userData) - #else: - #self.mainSizer.Add(valueWidgets, 0, passSizerFlags, userData=userData) - #if sizerFlags & PAD_RIGHT: - #self.mainSizer.Add((1,1), userData=userData) - #self.thisRow += 1 - - #app = wx.PySimpleApp() - #frame = MainWindow() - #app.MainLoop()
_______________________________________________ Commits mailing list [email protected] http://lists.osafoundation.org/mailman/listinfo/commits
