|
|
@@ -77,6 +77,7 @@ class Application: |
|
|
subparser = subparsers.add_parser(action+suffix, help=method.__doc__) |
|
|
subparser = subparsers.add_parser(action+suffix, help=method.__doc__) |
|
|
if method == self.do_pdf: |
|
|
if method == self.do_pdf: |
|
|
subparser.add_argument("--generate", "-g", action="store_true") |
|
|
subparser.add_argument("--generate", "-g", action="store_true") |
|
|
|
|
|
subparser.add_argument("--view", "-v", action="store_true") |
|
|
if action == "delete": |
|
|
if action == "delete": |
|
|
subparser.add_argument("--force", "-f", action="store_true") |
|
|
subparser.add_argument("--force", "-f", action="store_true") |
|
|
if action == "new": |
|
|
if action == "new": |
|
|
@@ -158,7 +159,7 @@ class Application: |
|
|
item = self.db.invoices[selector] |
|
|
item = self.db.invoices[selector] |
|
|
self._show(item._path) |
|
|
self._show(item._path) |
|
|
|
|
|
|
|
|
def do_pdf(self, selector, generate): |
|
|
|
|
|
|
|
|
def do_pdf(self, selector, generate, view): |
|
|
"""Generate and view a PDF invoice. |
|
|
"""Generate and view a PDF invoice. |
|
|
|
|
|
|
|
|
This requires Tempita 0.5. |
|
|
This requires Tempita 0.5. |
|
|
@@ -214,8 +215,9 @@ class Application: |
|
|
os.rename(tmp_pdf_file, pdf_file) |
|
|
os.rename(tmp_pdf_file, pdf_file) |
|
|
|
|
|
|
|
|
assert(os.path.exists(pdf_file)) |
|
|
assert(os.path.exists(pdf_file)) |
|
|
#log.debug("Running PDF viewer...") |
|
|
|
|
|
#subprocess.call((self.pdf_program, pdf_file)) |
|
|
|
|
|
|
|
|
if view: |
|
|
|
|
|
log.debug("Running PDF viewer...") |
|
|
|
|
|
subprocess.call((self.pdf_program, pdf_file)) |
|
|
|
|
|
|
|
|
def _check_path(self, path): |
|
|
def _check_path(self, path): |
|
|
if not os.path.exists(path): |
|
|
if not os.path.exists(path): |
|
|
|