예제 #1
0
 def test_scintillawrapper_void_int_colour(self):
     currentColour = editor.styleGetFore(1)
     editor.styleSetFore(1, (218,219,220))
     newColour = editor.styleGetFore(1)
     # reset the style back to the original (assuming it works!)
     editor.styleSetFore(1, currentColour)
     self.assertEquals(newColour, (218,219,220))
     self.assertNotEquals(currentColour, newColour)
예제 #2
0
    def setup(self):
        log('register callbacks etc...')
        notepad.callback(self.on_buffer_activated,
                         [NOTIFICATION.BUFFERACTIVATED])
        notepad.callback(self.on_file_saved, [NOTIFICATION.FILESAVED])
        notepad.callback(self.on_file_closed, [NOTIFICATION.FILECLOSED])
        notepad.callback(self.on_file_before_save,
                         [NOTIFICATION.FILEBEFORESAVE])
        editor.callbackSync(self.on_char_added,
                            [SCINTILLANOTIFICATION.CHARADDED])
        editor.callbackSync(self.on_dwell_end,
                            [SCINTILLANOTIFICATION.DWELLEND])
        editor.callbackSync(self.on_dwell_start,
                            [SCINTILLANOTIFICATION.DWELLSTART])

        fg_color = editor.styleGetFore(32)
        darker_bg_color = tuple(
            [x - 10 if x > 10 else x for x in editor.styleGetBack(32)])

        CALLTIP_STYLE = 38
        editor1.styleSetBack(CALLTIP_STYLE, darker_bg_color)
        editor1.styleSetFore(CALLTIP_STYLE, fg_color)
        editor2.styleSetBack(CALLTIP_STYLE, darker_bg_color)
        editor2.styleSetFore(CALLTIP_STYLE, fg_color)

        editor1.callTipUseStyle(80)  # 80 = tab width in pixels
        editor2.callTipUseStyle(80)

        editor1.autoCSetSeparator(10)
        editor1.autoCSetOrder(ORDERING.CUSTOM)
        editor2.autoCSetSeparator(10)
        editor2.autoCSetOrder(ORDERING.CUSTOM)

        self.PEEK_STYLE = 60
        editor1.styleSetFore(self.PEEK_STYLE, fg_color)
        editor1.styleSetBack(self.PEEK_STYLE, darker_bg_color)
        editor2.styleSetFore(self.PEEK_STYLE, fg_color)
        editor2.styleSetBack(self.PEEK_STYLE, darker_bg_color)

        editor1.setMouseDwellTime(500)
        editor2.setMouseDwellTime(500)

        self.open_files_dict = {x[1]: x[0] for x in notepad.getFiles()}
예제 #3
0
 def test_scintillawrapper_colour_int_void(self):
     original = editor.styleGetFore(4)
     editor.styleSetFore(4, (191, 195, 198))
     replaced = editor.styleGetFore(4)
     editor.styleSetFore(4, original)
     self.assertEqual(replaced, (191, 195, 198))