예제 #1
0
파일: timeline.py 프로젝트: Nic0/tyrs
 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
0
    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
0
파일: ui.py 프로젝트: Erik-k/turses
 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)
예제 #4
0
 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])
예제 #5
0
    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
0
 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'))
예제 #7
0
    def change_overlay(self, widget, onclose=None, **kwargs):
        self._onclose = onclose

        if widget:
            urwid.disconnect_signal(widget, 'close-overlay',
                                    self._close_handler)
            urwid.connect_signal(widget, 'close-overlay', self._close_handler)

            if 'box' in widget.sizing():
                # A box is probably a popup, so center it
                defaults = dict(
                    align='center',
                    valign='middle',
                    width=('relative', 90),
                    height=('relative', 90),
                )
            else:
                # Otherwise it's probably a prompt or something, so stick it at
                # the bottom
                defaults = dict(
                    align='left',
                    valign='bottom',
                    width=('relative', 100),
                    height='pack',
                )

            defaults.update(kwargs)
            self.set_overlay_parameters(**defaults)

        self.top_w = widget
        self._invalidate()
예제 #8
0
파일: qgh.py 프로젝트: infyhr/qgh
    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
예제 #9
0
파일: ui.py 프로젝트: replicant0wnz/turses
 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)
예제 #10
0
 def sig_unsubscribe(self, w):
     w_sig = None
     w_signals = getattr(w, 'signals', None)
     if isinstance(w_signals, list):
         w_sig = w_signals[0]
     if w_sig is not None:
         urwid.disconnect_signal(w, w_sig, lambda _, arg: self.on_event(w_sig, arg))
예제 #11
0
파일: ui.py 프로젝트: silky/xapers
 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])
예제 #12
0
파일: ui.py 프로젝트: qarth/xapers
 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])
예제 #13
0
파일: timeline.py 프로젝트: kezabelle/tyrs
 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
예제 #14
0
 def _promptTag_done(self, tag_string, sign):
     self.ui.view.set_focus('body')
     urwid.disconnect_signal(self, self.ui.prompt, 'done',
                             self._promptTag_done)
     if not tag_string:
         self.ui.set_status('No tags set.')
         return
     entry = self.listbox.get_focus()[0]
     try:
         with initdb(writable=True) as db:
             doc = db[entry.docid]
             tags = tag_string.split()
             if sign is '+':
                 doc.add_tags(tags)
                 msg = "Added tags: %s" % (tag_string)
             elif sign is '-':
                 doc.remove_tags(tags)
                 msg = "Removed tags: %s" % (tag_string)
             doc.sync()
         tags = doc.get_tags()
         entry.tag_field.set_text(' '.join(tags))
     except DatabaseLockError as e:
         msg = e.msg
     self.ui.db.reopen()
     self.ui.set_status(msg)
예제 #15
0
    def comment_on_item(self, text):
        """ comment to story or comment """

        #get user input
        urwid.disconnect_signal(self.footer, 'entered', self.comment_on_item)
        item = self.run_time_list[self.focus[1]]
        #if focus widget is news title
        if isinstance(item, base.Story):
            storyID = item.storyID
            result = self.r.comment_on_story(storyID, text)
            if result == True:
                self.view.set_footer(
                    urwid.Text(
                        "Comment Successfull! Please reload the comment page 20 seconds later."
                    ))
            else:
                self.view.set_footer(urwid.Text(result))

    #if focus widget is comment or reply
        else:
            commentID = item.commentID
            i = self.focus[1] - 1
            #go back and get the story id
            while not isinstance(self.run_time_list[i], base.Story):
                i = i - 1
            storyID = self.run_time_list[i].storyID
            result = self.r.reply_to_comment(storyID, commentID, text)
            if result == True:
                self.view.set_footer(
                    urwid.Text(
                        "Reply Successfull! Please reload the comment page 20 seconds later."
                    ))
            else:
                self.view.set_footer(urwid.Text(result))
        self.view.set_focus('body')
