mirror of
https://ghproxy.net/https://github.com/serpwings/static-wordpress.git
synced 2025-10-04 02:37:53 +08:00
code cleanup for webcrawler
This commit is contained in:
parent
c7ccb0ace4
commit
9ad3a118e5
2 changed files with 37 additions and 39 deletions
|
@ -301,17 +301,17 @@ class SWMainWindow(QMainWindow):
|
|||
|
||||
def set_expert_mode(self):
|
||||
expert_widgets = [
|
||||
"action_wordpress_create_404_page",
|
||||
"action_wordpress_create_redirects",
|
||||
"action_wordpress_create_robots_txt",
|
||||
"action_wordpress_create_search_index",
|
||||
"action_wordpress_crawl_webpages",
|
||||
"action_crawler_create_404_page",
|
||||
"action_crawler_create_redirects",
|
||||
"action_crawler_create_robots_txt",
|
||||
"action_crawler_create_search_index",
|
||||
"action_crawler_crawl_webpages",
|
||||
]
|
||||
|
||||
for widget_name in expert_widgets:
|
||||
self.findChild(QAction, widget_name).setVisible(self.sender().isChecked())
|
||||
|
||||
self.findChild(QAction, "action_wordpress_crawl_additional_files").setVisible(
|
||||
self.findChild(QAction, "action_crawler_crawl_additional_files").setVisible(
|
||||
self.sender().isChecked() and self._project.src_type != SOURCE.ZIP
|
||||
)
|
||||
|
||||
|
@ -786,7 +786,7 @@ class SWMainWindow(QMainWindow):
|
|||
def update_widgets(self) -> None:
|
||||
# Show Menus
|
||||
self.findChild(QMenu, "menu_github").setEnabled(self._project.has_github())
|
||||
self.findChild(QMenu, "menu_wordpress").setEnabled(
|
||||
self.findChild(QMenu, "menu_crawler").setEnabled(
|
||||
self._project.is_open()
|
||||
and (self._project.has_wordpress() or self._project.can_crawl())
|
||||
)
|
||||
|
@ -799,30 +799,28 @@ class SWMainWindow(QMainWindow):
|
|||
self.findChild(QToolBar, "toolbar_github").setEnabled(
|
||||
self._project.has_github()
|
||||
)
|
||||
self.findChild(QToolBar, "toolbar_wordpres").setEnabled(
|
||||
self.findChild(QToolBar, "toolbar_crawler").setEnabled(
|
||||
self._project.is_open()
|
||||
and (self._project.has_wordpress() or self._project.can_crawl())
|
||||
)
|
||||
|
||||
# Show Menubar Icons
|
||||
if self._project.src_type == SOURCE.ZIP:
|
||||
self.findChild(QAction, "action_wordpress_crawl_webpages").setText(
|
||||
self.findChild(QAction, "action_crawler_crawl_webpages").setText(
|
||||
"&Download Zip File"
|
||||
)
|
||||
self.findChild(
|
||||
QAction, "action_wordpress_crawl_additional_files"
|
||||
).setVisible(False)
|
||||
self.findChild(QAction, "action_crawler_crawl_additional_files").setVisible(
|
||||
False
|
||||
)
|
||||
else:
|
||||
self.findChild(QAction, "action_wordpress_crawl_webpages").setText(
|
||||
self.findChild(QAction, "action_crawler_crawl_webpages").setText(
|
||||
"&Crawl Webpages"
|
||||
)
|
||||
self.findChild(
|
||||
QAction, "action_wordpress_crawl_additional_files"
|
||||
).setVisible(
|
||||
self.findChild(QAction, "action_crawler_crawl_additional_files").setVisible(
|
||||
self.findChild(QAction, "action_edit_set_expert_mode").isChecked()
|
||||
)
|
||||
|
||||
self.findChild(QAction, "action_wordpress_crawl_additional_files").setVisible(
|
||||
self.findChild(QAction, "action_crawler_crawl_additional_files").setVisible(
|
||||
self.findChild(QAction, "action_edit_set_expert_mode").isChecked()
|
||||
)
|
||||
|
||||
|
|
|
@ -15,8 +15,8 @@
|
|||
"parent": ""
|
||||
},
|
||||
{
|
||||
"name": "menu_wordpress",
|
||||
"text": "&WordPress",
|
||||
"name": "menu_crawler",
|
||||
"text": "&Crawler",
|
||||
"enable": false,
|
||||
"icon": "",
|
||||
"parent": ""
|
||||
|
@ -62,8 +62,8 @@
|
|||
"enable": true
|
||||
},
|
||||
{
|
||||
"name": "toolbar_wordpres",
|
||||
"text": "WordPress",
|
||||
"name": "toolbar_crawler",
|
||||
"text": "Crawler",
|
||||
"enable": false
|
||||
},
|
||||
{
|
||||
|
@ -205,7 +205,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/crawl_website.svg",
|
||||
"name": "action_wordpress_crawl_webpages",
|
||||
"name": "action_crawler_crawl_webpages",
|
||||
"visible": false,
|
||||
"text": "&Crawl WebPages",
|
||||
"shortcut": "Ctrl+1",
|
||||
|
@ -213,12 +213,12 @@
|
|||
"seperator": false,
|
||||
"function": "self.crawl_webpages",
|
||||
"setCheckable": false,
|
||||
"menu": "menu_wordpress",
|
||||
"menu": "menu_crawler",
|
||||
"toolbar": ""
|
||||
},
|
||||
{
|
||||
"icon": "/icons/additionals.svg",
|
||||
"name": "action_wordpress_crawl_additional_files",
|
||||
"name": "action_crawler_crawl_additional_files",
|
||||
"visible": false,
|
||||
"text": "Crawl &Additional Files",
|
||||
"shortcut": "Ctrl+2",
|
||||
|
@ -226,12 +226,12 @@
|
|||
"seperator": false,
|
||||
"function": "self.crawl_additional_files",
|
||||
"setCheckable": false,
|
||||
"menu": "menu_wordpress",
|
||||
"menu": "menu_crawler",
|
||||
"toolbar": ""
|
||||
},
|
||||
{
|
||||
"icon": "/icons/search.svg",
|
||||
"name": "action_wordpress_create_search_index",
|
||||
"name": "action_crawler_create_search_index",
|
||||
"visible": false,
|
||||
"text": "Prepare &Search Index",
|
||||
"shortcut": "Ctrl+3",
|
||||
|
@ -239,12 +239,12 @@
|
|||
"seperator": false,
|
||||
"function": "self.create_search_index",
|
||||
"setCheckable": false,
|
||||
"menu": "menu_wordpress",
|
||||
"menu": "menu_crawler",
|
||||
"toolbar": ""
|
||||
},
|
||||
{
|
||||
"icon": "/icons/error.svg",
|
||||
"name": "action_wordpress_create_404_page",
|
||||
"name": "action_crawler_create_404_page",
|
||||
"visible": false,
|
||||
"text": "Create &404 Page",
|
||||
"shortcut": "Ctrl+4",
|
||||
|
@ -252,12 +252,12 @@
|
|||
"seperator": false,
|
||||
"function": "self.create_404_page",
|
||||
"setCheckable": false,
|
||||
"menu": "menu_wordpress",
|
||||
"menu": "menu_crawler",
|
||||
"toolbar": ""
|
||||
},
|
||||
{
|
||||
"icon": "/icons/redirects.svg",
|
||||
"name": "action_wordpress_create_redirects",
|
||||
"name": "action_crawler_create_redirects",
|
||||
"visible": false,
|
||||
"text": "Create &Redirects",
|
||||
"shortcut": "Ctrl+5",
|
||||
|
@ -265,12 +265,12 @@
|
|||
"seperator": false,
|
||||
"function": "self.create_redirects",
|
||||
"setCheckable": false,
|
||||
"menu": "menu_wordpress",
|
||||
"menu": "menu_crawler",
|
||||
"toolbar": ""
|
||||
},
|
||||
{
|
||||
"icon": "/icons/robots_txt.svg",
|
||||
"name": "action_wordpress_create_robots_txt",
|
||||
"name": "action_crawler_create_robots_txt",
|
||||
"visible": false,
|
||||
"text": "Create Robots.&txt",
|
||||
"shortcut": "Ctrl+6",
|
||||
|
@ -278,25 +278,25 @@
|
|||
"seperator": true,
|
||||
"function": "self.create_robots_txt",
|
||||
"setCheckable": false,
|
||||
"menu": "menu_wordpress",
|
||||
"menu": "menu_crawler",
|
||||
"toolbar": ""
|
||||
},
|
||||
{
|
||||
"icon": "/icons/play.svg",
|
||||
"name": "action_wordpress_start_batch_process",
|
||||
"name": "action_crawler_start_batch_process",
|
||||
"visible": true,
|
||||
"text": "Start &Batch Process",
|
||||
"shortcut": "Ctrl+F6",
|
||||
"tooltip": "Start Batch Process (Ctrl+F6)",
|
||||
"function": "self.start_batch_process",
|
||||
"setCheckable": false,
|
||||
"menu": "menu_wordpress",
|
||||
"menu": "menu_crawler",
|
||||
"seperator": false,
|
||||
"toolbar": "toolbar_wordpres"
|
||||
"toolbar": "toolbar_crawler"
|
||||
},
|
||||
{
|
||||
"icon": "/icons/stop.svg",
|
||||
"name": "action_wordpress_stop_process",
|
||||
"name": "action_crawler_stop_process",
|
||||
"visible": true,
|
||||
"text": "&Stop Process",
|
||||
"shortcut": "Ctrl+F7",
|
||||
|
@ -304,8 +304,8 @@
|
|||
"seperator": false,
|
||||
"function": "self.stop_process",
|
||||
"setCheckable": false,
|
||||
"menu": "menu_wordpress",
|
||||
"toolbar": "toolbar_wordpres"
|
||||
"menu": "menu_crawler",
|
||||
"toolbar": "toolbar_crawler"
|
||||
},
|
||||
{
|
||||
"icon": "/icons/pencil-outline.svg",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue