• wcaleb

    I've looked at the documentation on this, but I'm having a hard time understanding how to implement a swipe-to-delete function in my Custom UI. I have the following set up and working:

    data = ui.ListDataSource(items)  
    view['tableview1'].data_source = data
    

    Where items is a list of files in my DropBox that the custom UI displays, along with some other buttons and features. I want to implement a function whereby when I swipe on a list item and delete it, it deletes it from DropBox, and I don't need help with the code to do the actual deleting in DropBox. But I don't know how/where to define the tableview_delete function described here:

    http://omz-software.com/editorial/docs/ios/ui.html#ui.TableView.data_source

    Do I need to include that entire class block in my script? My Python fu is still limited, so any help with the syntax for defining that function would be much appreciated.

    posted in Editorial read more
  • wcaleb

    Thanks for the helpful reply!

    posted in Editorial read more
  • wcaleb

    Great thread! I have a workflow, Send to Docverter that might be relevant here. Docverter is a web service that uses Pandoc under the hood, so my workflow can (with an Internet connection) convert from Markdown, HTML, Latex to MD, HTML, Tex, PDF (using Flying Saucer), EPUB, or even DOCX.

    I'm hoping soon to add Pandoc's template capabilities, but unfortunately Docverter does not support Pandoc's citation features.

    posted in Editorial read more
  • wcaleb

    I am working on a workflow for using Docverter to convert markdown, latex, and HTML into the same three formats. The workflow uses Editorial 1.1's new custom UI feature to allow the user to set Docverter options before clicking a button. Output from Docverter will, depending on the button tapped, either be copied to the clipboard or inserted in the editor.

    Right now, for debugging purposes, I'm using a simple string as the input for sending to Docverter, but eventually want the workflow to get the input text using editor.get_text().

    I'm having (so far) two problems that I can't diagnose, one (I think) Editorial-related and one python-related.

    The Editorial one: often, after the workflow successfully runs, when I try to run the workflow again, I get a spinning wheel in where the wrench icon was, and the custom UI never again appears. I have to force quit the app. Occasionally, I can run the workflow successfully two or three times before the spinning wheel appears. But more frequently, I am only able to run it once before I have to force quit whenever I try it again. I don't think it's a Docverter problem, because the API call is in a function that is never called unless a button on the Custom UI is clicked.

    The Python problem is a familiar one, but one that always gives me fits: encoding. If I change my diagnostic input string ("Hello world!" in the Gist) to one that has special characters like "smart quotes" and "smart apostrophers" and "em-dashes," then Docverter returns an error. I think this is because Docverter needs unicode, but I can't figure out the right sequence of encode/decode commands (or where to place them) to get things to work with special strings.

    Any help would be most welcome!

    posted in Editorial read more
  • wcaleb

    I have a pretty good working workflow now: Send to Docverter. Would appreciate feedback from testers.

    posted in Editorial read more
  • wcaleb

    I figured out the problem that was giving me the Invalid Manifest error. I needed to encode the body not only in the h.send line, as you suggested, but also in the line that calculated the content length header. Otherwise, the length of the body string would not match the length of the encoded body, raising a Docverter error when the request was made.

    The working script does not seem to require the use of codecs to read from and write to the input file.

    posted in Editorial read more
  • wcaleb

    I've read more about Unicode and watched the very helpful Unipain presentation, but still having trouble debugging.

    If I understand the "Unicode sandwich" concept, then encoding the multipart body handles the output edge.

    To get into unicode as quickly as possible, I tried to turn my test string into a unicode string before writing it to the Docverter input file, using unicode().

    After that, I presume I should try to keep everything in unicode in the program itself. Right away, I run into trouble when opening the Docverter input file to pass it to post_multipart() as part of files. At that point, the text is type str, right? But if I try to decode the file contents right after reading the file, it doesn't seem to fix my problem. Docverter returns an error message that does not appear when I use non-problematic strings.

    {"error":"uninitialized constant DocverterServer::Manifest::InvalidManifestError"}
    

    Is there a library I'm using that is doing some implicit encoding somewhere?

    posted in Editorial read more
  • wcaleb

    Thanks for the help. I am the Caleb of whom you speak, though as you can see I need help even hacking my own stuff!

    I'll do some more reading, as you suggest. In the meantime, even adding the encode call to the body, as you suggest, seems to have helped with the other problem I was describing. Maybe encoding errors were somehow trying to throw exceptions that crashed the workflow?

    posted in Editorial read more

Internal error.

Oops! Looks like something went wrong!