예제 #16
0
 def reply_done(self, content):
     self.clean_edit()
     urwid.disconnect_signal(self, self.interface.foot, 'done',
                             self.reply_done)
     if content:
         self.post_tweet(encode(content),
                         self.interface.current_status().id)
 def next_page(self):
     # disconnect the signal handler setup by __init__
     urwid.disconnect_signal(self.common_password.base_widget,
                             'change',
                             callback=self.common_pswd_change)
     app = self.parent
     app.next_page()
예제 #18
0
파일: qgh.py 프로젝트: timofonic-git/qgh
    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
예제 #19
0
 def __del__(self):
     self._disconnect_model_signals()
     urwid.disconnect_signal(self, self.SIGNAL_ACTION_REFRESH,
                             self.refresh_model)
     self._disconnect_model_signals()
     self._model = None
     self._connection = None
예제 #20
0
 def __del__(self):
     while True:
         try:
             obj, name, callback, kwargs = self._signal_handlers.pop()
             urwid.disconnect_signal(obj, name, callback, **kwargs)
         except IndexError:
             break
예제 #21
0
 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')
예제 #22
0
파일: app.py 프로젝트: tuandm/sclack
 def go_to_channel(self, channel_id):
     if self.quick_switcher:
         urwid.disconnect_signal(self.quick_switcher, 'go_to_channel',
                                 self.go_to_channel)
         self.urwid_loop.widget = self._body
         self.quick_switcher = None
     loop.create_task(self._go_to_channel(channel_id))
예제 #23
0
파일: ListBox.py 프로젝트: sushi-irc/nigiri
	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)
예제 #24
0
 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])
예제 #25
0
파일: gui.py 프로젝트: ricott1/twissh
    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)
예제 #26
0
파일: ui.py 프로젝트: nico202/papis
 def _prompt_search_done(self, query):
     self.view.set_focus('body')
     urwid.disconnect_signal(self, self.prompt, 'done',
                             self._prompt_search_done)
     if not query:
         self.set_status()
         return
     self.newbuffer(['search', query])
예제 #27
0
 def __build_data(self, tab_list):
     for tab in tab_list:
         n = len(self)
         self.__tabs_and_indices[tab] = n
         self.__tabs_and_indices[n] = tab
         self.__focus[tab] = None
         disconnect_signal(tab, 'tab', self.tab)
         connect_signal(tab, 'tab', self.tab)
예제 #28
0
파일: ui.py 프로젝트: tazjel/turses
 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()
예제 #29
0
파일: ui.py 프로젝트: gigigi/turses
 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()
예제 #30
0
 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)
예제 #31
0
 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'))
예제 #32
0
    def _user(self, name):
        """ allow user input password """

        urwid.disconnect_signal(self.footer, 'entered', self._user)
        self.username = name
        self.footer = FooterEdit(u"password: ")
        self.view.set_footer(self.footer)
        self.view.set_focus('footer')
        urwid.connect_signal(self.footer, 'entered', self._password)
예제 #33
0
파일: views.py 프로젝트: brkcmd/pennon
    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
예제 #34
0
파일: app.py 프로젝트: andrepcg/sclack
 def go_to_sidebar(self):
     if len(self.columns.contents) > 2:
         self.columns.contents.pop()
     self.columns.focus_position = 0
     if self.store.state.editing_widget:
         self.leave_edit_mode()
     if self.quick_switcher:
         urwid.disconnect_signal(self.quick_switcher, 'go_to_channel', self.go_to_channel)
         self.urwid_loop.widget = self._body
         self.quick_switcher = None
예제 #35
0
 def __del__(self):
     self._cancel_clear_error_timer()
     if not self._command_bar:
         return
     command_bar = utils.orig_w(self._command_bar)
     urwid.disconnect_signal(command_bar, command_bar.SIGNAL_CANCEL,
                             self.cancel_command_edit)
     urwid.disconnect_signal(self._command_processor,
                             self._command_processor.SIGNAL_ERROR,
                             self.show_command_error)
