本文整理汇总了Python中openzwave.network.ZWaveNetwork.getCommandClassName方法的典型用法代码示例。如果您正苦于以下问题:Python ZWaveNetwork.getCommandClassName方法的具体用法?Python ZWaveNetwork.getCommandClassName怎么用?Python ZWaveNetwork.getCommandClassName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openzwave.network.ZWaveNetwork
的用法示例。
在下文中一共展示了ZWaveNetwork.getCommandClassName方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from openzwave.network import ZWaveNetwork [as 别名]
# 或者: from openzwave.network.ZWaveNetwork import getCommandClassName [as 别名]
#.........这里部分代码省略.........
pad.move(i+1,1)
i += 1
for key, wid in zip(self._deviceValueColumns, self._deviceValueWidths):
clr = self._getListItemColor(drawSelected)
text = value.getValue(key)
# strip 'COMMAND_CLASS_' prefix to save some space
if key == 'commandClass' and text.startswith('COMMAND_CLASS_'):
text = text[14:]
# TODO: value decorators (checkbox for Booleans, edit box for others)
# decimal: format to 2 places
# bool as checkbox
# byte as minibar if editable
# ints need to be directly edited...
# buttons... ?
# Draw editable items differently
if key == 'value' and not vdic['readOnly'] and drawSelected:
clr = curses.color_pair(self.COLOR_ERROR)
pad.addstr(self._fixColumn(text, wid), clr)
def _updateDetail_Info(self, pad):
node = self._selectedNode
if node:
#baudRate, basic, generic, specific, version, security
self._deviceInfoColumns=['id','name','location','capabilities','neighbors','manufacturer','product','productType']
if self._detailpos[self._detailview] >= len(self._deviceInfoColumns): self._detailpos[self._detailview]=len(self._deviceInfoColumns)-1
editableColumns=['name','location','manufacturer','product']
i = maxwid = 0
for name in self._deviceInfoColumns: maxwid = len(name) if len(name) > maxwid else maxwid
colwidth = maxwid + 2
clr = self._getListItemColor(False)
clr_rw = curses.color_pair(self.COLOR_ERROR)
clr_ro = self._getListItemColor(True)
clr_col = curses.color_pair(self.COLOR_OK)
# TODO: If editable, should be textpad
for column in self._deviceInfoColumns:
val = str(getattr(node, column))
pad.move(i + 1, 1)
pad.addstr('{0:>{width}}'.format(column.title() + ':', width=colwidth), clr_col)
selected = i == self._detailpos[self._detailview]
thisclr = clr
if selected: thisclr = clr_rw if column in editableColumns else clr_ro
i += 1
pad.addstr(' ')
pad.addstr('{0:<{width}}'.format(val, width=30), thisclr)
def _updateDetail_Classes(self, pad):
clr = curses.color_pair(self.COLOR_HEADER_HI) | curses.A_BOLD
pad.addstr(0,0,'{0:<{width}}'.format(' CommandClass', width=self._screensize[1]), clr)
node = self._selectedNode
if node:
if self._detailpos[self._detailview] >= len(node.commandClasses): self._detailpos[self._detailview]=len(node.commandClasses)-1
i = 0
for cc in node.commandClasses:
pad.addstr(i + 1, 0, ' {0:<{width}}'.format(self._network.getCommandClassName(cc), width=30),
self._getListItemColor(i == self._detailpos[self._detailview]))
i += 1
def _updateDetail_Groups(self, pad):
pad.addstr(3,3,'Group view not yet implemented')
# groups tab:
# index label maxMembers members
# 1 my group 4 1, 2, 4
# Members column is editable - enter comma-separated list?
def _updateDetail_Events(self, pad):
pad.addstr(3,3,'Event view not yet implemented')
# event detail tab:
# timestamp commandClass notificationType
def _updateDeviceDetail(self):
# TODO: detail needs to be scrollable, but to accomplish that a couple of changes need to be made. First, the detail header band needs to be moved into a static shared section (above the detail pad); second, a new dict of 'top' positions needs to be created; finally, positioning code needs to be written to correctly offset the pad.
pad = self._detailpads[self._detailview]
pad.clear()
if self._detailpos[self._detailview] < 0: self._detailpos[self._detailview]=0
funcname = '_updateDetail_{0}'.format(self._detailview)
try:
method = getattr(self, funcname)
method(pad)
except AttributeError as ex:
msg = 'No method named [%s] defined!' % funcname
self._log.warn('_updateDeviceDetail: %s', msg)
self._log.warn('_updateDeviceDetail Exception Details: %s', str(ex))
self._alert(msg)
self._redrawDetailTab(pad)
def _updateMenu(self):
menurow = self._screensize[0] - 1
self._screen.addstr(menurow, 0, ' ' * (self._screensize[1] - 1), curses.color_pair(self.COLOR_HEADER_NORMAL))
self._screen.move(menurow,4)
for mnemonic, text in self._keys.iteritems():
self._screen.addstr(' {0} '.format(mnemonic), curses.color_pair(self.COLOR_NORMAL) | curses.A_BOLD)
self._screen.addstr('{0}'.format(text), curses.color_pair(self.COLOR_HEADER_NORMAL))
def _redrawMenu(self):
self._updateMenu()
self._screen.refresh()