本文整理汇总了Python中urwid.emit_signal函数的典型用法代码示例。如果您正苦于以下问题:Python emit_signal函数的具体用法?Python emit_signal怎么用?Python emit_signal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了emit_signal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_connected
def set_connected(self, switch):
self._connected = switch
for child in self.children:
child.set_connected(switch)
urwid.emit_signal(self, "connected", switch)
示例2: keypress
def keypress(self, size, key):
if key == "enter":
text = self.get_edit_text()
urwid.emit_signal(self, "send_signal", text)
self.set_edit_text("")
else:
return super(EditSms, self).keypress(size, key)
示例3: edit_changed
def edit_changed(self, x, d, *arg):
# r = self.lck.acquire(False)
# if r:
if self.textField._checamudou():
urwid.emit_signal(self, 'change', self, d)
nisk.util.dump((self.textField.value(), self.textField._lastlastvalue, self.textField._checamudou()),
'change date')
示例4: keypress
def keypress(self, size, key):
if key=='enter':
line=self.edit_text.strip()
if line:
urwid.emit_signal(self,'line_entered', line)
self.history.append(line)
self._history_index=len(self.history)
self.edit_text=u''
if key=='up':
self._history_index-=1
if self._history_index< 0:
self._history_index= 0
else:
self.edit_text=self.history[self._history_index]
self.set_edit_pos(len(self.edit_text))
if key=='down':
self._history_index+=1
if self._history_index>=len(self.history):
self._history_index=len(self.history)
self.edit_text=u''
else:
self.edit_text=self.history[self._history_index]
self.set_edit_pos(len(self.edit_text))
else:
urwid.Edit.keypress(self, size, key)
示例5: __accept
def __accept(self):
new_vals = {
'server_uri': self.server_uri,
'username': self.username,
'password': self.password,
}
urwid.emit_signal(self, SettingsWidget.SIG_SETTINGS_ACCEPTED, new_vals)
示例6: keypress
def keypress(self, size, key):
if key == 'enter':
urwid.emit_signal(self, 'done', self.get_edit_text())
return
if key == 'esc':
urwid.emit_signal(self, 'done', None)
urwid.Edit.keypress(self, size, key)
示例7: bottom
def bottom(self):
for index in xrange(len(self.contents) - 1, -1, -1):
widget = self.contents[index][0]
if self.constraint(index, widget):
self.focus_position = index
urwid.emit_signal(self, 'shift')
return
示例8: shiftUp
def shiftUp(self, amount=1):
if self.body.focus is not self.scroll(-amount):
self.focus_position = self.scroll()
self.body[:] = self.body[:]
urwid.emit_signal(self, 'shift')
else:
urwid.emit_signal(self,'top')
示例9: keypress
def keypress(self, size, key):
if key == "enter":
if self.edit_text == "" and self.history:
self.command = Command(self.history[-1])
else:
self.command = Command(self.edit_text)
self.history.append(self.edit_text)
self.command.executeCommand()
self.historyIdx = -1
self.edit_text = ""
urwid.emit_signal(self, "executed")
elif key == "up":
if len(self.history) != 0:
self.edit_text = self.history[self.historyIdx]
self.edit_pos = len(self.edit_text)
if self.historyIdx - 1 >= -1 * len(self.history):
self.historyIdx -= 1
elif key == "down":
if self.historyIdx == -1:
self.edit_text = ""
else:
self.historyIdx += 1
self.edit_text = self.history[self.historyIdx]
self.edit_pos = len(self.edit_text)
else:
return super(CliEdit, self).keypress(size, key)
示例10: __cebPrisoners
def __cebPrisoners(self, a_arg_or_err, a_auth, a_prisoners):
if isinstance(a_arg_or_err, twisted.python.failure.Failure):
urwid.emit_signal(self, SIG_RSP_PRISONERS, None, None, a_arg_or_err.value)
return
next_uri = None
iresponse, resp_str, json_obj = a_arg_or_err
new_items = dict(( ( i['id'], i ) for i in json_obj['items'] ))
a_prisoners['items'].update(new_items)
# Note, we check to see if "offset" has changed because there is a
# bug in the server reference implementation where the "offset"
# parameter is ignored (see "Server Issues" section in README)
if json_obj['next'] is not None \
and json_obj.get('offset', SENTINEL) != a_prisoners['offset']:
next_uri = urlparse.urljoin(self.__base_uri, json_obj['next'])
a_prisoners.update(( ( k, v ) for k, v in json_obj.items() if k != 'items' ))
# Keep calling ourselves as long as we have somewhere to go
if next_uri is not None:
d = self._jsonRequest(next_uri, a_auth)
d.addCallback(self.__cebPrisoners, a_auth, a_prisoners)
d.addErrback(self.__cebPrisoners, a_auth, a_prisoners)
return d
urwid.emit_signal(self, SIG_RSP_PRISONERS, a_auth, a_prisoners['items'])
示例11: __cebNewAccountLogIn
def __cebNewAccountLogIn(self, a_arg_or_err, a_base_uri, a_auth):
try:
self.__logIn(a_base_uri, a_auth, a_arg_or_err)
except Exception, e:
urwid.emit_signal(self, SIG_RSP_NEW_ACCT, None, e)
return
示例12: remove
def remove(self):
""" emit remove signals """
for child in self.children:
child.remove()
self.child_removed(child)
urwid.emit_signal(self, "remove")
self.set_parent(None)
示例13: keypress
def keypress(self, size, key):
key = super().keypress(size, key)
if key is not 'enter':
return key
else:
message_text = self.input_field.get_edit_text()
urwid.emit_signal(self, 'message-send', message_text)
示例14: cmd_exit_msgbox
def cmd_exit_msgbox(self, *args):
if self.logo_displayed:
self.clear_msgbox()
self.logo_displayed = False
self._selectable = False
urwid.emit_signal(self, 'exit_msgbox')
示例15: keypress
def keypress(self, size, key):
if key == "enter":
self.save()
elif key == "ctrl k":
urwid.emit_signal(self, 'saved')
else:
return super(Saver, self).keypress(size, key)