Python curses.beep() Examples

The following are 21 code examples of curses.beep(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module curses , or try the search function .
Example #1
Source File: wgmultiline.py    From EDCOP with Apache License 2.0 5 votes vote down vote up
def h_set_filtered_to_selected(self, ch):
        # This is broken on multiline
        if len(self._filtered_values_cache) < 2:
            self.value = self._filtered_values_cache
        else:
            # There is an error - trying to select too many things.
            curses.beep() 
Example #2
Source File: oldtreeclasses.py    From TelegramTUI with MIT License 5 votes vote down vote up
def h_set_filtered_to_selected(self, ch):
        if len(self._filtered_values_cache) < 2:
            self.value = self.get_filtered_values()
        else:
            # There is an error - trying to select too many things.
            curses.beep()


#####################################################################################
# The Following are maintained here for compatibility only.
# All new Applications should use classes above this comment.
##################################################################################### 
Example #3
Source File: wgtextbox.py    From TelegramTUI with MIT License 5 votes vote down vote up
def show_brief_message(self, message):
        curses.beep()
        keep_for_a_moment = self.value
        self.value = message
        self.editing=False
        self.display()
        curses.napms(1200)
        self.editing=True
        self.value = keep_for_a_moment 
Example #4
Source File: fmForm.py    From TelegramTUI with MIT License 5 votes vote down vote up
def use_mouse_event(self, mouse_event):
        wg = self.find_mouse_handler(mouse_event)
        if wg:
            self.set_editing(wg)
            if hasattr(wg, 'handle_mouse_event'):
                wg.handle_mouse_event(mouse_event)
        else:
            curses.beep() 
Example #5
Source File: wgautocomplete.py    From TelegramTUI with MIT License 5 votes vote down vote up
def auto_complete(self, input):
        curses.beep() 
Example #6
Source File: wgmultiline.py    From TelegramTUI with MIT License 5 votes vote down vote up
def h_set_filtered_to_selected(self, ch):
        # This is broken on multiline
        if len(self._filtered_values_cache) < 2:
            self.value = self._filtered_values_cache
        else:
            # There is an error - trying to select too many things.
            curses.beep() 
Example #7
Source File: wgtextbox.py    From EDCOP with Apache License 2.0 5 votes vote down vote up
def show_brief_message(self, message):
        curses.beep()
        keep_for_a_moment = self.value
        self.value = message
        self.editing=False
        self.display()
        curses.napms(1200)
        self.editing=True
        self.value = keep_for_a_moment 
Example #8
Source File: fmForm.py    From EDCOP with Apache License 2.0 5 votes vote down vote up
def use_mouse_event(self, mouse_event):
        wg = self.find_mouse_handler(mouse_event)
        if wg:
            self.set_editing(wg)
            if hasattr(wg, 'handle_mouse_event'):
                wg.handle_mouse_event(mouse_event)
        else:
            curses.beep() 
Example #9
Source File: wgautocomplete.py    From EDCOP with Apache License 2.0 5 votes vote down vote up
def auto_complete(self, input):
        curses.beep() 
Example #10
Source File: wgmultiline.py    From apple_bleee with GNU General Public License v3.0 5 votes vote down vote up
def h_set_filtered_to_selected(self, ch):
        # This is broken on multiline
        if len(self._filtered_values_cache) < 2:
            self.value = self._filtered_values_cache
        else:
            # There is an error - trying to select too many things.
            curses.beep() 
Example #11
Source File: oldtreeclasses.py    From HomePWN with GNU General Public License v3.0 5 votes vote down vote up
def h_set_filtered_to_selected(self, ch):
        if len(self._filtered_values_cache) < 2:
            self.value = self.get_filtered_values()
        else:
            # There is an error - trying to select too many things.
            curses.beep()


#####################################################################################
# The Following are maintained here for compatibility only.
# All new Applications should use classes above this comment.
##################################################################################### 
Example #12
Source File: wgtextbox.py    From HomePWN with GNU General Public License v3.0 5 votes vote down vote up
def show_brief_message(self, message):
        curses.beep()
        keep_for_a_moment = self.value
        self.value = message
        self.editing=False
        self.display()
        curses.napms(1200)
        self.editing=True
        self.value = keep_for_a_moment 
Example #13
Source File: fmForm.py    From HomePWN with GNU General Public License v3.0 5 votes vote down vote up
def use_mouse_event(self, mouse_event):
        wg = self.find_mouse_handler(mouse_event)
        if wg:
            self.set_editing(wg)
            if hasattr(wg, 'handle_mouse_event'):
                wg.handle_mouse_event(mouse_event)
        else:
            curses.beep() 
Example #14
Source File: wgautocomplete.py    From HomePWN with GNU General Public License v3.0 5 votes vote down vote up
def auto_complete(self, input):
        curses.beep() 
Example #15
Source File: wgmultiline.py    From HomePWN with GNU General Public License v3.0 5 votes vote down vote up
def h_set_filtered_to_selected(self, ch):
        # This is broken on multiline
        if len(self._filtered_values_cache) < 2:
            self.value = self._filtered_values_cache
        else:
            # There is an error - trying to select too many things.
            curses.beep() 
Example #16
Source File: oldtreeclasses.py    From apple_bleee with GNU General Public License v3.0 5 votes vote down vote up
def h_set_filtered_to_selected(self, ch):
        if len(self._filtered_values_cache) < 2:
            self.value = self.get_filtered_values()
        else:
            # There is an error - trying to select too many things.
            curses.beep()


#####################################################################################
# The Following are maintained here for compatibility only.
# All new Applications should use classes above this comment.
##################################################################################### 
Example #17
Source File: wgtextbox.py    From apple_bleee with GNU General Public License v3.0 5 votes vote down vote up
def show_brief_message(self, message):
        curses.beep()
        keep_for_a_moment = self.value
        self.value = message
        self.editing=False
        self.display()
        curses.napms(1200)
        self.editing=True
        self.value = keep_for_a_moment 
Example #18
Source File: fmForm.py    From apple_bleee with GNU General Public License v3.0 5 votes vote down vote up
def use_mouse_event(self, mouse_event):
        wg = self.find_mouse_handler(mouse_event)
        if wg:
            self.set_editing(wg)
            if hasattr(wg, 'handle_mouse_event'):
                wg.handle_mouse_event(mouse_event)
        else:
            curses.beep() 
Example #19
Source File: wgautocomplete.py    From apple_bleee with GNU General Public License v3.0 5 votes vote down vote up
def auto_complete(self, input):
        curses.beep() 
Example #20
Source File: fmFileSelector.py    From EDCOP with Apache License 2.0 4 votes vote down vote up
def auto_complete(self, input):
        self.value = os.path.expanduser(self.value)
        
        directory, fname = os.path.split(self.value)
        # Let's have absolute paths.
        directory = os.path.abspath(directory)
        
        if self.value == '': 
            self.value=directory
            
        
        try: 
            flist = os.listdir(directory)
        except:
            self.show_brief_message("Can't read directory!")
            return False
            
        flist = [os.path.join(directory, x) for x in flist]
        possibilities = list(filter(
            (lambda x: os.path.split(x)[1].startswith(fname)), flist
            ))

        if len(possibilities) == 0:
            # can't complete
            curses.beep()
            self.cursor_position = len(self.value)

        elif len(possibilities) == 1:
            if self.value != possibilities[0]:
                self.value = possibilities[0]
                if os.path.isdir(self.value) \
                    and not self.value.endswith(os.sep):
                    self.value = self.value + os.sep
            self.cursor_position = len(self.value)
        
        elif len(possibilities) > 1:
            self.value = os.path.commonprefix(possibilities)
            self.cursor_position = len(self.value)
            curses.beep()
            
        if os.path.isdir(self.value) and len(possibilities) < 2:
            self.parent.wMain.change_dir(self.value)
            if os.path.isdir(self.value) \
                and not self.value.endswith(os.sep):
                self.value = self.value + os.sep
            self.cursor_position = len(self.value)
            
            #self.h_exit_up(None)
        else:
            self.parent.value = directory
            self.parent.update_grid() 
Example #21
Source File: app.py    From toot with GNU General Public License v3.0 4 votes vote down vote up
def do_command(self, ch):
        if curses.ascii.isprint(ch) or ch == curses.ascii.LF:
            text_window_height, text_window_width = self.text_window.getmaxyx()
            y, x = size_as_drawn((self.get_content() + chr(ch)).split('\n'), text_window_width)
            if y < text_window_height - 1 and x < text_window_width:
                self.content.insert(self.cursor_pos, chr(ch))
                self.cursor_pos += 1
            else:
                curses.beep()

        elif ch == curses.KEY_BACKSPACE:
            if self.cursor_pos > 0:
                del self.content[self.cursor_pos - 1]
                self.cursor_pos -= 1
            else:
                curses.beep()

        elif ch == curses.KEY_DC:
            if self.cursor_pos >= 0 and self.cursor_pos < len(self.content):
                del self.content[self.cursor_pos]
            else:
                curses.beep()

        elif ch == curses.KEY_LEFT:
            if self.cursor_pos > 0:
                self.cursor_pos -= 1
            else:
                curses.beep()

        elif ch == curses.KEY_RIGHT:
            if self.cursor_pos + 1 <= len(self.content):
                self.cursor_pos += 1
            else:
                curses.beep()

        elif ch in (curses.ascii.EOT, curses.ascii.RS):  # ^D or (for some terminals) Ctrl+Enter
            return False, False

        elif ch == curses.ascii.ESC:
            self.clear()
            return False, True

        elif ch == curses.KEY_RESIZE:
            self.on_resize()
            return True, False

        self.refresh_text()
        return True, False