当前位置: 首页>>代码示例>>Python>>正文


Python wx.LIST_STATE_SELECTED属性代码示例

本文整理汇总了Python中wx.LIST_STATE_SELECTED属性的典型用法代码示例。如果您正苦于以下问题:Python wx.LIST_STATE_SELECTED属性的具体用法?Python wx.LIST_STATE_SELECTED怎么用?Python wx.LIST_STATE_SELECTED使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在wx的用法示例。


在下文中一共展示了wx.LIST_STATE_SELECTED属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: selectBeforePopup

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def selectBeforePopup(ctrl, pos):
    """Ensures the item the mouse is pointing at is selected before a popup.

    Works with both single-select and multi-select lists."""

    if not isinstance(ctrl, wx.ListCtrl):
        return

    n, flags = ctrl.HitTest(pos)
    if n < 0:
        return

    if not ctrl.GetItemState(n, wx.LIST_STATE_SELECTED):
        for i in xrange(ctrl.GetItemCount()):
            ctrl.SetItemState(i, 0, SEL_FOC)
        ctrl.SetItemState(n, SEL_FOC, SEL_FOC) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:18,代码来源:ListCtrl.py

示例2: move_item_left

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def move_item_left(self, event=None, index=None):
        """moves the selected menu item one level up in the hierarchy, i.e.
        shifts its label 4 spaces left in self.menu_items"""
        if index is None:
            index = self.selected_index
        if index <= 0:
            wx.Bell()
            return
        level = self.item_level(index)
        if level==0 or ( index+1 < self.items.GetItemCount() and (level < self.item_level(index+1)) ):
            wx.Bell()
            return
        level -= 1
        label = self._get_item_text(index, "label")
        self._set_item_string(index, "label", label[4:])
        self._set_item_string(index, "level", level)
        self.items.SetItemState(index, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
        self._enable_buttons() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:20,代码来源:menubar.py

示例3: move_item_right

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def move_item_right(self, event):
        """moves the selected menu item one level down in the hierarchy, i.e.
        shifts its label 4 spaces right in self.menu_items"""
        index = self.selected_index
        if index <= 0:
            wx.Bell()
            return
        level = self.item_level(index)
        if level > self.item_level(index-1):
            wx.Bell()
            return
        level += 1
        label = self._get_item_text(index, "label")
        self._set_item_string(index, "label", misc.wxstr(" "*4) + label)
        self._set_item_string(index, "level", level)
        self.items.SetItemState(index, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)
        self._enable_buttons() 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:19,代码来源:menubar.py

示例4: SelectObject

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def SelectObject(self, modelObject, deselectOthers=True, ensureVisible=False):
        """
        Select the given modelObject. If deselectOthers is True, all other rows will be deselected
        """
        i = self.GetIndexOf(modelObject)
        if i == -1:
            return

        if deselectOthers:
            self.DeselectAll()

        realIndex = self._MapModelIndexToListIndex(i)
        self.SetItemState(realIndex, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)

        if ensureVisible:
            self.EnsureVisible(realIndex) 
开发者ID:JackonYang,项目名称:bookhub,代码行数:18,代码来源:ObjectListView.py

示例5: selectAllTypes

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def selectAllTypes(self, event = None):
        for i in range(len(nameArr.typeNamesById)):
            self.typeList.SetItemState(i, wx.LIST_STATE_SELECTED,
                                       wx.LIST_STATE_SELECTED) 
开发者ID:trelby,项目名称:trelby,代码行数:6,代码来源:namesdlg.py

示例6: OnInsertName

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def OnInsertName(self, event):
        item = self.list.GetNextItem(-1, wx.LIST_NEXT_ALL,
                                     wx.LIST_STATE_SELECTED)

        if item == -1:
            return

        # this seems to return column 0's text, which is lucky, because I
        # don't see a way of getting other columns' texts...
        name = self.list.GetItemText(item)

        for ch in name:
            self.ctrl.OnKeyChar(util.MyKeyEvent(ord(ch))) 
开发者ID:trelby,项目名称:trelby,代码行数:15,代码来源:namesdlg.py

示例7: _ListCtrl_Select

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def _ListCtrl_Select(self, idx, on=1):
    """
    Selects/deselects an item.
    """
    if on: state = wx.LIST_STATE_SELECTED
    else: state = 0
    self.SetItemState(idx, state, wx.LIST_STATE_SELECTED) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:9,代码来源:core.py

示例8: _ListCtrl_GetNextSelected

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def _ListCtrl_GetNextSelected(self, item):
    """
    Returns subsequent selected items, or -1 when no more are selected.
    """
    return self.GetNextItem(item, wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED) 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:7,代码来源:core.py

示例9: _ListCtrl_IsSelected

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def _ListCtrl_IsSelected(self, idx):
    """
    Returns ``True`` if the item is selected.
    """
    return (self.GetItemState(idx, wx.LIST_STATE_SELECTED) & wx.LIST_STATE_SELECTED) != 0 
开发者ID:dougthor42,项目名称:wafer_map,代码行数:7,代码来源:core.py

示例10: get_selected_items

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def get_selected_items(self):
        """
        Gets the selected items for the list control.
        Selection is returned as a list of selected indices,
        low to high.
        """
        selection = []
        current = -1    # start at -1 to get the first selected item
        while True:
            next = self.GetNextItem(current, wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED)
            if next == -1:
                return selection
            else:
                selection.append(next)
                current = next 
开发者ID:bluenote10,项目名称:PandasDataFrameGUI,代码行数:17,代码来源:dfgui.py

示例11: get_selected

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def get_selected(self):
        return self.GetNextItem(-1, wx.LIST_NEXT_ALL, wx.LIST_STATE_SELECTED) 
开发者ID:MrS0m30n3,项目名称:youtube-dl-gui,代码行数:4,代码来源:mainframe.py

示例12: DeselectAll

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def DeselectAll(self):
        self.SetItemState(-1, 0, wx.LIST_STATE_SELECTED)
        # fallback. for extremely long lists a generator should be used
        #for i in xrange(self.GetItemCount()):
        #    self.SetItemState(i, 0, wx.LIST_STATE_SELECTED) 
开发者ID:kenorb-contrib,项目名称:BitTorrent,代码行数:7,代码来源:ListCtrl.py

示例13: _select_item

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def _select_item(self, index, force=False):
        item_count = self.items.GetItemCount()
        if index == -1 and item_count: index = 0
        if index >= item_count and item_count: index = item_count-1
        if index==self.selected_index and not force: return
        self.selected_index = index
        if index == -1:
            self._enable_fields(False, clear=True)
            self._enable_buttons()
            return

        self._ignore_events = True
        self.items.Select(index)

        if self._get_item_text(index, "name") != '---':
            # skip if the selected item is a separator
            for i,colname in enumerate(self.columns):
                s = getattr(self, colname, None)
                if not s: continue
                coltype = self.coltypes.get(colname,None)
                value = self._get_item_text(index, i)
                if coltype is None:
                    # at this point, the value should be validated already
                    s.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
                    s.SetValue(value)
                elif coltype is int:
                    s.SetSelection( int(value) )
            self.label.SetValue(self.label.GetValue().lstrip())
            self._enable_fields(True)
        else:
            self._enable_fields(False, clear=True)
        self._enable_buttons()
        state = wx.LIST_STATE_SELECTED | wx.LIST_STATE_FOCUSED
        self.items.SetItemState(index, state, state)  # fix bug 698071 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:36,代码来源:menubar.py

示例14: _insert_item

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def _insert_item(self, index, item):
        self._insert_item_string(index, item[0])
        for col, value in enumerate(item):
            if col==0: continue
            value = compat.unicode(value) if value is not None else ""
            self._set_item_string(index, col, value)
        self.items.SetItemState(index, wx.LIST_STATE_SELECTED, wx.LIST_STATE_SELECTED)  # fix bug 698074 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:9,代码来源:menubar.py

示例15: _select_item

# 需要导入模块: import wx [as 别名]
# 或者: from wx import LIST_STATE_SELECTED [as 别名]
def _select_item(self, index, force=False):
        item_count = self.items.GetItemCount()
        if index == -1 and item_count: index = 0
        if index >= item_count and item_count: index = item_count-1
        if index==self.selected_index and not force: return
        self.selected_index = index
        if index == -1:
            self._enable_fields(False, clear=True)
            self._enable_buttons()
            return

        self._ignore_events = True
        self.items.Select(index)

        if self._get_item_text(index, "label") != '---':
            # skip if the selected item is a separator
            for i,colname in enumerate(self.columns):
                s = getattr(self, colname)
                coltype = self.coltypes.get(colname,None)
                value = self._get_item_text(index, i)
                if coltype is None:
                    # at this point, the value should be validated already
                    s.SetBackgroundColour( compat.wx_SystemSettings_GetColour(wx.SYS_COLOUR_WINDOW) )
                    s.SetValue(value)
                elif coltype is int:
                    s.SetSelection( int(value) )
            self.label.SetValue(self.label.GetValue().lstrip())
            self._enable_fields(True)
        else:
            self._enable_fields(False, clear=True)
        self._enable_buttons()
        state = wx.LIST_STATE_SELECTED | wx.LIST_STATE_FOCUSED
        self.items.SetItemState(index, state, state)  # fix bug 698071 
开发者ID:wxGlade,项目名称:wxGlade,代码行数:35,代码来源:toolbar.py


注:本文中的wx.LIST_STATE_SELECTED属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。