Python curses.BUTTON1_RELEASED Examples
The following are 6
code examples of curses.BUTTON1_RELEASED().
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: fake_curses_testing.py From ci_edit with Apache License 2.0 | 6 votes |
def mouseEvent(self, timeStamp, mouseRow, mouseCol, bState): """ bState may be a logical or of: curses.BUTTON1_PRESSED; curses.BUTTON1_RELEASED; ... curses.BUTTON_SHIFT curses.BUTTON_CTRL curses.BUTTON_ALT """ assert isinstance(timeStamp, int) assert isinstance(mouseRow, int) assert isinstance(mouseCol, int) assert isinstance(bState, int) # Note that the mouse info is x,y (col, row). info = (timeStamp, mouseCol, mouseRow, 0, bState) def createEvent(display, cmdIndex): curses.addMouseEvent(info) return curses.KEY_MOUSE return createEvent
Example #2
Source File: fake_curses_testing.py From ci_edit with Apache License 2.0 | 6 votes |
def addMouseInfo(self, timeStamp, mouseRow, mouseCol, bState): """ bState may be a logical or of: curses.BUTTON1_PRESSED; curses.BUTTON1_RELEASED; ... curses.BUTTON_SHIFT curses.BUTTON_CTRL curses.BUTTON_ALT """ assert isinstance(timeStamp, int) assert isinstance(mouseRow, int) assert isinstance(mouseCol, int) assert isinstance(bState, int) # Note that the mouse info is x,y (col, row). info = (timeStamp, mouseCol, mouseRow, 0, bState) def createEvent(display, cmdIndex): curses.addMouseEvent(info) return None return createEvent
Example #3
Source File: curses_display.py From anyMesh-Python with MIT License | 5 votes |
def set_mouse_tracking(self, enable=True): """ Enable mouse tracking. After calling this function get_input will include mouse click events along with keystrokes. """ enable = bool(enable) if enable == self._mouse_tracking_enabled: return if enable: curses.mousemask(0 | curses.BUTTON1_PRESSED | curses.BUTTON1_RELEASED | curses.BUTTON2_PRESSED | curses.BUTTON2_RELEASED | curses.BUTTON3_PRESSED | curses.BUTTON3_RELEASED | curses.BUTTON4_PRESSED | curses.BUTTON4_RELEASED | curses.BUTTON1_DOUBLE_CLICKED | curses.BUTTON1_TRIPLE_CLICKED | curses.BUTTON2_DOUBLE_CLICKED | curses.BUTTON2_TRIPLE_CLICKED | curses.BUTTON3_DOUBLE_CLICKED | curses.BUTTON3_TRIPLE_CLICKED | curses.BUTTON4_DOUBLE_CLICKED | curses.BUTTON4_TRIPLE_CLICKED | curses.BUTTON_SHIFT | curses.BUTTON_ALT | curses.BUTTON_CTRL) else: raise NotImplementedError() self._mouse_tracking_enabled = enable
Example #4
Source File: termpdf.py From termpdf.py with MIT License | 5 votes |
def init_curses(self): os.environ.setdefault('ESCDELAY', '25') self.stdscr = curses.initscr() self.stdscr.clear() curses.noecho() curses.curs_set(0) curses.mousemask(curses.REPORT_MOUSE_POSITION | curses.BUTTON1_PRESSED | curses.BUTTON1_RELEASED | curses.BUTTON2_PRESSED | curses.BUTTON2_RELEASED | curses.BUTTON3_PRESSED | curses.BUTTON3_RELEASED | curses.BUTTON4_PRESSED | curses.BUTTON4_RELEASED | curses.BUTTON1_CLICKED | curses.BUTTON3_CLICKED | curses.BUTTON1_DOUBLE_CLICKED | curses.BUTTON1_TRIPLE_CLICKED | curses.BUTTON2_DOUBLE_CLICKED | curses.BUTTON2_TRIPLE_CLICKED | curses.BUTTON3_DOUBLE_CLICKED | curses.BUTTON3_TRIPLE_CLICKED | curses.BUTTON4_DOUBLE_CLICKED | curses.BUTTON4_TRIPLE_CLICKED | curses.BUTTON_SHIFT | curses.BUTTON_ALT | curses.BUTTON_CTRL) self.stdscr.keypad(True) # Handle our own escape codes for now # The first call to getch seems to clobber the statusbar. # So we make a dummy first call. self.stdscr.nodelay(True) self.stdscr.getch() self.stdscr.nodelay(False)
Example #5
Source File: curses_display.py From anyMesh-Python with MIT License | 4 votes |
def _encode_mouse_event(self): # convert to escape sequence last = next = self.last_bstate (id,x,y,z,bstate) = curses.getmouse() mod = 0 if bstate & curses.BUTTON_SHIFT: mod |= 4 if bstate & curses.BUTTON_ALT: mod |= 8 if bstate & curses.BUTTON_CTRL: mod |= 16 l = [] def append_button( b ): b |= mod l.extend([ 27, ord('['), ord('M'), b+32, x+33, y+33 ]) if bstate & curses.BUTTON1_PRESSED and last & 1 == 0: append_button( 0 ) next |= 1 if bstate & curses.BUTTON2_PRESSED and last & 2 == 0: append_button( 1 ) next |= 2 if bstate & curses.BUTTON3_PRESSED and last & 4 == 0: append_button( 2 ) next |= 4 if bstate & curses.BUTTON4_PRESSED and last & 8 == 0: append_button( 64 ) next |= 8 if bstate & curses.BUTTON1_RELEASED and last & 1: append_button( 0 + escape.MOUSE_RELEASE_FLAG ) next &= ~ 1 if bstate & curses.BUTTON2_RELEASED and last & 2: append_button( 1 + escape.MOUSE_RELEASE_FLAG ) next &= ~ 2 if bstate & curses.BUTTON3_RELEASED and last & 4: append_button( 2 + escape.MOUSE_RELEASE_FLAG ) next &= ~ 4 if bstate & curses.BUTTON4_RELEASED and last & 8: append_button( 64 + escape.MOUSE_RELEASE_FLAG ) next &= ~ 8 if bstate & curses.BUTTON1_DOUBLE_CLICKED: append_button( 0 + escape.MOUSE_MULTIPLE_CLICK_FLAG ) if bstate & curses.BUTTON2_DOUBLE_CLICKED: append_button( 1 + escape.MOUSE_MULTIPLE_CLICK_FLAG ) if bstate & curses.BUTTON3_DOUBLE_CLICKED: append_button( 2 + escape.MOUSE_MULTIPLE_CLICK_FLAG ) if bstate & curses.BUTTON4_DOUBLE_CLICKED: append_button( 64 + escape.MOUSE_MULTIPLE_CLICK_FLAG ) if bstate & curses.BUTTON1_TRIPLE_CLICKED: append_button( 0 + escape.MOUSE_MULTIPLE_CLICK_FLAG*2 ) if bstate & curses.BUTTON2_TRIPLE_CLICKED: append_button( 1 + escape.MOUSE_MULTIPLE_CLICK_FLAG*2 ) if bstate & curses.BUTTON3_TRIPLE_CLICKED: append_button( 2 + escape.MOUSE_MULTIPLE_CLICK_FLAG*2 ) if bstate & curses.BUTTON4_TRIPLE_CLICKED: append_button( 64 + escape.MOUSE_MULTIPLE_CLICK_FLAG*2 ) self.last_bstate = next return l
Example #6
Source File: curses_util.py From ci_edit with Apache License 2.0 | 4 votes |
def mouseButtonName(buttonState): """Curses debugging. Prints readable name for state of mouse buttons.""" result = u"" if buttonState & curses.BUTTON1_RELEASED: result += u'BUTTON1_RELEASED' if buttonState & curses.BUTTON1_PRESSED: result += u'BUTTON1_PRESSED' if buttonState & curses.BUTTON1_CLICKED: result += u'BUTTON1_CLICKED' if buttonState & curses.BUTTON1_DOUBLE_CLICKED: result += u'BUTTON1_DOUBLE_CLICKED' if buttonState & curses.BUTTON2_RELEASED: result += u'BUTTON2_RELEASED' if buttonState & curses.BUTTON2_PRESSED: result += u'BUTTON2_PRESSED' if buttonState & curses.BUTTON2_CLICKED: result += u'BUTTON2_CLICKED' if buttonState & curses.BUTTON2_DOUBLE_CLICKED: result += u'BUTTON2_DOUBLE_CLICKED' if buttonState & curses.BUTTON3_RELEASED: result += u'BUTTON3_RELEASED' if buttonState & curses.BUTTON3_PRESSED: result += u'BUTTON3_PRESSED' if buttonState & curses.BUTTON3_CLICKED: result += u'BUTTON3_CLICKED' if buttonState & curses.BUTTON3_DOUBLE_CLICKED: result += u'BUTTON3_DOUBLE_CLICKED' if buttonState & curses.BUTTON4_RELEASED: result += u'BUTTON4_RELEASED' if buttonState & curses.BUTTON4_PRESSED: result += u'BUTTON4_PRESSED' if buttonState & curses.BUTTON4_CLICKED: result += u'BUTTON4_CLICKED' if buttonState & curses.BUTTON4_DOUBLE_CLICKED: result += u'BUTTON4_DOUBLE_CLICKED' if buttonState & curses.REPORT_MOUSE_POSITION: result += u'REPORT_MOUSE_POSITION' if buttonState & curses.BUTTON_SHIFT: result += u' SHIFT' if buttonState & curses.BUTTON_CTRL: result += u' CTRL' if buttonState & curses.BUTTON_ALT: result += u' ALT' return result