예제 #36
0
 def handle_close_set_snooze(self):
     """
     Close set_snooze
     :return:
     """
     if self.set_snooze_widget:
         urwid.disconnect_signal(self.set_snooze_widget, 'set_snooze_time', self.handle_set_snooze_time)
         urwid.disconnect_signal(self.set_snooze_widget, 'close_set_snooze', self.handle_close_set_snooze)
         self.urwid_loop.widget = self._body
         self.set_snooze_widget = None
예제 #37
0
    def _password(self, password):
        """ log in and print response """

        urwid.disconnect_signal(self.footer, 'entered', self._password)
        self.password = password
        if self.r.login(self.username, self.password):
            self.logged_in = "Login Successfull!"
        else:
            self.logged_in = "Login Unsuccessful :("
        self.view.set_focus('body')
        self.view.set_footer(urwid.Text(self.logged_in))
예제 #38
0
 def _runtest(self, b):
     if not self._tclist:
         self._emit("message", "No tests selected")
         return
     urwid.disconnect_signal(b, "click", self._runtest) # prevent running again until test ends
     environmentname = self._envsel.value
     reportname = self._repsel.value
     options = self._get_options()
     testlist = [tw.base_widget.text for tw in self._tclist]
     self.runtest(testlist, environmentname, reportname, options)
     self._w.set_focus("body")
