omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    Welcome!

    This is the community forum for my apps Pythonista and Editorial.

    For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.


    Modifying Docverter Workflow

    Editorial
    1
    2
    8041
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • fred
      fred last edited by

      Hi,

      I'm trying to modify the Docverter workflow so that it includes an HTML preview.

      In the UI, I've added "button4" with the title "Preview HTML," and placed this below "Open New File in …." My new button is hooked up to the action out_to_preview.

      That action corresponds to the following code:

      # button4
      def out_to_preview(sender):
      		global files, fields
      		input_to_files()
      		args_to_fields(scrollview['textfield1'])
      		request = post_multipart(formats.items() + fields, files)
      		o = open('docverter/' + filename + '.' + 'html', 'w').write(request)
      		output_path = os.path.abspath('docverter/' + filename + '.' + 'html')
      		preview_file(output_path)
      

      And in the MAIN EXECUTE BLOCK I have:

      @ui.in_background
      def preview_file(p):
      		console.quicklook(p)
      		view.close()
      

      When I select "To --> html" and then press the "Preview HTML" button in the workflow, the console appears and shows the converted HTML. However, the UI seems to freeze. When I press the "Done" button at the top of the screen, nothing happens and I need to force quit the program to get things working again. How can I fix this?

      Here's a link to the non-functioning workflow http://www.editorial-workflows.com/workflow/5777303720165376/PJqAkD6AriQ.

      Thanks for your help!

      1 Reply Last reply Reply Quote 0
      • fred
        fred last edited by

        Just a quick update:

        I got around this problem by calling webbrowser.open instead of the preview_file method:

        webbrowser.open('file://' + urllib.quote(output_path))
        
        1 Reply Last reply Reply Quote 0
        • First post
          Last post
        Powered by NodeBB Forums | Contributors