Python curses.REPORT_MOUSE_POSITION Examples

The following are 2 code examples of curses.REPORT_MOUSE_POSITION(). 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: unit_test_file_manager.py    From ci_edit with Apache License 2.0 6 votes vote down vote up
def test_mouse_scroll(self):
        #self.setMovieMode(True)
        dirList = [
            u"./     ", u"../     ", u"._ A name with cr\\r/",
        ]
        self.runWithFakeInputs([
            self.displayCheck(0, 0, [u" ci     "]),
            self.displayCheck(2, 7, [u"     "]), CTRL_O,
            self.displayCheck(0, 0, [u" ci    Open File  "]), CTRL_A,
            self.writeText(self.pathToSample(u"")),
            self.displayCheck(3, 0, dirList[0:3]),
            self.mouseEvent(0, 5, 0, curses.REPORT_MOUSE_POSITION),
            self.displayCheck(3, 0, dirList[0:3]),
            self.mouseEvent(1, 5, 0, curses.REPORT_MOUSE_POSITION),
            self.displayCheck(3, 0, dirList[1:3]),
            self.mouseEvent(2, 5, 0, curses.REPORT_MOUSE_POSITION),
            self.displayCheck(3, 0, dirList[2:3]),
            self.mouseEvent(0, 5, 0, curses.BUTTON4_PRESSED),
            self.displayCheck(3, 0, dirList[1:3]),
            self.mouseEvent(1, 5, 0, curses.BUTTON4_PRESSED),
            self.displayCheck(3, 0, dirList[0:3]),
            self.mouseEvent(2, 5, 0, curses.BUTTON4_PRESSED),
            self.displayCheck(3, 0, dirList[0:3]),
            CTRL_Q, CTRL_Q
        ]) 
Example #2
Source File: curses_util.py    From ci_edit with Apache License 2.0 4 votes vote down vote up
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