Skip to content

Commit

Permalink
Merge pull request #59 from seowings/main
Browse files Browse the repository at this point in the history
Added Generalized Crawler #57
  • Loading branch information
seowings authored Dec 23, 2023
2 parents 3aedd26 + a667df8 commit ec8511d
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 39 deletions.
32 changes: 15 additions & 17 deletions src/staticwordpress/gui/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -301,17 +301,17 @@ def closeEvent(self, event):

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
)

Expand Down Expand Up @@ -786,7 +786,7 @@ def update_statusbar(self, message_: str = "", percent_: int = 0) -> None:
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())
)
Expand All @@ -799,30 +799,28 @@ def update_widgets(self) -> None:
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()
)

Expand Down
44 changes: 22 additions & 22 deletions src/staticwordpress/share/gui.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
"parent": ""
},
{
"name": "menu_wordpress",
"text": "&WordPress",
"name": "menu_crawler",
"text": "&Crawler",
"enable": false,
"icon": "",
"parent": ""
Expand Down Expand Up @@ -62,8 +62,8 @@
"enable": true
},
{
"name": "toolbar_wordpres",
"text": "WordPress",
"name": "toolbar_crawler",
"text": "Crawler",
"enable": false
},
{
Expand Down Expand Up @@ -205,107 +205,107 @@
},
{
"icon": "/icons/crawl_website.svg",
"name": "action_wordpress_crawl_webpages",
"name": "action_crawler_crawl_webpages",
"visible": false,
"text": "&Crawl WebPages",
"shortcut": "Ctrl+1",
"tooltip": "Crawl WebPages (Ctrl+1)",
"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",
"tooltip": "Crawl Additional Files (Ctrl+2)",
"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",
"tooltip": "Prepare Search Index (Ctrl+3)",
"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",
"tooltip": "Create 404 Page (Ctrl+4)",
"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",
"tooltip": "Create Redirects (Ctrl+5)",
"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",
"tooltip": "Create Robots.txt File (Ctrl+6)",
"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",
"tooltip": "Stop Current Process (Ctrl+F7)",
"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",
Expand Down

0 comments on commit ec8511d

Please sign in to comment.