當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。