예제 #39
0
 def login_authenticate(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 = content[0]
     self.password = content[1]
     self.view.set_footer(urwid.AttrWrap(self.default_footer, 'foot'))
     self.display_to_top('MALSnakes - logged in as ' + self.username)
     self.authenticated = True
예제 #40
0
 def edit_done(self, content):
   self.box.set_focus('body')
   urwid.disconnect_signal(self, self.foot, 'done', self.edit_done)
   if content:
     if content[0] == "/":
       self.parse_self_command(content[1:])
     else:
       for friend in self.friends:
         self.send_command(friend, content)
     self.txt.set_text(self.txt.get_text()[0] + "\n<" + self.nick + "> " + content)
   self.inputbox.set_text("> ")
   self.loop.draw_screen()
예제 #41
0
파일: runner.py 프로젝트: wildone/pycopia
 def _runtest(self, b):
     if not self._tclist:
         self._emit("message", "No tests selected")
         return
     urwid.disconnect_signal(
         b, "click", self._runtest)  # prevent running again until test ends
     environmentname = self._envsel.value
     reportname = self._repsel.value
     options = self._get_options()
     testlist = [tw.base_widget.text for tw in self._tclist]
     self.runtest(testlist, environmentname, reportname, options)
     self._w.set_focus("body")
예제 #42
0
 def edit_done(self, content):
     self.box.set_focus('body')
     urwid.disconnect_signal(self, self.foot, 'done', self.edit_done)
     if content:
         if content[0] == "/":
             self.parse_self_command(content[1:])
         else:
             for friend in self.friends:
                 self.send_command(friend, content)
         self.txt.set_text(self.txt.get_text()[0] + "\n<" + self.nick +
                           "> " + content)
     self.inputbox.set_text("> ")
     self.loop.draw_screen()
예제 #43
0
파일: qgh.py 프로젝트: timofonic-git/qgh
    def edit_done(self, content=None):
        """After footer editing process is pointed here.

        Args:
            content: The content, what user entered, if any.

        """
        self.view.set_focus('body')
        urwid.disconnect_signal(self.foot_new, 'done', self.edit_done)
        if content:
            # Command processor here?
            self.view.set_body(urwid.Filler(urwid.Text(content), 'top'))
        self.view.set_footer(self.foot)
예제 #44
0
    def go_to_channel(self, channel_id):
        if self.quick_switcher:
            urwid.disconnect_signal(self.quick_switcher, 'go_to_channel',
                                    self.go_to_channel)
            self.urwid_loop.widget = self._body
            self.quick_switcher = None

        # We are not showing a thread - this needs to be reset as this method might be
        # triggered from the sidebar while a thread is being shown.
        self.showing_thread = False

        # Show the channel in the chatbox
        loop.create_task(self._go_to_channel(channel_id))
예제 #45
0
 def __connect(self, widget, name):
     # we don't use weak args because we want the binder to be around as long as the widget
     user_args = [name]
     self.__log.debug('Disconnecting %s' % widget)
     disconnect_signal(widget,
                       'change',
                       self.__change_callback,
                       user_args=user_args)
     self.__log.debug('Connecting %s' % widget)
     connect_signal(widget,
                    'change',
                    self.__change_callback,
                    user_args=user_args)
예제 #46
0
파일: qgh.py 프로젝트: infyhr/qgh
    def edit_done(self, content=None):
        """After footer editing process is pointed here.

        Args:
            content: The content, what user entered, if any.

        """
        self.view.set_focus('body')
        urwid.disconnect_signal(self.foot_new, 'done', self.edit_done)
        if content:
            # Command processor here?
            self.view.set_body(urwid.Filler(urwid.Text(content), 'top'))
        self.view.set_footer(self.foot)
예제 #47
0
 def keypress(self, size, key):
     key = urwid.Frame.keypress(self, size, key)
     if self.overlay and key not in UI.keys['help']:
         if key in UI.keys['escape']:
             urwid.disconnect_signal(self.overlay.top_w.original_widget,
                                     'update_status', self.update_status)
             self.body = self.overlay.bottom_w
             self.overlay = None
         if key in UI.keys['left']:
             urwid.emit_signal(self, 'goto_matching_frame', -1)
         elif key in UI.keys['right']:
             urwid.emit_signal(self, 'goto_matching_frame', 1)
         return None
     else:
         return key
예제 #48
0
    def on_aws_changed(self):
        # aws
        self.aws_view.update_focus()

        # group
        urwid.disconnect_signal(self.group_view.get_walker(), "modified",
                                self.on_group_changed)
        aws_name = self.aws_view.get_selected_name()
        self.group_view.update_widgets(self.instances[aws_name].keys())
        urwid.connect_signal(self.group_view.get_walker(), "modified",
                             self.on_group_changed)

        # instance
        group_name = self.group_view.get_selected_name()
        self.instance_view.update_widgets(self.instances[aws_name][group_name])
예제 #49
0
	def edit_done(self, content):
		
		try:
			self.view.set_focus('body')
			urwid.disconnect_signal(self, self.foot, 'done', self.edit_done)
			
			if content:
				self.q = '\"'+content+'\"'
				self.num = 50
				self.order = 'relevance'
				self.execute()
			
			self.view.set_footer(None)
		
		except Exception as e:
			logging.exception(e)
예제 #50
0
    def command(self, command):
        """ check the commands entered by user """

        urwid.disconnect_signal(self, self.footer, 'entered', self.command)
        if command in ['quit', 'exit', ':q', 'q']:
            raise urwid.ExitMainLoop()
        elif command == "login":
            self.login()
        elif command in ['comment', 'reply']:
            self.type_comment()
        elif command in ['open', 'go']:
            self.focus = self.listbox.get_focus()
            if isinstance(self.run_time_list[self.focus[1]], base.Story):
                webbrowser.open(self.run_time_list[self.focus[1]].content)
        else:
            self.view.set_focus('body')
예제 #51
0
    def search_done(self, pattern, reverse=False):
        logger.debug('Reverse: {}'.format(reverse))
        self.top.update_focus('body')
        urwid.disconnect_signal(
            self,
            self.edit,
            signals.PROMPT_DONE,
            self.search_done)

        if pattern:
            logger.debug('SEARCH FOR: {}'.format(pattern))
            searcher = LazySearcher(pattern, reverse=reverse)

            for buf in self.top:
                buf.search(searcher)

            self.top.current_buffer().next_search()
예제 #52
0
파일: util.py 프로젝트: piercyjoshua/flax
    def change_overlay(self, widget, onclose=None, **kwargs):
        self._onclose = onclose

        if widget:
            urwid.disconnect_signal(widget, "close-overlay", self._close_handler)
            urwid.connect_signal(widget, "close-overlay", self._close_handler)

            if "box" in widget.sizing():
                # A box is probably a popup, so center it
                defaults = dict(align="center", valign="middle", width=("relative", 90), height=("relative", 90))
            else:
                # Otherwise it's probably a prompt or something, so stick it at
                # the bottom
                defaults = dict(align="left", valign="bottom", width=("relative", 100), height="pack")

            defaults.update(kwargs)
            self.set_overlay_parameters(**defaults)

        self.top_w = widget
        self._invalidate()
예제 #53
0
파일: search.py 프로젝트: pazz/xapers
 def _promptTag_done(self, tag_string, sign):
     self.ui.view.set_focus('body')
     urwid.disconnect_signal(self, self.ui.prompt, 'done', self._promptTag_done)
     if not tag_string:
         self.ui.set_status('No tags set.')
         return
     entry = self.listbox.get_focus()[0]
     try:
         with Database(self.ui.xroot, writable=True) as db:
             doc = db[entry.docid]
             tags = tag_string.split()
             if sign is '+':
                 doc.add_tags(tags)
                 msg = "Added tags: %s" % (tag_string)
             elif sign is '-':
                 doc.remove_tags(tags)
                 msg = "Removed tags: %s" % (tag_string)
             doc.sync()
         tags = doc.get_tags()
         entry.fields['tags'].set_text(' '.join(tags))
     except DatabaseLockError as e:
         msg = e.msg
     self.ui.set_status(msg)
예제 #54
0
파일: main.py 프로젝트: bharathi26/pycopia
 def _popform(self, form):
     if form is not None:
         urwid.disconnect_signal(form, 'pushform', self._pushform)
         urwid.disconnect_signal(form, 'popform', self._popform)
         urwid.disconnect_signal(form, 'message', self._message)
     if self._formtrail:
         self.form = self._formtrail.pop()
         #self.form.invalidate()
         self.top.body = self.form
     else:
         raise urwid.ExitMainLoop()
예제 #55
0
파일: tweets.py 프로젝트: muromec/tyrs
 def public_done(self, content):
     self.clean_edit()
     urwid.disconnect_signal(self, self.interface.foot, 'done', self.public_done)
     if content:
         self.find_public_timeline(content)
예제 #56
0
파일: tweets.py 프로젝트: muromec/tyrs
 def reply_done(self, content):
     self.clean_edit()
     urwid.disconnect_signal(self, self.interface.foot, 'done', self.reply_done)
     if content:
         self.post_tweet(encode(content), self.interface.current_status().id)
예제 #57
0
파일: vxargs2.py 프로젝트: kroemeke/vxargs2
 def edit_done(self, content):
     self.view.set_focus('body')
     urwid.disconnect_signal(self, self.foot, 'done', self.edit_done)
     if content:
         subprocess.Popen(["vxargs.py", "-t", "300", "-a", sys.argv[1], "-P", str(self.concurrency), "-y", "-p", "-o", self.tempdir, "ssh", "{}", content], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
         self.view.set_focus('body')
예제 #58
0
파일: tweets.py 프로젝트: muromec/tyrs
 def unfollow_done(self, content):
     self.clean_edit()
     urwid.disconnect_signal(self, self.interface.foot, 'done', self.unfollow_done)
     if content:
         self.destroy_friendship(content)
예제 #59
0
파일: tweets.py 프로젝트: muromec/tyrs
 def search_done(self, content):
     self.clean_edit()
     urwid.disconnect_signal(self, self.interface.foot, 'done', self.search_done)
     if content:
         self.search(encode(content))