本文整理汇总了Python中urwid.disconnect_signal函数的典型用法代码示例。如果您正苦于以下问题:Python disconnect_signal函数的具体用法?Python disconnect_signal怎么用?Python disconnect_signal使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了disconnect_signal函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: clear
def clear(self):
urwid.disconnect_signal(self.walker, 'modified', self.interface.lazzy_load)
while len(self.walker) > 1:
pop = self.walker.pop()
self.cleared = pop.id
if self.cleared == None:
self.cleared = True
示例2: complete_move
def complete_move(self, value, current_position):
urwid.disconnect_signal(
self,
self.move_prompt,
signals.PROMPT_DONE,
self.complete_move)
urwid.disconnect_signal(
self,
self.move_prompt,
signals.UPDATE_INDEX,
self.view.move_update_index)
self.update_focus('body')
try:
new_index = int(value)
logger.debug('Moving playlist track from {} to {}'.format(
current_position, new_index))
mpd = mstat.initialize_mpd(self.conf)
mpd.move(current_position, new_index)
self.view.focus_position = new_index
except (TypeError, ValueError):
logger.error('Invalid move index: {}'.format(value))
self.view.update()
self.update()
示例3: search_entered
def search_entered(self, content):
self.view.set_focus('body')
urwid.disconnect_signal(
self, self.foot, 'search_entered', self.anime_entered)
urwid.disconnect_signal(
self, self.foot, 'query_escaped', self.query_escaped)
self.view.set_footer(urwid.AttrWrap(self.default_footer, 'foot'))
items = []
# categories
if self.current_view == 1 and self.list_sort_type in (0, 1):
lst = malconstrict.helpers.search_substring(self.cached_sections[self.cats[self.catfocus]], content)
i = 1
items.append(CategoryItemWidget(self.cats[self.catfocus]))
for anime in lst:
items.append(ListItemWidget(i, anime.title + ' [' + str(anime.score) + ']', anime.id))
i = i + 1
# full
elif (self.current_view == 1 and self.list_sort_type in (2, 3)) or self.current_view == 2:
items = []
lst = malconstrict.helpers.search_substring(self.cached_list, content)
i = 1
for anime in lst:
if self.current_view == 1:
items.append(ListItemWidget(i, anime.title + ' [' + str(anime.score) + ']', anime.id))
elif self.current_view == 2:
items.append(
ListItemWidget(i, anime.title + ' [' + str(anime.members_score) + ']', anime.id))
i = i + 1
walker = urwid.SimpleListWalker(items)
self.listbox = urwid.ListBox(walker)
self.view.set_body(urwid.Frame(urwid.AttrWrap(self.listbox, 'body')))
self.view.set_footer(urwid.AttrWrap(self.default_footer, 'foot'))
self.view.set_focus('body')
示例4: query_escaped
def query_escaped(self, content):
self.view.set_focus('body')
urwid.disconnect_signal(
self, self.foot, 'username_entered', self.username_entered)
urwid.disconnect_signal(
self, self.foot, 'anime_entered', self.anime_entered)
self.view.set_footer(urwid.AttrWrap(self.default_footer, 'foot'))
示例5: command_done
def command_done(self, command):
self.top.set_focus('body')
urwid.disconnect_signal(
self,
self.edit,
signals.COMMAND_DONE,
self.command_done)
if command:
try:
current_buf = self.top.current_buffer()
success = current_buf.execute_command(command)
if not success:
success = self.execute_command(command)
if not success:
self.update_footer_text(
"Unable to execute command '{}'".format(command),
error=True)
except TypeError as err:
logger.debug('TypeError: {}'.format(err))
self.update_footer_text(
"Invalid arguments for command '{}'".format(command),
error=True)
except CommandError as ex:
logger.debug(ex)
self.update_footer_text(ex.message, error=True)
示例6: _promptSearch_done
def _promptSearch_done(self, query):
self.view.set_focus("body")
urwid.disconnect_signal(self, self.prompt, "done", self._promptSearch_done)
if not query:
self.set_status()
return
self.newbuffer(["search", query])
示例7: go_search
def go_search(self, what_for):
# Set the focus back to body
self.view.set_focus('body')
# Disconnect
urwid.disconnect_signal(self.foot_new, 'done', self.go_search)
# Check if we got a query...
if not what_for: return
# Construct a regex (yeah...)
pattern = r'(.*)' + re.escape(what_for) + r'(.*)'
# Store elements that match the query
self.matches = []
# Loop and match
n = 0
for i in self.elements:
m = re.search(pattern, i.content, re.IGNORECASE)
if m:
# self.listbox.set_focus(n)
# break
self.matches.append(n)
n = n + 1
# Now jump to the first match and then later we can use n N to go around
if self.matches:
self.listbox.set_focus(self.matches[0])
# Set the search pointer to point to the first element.
self.search_ptr = 0
else:
self.search_ptr = -1
示例8: hide_editor
def hide_editor(self, done_signal_handler):
try:
disconnect_signal(self._editor, 'done', done_signal_handler)
except Exception, message:
# `disconnect_signal` raises an exception if no signal was
# connected from `self._editor`. we can safely ignore it.
logging.exception(message)
示例9: _filterSearch_done
def _filterSearch_done(self, newquery):
self.ui.view.set_focus('body')
urwid.disconnect_signal(self.ui, self.ui.prompt, 'done', self._filterSearch_done)
if not newquery:
self.ui.set_status()
return
self.ui.newbuffer(['search', self.query, newquery])
示例10: switch_body
def switch_body(self, body):
if self.body:
urwid.disconnect_signal(body, "modified", self._invalidate)
self.body = body
self._invalidate()
urwid.connect_signal(body, "modified", self._invalidate)
示例11: hide_editor
def hide_editor(self, done_signal_handler):
try:
disconnect_signal(self._editor, 'done', done_signal_handler)
except:
# `disconnect_signal` raises an exception if no signal was
# connected from `self._editor`. We can safely ignore it.
pass
self._editor = None
self.body.hide_top_widget()
示例12: remove_editor
def remove_editor(self, done_signal_handler):
try:
disconnect_signal(self.editor, 'done', done_signal_handler)
except:
# `disconnect_signal` raises an exception if no signal was
# connected from `self.editor`. We can safely ignore it.
pass
self.editor = None
self.clear_status()
示例13: anime_entered
def anime_entered(self, content):
self.view.set_focus('body')
urwid.disconnect_signal(
self, self.foot, 'anime_entered', self.anime_entered)
urwid.disconnect_signal(
self, self.foot, 'query_escaped', self.query_escaped)
self.view.set_footer(urwid.AttrWrap(self.default_footer, 'foot'))
self.display_to_top('MALSnakes - showing results for "' + content + '"')
self.pull_in_anime_query_list(content)
示例14: login_escaped
def login_escaped(self, content):
self.view.set_focus('body')
urwid.disconnect_signal(
self, self.foot, 'login_authenticate', self.login_authenticate)
urwid.disconnect_signal(
self, self.foot, 'login_escaped', self.login_escaped)
self.username = ''
self.password = ''
self.view.set_footer(urwid.AttrWrap(self.default_footer, 'foot'))
示例15: input_done
def input_done(self, response):
urwid.disconnect_signal(self, self.container.get_footer(),
'done', self.input_done)
self.container.set_footer(self.footer)
self.container.set_focus('body')
if self.input_callback:
self.input_callback(response)
self.input_callback = None