Make AbstractHistory.history private
This commit is contained in:
parent
b0ba2125a3
commit
52efa9f185
@ -327,13 +327,13 @@ class AbstractHistory:
|
||||
|
||||
def __init__(self, tab):
|
||||
self._tab = tab
|
||||
self.history = None
|
||||
self._history = None
|
||||
|
||||
def __len__(self):
|
||||
return len(self.history)
|
||||
return len(self._history)
|
||||
|
||||
def __iter__(self):
|
||||
return iter(self.history.items())
|
||||
return iter(self._history.items())
|
||||
|
||||
def current_idx(self):
|
||||
raise NotImplementedError
|
||||
@ -408,7 +408,7 @@ class AbstractTab(QWidget):
|
||||
def _set_widget(self, widget):
|
||||
self._layout = WrapperLayout(widget, self)
|
||||
self._widget = widget
|
||||
self.history.history = widget.history()
|
||||
self.history._history = widget.history()
|
||||
self.scroll._widget = widget
|
||||
self.caret._widget = widget
|
||||
self.zoom._widget = widget
|
||||
|
@ -61,25 +61,25 @@ class WebEngineScroller(tab.AbstractScroller):
|
||||
class WebEngineHistory(tab.AbstractHistory):
|
||||
|
||||
def current_idx(self):
|
||||
return self.history.currentItemIndex()
|
||||
return self._history.currentItemIndex()
|
||||
|
||||
def back(self):
|
||||
self.history.back()
|
||||
self._history.back()
|
||||
|
||||
def forward(self):
|
||||
self.history.forward()
|
||||
self._history.forward()
|
||||
|
||||
def can_go_back(self):
|
||||
return self.history.canGoBack()
|
||||
return self._history.canGoBack()
|
||||
|
||||
def can_go_forward(self):
|
||||
return self.history.canGoForward()
|
||||
return self._history.canGoForward()
|
||||
|
||||
def serialize(self):
|
||||
return qtutils.serialize(self.history)
|
||||
return qtutils.serialize(self._history)
|
||||
|
||||
def deserialize(self, data):
|
||||
return qtutils.deserialize(data, self.history)
|
||||
return qtutils.deserialize(data, self._history)
|
||||
|
||||
def load_items(self, items):
|
||||
# TODO
|
||||
|
@ -369,32 +369,32 @@ class WebViewScroller(tab.AbstractScroller):
|
||||
class WebViewHistory(tab.AbstractHistory):
|
||||
|
||||
def current_idx(self):
|
||||
return self.history.currentItemIndex()
|
||||
return self._history.currentItemIndex()
|
||||
|
||||
def back(self):
|
||||
self.history.back()
|
||||
self._history.back()
|
||||
|
||||
def forward(self):
|
||||
self.history.forward()
|
||||
self._history.forward()
|
||||
|
||||
def can_go_back(self):
|
||||
return self.history.canGoBack()
|
||||
return self._history.canGoBack()
|
||||
|
||||
def can_go_forward(self):
|
||||
return self.history.canGoForward()
|
||||
return self._history.canGoForward()
|
||||
|
||||
def serialize(self):
|
||||
return qtutils.serialize(self.history)
|
||||
return qtutils.serialize(self._history)
|
||||
|
||||
def deserialize(self, data):
|
||||
return qtutils.deserialize(data, self.history)
|
||||
return qtutils.deserialize(data, self._history)
|
||||
|
||||
def load_items(self, items):
|
||||
stream, _data, user_data = tabhistory.serialize(items)
|
||||
qtutils.deserialize_stream(stream, self.history)
|
||||
qtutils.deserialize_stream(stream, self._history)
|
||||
for i, data in enumerate(user_data):
|
||||
self.history.itemAt(i).setUserData(data)
|
||||
cur_data = self.history.currentItem().userData()
|
||||
self._history.itemAt(i).setUserData(data)
|
||||
cur_data = self._history.currentItem().userData()
|
||||
if cur_data is not None:
|
||||
if 'zoom' in cur_data:
|
||||
self._tab.zoom.set_factor(cur_data['zoom'])
|
||||
|
Loading…
Reference in New Issue
Block a user