Skip to content

Commit

Permalink
adding get_epub_is_modfied() and get_epub_filepath() to plugin interface
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhendricks committed Jan 22, 2018
1 parent adb5b88 commit 2e58684
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/Dialogs/PluginRunner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,12 @@ void PluginRunner::writeSigilCFG()
#endif
cfg << settings.uiLanguage();
cfg << settings.dictionary();
if (m_mainWindow->isWindowModified()) {
cfg << QString("True");
} else {
cfg << QString("False");
}
cfg << m_mainWindow->GetCurrentFilePath();
QList <Resource *> selected_resources = m_bookBrowser->AllSelectedResources();
foreach(Resource * resource, selected_resources) {
cfg << resource->GetRelativePathToRoot();
Expand Down
5 changes: 5 additions & 0 deletions src/MainUI/MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,11 @@ FlowTab *MainWindow::GetCurrentFlowTab()
return qobject_cast<FlowTab *>(GetCurrentContentTab());
}

QString MainWindow::GetCurrentFilePath()
{
return m_CurrentFilePath;
}

void MainWindow::ResetLinkOrStyleBookmark()
{
ResetLocationBookmark(m_LinkOrStyleBookmark);
Expand Down
3 changes: 3 additions & 0 deletions src/MainUI/MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ class MainWindow : public QMainWindow

void sizeMenuIcons();

QString GetCurrentFilePath();


public slots:
void AnyCodeView();

Expand Down
8 changes: 8 additions & 0 deletions src/Resource_Files/plugin_launchers/python/bookcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,14 @@ def copy_book_contents_to(self, destdir):
def get_dictionary_dirs(self):
return self._w.get_dictionary_dirs()

# get status of epub file open inside of Sigil
def get_epub_is_modified(self):
return self._w.epub_isDirty

# get path to currently open epub or an inside Sigil or empty string if unsaved
def get_epub_filepath(self):
return self._w.epub_filepath


# functions for converting from manifest id to href, basename, mimetype etc
def href_to_id(self, href, ow=None):
Expand Down
8 changes: 8 additions & 0 deletions src/Resource_Files/plugin_launchers/python/outputcontainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,14 @@ def copy_book_contents_to(self, destdir):
def get_dictionary_dirs(self):
return self._w.get_dictionary_dirs()

# get status of epub file open inside of Sigil
def get_epub_is_modified(self):
return self._w.epub_isDirty

# get path to currently open epub or an inside Sigil or empty string if unsaved
def get_epub_filepath(self):
return self._w.epub_filepath


# functions for converting from manifest id to href, basename, mimetype etc
def href_to_id(self, href, ow=None):
Expand Down
7 changes: 6 additions & 1 deletion src/Resource_Files/plugin_launchers/python/wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
from unipath import pathof
import unicodedata

_launcher_version=20171212
_launcher_version=20180122

_PKG_VER = re.compile(r'''<\s*package[^>]*version\s*=\s*["']([^'"]*)['"][^>]*>''',re.IGNORECASE)

Expand Down Expand Up @@ -145,6 +145,9 @@ def __init__(self, ebook_root, outdir, op, plugin_dir, plugin_name, debug = Fals
self.sigil_ui_lang = None
# Default Sigil spell check dictionary
self.sigil_spellcheck_lang = None
# status of epub inside Sigil (isDirty) and CurrentFilePath of current epub file
self.epub_isDirty = False
self.epub_filepath = ""
# File selected in Sigil's Book Browser
self.selected = []
cfg = ''
Expand All @@ -159,6 +162,8 @@ def __init__(self, ebook_root, outdir, op, plugin_dir, plugin_name, debug = Fals
self.linux_hunspell_dict_dirs = cfg_lst.pop(0).split(":")
self.sigil_ui_lang = cfg_lst.pop(0)
self.sigil_spellcheck_lang = cfg_lst.pop(0)
self.epub_isDirty = (cfg_lst.pop(0) == "True")
self.epub_filepath = cfg_lst.pop(0)
self.selected = cfg_lst
os.environ['SigilGumboLibPath'] = self.get_gumbo_path()

Expand Down

0 comments on commit 2e58684

Please sign in to comment.