-
Notifications
You must be signed in to change notification settings - Fork 16
/
Copy pathereader.py
58 lines (41 loc) · 1.89 KB
/
ereader.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
from index_viewer.index_viewer import IndexViewer
from ebody_viewer.ebook_body_viewer import EBookBodyViewer
from ebody_viewer.eimg_body_viewer import EImgBodyViewer
class EReader:
def __init__(self, EBodyViewer, controller):
self.var_ebody_viewer = EBodyViewer(self)
self.var_index_viewer = IndexViewer(self)
self.controller = controller
def req_data_bg(self, var):
if var is self.var_ebody_viewer:
self.controller.req_ebody_data_bg()
elif var is self.var_index_viewer:
self.controller.req_eindex_data_bg()
def req_data(self, var, init=False):
if var is self.var_ebody_viewer:
self.controller.req_ebody_data(init)
elif var is self.var_index_viewer:
self.controller.req_eindex_data(init)
def load_data(self, var):
if var is self.var_ebody_viewer:
return self.controller.load_ebody_data()
elif var is self.var_index_viewer:
return self.controller.load_eindex_data()
def open_url(self, url):
self.controller.load_reader(url, is_init=False)
def set_navi_view_name(self, name):
self.controller.set_navi_view_name(name)
def reset_view(self, i, j):
# 先后顺序不能反,因为两个都会调用set_navi_view_name这个api,会覆盖
self.var_index_viewer.reset_view(i, j)
self.var_ebody_viewer.reset_view(i, j)
def reset_scrollbar(self):
self.var_ebody_viewer.reset_scrollbar()
def get_offset(self):
return self.var_ebody_viewer.get_offset()
class EImgReader(EReader):
def __init__(self, controller):
super().__init__(EImgBodyViewer, controller)
class EBookReader(EReader):
def __init__(self, controller):
super().__init__(EBookBodyViewer, controller)