diff options
| author | Neil <nyamatongwe@gmail.com> | 2016-05-05 10:58:13 +1000 | 
|---|---|---|
| committer | Neil <nyamatongwe@gmail.com> | 2016-05-05 10:58:13 +1000 | 
| commit | 4c3df3da9fdcec8b71fcd0e041c93027fac57c39 (patch) | |
| tree | 6aa2954370ce63f4ab223f8891532ac10b0170c6 /test/XiteWin.py | |
| parent | 1c5cc9a5fc8a6bfb9b9791338c5c5a20b21288e8 (diff) | |
| download | scintilla-mirror-4c3df3da9fdcec8b71fcd0e041c93027fac57c39.tar.gz | |
Make Open work again and print out message when SciLexer can't be found.
Diffstat (limited to 'test/XiteWin.py')
| -rw-r--r-- | test/XiteWin.py | 14 | 
1 files changed, 9 insertions, 5 deletions
diff --git a/test/XiteWin.py b/test/XiteWin.py index 0dd9e4309..5953fd502 100644 --- a/test/XiteWin.py +++ b/test/XiteWin.py @@ -182,7 +182,11 @@ class XiteWin():  	def OnCreate(self, hwnd):  		self.win = hwnd  		# Side effect: loads the DLL -		x = ctypes.windll.SciLexer.Scintilla_DirectFunction +		try: +			x = ctypes.windll.SciLexer.Scintilla_DirectFunction +		except OSError: +			print("Can't find SciLexer.DLL") +			sys.exit()  		self.sciHwnd = user32.CreateWindowExW(0,  			"Scintilla", "Source",  			WS_CHILD | WS_VSCROLL | WS_HSCROLL | WS_CLIPCHILDREN, @@ -299,16 +303,16 @@ class XiteWin():  	def Open(self):  		ofx = OPENFILENAME(self.win, "Open File") -		opath = "\0" * 1024 -		ofx.lpstrFile = opath +		opath = ctypes.create_unicode_buffer(1024) +		ofx.lpstrFile = ctypes.addressof(opath)  		filters = ["Python (.py;.pyw)|*.py;*.pyw|All|*.*"]  		filterText = "\0".join([f.replace("|", "\0") for f in filters])+"\0\0"  		ofx.lpstrFilter = filterText  		if ctypes.windll.comdlg32.GetOpenFileNameW(ctypes.byref(ofx)): -			absPath = opath.replace("\0", "") +			absPath = opath.value.replace("\0", "")  			self.GrabFile(absPath)  			self.FocusOnEditor() -			self.ed.LexerLanguage = "python" +			self.ed.LexerLanguage = b"python"  			self.ed.Lexer = self.ed.SCLEX_PYTHON  			self.ed.SetKeyWords(0, b"class def else for from if import print return while")  			for style in [k for k in self.ed.k if k.startswith("SCE_P_")]:  | 
