本文整理汇总了Python中wx.IMAGE_LIST_SMALL属性的典型用法代码示例。如果您正苦于以下问题:Python wx.IMAGE_LIST_SMALL属性的具体用法?Python wx.IMAGE_LIST_SMALL怎么用?Python wx.IMAGE_LIST_SMALL使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类wx
的用法示例。
在下文中一共展示了wx.IMAGE_LIST_SMALL属性的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_LIST_SMALL [as 别名]
def __init__(self, parent, id, evtList, ix, plugin):
width = 205
wx.ListCtrl.__init__(self, parent, id, style=wx.LC_REPORT |
wx.LC_NO_HEADER | wx.LC_SINGLE_SEL, size = (width, -1))
self.parent = parent
self.id = id
self.evtList = evtList
self.ix = ix
self.plugin = plugin
self.sel = -1
self.il = wx.ImageList(16, 16)
self.il.Add(wx.BitmapFromImage(wx.Image(join(eg.imagesDir, "event.png"), wx.BITMAP_TYPE_PNG)))
self.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
self.InsertColumn(0, '')
self.SetColumnWidth(0, width - 5 - SYS_VSCROLL_X)
self.Bind(wx.EVT_LIST_ITEM_SELECTED, self.OnSelect)
self.Bind(wx.EVT_SET_FOCUS, self.OnChange)
self.Bind(wx.EVT_LIST_INSERT_ITEM, self.OnChange)
self.Bind(wx.EVT_LIST_ITEM_DESELECTED, self.OnChange)
self.Bind(wx.EVT_LIST_ITEM_RIGHT_CLICK, self.OnRightClick)
self.SetToolTipString(self.plugin.text.toolTip)
示例2: CalculateHeight
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_LIST_SMALL [as 别名]
def CalculateHeight(self, dc):
"""
Return the heights of this block in pixels
"""
GAP_BETWEEN_IMAGE_AND_TEXT = 4
# If cells can wrap, figure out the tallest, otherwise we just figure out the height of one line
if self.GetFormat().CanWrap:
font = self.GetFont()
height = 0
for x in self.GetCombinedLists():
textWidth = x.innerCellWidth
if self.GetListCtrl() and x.image != -1:
imageList = self.GetListCtrl().GetImageList(wx.IMAGE_LIST_SMALL)
textWidth -= imageList.GetSize(0)[0]+GAP_BETWEEN_IMAGE_AND_TEXT
bounds = [0, 0, textWidth, 99999]
height = max(height, self.CalculateTextHeight(dc, x.text, bounds, font))
else:
height = self.CalculateTextHeight(dc, "Wy")
# We also have to allow for cell padding, on top of the normal padding and decorations
cellPadding = self.GetFormat().CalculateCellPadding()
return height + cellPadding[1] + cellPadding[3] + self.CalculateExtrasHeight(dc)
示例3: SetImageLists
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_LIST_SMALL [as 别名]
def SetImageLists(self, smallImageList=None, normalImageList=None):
"""
Remember the image lists to be used for this control.
Call this without parameters to create reasonable default image lists.
Use this to change the size of images shown by the list control.
"""
if isinstance(smallImageList, NamedImageList):
self.smallImageList = smallImageList
else:
self.smallImageList = NamedImageList(smallImageList, 16)
self.SetImageList(self.smallImageList.imageList, wx.IMAGE_LIST_SMALL)
if isinstance(normalImageList, NamedImageList):
self.normalImageList = normalImageList
else:
self.normalImageList = NamedImageList(normalImageList, 32)
self.SetImageList(self.normalImageList.imageList, wx.IMAGE_LIST_NORMAL)
#--------------------------------------------------------------#000000#FFFFFF
# Commands
示例4: create_sizer_paths
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_LIST_SMALL [as 别名]
def create_sizer_paths(self):
self.sizer_setting_paths = wx.StaticBoxSizer(wx.VERTICAL, self, "Wallpaper paths")
self.statbox_parent_paths = self.sizer_setting_paths.GetStaticBox()
st_paths_info = wx.StaticText(self.statbox_parent_paths, -1, "Browse to add your wallpaper files or source folders here:")
if self.use_multi_image:
self.path_listctrl = wx.ListCtrl(self.statbox_parent_paths, -1,
style=wx.LC_REPORT
| wx.BORDER_SIMPLE
| wx.LC_SORT_ASCENDING
)
self.path_listctrl.InsertColumn(0, 'Display', wx.LIST_FORMAT_RIGHT, width = 100)
self.path_listctrl.InsertColumn(1, 'Source', width = 400)
else:
# show simpler listing without header if only one wallpaper target
self.path_listctrl = wx.ListCtrl(self.statbox_parent_paths, -1,
style=wx.LC_REPORT
| wx.BORDER_SIMPLE
| wx.LC_NO_HEADER
)
self.path_listctrl.InsertColumn(0, 'Source', width = 500)
self.path_listctrl.SetImageList(self.image_list, wx.IMAGE_LIST_SMALL)
self.sizer_setting_paths.Add(st_paths_info, 0, wx.ALIGN_LEFT|wx.ALL, 5)
self.sizer_setting_paths.Add(
self.path_listctrl, 1, wx.CENTER|wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5
)
# Buttons
self.sizer_setting_paths_buttons = wx.BoxSizer(wx.HORIZONTAL)
self.button_browse = wx.Button(self.statbox_parent_paths, label="Browse")
self.button_remove_source = wx.Button(self.statbox_parent_paths, label="Remove selected source")
self.button_browse.Bind(wx.EVT_BUTTON, self.onBrowsePaths)
self.button_remove_source.Bind(wx.EVT_BUTTON, self.onRemoveSource)
self.sizer_setting_paths_buttons.Add(self.button_browse, 0, wx.CENTER|wx.ALL, 5)
self.sizer_setting_paths_buttons.Add(self.button_remove_source, 0, wx.CENTER|wx.ALL, 5)
# add button sizer to parent paths sizer
self.sizer_setting_paths.Add(self.sizer_setting_paths_buttons, 0, wx.CENTER|wx.EXPAND|wx.ALL, 0)
self.sizer_settings_right.Add(
self.sizer_setting_paths, 1, wx.CENTER|wx.EXPAND|wx.TOP|wx.LEFT|wx.RIGHT, 5
)
示例5: refresh_path_listctrl
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_LIST_SMALL [as 别名]
def refresh_path_listctrl(self, use_multi_image, migrate_paths=False):
if use_multi_image == self.multi_column_listc and migrate_paths:
self.sizer_main.Layout()
else:
if migrate_paths and self.path_listctrl.GetItemCount():
# warn that paths can't be migrated
msg = ("Wallpaper sources cannot be migrated between span"
" and multi image, continue?"
"\n"
"Saved sources are not affected until you overwrite.")
res = show_message_dialog(msg, style="YES_NO")
if not res:
# user canceled
return False
self.path_listctrl.Destroy()
self.image_list.RemoveAll()
if use_multi_image:
self.multi_column_listc = True
self.path_listctrl = wx.ListCtrl(self.statbox_parent_paths, -1,
style=wx.LC_REPORT
| wx.BORDER_SIMPLE
| wx.LC_SORT_ASCENDING
)
self.path_listctrl.InsertColumn(0, 'Display', wx.LIST_FORMAT_RIGHT, width=100)
self.path_listctrl.InsertColumn(1, 'Source', width=400)
else:
self.multi_column_listc = False
# show simpler listing without header if only one wallpaper target
self.path_listctrl = wx.ListCtrl(self.statbox_parent_paths, -1,
style=wx.LC_REPORT
| wx.BORDER_SIMPLE
| wx.LC_NO_HEADER
)
self.path_listctrl.InsertColumn(0, 'Source', width=500)
self.path_listctrl.SetImageList(self.image_list, wx.IMAGE_LIST_SMALL)
self.sizer_setting_paths.Insert(1, self.path_listctrl, 1,
wx.CENTER | wx.EXPAND | wx.ALL, 5)
self.path_listctrl.InvalidateBestSize()
self.sizer_main.Layout()
return True
示例6: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_LIST_SMALL [as 别名]
def __init__(self, parent):
wx.ListCtrl.__init__(self, parent, wx.ID_ANY, style=wx.LC_REPORT)
ContextMenuMixin.__init__(self)
self.il = wx.ImageList(self.icon_size, self.icon_size)
# TODO: use a real icon
self.il.Add(self.draw_blank())
self.il.Add(self.draw_sort_arrow('up'))
self.il.Add(self.draw_sort_arrow('down'))
self.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
self.update_enabled_columns()
for i, name in enumerate(self.enabled_columns):
column = self.columns[name]
column.SetColumn(i)
self.InsertColumnItem(i, column)
self.itemData_to_row = {}
self.index_to_itemData = {}
self.selected_column = None
self.SelectColumn(self.enabled_columns[0])
cmenu = wx.Menu()
for name in self.column_order:
column = self.columns[name]
id = wx.NewId()
cmenu.AppendCheckItem(id, column.GetText())
cmenu.Check(id, column.enabled)
self.Bind(wx.EVT_MENU,
lambda e, c=column, id=id: self.toggle_column(c, id, e),
id=id)
self.SetColumnContextMenu(cmenu)
ColumnSorterMixin.__init__(self, len(self.enabled_columns))
self._last_scrollpos = 0
if sys.platform != "darwin":
self.Bind(wx.EVT_ERASE_BACKGROUND, self.OnEraseBackground)
self.default_rect = wx.Rect(0,0)
示例7: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_LIST_SMALL [as 别名]
def __init__(self, parentWin, defaultImageName="", id=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.LC_REPORT):
unused=style
style=wx.LC_REPORT
wx.ListView.__init__(self, parentWin, id, pos, size, style)
if adm:
self.SetImageList(adm.images, wx.IMAGE_LIST_SMALL)
self.defaultImageId=adm.images.GetId(defaultImageName)
self.Bind(wx.EVT_MOTION, self.OnMouseMove)
self.getToolTipTextProc=None
self.getToolTipCol=None
self.colInfos=[]
示例8: __init__
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_LIST_SMALL [as 别名]
def __init__(self, parent, hwnds):
wx.ListCtrl.__init__(self, parent, style=wx.LC_REPORT | wx.LC_SINGLE_SEL)
listmix.ListCtrlAutoWidthMixin.__init__(self)
imageList = wx.ImageList(16, 16)
imageList.Add(GetInternalBitmap("cwindow"))
self.AssignImageList(imageList, wx.IMAGE_LIST_SMALL)
self.InsertColumn(0, "Program")
self.InsertColumn(1, "Name")
self.InsertColumn(2, "Class")
self.InsertColumn(3, "Handle", wx.LIST_FORMAT_RIGHT)
for hwnd in hwnds:
imageIdx = 0
icon = GetHwndIcon(hwnd)
if icon:
imageIdx = imageList.AddIcon(icon)
idx = self.InsertImageStringItem(
sys.maxint,
GetWindowProcessName(hwnd),
imageIdx
)
self.SetStringItem(idx, 1, GetWindowText(hwnd))
self.SetStringItem(idx, 2, GetClassName(hwnd))
self.SetStringItem(idx, 3, str(hwnd))
for i in range(4):
self.SetColumnWidth(i, -2)
headerSize = self.GetColumnWidth(i)
self.SetColumnWidth(i, -1)
labelSize = self.GetColumnWidth(i)
if headerSize > labelSize:
self.SetColumnWidth(i, headerSize)
示例9: create_paths_listctrl
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_LIST_SMALL [as 别名]
def create_paths_listctrl(self, use_multi_image):
if use_multi_image:
self.paths_listctrl = wx.ListCtrl(self, -1,
size=(-1, -1),
style=wx.LC_REPORT
# | wx.BORDER_SUNKEN
| wx.BORDER_SIMPLE
# | wx.BORDER_STATIC
# | wx.BORDER_THEME
# | wx.BORDER_NONE
# | wx.LC_EDIT_LABELS
| wx.LC_SORT_ASCENDING
# | wx.LC_NO_HEADER
# | wx.LC_VRULES
# | wx.LC_HRULES
# | wx.LC_SINGLE_SEL
)
self.paths_listctrl.InsertColumn(0, 'Display', wx.LIST_FORMAT_RIGHT, width=100)
self.paths_listctrl.InsertColumn(1, 'Source', width=620)
else:
# show simpler listing without header if only one wallpaper target
self.paths_listctrl = wx.ListCtrl(self, -1,
size=(-1, -1),
style=wx.LC_REPORT
# | wx.BORDER_SUNKEN
| wx.BORDER_SIMPLE
# | wx.BORDER_STATIC
# | wx.BORDER_THEME
# | wx.BORDER_NONE
# | wx.LC_EDIT_LABELS
# | wx.LC_SORT_ASCENDING
| wx.LC_NO_HEADER
# | wx.LC_VRULES
# | wx.LC_HRULES
# | wx.LC_SINGLE_SEL
)
self.paths_listctrl.InsertColumn(0, 'Source', width=720)
# Add the item list to the control
self.paths_listctrl.SetImageList(self.il, wx.IMAGE_LIST_SMALL)
self.sizer_paths_list.Add(self.paths_listctrl, 1, wx.CENTER|wx.ALL|wx.EXPAND, 5)
示例10: DrawText
# 需要导入模块: import wx [as 别名]
# 或者: from wx import IMAGE_LIST_SMALL [as 别名]
def DrawText(self, dc, txt, bounds, font=None, alignment=wx.ALIGN_LEFT, valignment=wx.ALIGN_CENTRE,
image=None, color=None, canWrap=True, imageIndex=-1, listCtrl=None):
"""
Draw the given text in the given DC according to the given characteristics.
This is the workhorse text drawing method for our reporting engine.
The *font*, *alignment*, and *color* attributes are applied to the drawn text.
If *image* is not None, it will be drawn to the left of the text. All text is indented
by the width of the image, even if the text is multi-line.
If *imageIndex* is 0 or more and *listCtrl* is not None, the corresponding image from
the ListCtrl's small image list will be drawn to the left of the text.
If *canWrap* is True, the text will be wrapped to fit within the given bounds. If it is False,
then the first line of *txt* will be truncated at the edge of the given *bounds*.
"""
GAP_BETWEEN_IMAGE_AND_TEXT = 4
def _CalcBitmapPosition(r, height):
if valignment == wx.ALIGN_TOP:
return RectUtils.Top(r)
elif valignment == wx.ALIGN_CENTER:
return RectUtils.CenterY(r) - height / 2
elif valignment == wx.ALIGN_BOTTOM:
return RectUtils.Bottom(r) - height
else:
return RectUtils.Top(r)
# Draw any image
if image:
y = _CalcBitmapPosition(bounds, image.Height)
dc.DrawBitmap(image, RectUtils.Left(bounds), y)
RectUtils.MoveLeftBy(bounds, image.GetWidth()+GAP_BETWEEN_IMAGE_AND_TEXT)
elif listCtrl and imageIndex >=0:
imageList = listCtrl.GetImageList(wx.IMAGE_LIST_SMALL)
y = _CalcBitmapPosition(bounds, imageList.GetSize(0)[1])
imageList.Draw(imageIndex, dc, RectUtils.Left(bounds), y, wx.IMAGELIST_DRAW_TRANSPARENT)
RectUtils.MoveLeftBy(bounds, imageList.GetSize(0)[0]+GAP_BETWEEN_IMAGE_AND_TEXT)
# Draw the text
dc.SetFont(font or self.GetFont())
dc.SetTextForeground(color or self.GetTextColor() or wx.BLACK)
if canWrap:
WordWrapRenderer.DrawString(dc, txt, bounds, alignment, valignment)
else:
WordWrapRenderer.DrawTruncatedString(dc, txt, bounds, alignment, valignment)