def regex_tester_doc_already_exists(): files = notepad.getFiles() f = [i[1][1] for i in enumerate(files) if i[1][0].upper() == REGEX_TESTER_FILE_NAME.upper()] if f: return f[0] else: return 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()}
def set_current_buffer_id(): global CURRENT_BUFFER_ID doc_idx = notepad.getCurrentDocIndex(0) CURRENT_BUFFER_ID = notepad.getFiles()[doc_idx][1]