blog_repo: str = ""
transart_script: str = "/home/danix/bin/transart.py"
typora_bin: str = "typora"
+ typora_args: str = ""
font_size: int = 10
def is_complete(self) -> bool:
doc.add("blog_repo", self.blog_repo)
doc.add("transart_script", self.transart_script)
doc.add("typora_bin", self.typora_bin)
+ doc.add("typora_args", self.typora_args)
doc.add("font_size", self.font_size)
path.write_text(tomlkit.dumps(doc))
blog_repo=str(data.get("blog_repo", defaults.blog_repo)),
transart_script=str(data.get("transart_script", defaults.transart_script)),
typora_bin=str(data.get("typora_bin", defaults.typora_bin)),
+ typora_args=str(data.get("typora_args", defaults.typora_args)),
font_size=int(data.get("font_size", defaults.font_size)),
)
self._translation_view = TranslationView(
self.config.transart_script,
self.config.typora_bin,
+ self.config.typora_args,
parent=self,
)
self._translation_view.push_master.connect(lambda: self._do_git_push("master"))
self._stack.setCurrentIndex(self._page_detail)
def _do_open_typora(self, article: Article):
- subprocess.Popen([self.config.typora_bin, str(article.path)])
+ _args = self.config.typora_args.split() if self.config.typora_args else []
+ subprocess.Popen([self.config.typora_bin, *_args, str(article.path)])
def _do_open_frontmatter(self, article: Article):
from ui.frontmatter_editor import FrontmatterEditor
dlg = NewArticleDialog(Path(self.config.blog_repo), self)
if dlg.exec() and dlg.created_path:
self._refresh_articles()
- subprocess.Popen([self.config.typora_bin, str(dlg.created_path)])
+ _args = self.config.typora_args.split() if self.config.typora_args else []
+ subprocess.Popen([self.config.typora_bin, *_args, str(dlg.created_path)])
def _do_translate(self, article: Article):
self._translation_view.start_translation(article)
self._typora = QLineEdit(self._config.typora_bin)
form.addRow("Typora bin:", self._typora)
+ self._typora_args = QLineEdit(self._config.typora_args)
+ form.addRow("Typora args:", self._typora_args)
+
layout.addLayout(form)
btns = QHBoxLayout()
self._config.blog_repo = self._blog_repo.text().strip()
self._config.transart_script = self._transart.text().strip()
self._config.typora_bin = self._typora.text().strip()
+ self._config.typora_args = self._typora_args.text().strip()
self._config.save()
self.accept()
push_master = pyqtSignal()
publish = pyqtSignal()
- def __init__(self, transart_script: str, typora_bin: str, parent=None):
+ def __init__(self, transart_script: str, typora_bin: str, typora_args: str = "", parent=None):
super().__init__(parent)
self._transart_script = transart_script
self._typora_bin = typora_bin
+ self._typora_args = typora_args
self._article: Article | None = None
self._worker: TranslationWorker | None = None
self._output_path: str = ""
def _open_typora(self):
if self._output_path:
- subprocess.Popen([self._typora_bin, self._output_path])
+ _args = self._typora_args.split() if self._typora_args else []
+ subprocess.Popen([self._typora_bin, *_args, self._output_path])
def _retry(self):
if self._article: