|
2 | 2 | # License: New BSD License. |
3 | 3 | # Website: http://code.google.com/p/cefpython/ |
4 | 4 |
|
5 | | -import os |
6 | | -import sys |
7 | | -import win32con |
8 | | -import win32gui |
9 | | -import win32api |
10 | | -import cython |
11 | | -import traceback |
12 | | -import time |
13 | | - |
14 | | -from libcpp cimport bool as cbool |
15 | | -from libcpp.map cimport map |
16 | | -from libcpp.vector cimport vector |
17 | | -from cython.operator cimport preincrement as preinc, dereference as deref # must be "as" otherwise not seen. |
18 | | -from libc.stdlib cimport malloc, free |
19 | | - |
20 | | -# When pyx file cimports * from a pxd file and that cimports * from another pxd |
21 | | -# then these another names will be visible in pyx file. |
22 | | - |
23 | | -# Circular imports are allowed in form "cimport ...", |
24 | | -# but won't work if you do "from ... cimport *", this |
25 | | -# is important to know in pxd files. |
26 | | - |
27 | | -# <CefRefPtr[ClientHandler]?>new ClientHandler() # <...?> means to throw an error if the cast is not allowed |
28 | | - |
29 | | -from windows cimport * |
30 | | -from cef_string cimport * |
31 | | -from cef_type_wrappers cimport * |
32 | | -from cef_task cimport * |
33 | | -from cef_win cimport * |
34 | | -from cef_ptr cimport * |
35 | | -from cef_app cimport * |
36 | | -from cef_browser cimport * |
37 | | -from cef_client cimport * |
38 | | -from clienthandler cimport * |
39 | | -from cef_frame cimport * |
40 | | -cimport cef_types |
| 5 | +# All .pyx files need to be included here for Cython compiler. |
| 6 | +include "imports.pyx" |
| 7 | +include "browser.pyx" |
| 8 | +include "frame.pyx" |
| 9 | +include "javascriptbindings.pyx" |
| 10 | +include "loadhandler.pyx" |
| 11 | +include "settings.pyx" |
| 12 | +include "utils.pyx" |
| 13 | +include "wndproc.pyx" |
41 | 14 |
|
42 | 15 | # Global variables. |
43 | | - |
44 | 16 | __debug = False |
45 | 17 |
|
46 | | - |
47 | 18 | # Client handler. |
48 | | -cdef CefRefPtr[ClientHandler] __clientHandler = <CefRefPtr[ClientHandler]?>new ClientHandler() |
| 19 | +cdef CefRefPtr[ClientHandler] __clientHandler = <CefRefPtr[ClientHandler]>new ClientHandler() |
49 | 20 |
|
50 | 21 |
|
51 | 22 | def ExceptHook(type, value, traceobject): |
52 | | - |
| 23 | + |
53 | 24 | error = "\n".join(traceback.format_exception(type, value, traceobject)) |
54 | 25 | if hasattr(sys, "frozen"): path = os.path.dirname(sys.executable) |
55 | 26 | elif "__file__" in locals(): path = os.path.dirname(os.path.realpath(__file__)) |
56 | 27 | else: path = os.getcwd() |
57 | | - with open(path+"/error.log", "a") as file: |
| 28 | + with open("%s/error.log" % path, "a") as file: |
58 | 29 | file.write("\n[%s] %s\n" % (time.strftime("%Y-%m-%d %H:%M:%S"), error)) |
59 | 30 | print "\n"+error+"\n" |
60 | 31 | CefQuitMessageLoop() |
61 | 32 | CefShutdown() |
62 | 33 | os._exit(1) # so that "finally" does not execute |
63 | 34 |
|
64 | | - |
65 | | -def GetLastError(): |
66 | | - |
67 | | - code = win32api.GetLastError() |
68 | | - return "(%d) %s" % (code, win32api.FormatMessage(code)) |
69 | | - |
70 | 35 | def __InitializeClientHandler(): |
71 | 36 |
|
72 | 37 | InitializeLoadHandler() |
@@ -184,17 +149,3 @@ def Shutdown(): |
184 | 149 | CefShutdown() |
185 | 150 | if __debug: print "GetLastError(): %s" % GetLastError() |
186 | 151 |
|
187 | | - |
188 | | -# ------------------ |
189 | | - |
190 | | -cimport cef_types |
191 | | - |
192 | | -TID_UI = cef_types.TID_UI |
193 | | -TID_IO = cef_types.TID_IO |
194 | | -TID_FILE = cef_types.TID_FILE |
195 | | - |
196 | | -def CurrentlyOn(threadID): |
197 | | - |
198 | | - threadID = <int>int(threadID) |
199 | | - return CefCurrentlyOn(<CefThreadId>threadID) |
200 | | - |
0 commit comments