def _calculateSize(self): (textW, textH) = getTextDimensions(self.text, self) width = max(self.bitmap.GetWidth(), textW) + TOOL_PADDING_LEFT + TOOL_PADDING_RIGHT height = self.bitmap.GetHeight() + 3 + textH + TOOL_PADDING_TOP + TOOL_PADDING_BOTTOM return (width, height)
def _createWidgets(self): self.panel = wx.Panel(self.parent, wx.ID_ANY, style=wx.SIMPLE_BORDER) self.panel.SetBackgroundColour(u"#FFFFE6") #$NON-NLS-1$ self.filterLabel = wx.StaticText( self.panel, wx.ID_ANY, _extstr(u"blogselector.BlogName")) #$NON-NLS-1$ self.filterTextBox = wx.TextCtrl(self.panel, wx.ID_ANY, style=wx.TE_PROCESS_ENTER) self.filterTextBox.SetSizeHints( -1, getTextDimensions(u"Zoundry", self.filterTextBox)[1]) #$NON-NLS-1$ self.filterAcctLabel = wx.StaticText( self.panel, wx.ID_ANY, _extstr(u"blogselector.Account")) #$NON-NLS-1$ self.filterAccountCombo = wx.ComboBox(self.panel, wx.ID_ANY, style=wx.CB_READONLY) self.separator = wx.StaticLine(self.panel, wx.HORIZONTAL) self.contentProvider = ZBlogListContentProvider(self.model) self.blogListView = ZPopupListView(self.contentProvider, self.panel, style=wx.LC_VIRTUAL | wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.NO_BORDER | wx.LC_NO_HEADER) self.blogListView.SetBackgroundColour(u"#FFFFE6") #$NON-NLS-1$
def _layoutWidgets(self): (w, h) = getTextDimensions(u"Zoundry", self.textBox) #$NON-NLS-1$ @UnusedVariable self.textBox.SetSizeHints(-1, h + 2) box = wx.BoxSizer(wx.HORIZONTAL) box.Add(self.staticBitmap, 0, wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT, 3) box.Add(self.bitmapButton, 0, wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT, 3) box.Add((3, -1)) box.Add(self.textBox, 1, wx.EXPAND | wx.TOP, 3) box.Add(self.clearButton, 0, wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT, 3) self.clearButton.Show(False) if self.choices is None or len(self.choices) == 0: self.staticBitmap.Show(True) self.bitmapButton.Show(False) else: self.staticBitmap.Show(False) self.bitmapButton.Show(True) sizer = wx.BoxSizer(wx.VERTICAL) sizer.AddSizer(box, 1, wx.EXPAND | wx.ALL, 2) self.SetAutoLayout(True) self.SetSizer(sizer) self.Layout()
def _drawLabel(self, paintDC): (w, h) = self.GetSizeTuple() (textW, textH) = getTextDimensions(self.text, self) x = (w - textW) / 2 y = h - textH - TOOL_PADDING_BOTTOM paintDC.SetFont(self.GetFont()) paintDC.DrawText(self.text, x, y)
def _getPreferredWidth(self): largestW = 50 largestBmpW = 0 for tab in self.tabs: title = tab.getTabInfo().getTitle() (w, h) = getTextDimensions(title, self.tabList) #@UnusedVariable largestW = max(w + 10, largestW) bitmap = tab.getTabInfo().getBitmap() if bitmap is not None: largestBmpW = max(largestBmpW, bitmap.GetWidth()) return largestW + largestBmpW
def _getPreferredWidth(self): largestW = 50 largestBmpW = 0 for tab in self.tabs: title = tab.getTabInfo().getTitle() (w, h) = getTextDimensions(title, self.tabList) #@UnusedVariable largestW = max(w + 10, largestW) bitmap = tab.getTabInfo().getBitmap() if bitmap is not None: largestBmpW = max(largestBmpW, bitmap.GetWidth()) return largestW + largestBmpW
def _getPreferredHeight(self): # FIXME (EPW) this logic is not guaranteed to work well for all operating systems totalH = 0 imageH = 0 imageList = self.provider.getImageList() if imageList is not None: (ilW, imageH) = imageList.GetSize(0) #@UnusedVariable for tab in self.tabs: (tabW, tabH) = getTextDimensions(tab.getTabInfo().getTitle(), self.tabList) #@UnusedVariable tabH = max(tabH, imageH) totalH += tabH + 2 return totalH
def _createWidgets(self): self.panel = wx.Panel(self.parent, wx.ID_ANY, style = wx.SIMPLE_BORDER) self.panel.SetBackgroundColour(u"#FFFFE6") #$NON-NLS-1$ self.filterLabel = wx.StaticText(self.panel, wx.ID_ANY, _extstr(u"blogselector.BlogName")) #$NON-NLS-1$ self.filterTextBox = wx.TextCtrl(self.panel, wx.ID_ANY, style = wx.TE_PROCESS_ENTER) self.filterTextBox.SetSizeHints(-1, getTextDimensions(u"Zoundry", self.filterTextBox)[1]) #$NON-NLS-1$ self.filterAcctLabel = wx.StaticText(self.panel, wx.ID_ANY, _extstr(u"blogselector.Account")) #$NON-NLS-1$ self.filterAccountCombo = wx.ComboBox(self.panel, wx.ID_ANY, style = wx.CB_READONLY) self.separator = wx.StaticLine(self.panel, wx.HORIZONTAL) self.contentProvider = ZBlogListContentProvider(self.model) self.blogListView = ZPopupListView(self.contentProvider, self.panel, style = wx.LC_VIRTUAL | wx.LC_REPORT | wx.LC_SINGLE_SEL | wx.NO_BORDER | wx.LC_NO_HEADER) self.blogListView.SetBackgroundColour(u"#FFFFE6") #$NON-NLS-1$
def _getPreferredHeight(self): # FIXME (EPW) this logic is not guaranteed to work well for all operating systems totalH = 0 imageH = 0 imageList = self.provider.getImageList() if imageList is not None: (ilW, imageH) = imageList.GetSize(0) #@UnusedVariable for tab in self.tabs: (tabW, tabH) = getTextDimensions(tab.getTabInfo().getTitle(), self.tabList) #@UnusedVariable tabH = max(tabH, imageH) totalH += tabH + 2 return totalH
def _calculateSize(self): minWidth = self.toolBitmapSize + ZTOOL_PADDING + ZTOOL_PADDING minHeight = self.toolBitmapSize + ZTOOL_PADDING + ZTOOL_PADDING if self.showTextFlag: (w, h) = getTextDimensions(self.text, self) tmWidth = w + ZTOOL_PADDING * 4 tmHeight = h minWidth = max(minWidth, tmWidth) minHeight = minHeight + tmHeight return (minWidth, minHeight)
def _drawText(self, paintDC): (textW, textH) = getTextDimensions(self.text, self) (w, h) = self._getToolDrawSize() textX = ZTOOL_PADDING * 2 textY = h - textH - ZTOOL_PADDING if textW < self.toolBitmapSize: textX = (w - textW) / 2 if self._isLeftClicking(): textX += 1 textY += 1 if not self.IsEnabled(): paintDC.SetTextForeground(getDisabledTextColor()) paintDC.SetFont(self.GetFont()) paintDC.DrawText(self.text, textX, textY)
def _layoutWidgets(self): (w, h) = getTextDimensions(u"Zoundry", self.textBox) #$NON-NLS-1$ @UnusedVariable self.textBox.SetSizeHints(-1, h + 2) box = wx.BoxSizer(wx.HORIZONTAL) box.Add(self.staticBitmap, 0, wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT, 3) box.Add(self.bitmapButton, 0, wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT, 3) box.Add( (3, -1) ) box.Add(self.textBox, 1, wx.EXPAND | wx.TOP, 3) box.Add(self.clearButton, 0, wx.ALIGN_CENTER | wx.RIGHT | wx.LEFT, 3) self.clearButton.Show(False) if self.choices is None or len(self.choices) == 0: self.staticBitmap.Show(True) self.bitmapButton.Show(False) else: self.staticBitmap.Show(False) self.bitmapButton.Show(True) sizer = wx.BoxSizer(wx.VERTICAL) sizer.AddSizer(box, 1, wx.EXPAND | wx.ALL, 2) self.SetAutoLayout(True) self.SetSizer(sizer) self.Layout()
def _calculatePreferredWidth(self): titleWidth = getTextDimensions(self.tabInfo.getTitle(), self)[0] if self.tabInfo.getBitmap() is not None: titleWidth += self.tabInfo.getBitmap().GetWidth() + 2 return titleWidth + 4 + 4 + 16 + 4
def _calculatePreferredWidth(self): titleWidth = getTextDimensions(self.tabInfo.getTitle(), self)[0] if self.tabInfo.getBitmap() is not None: titleWidth += self.tabInfo.getBitmap().GetWidth() + 2 return titleWidth + 4 + 4 + 16 + 4