mirror of
https://gitee.com/g1879/DrissionPage.git
synced 2024-12-10 04:00:23 +08:00
Tab的close()方法增加others参数
This commit is contained in:
parent
ded3e10020
commit
ad81575546
@ -58,9 +58,12 @@ class ChromiumTab(ChromiumBase):
|
||||
self._load_mode = self.browser._load_mode
|
||||
self._download_path = self.browser.download_path
|
||||
|
||||
def close(self):
|
||||
"""关闭当前标签页"""
|
||||
self.browser.close_tabs(self.tab_id)
|
||||
def close(self, others=False):
|
||||
"""关闭当前标签页
|
||||
:param others: 是否关闭其它,保留自己
|
||||
:return: None
|
||||
"""
|
||||
self.browser.close_tabs(self.tab_id, others=others)
|
||||
|
||||
@property
|
||||
def set(self):
|
||||
@ -361,9 +364,12 @@ class MixTab(SessionPage, ChromiumTab, BasePage):
|
||||
elif self._mode == 'd':
|
||||
return super(SessionPage, self).cookies(all_domains, all_info)
|
||||
|
||||
def close(self):
|
||||
"""关闭当前标签页"""
|
||||
self.browser.close_tabs(self.tab_id)
|
||||
def close(self, others=False):
|
||||
"""关闭当前标签页
|
||||
:param others: 是否关闭其它,保留自己
|
||||
:return: None
|
||||
"""
|
||||
self.browser.close_tabs(self.tab_id, others=others)
|
||||
self._session.close()
|
||||
if self._response is not None:
|
||||
self._response.close()
|
||||
|
@ -20,9 +20,6 @@ class DownloadManager(object):
|
||||
:param browser: Browser对象
|
||||
"""
|
||||
self._browser = browser
|
||||
# self._page = browser.page
|
||||
# self._when_download_file_exists = 'rename'
|
||||
# self._save_path = None
|
||||
|
||||
t = TabDownloadSettings('browser')
|
||||
t.path = self._browser.download_path
|
||||
@ -34,9 +31,6 @@ class DownloadManager(object):
|
||||
self._tab_missions = {} # {tab_id: DownloadMission}
|
||||
self._flags = {} # {tab_id: [bool, DownloadMission]}
|
||||
|
||||
# if self._page.download_path:
|
||||
# self.set_path(self._page, self._page.download_path)
|
||||
|
||||
self._running = False
|
||||
|
||||
@property
|
||||
@ -196,7 +190,7 @@ class DownloadManager(object):
|
||||
elif skip:
|
||||
self.skip(m)
|
||||
else:
|
||||
self._tab_missions.setdefault(tab_id, []).append(guid)
|
||||
self._tab_missions.setdefault(tab_id, []).append(m)
|
||||
|
||||
if self.get_flag(tab_id) is not None:
|
||||
self._flags[tab_id] = m
|
||||
|
@ -14,12 +14,10 @@ FILE_EXISTS = Literal['skip', 'rename', 'overwrite', 's', 'r', 'o']
|
||||
|
||||
class DownloadManager(object):
|
||||
_browser: Chromium = ...
|
||||
# _page: ChromiumPage = ...
|
||||
_missions: Dict[str, DownloadMission] = ...
|
||||
_tab_missions: dict = ...
|
||||
_flags: dict = ...
|
||||
_running: bool = ...
|
||||
# _save_path: Optional[str] = ...
|
||||
|
||||
def __init__(self, browser: Chromium): ...
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user