mirror of
https://ghproxy.net/https://github.com/serpwings/static-wordpress.git
synced 2025-10-04 02:37:53 +08:00
fix menu and actions as per project settings
This commit is contained in:
parent
ae2cc800e3
commit
0e9518cdd9
3 changed files with 86 additions and 79 deletions
|
@ -70,13 +70,14 @@ from ..core.utils import (
|
|||
get_remote_content,
|
||||
extract_urls_from_raw_text,
|
||||
)
|
||||
from .workflow import SWWorkflowObject
|
||||
from .logger import SWLoggerWidget
|
||||
from .editor import SWIPythonWidget
|
||||
from .rawtext import SWRawTextDialog
|
||||
from .config import SWConfigDialog
|
||||
from .project import SWProjectDialog
|
||||
from .utils import GUI_SETTINGS, logging_decorator
|
||||
from ..gui.workflow import SWWorkflowObject
|
||||
from ..gui.logger import SWLoggerWidget
|
||||
from ..gui.editor import SWIPythonWidget
|
||||
from ..gui.rawtext import SWRawTextDialog
|
||||
from ..gui.config import SWConfigDialog
|
||||
from ..gui.project import SWProjectDialog
|
||||
from ..gui.utils import GUI_SETTINGS, logging_decorator
|
||||
|
||||
|
||||
# +++++++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
# IMPLEMENATIONS
|
||||
|
@ -299,11 +300,11 @@ class SWMainWindow(QMainWindow):
|
|||
|
||||
def set_expert_mode(self):
|
||||
expert_widgets = [
|
||||
"action_wordpress_404_page",
|
||||
"action_wordpress_redirects",
|
||||
"action_wordpress_robots_txt",
|
||||
"action_wordpress_search_index",
|
||||
"action_wordpress_webpages",
|
||||
"action_wordpress_create_404_page",
|
||||
"action_wordpress_create_redirects",
|
||||
"action_wordpress_create_robots_txt",
|
||||
"action_wordpress_create_search_index",
|
||||
"action_wordpress_crawl_webpages",
|
||||
]
|
||||
|
||||
for widget_name in expert_widgets:
|
||||
|
@ -330,7 +331,7 @@ class SWMainWindow(QMainWindow):
|
|||
|
||||
def start_ipython_console(self):
|
||||
""" """
|
||||
if self.findChild(QAction, "action_ipython_widget").isChecked():
|
||||
if self.findChild(QAction, "action_start_ipython_console").isChecked():
|
||||
if self.ipython_console is None:
|
||||
self.ipython_console = SWIPythonWidget(interface_={"iface": self})
|
||||
self.dockwidget_ipython.setWidget(self.ipython_console)
|
||||
|
@ -443,7 +444,7 @@ class SWMainWindow(QMainWindow):
|
|||
# self._project.save()
|
||||
|
||||
@logging_decorator
|
||||
def show_project(self):
|
||||
def show_project_settings(self):
|
||||
"""showing static-wordpress Project File"""
|
||||
if self._project.is_open():
|
||||
project_dialog = SWProjectDialog(
|
||||
|
@ -592,7 +593,7 @@ class SWMainWindow(QMainWindow):
|
|||
self.update_statusbar("Stoping Processing", 100)
|
||||
|
||||
@is_project_open
|
||||
def crawl_website(self) -> None:
|
||||
def crawl_webpages(self) -> None:
|
||||
if self._bg_thread.isRunning():
|
||||
self._bg_thread.quit()
|
||||
|
||||
|
@ -788,6 +789,10 @@ class SWMainWindow(QMainWindow):
|
|||
self._project.is_open()
|
||||
and (self._project.has_wordpress() or self._project.can_crawl())
|
||||
)
|
||||
self.findChild(QMenu, "menu_tools").setEnabled(
|
||||
self._project.is_open()
|
||||
and (self._project.has_wordpress() or self._project.can_crawl())
|
||||
)
|
||||
|
||||
# Show Toolbarss
|
||||
self.findChild(QToolBar, "toolbar_github").setEnabled(
|
||||
|
@ -799,22 +804,24 @@ class SWMainWindow(QMainWindow):
|
|||
|
||||
# Show Menubar Icons
|
||||
if self._project.src_type == SOURCE.ZIP:
|
||||
self.findChild(QAction, "action_wordpress_webpages").setText(
|
||||
self.findChild(QAction, "action_wordpress_crawl_webpages").setText(
|
||||
"&Download Zip File"
|
||||
)
|
||||
self.findChild(QAction, "action_wordpress_additional_files").setVisible(
|
||||
False
|
||||
)
|
||||
self.findChild(
|
||||
QAction, "action_wordpress_crawl_additional_files"
|
||||
).setVisible(False)
|
||||
else:
|
||||
self.findChild(QAction, "action_wordpress_webpages").setText(
|
||||
self.findChild(QAction, "action_wordpress_crawl_webpages").setText(
|
||||
"&Crawl Webpages"
|
||||
)
|
||||
self.findChild(QAction, "action_wordpress_additional_files").setVisible(
|
||||
self.findChild(QAction, "action_edit_expert_mode").isChecked()
|
||||
self.findChild(
|
||||
QAction, "action_wordpress_crawl_additional_files"
|
||||
).setVisible(
|
||||
self.findChild(QAction, "action_edit_set_expert_mode").isChecked()
|
||||
)
|
||||
|
||||
for project_tool in [
|
||||
"action_utilities_clean_output_folder",
|
||||
"action_tools_clean_output_folder",
|
||||
]:
|
||||
self.findChild(QAction, project_tool).setVisible(self._project.is_open())
|
||||
|
||||
|
|
|
@ -64,10 +64,10 @@ from PyQt5.QtGui import QIcon
|
|||
from ..core.constants import (
|
||||
REDIRECTS,
|
||||
USER_AGENT,
|
||||
CONFIGS,
|
||||
SHARE_FOLDER_PATH,
|
||||
SOURCE,
|
||||
HOST,
|
||||
CONFIGS,
|
||||
SHARE_FOLDER_PATH,
|
||||
)
|
||||
|
||||
from ..core.project import Project
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
{
|
||||
"name": "menu_tools",
|
||||
"text": "&Tools",
|
||||
"enable": true,
|
||||
"enable": false,
|
||||
"icon": "",
|
||||
"parent": ""
|
||||
},
|
||||
|
@ -75,7 +75,7 @@
|
|||
"ACTIONS": [
|
||||
{
|
||||
"icon": "/icons/file-outline.svg",
|
||||
"name": "action_project_new",
|
||||
"name": "action_project_new_project",
|
||||
"visible": true,
|
||||
"text": "&New",
|
||||
"shortcut": "Ctrl+N",
|
||||
|
@ -88,7 +88,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/folder-outline.svg",
|
||||
"name": "action_project_open",
|
||||
"name": "action_project_open_project",
|
||||
"visible": true,
|
||||
"text": "&Open",
|
||||
"shortcut": "Ctrl+O",
|
||||
|
@ -101,12 +101,12 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/project_settings.svg",
|
||||
"name": "action_project_settings",
|
||||
"name": "action_project_show_project_settings",
|
||||
"visible": true,
|
||||
"text": "&Settings",
|
||||
"shortcut": "Ctrl+C",
|
||||
"tooltip": "Check (Ctrl+C)",
|
||||
"function": "self.show_project",
|
||||
"function": "self.show_project_settings",
|
||||
"setCheckable": false,
|
||||
"menu": "menu_project",
|
||||
"seperator": false,
|
||||
|
@ -114,7 +114,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/project_close.svg",
|
||||
"name": "action_project_close",
|
||||
"name": "action_project_close_project",
|
||||
"visible": true,
|
||||
"text": "&Close",
|
||||
"shortcut": "Ctrl+X",
|
||||
|
@ -127,7 +127,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/exit-to-app.svg",
|
||||
"name": "action_project_exit",
|
||||
"name": "action_project_close",
|
||||
"visible": true,
|
||||
"text": "&Exit",
|
||||
"shortcut": "Ctrl+Q",
|
||||
|
@ -153,7 +153,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/python.svg",
|
||||
"name": "action_ipython_widget",
|
||||
"name": "action_start_ipython_console",
|
||||
"visible": true,
|
||||
"text": "&IPython",
|
||||
"shortcut": "F4",
|
||||
|
@ -166,7 +166,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/bug-outline.svg",
|
||||
"name": "action_edit_debug",
|
||||
"name": "action_edit_set_debug_mode",
|
||||
"visible": true,
|
||||
"text": "&Debug",
|
||||
"shortcut": "F5",
|
||||
|
@ -179,7 +179,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/person.svg",
|
||||
"name": "action_edit_expert_mode",
|
||||
"name": "action_edit_set_expert_mode",
|
||||
"visible": true,
|
||||
"text": "&Expert Mode",
|
||||
"shortcut": "F10",
|
||||
|
@ -192,7 +192,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/configs.svg",
|
||||
"name": "action_file_project_close",
|
||||
"name": "action_project_show_configs",
|
||||
"visible": true,
|
||||
"text": "&Configurations",
|
||||
"shortcut": "F12",
|
||||
|
@ -203,48 +203,22 @@
|
|||
"seperator": false,
|
||||
"toolbar": "toolbar_edit"
|
||||
},
|
||||
{
|
||||
"icon": "/icons/play.svg",
|
||||
"name": "action_wordpress_batch_processing",
|
||||
"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",
|
||||
"seperator": false,
|
||||
"toolbar": "toolbar_wordpres"
|
||||
},
|
||||
{
|
||||
"icon": "/icons/stop.svg",
|
||||
"name": "action_wordpress_stop_processing",
|
||||
"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"
|
||||
},
|
||||
{
|
||||
"icon": "/icons/crawl_website.svg",
|
||||
"name": "action_wordpress_webpages",
|
||||
"name": "action_wordpress_crawl_webpages",
|
||||
"visible": false,
|
||||
"text": "&Crawl Webpages",
|
||||
"shortcut": "Ctrl+1 (Ctrl+1)",
|
||||
"tooltip": "Crawl Webpages",
|
||||
"text": "&Crawl WebPages",
|
||||
"shortcut": "Ctrl+1",
|
||||
"tooltip": "Crawl WebPages (Ctrl+1)",
|
||||
"seperator": false,
|
||||
"function": "self.crawl_website",
|
||||
"function": "self.crawl_webpages",
|
||||
"setCheckable": false,
|
||||
"menu": "menu_wordpress",
|
||||
"toolbar": ""
|
||||
},
|
||||
{
|
||||
"icon": "/icons/additionals.svg",
|
||||
"name": "action_wordpress_additional_files",
|
||||
"name": "action_wordpress_crawl_additional_files",
|
||||
"visible": false,
|
||||
"text": "Crawl &Additional Files",
|
||||
"shortcut": "Ctrl+2",
|
||||
|
@ -257,7 +231,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/search.svg",
|
||||
"name": "action_wordpress_search_index",
|
||||
"name": "action_wordpress_create_search_index",
|
||||
"visible": false,
|
||||
"text": "Prepare &Search Index",
|
||||
"shortcut": "Ctrl+3",
|
||||
|
@ -270,7 +244,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/error.svg",
|
||||
"name": "action_wordpress_404_page",
|
||||
"name": "action_wordpress_create_404_page",
|
||||
"visible": false,
|
||||
"text": "Create &404 Page",
|
||||
"shortcut": "Ctrl+4",
|
||||
|
@ -283,7 +257,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/redirects.svg",
|
||||
"name": "action_wordpress_redirects",
|
||||
"name": "action_wordpress_create_redirects",
|
||||
"visible": false,
|
||||
"text": "Create &Redirects",
|
||||
"shortcut": "Ctrl+5",
|
||||
|
@ -296,20 +270,46 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/robots_txt.svg",
|
||||
"name": "action_wordpress_robots_txt",
|
||||
"name": "action_wordpress_create_robots_txt",
|
||||
"visible": false,
|
||||
"text": "Create Robots.&txt",
|
||||
"shortcut": "Ctrl+6",
|
||||
"tooltip": "Copy Robots.txt File (Ctrl+6)",
|
||||
"seperator": false,
|
||||
"tooltip": "Create Robots.txt File (Ctrl+6)",
|
||||
"seperator": true,
|
||||
"function": "self.create_robots_txt",
|
||||
"setCheckable": false,
|
||||
"menu": "menu_wordpress",
|
||||
"toolbar": ""
|
||||
},
|
||||
{
|
||||
"icon": "/icons/play.svg",
|
||||
"name": "action_wordpress_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",
|
||||
"seperator": false,
|
||||
"toolbar": "toolbar_wordpres"
|
||||
},
|
||||
{
|
||||
"icon": "/icons/stop.svg",
|
||||
"name": "action_wordpress_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"
|
||||
},
|
||||
{
|
||||
"icon": "/icons/pencil-outline.svg",
|
||||
"name": "action_github_create_repositoy",
|
||||
"name": "action_github_create_github_repositoy",
|
||||
"visible": true,
|
||||
"text": "&Create on GitHub",
|
||||
"shortcut": "Ctrl+F9",
|
||||
|
@ -322,7 +322,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/delete-repo.svg",
|
||||
"name": "action_github_delete_repositoy",
|
||||
"name": "action_github_delete_github_repository",
|
||||
"visible": true,
|
||||
"text": "&Delete from GitHub",
|
||||
"shortcut": "Ctrl+Shift+F9",
|
||||
|
@ -374,7 +374,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/web-remove.svg",
|
||||
"name": "action_utilities_clear_crawl_cache",
|
||||
"name": "action_tools_clear_crawl_cache",
|
||||
"visible": true,
|
||||
"text": "C&lear Crawl Cache",
|
||||
"shortcut": "Ctrl+F2",
|
||||
|
@ -387,7 +387,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/text-recognition.svg",
|
||||
"name": "action_utilities_extract_url_from_raw_text",
|
||||
"name": "action_tools_extract_url_from_raw_text",
|
||||
"visible": true,
|
||||
"text": "&Extract Urls From Text",
|
||||
"shortcut": "Ctrl+F4",
|
||||
|
@ -400,7 +400,7 @@
|
|||
},
|
||||
{
|
||||
"icon": "/icons/delete-outline.svg",
|
||||
"name": "action_utilities_clean_output_folder",
|
||||
"name": "action_tools_clean_output_folder",
|
||||
"visible": false,
|
||||
"text": "Clean &Output Directory",
|
||||
"shortcut": "Ctrl+F5",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue